vapvarun icon

woofunnels-aero-checkout-assets-js

vapvarun | PRO | 06/04/20 11:46:49 AM UTC | 0 ⭐ | 1803 👁️ | Never ⏰ | []
JavaScript |

173.39 KB

|

None

|

0 👍

/

0 👎

"use strict";
function _createSuper(e) {
    return function () {
        var a,
            t = _getPrototypeOf(e);
        if (_isNativeReflectConstruct()) {
            var o = _getPrototypeOf(this).constructor;
            a = Reflect.construct(t, arguments, o);
        } else a = t.apply(this, arguments);
        return _possibleConstructorReturn(this, a);
    };
}
function _possibleConstructorReturn(e, a) {
    return !a || ("object" !== _typeof(a) && "function" != typeof a) ? _assertThisInitialized(e) : a;
}
function _assertThisInitialized(e) {
    if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return e;
}
function _isNativeReflectConstruct() {
    if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
    if (Reflect.construct.sham) return !1;
    if ("function" == typeof Proxy) return !0;
    try {
        return Date.prototype.toString.call(Reflect.construct(Date, [], function () {})), !0;
    } catch (e) {
        return !1;
    }
}
function _getPrototypeOf(e) {
    return (_getPrototypeOf = Object.setPrototypeOf
        ? Object.getPrototypeOf
        : function (e) {
              return e.__proto__ || Object.getPrototypeOf(e);
          })(e);
}
function _inherits(e, a) {
    if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function");
    (e.prototype = Object.create(a && a.prototype, { constructor: { value: e, writable: !0, configurable: !0 } })), a && _setPrototypeOf(e, a);
}
function _setPrototypeOf(e, a) {
    return (_setPrototypeOf =
        Object.setPrototypeOf ||
        function (e, a) {
            return (e.__proto__ = a), e;
        })(e, a);
}
function _classCallCheck(e, a) {
    if (!(e instanceof a)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e, a) {
    for (var t = 0; t < a.length; t++) {
        var o = a[t];
        (o.enumerable = o.enumerable || !1), (o.configurable = !0), "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
    }
}
function _createClass(e, a, t) {
    return a && _defineProperties(e.prototype, a), t && _defineProperties(e, t), e;
}
function _typeof(e) {
    "@babel/helpers - typeof";
    return (_typeof =
        "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
            ? function (e) {
                  return typeof e;
              }
            : function (e) {
                  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
              })(e);
}
!(function (e) {
    (wfacp_frontend.hooks = {
        hooks: { action: {}, filter: {} },
        addAction: function (e, a, t, o) {
            this.addHook("action", e, a, t, o);
        },
        addFilter: function (e, a, t, o) {
            this.addHook("filter", e, a, t, o);
        },
        doAction: function (e) {
            this.doHook("action", e, arguments);
        },
        applyFilters: function (e) {
            return this.doHook("filter", e, arguments);
        },
        removeAction: function (e, a) {
            this.removeHook("action", e, a);
        },
        removeFilter: function (e, a, t) {
            this.removeHook("filter", e, a, t);
        },
        addHook: function (e, a, t, o, n) {
            void 0 == this.hooks[e][a] && (this.hooks[e][a] = []);
            var r = this.hooks[e][a];
            void 0 == n && (n = a + "_" + r.length), void 0 == o && (o = 10), this.hooks[e][a].push({ tag: n, callable: t, priority: o });
        },
        doHook: function (e, a, t) {
            if (((t = Array.prototype.slice.call(t, 1)), void 0 != this.hooks[e][a])) {
                var o,
                    n = this.hooks[e][a];
                n.sort(function (e, a) {
                    return e.priority - a.priority;
                });
                for (var r = 0; r < n.length; r++) "function" != typeof (o = n[r].callable) && (o = window[o]), "action" == e ? o.apply(null, t) : (t[0] = o.apply(null, t));
            }
            if ("filter" == e) return t[0];
        },
        removeHook: function (e, a, t, o) {
            if (void 0 != this.hooks[e][a]) for (var n = this.hooks[e][a], r = n.length - 1; r >= 0; r--) (void 0 != o && o != n[r].tag) || (void 0 != t && t != n[r].priority) || n.splice(r, 1);
        },
    }),
        (e.wfacp_step_scrolling = function (a) {
            a.length && e("html, body").animate({ scrollTop: a.offset().top - 100 }, 700);
        }),
        void 0 === e.fn.block && ((e.fn.block = function (e) {}), (e.fn.unblock = function (e) {}), (e.scroll_to_notices = function () {}));
})(jQuery),
    (function (e) {
        var a,
            t = { message: wfacp_frontend.hooks.applyFilters("wfacp_block_message", null), overlayCSS: { background: "#fff", opacity: 0.6 } },
            o = window.innerWidth,
            n = !1,
            r = 0 === parseFloat(wfacp_frontend.cart_total),
            i = "1" == wfacp_frontend.cart_is_virtual,
            c = !1,
            s = e(".wfacp_err_message"),
            _ = e("form.checkout"),
            p = Object.create(wfacp_frontend.settings),
            l = !1,
            d = null,
            f = null,
            u = null,
            w = !1,
            h = {
                init: function () {
                    e(document.body).off("click", ".woocommerce-remove-coupon").on("click", ".woocommerce-remove-coupon", this.remove_coupon),
                        e(document.body).on("click", ".wfacp_main_showcoupon", h.show_coupon_form),
                        e("form.checkout_coupon").off("submit").on("submit", this.submit);
                },
                submit: function (a) {
                    if ((a.preventDefault(), "undefined" != typeof wc_checkout_params)) {
                        var o = e(this);
                        return "" === o.find('input[name="coupon_code"]').val()
                            ? (o.find('input[name="coupon_code"]').addClass("wfacp_coupon_failed_error"), !1)
                            : (o.find('input[name="coupon_code"]').removeClass("wfacp_coupon_failed_error"),
                              !o.is(".processing") &&
                                  (o.hasClass("wfacp_layout_shopcheckout") ? o.addClass("processing").children(".wfacp_coupon_row").block(t) : o.addClass("processing").block(t),
                                  e(".wfacp_coupon_msg").html("").show(),
                                  wfacp_send_ajax({ action: "apply_coupon", type: "post", data: { coupon_code: o.find('input[name="coupon_code"]').val(), wfacp_id: e("._wfacp_post_id").val() } }, function (a) {
                                      var t = e(".wfacp_coupon_msg");
                                      if (
                                          (t.html("").show(),
                                          o.hasClass("wfacp_layout_shopcheckout") ? o.removeClass("processing").children(".wfacp_coupon_row").unblock() : o.removeClass("processing").unblock(),
                                          e(".woocommerce-error, .woocommerce-message").remove(),
                                          e(document.body).trigger("wfacp_coupon_apply", [a]),
                                          a.hasOwnProperty("message"))
                                      ) {
                                          var n = a.message;
                                          if (n.hasOwnProperty("error")) {
                                              var r = n.error;
                                              if (r.length > 0)
                                                  for (var i = 0; i < r.length > 0; i++) {
                                                      var c = r[i],
                                                          s = r[i];
                                                      "object" == _typeof(c) && c.hasOwnProperty("notice") && (s = c.notice), t.prepend('<div class="woocommerce-error wfacp_error" role="alert">' + s + "</div>");
                                                  }
                                          }
                                          if (n.hasOwnProperty("success")) {
                                              var _ = n.success;
                                              if (_.length > 0)
                                                  for (var p = 0; p < _.length > 0; p++) {
                                                      var l = _[p],
                                                          d = _[p];
                                                      "object" == _typeof(l) && l.hasOwnProperty("notice") && (d = l.notice), t.prepend('<div class="woocommerce-message wfacp_sucuss" role="alert">' + d + "</div>");
                                                  }
                                          }
                                          update_fragments(a);
                                      }
                                  }),
                                  !1));
                    }
                    console.log("Coupon functionality not working in preview mode");
                },
                show_coupon_form: function (a) {
                    a.preventDefault();
                    var t = e(this).parents(".wfacp_woocommerce_form_coupon").find("form.woocommerce-form-coupon");
                    if (t.hasClass("wfacp_display_block")) {
                        t.removeClass("wfacp_display_block");
                        var o = ["wfacp_desktop_view", "wfacp_tablet_view", "wfacp_mobile_view"];
                        for (var n in o) t.parent(".wfacp_mini_cart_classes").hasClass(o[n]) && t.parent(".wfacp_mini_cart_classes").removeClass(o[n]);
                    }
                    return (
                        t.slideToggle(400, function () {
                            t.find(".wfacp-form-control").focus();
                        }),
                        !1
                    );
                },
                remove_coupon: function (a) {
                    if ((a.preventDefault(), "undefined" != typeof wc_checkout_params)) {
                        var o = e(this).parents(".woocommerce-checkout-review-order"),
                            n = e(this).data("coupon");
                        o.addClass("processing").block(t);
                        var r = { security: wc_checkout_params.remove_coupon_nonce, coupon: n },
                            i = e(".wfacp_coupon_msg");
                        e.ajax({
                            type: "POST",
                            url: wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%", "remove_coupon"),
                            data: r,
                            success: function (a) {
                                if ((e(".woocommerce-error, .woocommerce-message").remove(), o.removeClass("processing").unblock(), a)) {
                                    v(n), i.length > 0 ? i.html(a) : e(".wfacp_layout_9_coupon_error_msg").html(a), e(document.body).trigger("update_checkout", { update_shipping_method: !1 });
                                    var t = e("form.checkout_coupon").find('input[name="coupon_code"]');
                                    t.val(""), t.parent(".wfacp-input-form").removeClass("wfacp-anim-wrap");
                                }
                                e("form.woocommerce-form-coupon:visible").length > 0 && e.scroll_to_notices(e(".wfacp_main_form")), e(document.body).trigger("wfacp_coupon_form_removed", [a]);
                            },
                            error: function () {
                                wc_checkout_params.debug_mode;
                            },
                            dataType: "html",
                        });
                    } else console.log("Coupon functionality not working in preview mode");
                },
            },
            m = {
                init: function () {
                    e(".wfacp_woocommerce_form_coupon");
                    e(document.body).on("keyup focus", ".wfacp_coupon_code", m.onenter),
                        e(document.body).on("change focusout", ".wfacp_coupon_code", m.remove_class),
                        e(document.body).on("click", ".wfacp_showcoupon", m.show_coupon_form),
                        e(document.body).on("click", ".wfacp-coupon-field-btn", m.apply_coupon),
                        e(document.body).on("click", ".wfacp_remove_coupon", m.remove_coupon);
                },
                onenter: function (e) {
                    _.addClass("processing");
                },
                remove_class: function () {
                    _.removeClass("processing");
                },
                show_coupon_form: function (a) {
                    a.preventDefault();
                    var t = e(this).parents(".wfacp_woocommerce_form_coupon");
                    return (
                        t.find(".wfacp_coupon_field_box").slideToggle(400, function () {
                            t.find(".wfacp_coupon_field_box").addClass("wfacp_coupon_collapsed"), t.find(".wfacp_coupon_field_box").find(":input:eq(0)").focus();
                        }),
                        !1
                    );
                },
                apply_coupon: function () {
                    if ("undefined" != typeof wc_checkout_params) {
                        m.remove_class();
                        var a = e(this).parents(".wfacp_woocommerce_form_coupon");
                        if (a.is(".processing")) return !1;
                        var o = a.find(".wfacp_coupon_error_msg"),
                            n = a.find(".wfacp_coupon_code").val();
                        return "" === n
                            ? (a.removeClass("wfacp_coupon_success"), void a.addClass("wfacp_coupon_failed"))
                            : (a.removeClass("wfacp_coupon_success"),
                              a.removeClass("wfacp_coupon_failed"),
                              a.addClass("processing").find(".wfacp_coupon_field_box").block(t),
                              wfacp_send_ajax({ action: "apply_coupon", type: "post", data: { coupon_code: n, wfacp_id: e("._wfacp_post_id").val() } }, function (t) {
                                  if (
                                      (e(".woocommerce-error, .woocommerce-message").remove(),
                                      a.removeClass("processing").find(".wfacp_coupon_field_box").unblock(),
                                      a.find(".wfacp-anim-wrap").removeClass("wfacp-anim-wrap"),
                                      e(document.body).trigger("wfacp_coupon_apply", [t]),
                                      t.hasOwnProperty("message"))
                                  ) {
                                      var n = t.message;
                                      if (n.hasOwnProperty("error")) {
                                          var r = n.error;
                                          if (r.length > 0)
                                              for (var i = 0; i < r.length > 0; i++) {
                                                  var c = r[i],
                                                      s = r[i];
                                                  "object" == _typeof(c) && c.hasOwnProperty("notice") && (s = c.notice), o.html('<div class="woocommerce_single_error_message" role="alert">' + s + "</div>");
                                              }
                                          a.addClass("wfacp_coupon_failed"),
                                              setTimeout(
                                                  function (e) {
                                                      e.html("");
                                                  },
                                                  4e3,
                                                  o
                                              );
                                      } else a.addClass("wfacp_coupon_success"), a.find(".wfacp_coupon_code").val("");
                                  }
                                  update_fragments(t);
                              }),
                              !1);
                    }
                    console.log("Coupon functionality not working in preview mode");
                },
                remove_coupon: function (a) {
                    if ((a.preventDefault(), "undefined" != typeof wc_checkout_params)) {
                        m.remove_class();
                        var o = e(this).parents(".wfacp_woocommerce_form_coupon"),
                            n = e(this).parent(".wfacp_single_coupon_msg");
                        o.addClass("processing").find(".wfacp_coupon_field_box").block(t);
                        var r = e(this).data("coupon"),
                            i = { security: wc_checkout_params.remove_coupon_nonce, coupon: r };
                        o.removeClass("wfacp_coupon_success"),
                            o.removeClass("wfacp_coupon_failed"),
                            e.ajax({
                                type: "POST",
                                url: wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%", "remove_coupon"),
                                data: i,
                                success: function (a) {
                                    if ((e(".woocommerce-error, .woocommerce-message").remove(), n.remove(), o.removeClass("processing").find(".wfacp_coupon_field_box").unblock(), a)) {
                                        v(r);
                                        var t = e("<div>" + a + "</div>");
                                        o.find(".wfacp_coupon_remove_msg").html(t.text()),
                                            e(document.body).trigger("update_checkout", { update_shipping_method: !1 }),
                                            e("form.checkout_coupon").find('input[name="coupon_code"]').val(""),
                                            setTimeout(
                                                function () {
                                                    o.find(".wfacp_coupon_remove_msg").html("");
                                                },
                                                4e3,
                                                o
                                            );
                                    }
                                    e(document.body).trigger("wfacp_coupon_form_removed", [a]);
                                },
                                error: function (e) {},
                                dataType: "html",
                            });
                    } else console.log("Coupon functionality not working in preview mode");
                },
            },
            v = function (a) {
                var t = e('[data-coupon="' + a + '"]');
                console.log("dat_coupon", t), t.length > 0 && (t.parents("tr").remove(), t.parents(".woocommerce-message1.wfacp_coupon_success").remove(), t.parents(".wfacp_single_coupon_msg").remove());
            },
            g = function (a) {
                if (a.hasOwnProperty("cart_is_virtual") && i !== a.cart_is_virtual) {
                    var t = e("#shipping_same_as_billing_field");
                    t.length > 0 && (1 == t.is(":visible") && 1 == a.cart_is_virtual ? (t.hide(), e("#shipping_same_as_billing").prop("checked", !1).trigger("change")) : t.show());
                    var o = { previous: i, current: a.cart_is_virtual };
                    wfacp_frontend.hooks.doAction("wfacp_cart_behaviour_changed", o), (i = a.cart_is_virtual);
                }
            };
        function y() {
            if (e(".wfacp_qv-main table.variations").length > 0) {
                var a = e(".wfacp_qv-main .wfacp_qv-images").innerHeight();
                e(".wfacp_qv-main").animate({ scrollTop: a });
            }
            e("form.variations_form.cart .variations").removeClass("wfacp_animate_shake"),
                setTimeout(function () {
                    e("form.variations_form.cart .variations").addClass("wfacp_animate_shake");
                }, 500);
        }
        function b() {
            var a = e(".variations_form");
            a.on("hide_variation", function (a) {
                e(".wfacp_qv-summary .quantity").hide(), e(".wfacp_option_btn").show();
                e(this).find(".wfacp_single_add_to_cart_button").text();
                var t = wfacp_frontend.select_options_text;
                "" != wfacp_frontend.select_options_text && (t = wfacp_frontend.select_options_text),
                    e(this).find(".wfacp_single_add_to_cart_button").text(t),
                    e("#wfacp_qr_model_wrap .wfacp_option_btn").click(function () {
                        y();
                    });
            }),
                a.on("show_variation", function (a, t) {
                    var o = t.variation_id,
                        n = JSON.stringify(t);
                    (wfacp_storage.variation_data[o] = JSON.parse(n)), j(o);
                    e(this).find(".wfacp_single_add_to_cart_button").text();
                    e(this).find(".wfacp_single_add_to_cart_button").text(), e(".wfacp_qv-summary .quantity").show();
                    var r = "";
                    (r = "" == e("#wfacp_qr_model_wrap").data("cart-key") ? wfacp_frontend.add_to_cart_text : wfacp_frontend.update_button_text), e(this).find(".wfacp_single_add_to_cart_button").text(r), e(".wfacp_option_btn").hide();
                });
        }
        function k() {
            var a = e(".wfacp_incomplete_variation");
            return (
                !(a.length > 0) ||
                (e.scroll_to_notices(a.eq(0)),
                setTimeout(function () {
                    a.addClass("wfacp_animate_shake"),
                        setTimeout(function () {
                            a.removeClass("wfacp_animate_shake");
                        }, 500);
                }, 1e3),
                !1)
            );
        }
        function C() {
            if (o > 767 && e("body").hasClass("wfacp_cls_layout_9") && e(".wfacp_outside_header").length > 0) {
                var a,
                    t = e(window).height(),
                    n = e(".wfacp-form").innerHeight() + (a = e(".wfacp-form .wfacp_inner_footer_m").innerHeight()),
                    r = t - e(".wfacp-form").innerHeight();
                if (t > n) {
                    e(".wfacp-left-wrapper").css("padding-bottom", r), e(".wfacp_footer_n").hasClass() || (e(".wfacp-form").css("padding-bottom", a), e(".wfacp_inner_footer_m").addClass("wfacp_change_position"));
                } else e(".wfacp-left-wrapper").css("padding-bottom", 0), e(".wfacp-form").css("padding-bottom", 0), e(".wfacp_inner_footer_m").removeClass("wfacp_change_position");
            }
        }
        function x(a) {
            var t = a.data("current-step"),
                o = a.data("next-step"),
                n = e(".wfacp_page." + t),
                r = e(".wfacp_page." + o),
                i = n.data("step"),
                c = r.data("step");
            !(function (a, t) {
                e("body").hasClass(a) && (e("body").removeClass(a), e("body").addClass(t));
            })(i, c);
            var s = !1;
            if ((r.hasClass("wfacp_last_page") && (s = !0), e(".wfacp_steps_sec ul").length > 0)) {
                e(".wfacp_bred." + t).removeClass("wfacp_bred_active ");
                var _ = e(".wfacp_bred." + o);
                _.addClass("wfacp_bred_active wfacp_bred_visited"), _.children(".wfacp_step_text_have").length > 0 && z(_.children(".wfacp_step_text_have"));
                var p = _.find("a").data("text");
                "" === p && (p = o), "yes" === wfacp_frontend.enable_hashtag_for_multistep_checkout && window.location.assign("#" + p);
            }
            var d = e(".wfacp_payment");
            e.wfacp_step_scrolling(e(".wfacp_main_form"));
            var f = { hide_parent: t, next_shown: o, previous_step: i, current_step: c, last_step: s };
            if (!1 === l) {
                var u = r.find("#shipping_country");
                u.length > 0 && (u.parents(".wfacp-form-control-wrapper").is(":visible") && (e("#ship-to-different-address-checkbox").prop("checked", !0), (l = !0)), u.trigger("change"));
            }
            n.fadeOut(300, function () {
                s ? (d.removeClass("wfacp_hide_payment_part"), d.addClass("wfacp_show_payment_part")) : (d.addClass("wfacp_hide_payment_part"), d.removeClass("wfacp_show_payment_part")),
                    r.fadeIn(600, function () {
                        0 === r.find("#shipping_method li").length && update_checkout(),
                            e(".country_to_state").length > 0 && e(document.body).trigger("country_to_state_changed"),
                            e("." + c + " .wfacp-row .form-row").each(function () {
                                var a = e(this);
                                (a.hasClass("wfacp_drop_list") || a.hasClass("wfacp_add_select_2")) &&
                                    a.length > 0 &&
                                    a.find("select").hasClass("select2-hidden-accessible") &&
                                    (a.hasClass("wfacp_custom_field_multiselect") ? a.find("select").select2() : a.find("select").select2("destroy"));
                            }),
                            C(),
                            e("." + c).find(".wfacp_divider_billing").length > 0 &&
                                e("." + c)
                                    .find(".wfacp_divider_billing .form-row")
                                    .each(function () {
                                        var a = e(this).attr("id");
                                        if ("" != a) {
                                            var t = a.replace("_field", ""),
                                                o = e("#" + t).val();
                                            "" == o || null == o || e(this).hasClass("wfacp-anim-wrap") || e(this).addClass("wfacp-anim-wrap");
                                        }
                                    }),
                            e("." + c).find(".wfacp_divider_shipping").length > 0 &&
                                e("." + c)
                                    .find(".wfacp_divider_shipping .form-row")
                                    .each(function () {
                                        var a = e(this).attr("id");
                                        if ("" != a) {
                                            var t = a.replace("_field", ""),
                                                o = e("#" + t).val();
                                            "" == o || null == o || e(this).hasClass("wfacp-anim-wrap") || e(this).addClass("wfacp-anim-wrap");
                                        }
                                    });
                    });
            }),
                B(),
                e(document.body).trigger("wfacp_step_switching", f);
        }
        function q() {
            e(document.body).trigger("country_to_state_changed"), update_checkout();
        }
        function O(a, t) {
            e(".wfacp_qv-inner-modal").css("opacity", "0").addClass(t);
        }
        function F(a, t) {
            !(function (a, t, n, r) {
                wfacp_send_ajax({ action: "quick_view_ajax", type: "post", data: a }, function (i) {
                    if (1 == i.status) {
                        e(".wfacp_qv-modal").html(i.html),
                            t(n, r),
                            (wc_single_product_params.flexslider_enabled = !0),
                            (wc_single_product_params.photoswipe_enabled = !0),
                            (wc_single_product_params.zoom_enabled = !0),
                            e(".woocommerce-product-gallery").each(function () {
                                e(this).wc_product_gallery();
                            }),
                            e(".wfacp_qv-panel").find(".variations_form").wc_variation_form(),
                            e(".wfacp_qv-panel .variations_form select").change(),
                            a.hasOwnProperty("variation_id") &&
                                (function (a) {
                                    if (!window.wfacp_storage.variation_data.hasOwnProperty(a)) return !1;
                                    var t = window.wfacp_storage.variation_data[a];
                                    if (0 === Object.keys(t).length) return !1;
                                    var o = t.attributes;
                                    if (0 === Object.keys(o).length) return !1;
                                    for (var n in o) {
                                        var r = e("#" + n);
                                        if (r.length > 0) {
                                            var i = o[n];
                                            r.val(i);
                                        }
                                    }
                                })(a.variation_id),
                            b(),
                            o < 600 &&
                                setTimeout(function () {
                                    y();
                                }, 600);
                        var c = e('.wfacp_product_row[data-item-key="' + a.item_key + '"]');
                        if (0 === c.length) return;
                        var s = e(".wfacp_qv-summary .product_title");
                        if (s.length > 0) {
                            var _ = c.find(".wfacp_product_choosen_label").html();
                            s.html(_);
                        }
                        var p = e(".wfacp_qv-summary .price");
                        if (p.length > 0) {
                            var l = c.find(".product-price").html();
                            p.html(l);
                        }
                        var d = e(".wfacp_qv-summary [name=quantity]");
                        if (d.length > 0) {
                            var f = c.find(".wfacp_product_switcher_quantity");
                            f.length > 0 && d.val(f.val());
                        }
                        var u,
                            w = e(".wfacp_qv-images"),
                            h = w.find(".woocommerce-product-gallery__image");
                        if (
                            (h.length > 0 ? ((h = w.find(".woocommerce-product-gallery__image").eq(0)), (u = h.find("img").data("large_image"))) : ((h = w.find(".woocommerce-product-gallery__wrapper")), (u = h.find("img").attr("src"))),
                            void 0 !== u)
                        ) {
                            var m = new Image();
                            (m.src = u),
                                (m.onload = function () {
                                    e(".wfacp_qv-pl-active").removeClass("wfacp_qv-pl-active");
                                });
                        } else e(".wfacp_qv-pl-active").removeClass("wfacp_qv-pl-active");
                    } else e(".wfacp_qv-close").trigger("click");
                });
            })(a, O, null, "wfacp_qv-animation-fadein");
        }
        function P(a) {
            a.preventDefault(),
                e.each(a.target.classList, function (a, t) {
                    ("wfacp_qv-close" !== t && "wfacp_qv-inner-modal" !== t) || (e(".wfacp_qv-opac").hide(), e(".wfacp_qv-panel").removeClass("wfacp_qv-panel-active"), e(".wfacp_qv-modal").html(""));
                });
        }
        function j(a) {
            if (!window.wfacp_storage.variation_data.hasOwnProperty(a)) return {};
            var t = window.wfacp_storage.variation_data[a];
            if (0 === Object.keys(t).length) return {};
            var o = t.attributes;
            if (0 === Object.keys(o).length) return {};
            var n = {};
            for (var r in o) {
                var i = e('[data-attribute_name="' + r + '"]');
                i.length > 0 && ((n[r] = i.val()), (window.wfacp_storage.variation_data[a].attributes[r] = i.val()));
            }
            return n;
        }
        function S(a, t) {
            var o = e(".wfacp_qv-summary .variation_id").val();
            o > 0 && a.attr("variation_id", o);
            var n = j(o),
                r = a.find("[name=wfacp_product_choosen]").attr("type"),
                i = a.attr("cart_key"),
                c = { variation_id: o, quantity: 1, attributes: n };
            if ("hidden" === r || "checkbox" === r) {
                var s = {};
                (s.wfacp_id = e("._wfacp_post_id").val()), (s.new_item = a.data("item-key")), (s.remove_item_key = i), (s.quantity = 1), (s.variation_id = 0), (s.field_type = r), (s = set_variation_data(s, c)), wfacp_product_switch(s);
            } else a.find("[name=wfacp_product_choosen]").prop("checked", !0).trigger("change", c);
        }
        function T(a, t) {
            "1" !== wfacp_frontend.is_customizer &&
                (("object" == _typeof(t) && t.hasOwnProperty("aero_do_not_state_service")) ||
                    (clearTimeout(f),
                    (f = setTimeout(function () {
                        var a = e("#shipping_postcode").val(),
                            t = e("#shipping_country").val();
                        0 !== e("#shipping_state").length &&
                            void 0 !== a &&
                            "" !== a &&
                            void 0 !== t &&
                            "" !== t &&
                            e.get("//api.zippopotam.us/" + t + "/" + a, function (a) {
                                if (Object.keys(a).length > 0 && a.hasOwnProperty("places") && a.places.length > 0) {
                                    var t = a.places[0];
                                    if (Object.keys(t).length > 0 && t.hasOwnProperty("state abbreviation")) {
                                        var o = t["state abbreviation"];
                                        if ("" == o) return;
                                        var n = e("#shipping_state option[value=" + o + "]");
                                        if (n.length > 0) {
                                            e("#shipping_state").val(o), e("#shipping_state").parents(".form-row").addClass("wfacp-anim-wrap");
                                            var r = n.text();
                                            e("#select2-shipping_state-container").text(r), update_checkout();
                                        }
                                    }
                                }
                            });
                    }, 100))));
        }
        function D(a, t) {
            "1" !== wfacp_frontend.is_customizer &&
                (("object" == _typeof(t) && t.hasOwnProperty("aero_do_not_state_service")) ||
                    (clearTimeout(u),
                    (u = setTimeout(function () {
                        var a = e("#billing_postcode").val(),
                            t = e("#billing_country").val();
                        0 !== e("#billing_state").length &&
                            void 0 !== a &&
                            "" !== a &&
                            void 0 !== t &&
                            "" !== t &&
                            e.get("//api.zippopotam.us/" + t + "/" + a, function (a) {
                                if (Object.keys(a).length > 0 && a.hasOwnProperty("places") && a.places.length > 0) {
                                    var t = a.places[0];
                                    if (Object.keys(t).length > 0 && t.hasOwnProperty("state abbreviation")) {
                                        var o = t["state abbreviation"];
                                        if ("" == o) return;
                                        var n = e("#billing_state option[value=" + o + "]");
                                        if (n.length > 0) {
                                            e("#billing_state").val(o), e("#billing_state").parents(".form-row").addClass("wfacp-anim-wrap");
                                            var r = n.text();
                                            e("#select2-billing_state-container").text(r), update_checkout();
                                        }
                                    }
                                }
                            });
                    }, 100))));
        }
        function A() {
            "undefined" != typeof wfacp_variation_attributes_data && null !== wfacp_variation_attributes_data && (wfacp_storage.variation_data = wfacp_variation_attributes_data),
                (function () {
                    var a = 0;
                    if (o > 480) {
                        var t = e(".div_wrap_sec .wfacp-three-cols"),
                            n = e(".div_wrap_sec .wfacp-two-cols");
                        t.length > 0
                            ? (t.each(function () {
                                  e(this).height() > a && (a = e(this).height());
                              }),
                              t.height(a))
                            : n.length > 0 &&
                              (n.each(function () {
                                  e(this).height() > a && (a = e(this).height());
                              }),
                              n.height(a));
                    }
                })(),
                (function () {
                    if (o > 991) {
                        var a = e(".wfacp_cls_layout_1 .wfacp_header .wfacp-container.wfacp-inner-header");
                        if (a.length > 0) {
                            var t = a.height() - e(".wfacp-header").height();
                            e(".wfacp-panel-wrapper").css("margin-top", t);
                        }
                    }
                })(),
                e("body").addClass("wfacp_page_loaded");
            var a = e("#billing_country"),
                t = e("#billing_country_field");
            a.length > 0 && "" !== a.val() && t.addClass("wfacp-anim-wrap");
            var n = e("#billing_state");
            n.length > 0 &&
                (n.parents(".wfacp-form-control-wrapper").removeClass("woocommerce-invalid-required-field"),
                "" !== n.val() && n.parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap"),
                N(e("#billing_state_field"), e("#billing_state").val()));
            var r = e("#shipping_country"),
                i = e("#shipping_country_field");
            r.length > 0 && (i.removeClass("woocommerce-invalid-required-field"), i.is(":visible") && e("#ship-to-different-address-checkbox").prop("checked", !0), "" !== r.val() && i.addClass("wfacp-anim-wrap"));
            var c = e("#shipping_state");
            c.length > 0 &&
                (c.parents(".wfacp-form-control-wrapper").removeClass("woocommerce-invalid-required-field"),
                c.parents(".wfacp-form-control-wrapper").is(":visible") &&
                    (c.parents(".wfacp-form-control-wrapper").removeClass("woocommerce-invalid-required-field"), "" !== c.val() && c.parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap")),
                setTimeout(function () {
                    N(e("#shipping_state_field"), e("#shipping_state").val());
                }, 600));
            var s,
                _,
                p = e("#billing_shipping_index").val();
            if (
                ("billing" === p ? e(".wfacp_billing_fields").removeClass("validate-required") : "shipping" === p && e(".wfacp_shipping_fields").removeClass("validate-required"),
                h.init(),
                m.init(),
                (s = e(".wfacp-form-control")),
                (_ = ["account_password", "password", "username", "user_email", "wfacp_coupon_code_field", "coupon_code"]),
                (_ = wfacp_frontend.hooks.applyFilters("wfacp_skip_keys_before_localize", _)),
                s.length > 0 &&
                    wfacp_frontend.hasOwnProperty("autopopulate") &&
                    "yes" === wfacp_frontend.autopopulate &&
                    e(document.body).on("focusout change", ".wfacp-form-control", function () {
                        var a = {};
                        if (
                            (e(document.body)
                                .find(".wfacp-form-control")
                                .each(function () {
                                    var t = e(this).attr("id"),
                                        o = e(this).val();
                                    void 0 !== _typeof(t) && null !== o && -1 === e.inArray(t, _) && "" !== o && (a[t] = e(this).val());
                                }),
                            "undefined" != typeof Storage)
                        )
                            try {
                                window.localStorage.setItem("wfacp_form_values", JSON.stringify(a));
                            } catch (e) {}
                    }),
                update_checkout(),
                "undefined" != typeof wc_address_i18n_params && r.length > 0)
            ) {
                var l = r.val(),
                    d = wc_address_i18n_params.locale.replace(/&quot;/g, '"');
                e.parseJSON(d).hasOwnProperty(l) || r.trigger("change");
            }
            e("form.woocommerce-checkout").on("checkout_place_order", function () {
                if ((e(".woocommerce-NoticeGroup").remove(), !k())) return !1;
                wfacp_frontend.hooks.doAction("wfacp_checkout_place_order");
            }),
                B();
        }
        function G() {
            var a = e(".wfacp_select2_country_state");
            a.length > 0 && a.removeClass("wfacp_select2_country_state");
        }
        function N(e, a) {
            (void 0 !== a && "" != a && null != a) || e.removeClass("wfacp-anim-wrap");
        }
        function z(e) {
            e.parent().prev().hasClass("wfacp_active_prev") || e.parent().prev().addClass("wfacp_active_prev"), e.parent().next().hasClass("wfacp_active_prev") && e.parent().next().removeClass("wfacp_active_prev");
        }
        function B() {
            if ("function" == typeof e.fn.select2) {
                var a = e(".wfacp_select2_custom_field");
                a.length > 0 && a.select2();
                var t = e(".wfacp_custom_field_multiselect select");
                t.length > 0 &&
                    t.each(function () {
                        var a = e(this).data("max-selection"),
                            t = e(this).data("max-error");
                        void 0 == t && (t = "");
                        var o = e(this);
                        void 0 != a && a > 1
                            ? e(this).select2({
                                  maximumSelectionLength: a,
                                  language: {
                                      maximumSelected: function (e) {
                                          return (t = t.replace("{maximum_number}", e.maximum)), (t = wfacp_frontend.hooks.applyFilters("wfacp_multiselect_error_message", t, e, o));
                                      },
                                  },
                              })
                            : e(this).select2();
                    });
            }
        }
        (window.wfacp_haschanges = "no"),
            (window.wfacp_storage = { add_to_cart: {}, analytics_data: wfacp_analytics_data, variation_data: {} }),
            (window.increaseItmQty = function (a) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
                    o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "",
                    n = e(a),
                    r = n.siblings(".wfacp_product_quantity_number_field"),
                    i = parseInt(r.val(), 10);
                if (((i = isNaN(i) ? 0 : i), "" !== t)) {
                    show_blocked_mini_cart();
                    var c = e(".wfacp_increase_item[data-item-key=" + t + "]");
                    if (c.length > 0)
                        return void increaseItmQty(c[0], "", function (e) {
                            if (e.hasOwnProperty("error")) {
                                var a = n.parents(".product-name-area");
                                wfacp_show_error(a, e);
                            } else;
                        });
                }
                i++, r.val(i);
                var s = n.parents("fieldset.wfacp_product_row");
                s.find(".wfacp_product_switch").length > 0 && 0 == s.find(".wfacp_product_switch:checked").length ? s.find(".wfacp_product_switch").trigger("click") : r.trigger("change", [o]);
            }),
            (window.decreaseItmQty = function (a) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
                    o = e(a).siblings(".wfacp_product_quantity_number_field"),
                    n = parseInt(o.val(), 10);
                if (((n = isNaN(n) ? 0 : n) < 1 && (n = 1), "" !== t && n > 1)) {
                    var r = e(".wfacp_decrease_item[data-item-key=" + t + "]");
                    if (r.length > 0) return show_blocked_mini_cart(), void r.click();
                }
                n--, o.val(n), o.trigger("change");
            }),
            (window.show_blocked_mini_cart = function () {
                e(".wfacp_mini_cart_items").block(t);
            }),
            (window.show_unblocked_mini_cart = function () {
                e(".wfacp_mini_cart_items").unblock();
            }),
            (window.wfacp_send_ajax = function (a, t) {
                arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
                if ("1" !== wfacp_frontend.is_customizer) {
                    var o = wfacp_frontend.admin_ajax;
                    a.hasOwnProperty("url") && (o = a.url),
                        (a.action = "wfacp_" + a.action),
                        wfacp_frontend.hasOwnProperty("wc_endpoints") && wfacp_frontend.wc_endpoints.hasOwnProperty(a.action) && (o = wfacp_frontend.wc_endpoints[a.action]),
                        e("#product_switcher_need_refresh").val(1),
                        e(document.body).trigger(a.action, a);
                    var n = { action: a.action, wfacp_nonce: wfacp_frontend.wfacp_nonce, data: a.data, post_data: e("#wfacp_checkout_form").serialize() };
                    (n = wfacp_frontend.hooks.applyFilters("wfacp_send_ajax_data", n, a.action)),
                        e.ajax({
                            url: o,
                            type: a.type,
                            data: n,
                            success: function (o) {
                                if (o.hasOwnProperty("force_redirect")) window.location.href = o.force_redirect;
                                else if (1 != wfacp_frontend.hooks.applyFilters("wfacp_stop_updating_fragments", !1, o, n)) {
                                    if (o.hasOwnProperty("cart_contains_subscription") && 1 == o.cart_contains_subscription) {
                                        var r = e("#createaccount");
                                        r.length > 0 && (r.is(":checked") || r.trigger("click")), e("#wfacp_cart_contains_subscription").val(1);
                                    } else e("#wfacp_cart_contains_subscription").val(0);
                                    g(o),
                                        "function" == typeof t && ((o.action = a.action), t(o)),
                                        "object" == _typeof(o) && o.hasOwnProperty("nonce") && (wfacp_frontend.wfacp_nonce = o.nonce),
                                        o.hasOwnProperty("analytics_data") && e(document.body).trigger("wfacp_checkout_data", { checkout: o.analytics_data });
                                } else wfacp_frontend.hooks.doAction("wfacp_stop_updating_fragments", o, n);
                            },
                            error: function (e) {
                                e.hasOwnProperty("status") &&
                                    (403 == e.status
                                        ? console.log("Aero: Page is cached")
                                        : 500 == e.status
                                        ? console.log("Aero: Site Contain fatal error")
                                        : 502 == e.status
                                        ? console.log("Aero: Bad gateway")
                                        : console.log("Aero: Error", e.status));
                            },
                        });
                } else console.log("stop execution of ajax in customizer for aero checkout");
            }),
            (window.wfacp_submit_error = function (a) {
                var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
                console.log(a);
                var o = e(".checkout.woocommerce-checkout");
                e(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),
                    o.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">' + a + "</div>"),
                    o.removeClass("processing").unblock(),
                    !0 === t && o.find(".input-text, select, input:checkbox").trigger("validate").blur(),
                    e.scroll_to_notices(e(".woocommerce-NoticeGroup.woocommerce-NoticeGroup-checkout"));
            }),
            (window.wfacp_show_error = function (e, a) {
                if (0 !== e.length) {
                    e.find(".wfacp_product_switcher_error").remove();
                    var t = e.parents("tr"),
                        o = e.parents("tbody");
                    if ((o.find(".wfacp_ps_error_state").remove(), e.hasClass("product-name-area"))) {
                        t.addClass("wfacp_noborder");
                        var n = "";
                        e.find(".product-name").hasClass("wfacp_summary_img_true") && (n = " wfacp_enable_image "),
                            t.after('<tr class="wfacp_ps_error_state' + n + '" ><td colspan="2"><div class="wfacp_product_switcher_error"style="clear:both">' + a.error + "</div></td></tr>");
                    } else e.append('<div class="wfacp_product_switcher_error"style="clear:both">' + a.error + "</div>");
                    if (a.hasOwnProperty("qty")) {
                        var r = e.find(".wfacp_product_switcher_quantity").data("value"),
                            i = a.qty;
                        parseInt(r) > 0 && (i = r), e.find(".wfacp_product_switcher_quantity").val(i);
                    }
                    setTimeout(
                        function (e) {
                            e.hasClass("product-name-area") ? (o.find(".wfacp_ps_error_state").remove(), t.removeClass("wfacp_noborder")) : e.find(".wfacp_product_switcher_error").remove();
                        },
                        1e5,
                        e
                    );
                }
            }),
            (window.set_variation_data = function (e, a) {
                return void 0 !== a && (a.hasOwnProperty("variation_id") && (e.variation_id = a.variation_id), a.hasOwnProperty("quantity") && (e.quantity = a.quantity), a.hasOwnProperty("attributes") && (e.attributes = a.attributes)), e;
            }),
            (window.populate_fields_value = function () {
                var a = e(".wfacp-form-control");
                if ("undefined" != typeof Storage && 0 !== a.length && wfacp_frontend.hasOwnProperty("autopopulate") && "yes" === wfacp_frontend.autopopulate) {
                    var t = window.localStorage.getItem("wfacp_form_values");
                    if (null != t && "object" === _typeof((t = JSON.parse(t))) && 0 !== Object.keys(t).length)
                        for (var o in t) {
                            var n = e("#" + o);
                            t.hasOwnProperty(o) && "" !== t[o]
                                ? (n.val(t[o]), n.parents(".form-row").hasClass("wfacp-anim-wrap") || n.parents(".form-row").addClass("wfacp-anim-wrap"))
                                : n.parents(".form-row").removeClass("wfacp-anim-wrap");
                        }
                }
            }),
            (window.wfacp_product_switch = function (a, o) {
                var n = e(".wfacp-product-switch-panel");
                n.block(t),
                    (a.you_save = n.data("you-save-text")),
                    (a.is_hide = n.data("is-hide")),
                    e("#product_switcher_need_refresh").val(0),
                    show_blocked_mini_cart(),
                    wfacp_send_ajax({ action: "switch_product_addon", type: "post", data: a }, function (a) {
                        "function" == typeof o && o(a),
                            !1 !== a.status
                                ? (!0 === a.status &&
                                      void 0 != a.new_cart_key &&
                                      "" != a.new_cart_key &&
                                      setTimeout(function () {
                                          e(document.body).trigger("wfacp_product_added", { item: a.cart_item, item_key: a.item_key, cart_key: a.new_cart_key });
                                      }, 300),
                                  e("#product_switcher_need_refresh").val(1),
                                  update_checkout())
                                : n.unblock();
                    });
            }),
            (window.update_fragments = function (a) {
                if (
                    (e(document.body).trigger("wfacp_update_fragments", a),
                    g(a),
                    a.hasOwnProperty("cart_total") && 0 === parseInt(a.cart_total) ? ((r = !0), e(document.body).trigger("wfacp_cart_goes_empty", { cart_total: parseInt(a.cart_total) })) : (r = !1),
                    r)
                )
                    return (
                        (r = !1),
                        a.hasOwnProperty("fragments") &&
                            e.each(a.fragments, function (a, t) {
                                e(a).replaceWith(t), e(a).unblock();
                            }),
                        void update_checkout()
                    );
                a.hasOwnProperty("fragments") &&
                    a.fragments.hasOwnProperty(".cart_total") &&
                    0 === parseFloat(a.fragments[".cart_total"]) &&
                    (e(document.body).trigger("wfacp_cart_goes_empty", { cart_total: parseFloat(a.cart_total) }), update_checkout()),
                    a.hasOwnProperty("fragments") &&
                        e.each(a.fragments, function (a, t) {
                            e(a).replaceWith(t), e(a).unblock();
                        }),
                    e(document.body).trigger("wfacp_after_fragment_received", { response: a });
            }),
            (window.update_checkout = function (a) {
                /*
                Commented code for multipal time call update checkbox function
                (a = void 0 !== a ? parseInt(a) : 1e3),
                    !1 === c &&
                        (clearTimeout(d),
                        (d = setTimeout(function () {
                            e(document.body).trigger("update_checkout");
                        }, a)));
                */
            }),
            (window.validate_fields = function (a) {
                0 !== a.length &&
                    a.each(function (a) {
                        var t = e(this),
                            o = t.closest(".form-row"),
                            n = !0,
                            r = o.is(".validate-required"),
                            i = o.is(".validate-email"),
                            c = t.val();
                        r &&
                            ("checkbox" !== t.attr("type") || t.is(":checked")
                                ? "select-multiple" === t[0].type
                                    ? (null != t.val() && void 0 != t.val() && "" !== t.val() && 0 !== t.val().length) || (o.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"), (n = !1))
                                    : t.parents(".wfacp_custom_field_radio_wrap").length > 0
                                    ? 0 == t.parents(".wfacp_custom_field_radio_wrap").find("input:checked").length
                                        ? ((n = !1), o.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"))
                                        : (n = !0)
                                    : (null != c && "" !== c.trim()) || (o.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"), (n = !1))
                                : (o.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field"), (n = !1))),
                            (i = wfacp_frontend.hooks.applyFilters("wfacp_field_validate_email", i, t, o)) &&
                                t.val() &&
                                (new RegExp(
                                    /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i
                                ).test(t.val()) ||
                                    (o.removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-email"), (n = !1))),
                            (n = wfacp_frontend.hooks.applyFilters("wfacp_field_validated", n, t, o)) && o.removeClass("woocommerce-invalid woocommerce-invalid-required-field woocommerce-invalid-email").addClass("woocommerce-validated");
                    });
            }),
            (window.wfacp_validate_email = function (e) {
                return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase());
            }),
            (window.refresh_page_data = function (a) {
                if ("" !== wfacp_frontend.is_global) return update_checkout(), void (window.wfacp_haschanges = "no");
                var o = { products: {}, coupon: "", wfacp_id: a },
                    n = e("fieldset.wfacp-selected-product"),
                    r = e("fieldset.wfacp_product_row");
                if (n.length > 0)
                    n.each(function () {
                        if (!("hidden" !== e(this).find(".wfacp_switcher_checkbox").attr("type") && e(this).find(".wfacp_switcher_checkbox:checked") > 0) && "" !== e(this).attr("cart_key")) {
                            var a = e(this).data("item-key"),
                                t = 1;
                            e(this).find("input.wfacp_product_switcher_quantity").length > 0 && (t = e(this).find("input.wfacp_product_switcher_quantity").val()), (o.products[a] = t);
                        }
                    });
                else if (r.length > 0) {
                    var i = r.find("input.wfacp_switcher_checkbox");
                    if (i.length > 0) {
                        var c = i.eq(0);
                        if ("checkbox" == c.attr("type") || "radio" == c.attr("type")) return void c.trigger("click");
                        o.products = wfacp_frontend.products_in_cart;
                    } else o.products = wfacp_frontend.products_in_cart;
                } else o.products = wfacp_frontend.products_in_cart;
                var s = e(".woocommerce-remove-coupon");
                s.length > 0 && (o.coupon = s.eq(0).data("coupon")),
                    0 !== Object.keys(o.products).length &&
                        (_.block(t),
                        wfacp_send_ajax({ action: "update_cart_multiple_page", type: "post", data: o }, function (a) {
                            (window.wfacp_haschanges = "no"),
                                window.localStorage.setItem("wfacp_checkout_page_id", wfacp_frontend.id),
                                _.unblock(),
                                !0 === a.status && (e("#wfacp_has_active_multi_checkout").val(wfacp_frontend.id), update_fragments(a));
                        }));
            }),
            (window.is_document_visible = function () {
                return !document.hidden;
            }),
            e(document).keydown(function (e) {
                9 === e.which && (n = !0);
            }),
            e(document).on("focus", ".select2", function () {
                n && ((n = !1), e(this).siblings("select").select2("open"));
            }),
            e(document).keyup(function (a) {
                27 === a.keyCode && e(".wfacp_qv-close").trigger("click");
            }),
            e(document.body).on("click", ".wfacp_next_page_button", function () {
                var a = e(this),
                    t = e(this).data("current-step"),
                    o = e(".wfacp_page." + t);
                if (!(o.find("#product_switching_field").length > 0) || k()) {
                    if ((G(), (w = !0), e(".woocommerce-error").remove(), validate_fields(o.find(".wfacp-form-control:visible")), o.find(".woocommerce-invalid:visible").length > 0))
                        return e(".wfacp_payment").removeClass("wfacp_show_payment_part"), void e(document.body).trigger("checkout_error");
                    var n = new Promise(function (e, a) {
                        setTimeout(function () {
                            e();
                        }, 10);
                    });
                    "object" == _typeof((n = wfacp_frontend.hooks.applyFilters("wfacp_next_button_trigger", n, a, o)))
                        ? (n.catch(function (e) {
                              o.unblock(), wfacp_frontend.hooks.doAction("wfacp_next_button_trigger_validation_error", a, o);
                          }),
                          n.then(function (e) {
                              o.unblock(),
                                  x(a),
                                  setTimeout(function () {
                                      w = !1;
                                  }, 450),
                                  setTimeout(function () {
                                      w = !1;
                                  }, 450);
                          }))
                        : (o.unblock(), wfacp_frontend.hooks.doAction("wfacp_next_button_trigger_validation_error", a, o));
                }
            }),
            e(document.body).on("click", ".wfacp_back_page_button", function () {
                x(e(this));
            }),
            e(document.body).on(
                "click",
                ".wfacp_product_choosen_label_wrap .wfacp_product_choosen_label,.wfacp_product_switcher_col.wfacp_product_switcher_col_2 .product_name > span,.wfacp_product_row .product-price .wfacp_product_price_sec, #product_switching_field.wfacp_not_force_all.wfacp_setting_not_image_hide .wfacp_product_switcher_col_1 .product-image",
                function () {
                    var a = e(this).parents(".wfacp_product_row").find("input[name='wfacp_product_choosen']").attr("type");
                    (e(this).parents(".wfacp_product_row").hasClass("wfacp-selected-product") && "checkbox" != a) || e(this).parents(".wfacp_product_row").find("input[name='wfacp_product_choosen']").trigger("click");
                }
            ),
            e(document.body).on("focus", ".wfacp-form-control", function () {
                e(this).parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap");
            }),
            e(document.body).on("keyup", ".wfacp-form-control", function () {
                var a = e(this).parents(".wfacp-form-control-wrapper");
                a.addClass("wfacp-anim-wrap"), "" === e(this).val() && a.hasClass("validate-required") && a.addClass("woocommerce-invalid woocommerce-invalid-required-field");
            }),
            e(document.body).on("change", ".wfacp-form-control", function () {
                var a = e(this).find(".input-radio");
                a.length > 0
                    ? a.is(":checked").length > 0
                        ? e(this).parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap")
                        : e(this).parents(".wfacp-form-control-wrapper").removeClass("wfacp-anim-wrap")
                    : null != e(this).val() && "" != e(this).val()
                    ? "" !== e(this).val() && (e(this).parent().siblings(".wfacp_input_error_msg").hide(), e(this).parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap"))
                    : e(this).parents(".wfacp-form-control-wrapper").removeClass("wfacp-anim-wrap");
            }),
            e(document.body).on("focusout", ".wfacp-form-control", function () {
                var a = e(this).find(".input-radio");
                if (a.length > 0) a.is(":checked").length > 0 ? e(this).parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap") : e(this).parents(".wfacp-form-control-wrapper").removeClass("wfacp-anim-wrap");
                else if ("" === e(this).val()) {
                    var t = e(this).parents(".wfacp-form-control-wrapper");
                    t.removeClass("wfacp-anim-wrap"), t.hasClass("validate-required") && t.addClass("woocommerce-invalid woocommerce-invalid-required-field");
                }
            }),
            e(document.body).on("change", "#shipping_same_as_billing,.shipping_same_as_billing", function () {
                var a = wfacp_frontend.wc_customizer_validation_status,
                    t = e(this).prop("type");
                !0 === (("radio" == t && "option_2" == e(this).val()) || !("checkbox" != t || !e(this).is(":checked")))
                    ? (e(".ship_to_different_address").val(1).prop("checked", !0),
                      e(".wfacp_shipping_fields").each(function () {
                          e(this).removeClass("wfacp_shipping_field_hide"), e(this).addClass("wfacp_shipping_field_show");
                          var t = e(this).attr("id");
                          e(this).addClass("validate-required"), e(this).hasClass("validate-required") && void 0 !== a[t] && "wfacp_required_optional" === a[t] && e(this).removeClass("validate-required");
                      }),
                      e("#shipping_first_name").val(""),
                      e("#shipping_last_name").val(""),
                      e("#shipping_address_1").val(""),
                      e("#shipping_city").val(""),
                      e("#shipping_first_name_field").removeClass("wfacp-anim-wrap"),
                      e("#shipping_last_name_field").removeClass("wfacp-anim-wrap"),
                      e("#shipping_address_1_field").removeClass("wfacp-anim-wrap"),
                      e("#shipping_city_field").removeClass("wfacp-anim-wrap"))
                    : (e(".ship_to_different_address").prop("checked", !1),
                      e(".wfacp_shipping_fields").each(function () {
                          e(this).addClass("wfacp_shipping_field_hide"), e(this).removeClass("wfacp_shipping_field_show"), e(this).removeClass("validate-required");
                      }),
                      e("#shipping_first_name").val(e("#billing_first_name").val()),
                      e("#shipping_last_name").val(e("#billing_last_name").val()),
                      e("#shipping_address_1").val(e("#billing_address_1").val()),
                      e("#shipping_city").val(e("#billing_city").val()),
                      e("#shipping_state").val(e("#billing_state").val()),
                      e("#shipping_country").val(e("#billing_country").val()).trigger("change")),
                    q();
            }),
            e(document.body).on("change", "#billing_same_as_shipping,.billing_same_as_shipping", function () {
                var a = wfacp_frontend.wc_customizer_validation_status,
                    t = e(this).prop("type");
                if (!0 === (("radio" == t && "option_2" == e(this).val()) || !("checkbox" != t || !e(this).is(":checked")))) {
                    e("#wfacp_billing_same_as_shipping").val(1),
                        e(".wfacp_billing_fields").each(function () {
                            e(this).removeClass("wfacp_billing_field_hide"), e(this).addClass("wfacp_billing_field_show");
                        }),
                        e("#billing_address_1").val(""),
                        e("#billing_city").val(""),
                        e("#billing_postcode").val(""),
                        e("#billing_first_name_field").parents(".wfacp_divider_billing").length > 0 && (e("#billing_first_name").val(""), e("#billing_first_name_field").removeClass("wfacp-anim-wrap")),
                        e("#billing_last_name_field").parents(".wfacp_divider_billing").length > 0 && (e("#billing_last_name").val(""), e("#billing_last_name_field").removeClass("wfacp-anim-wrap")),
                        e("#billing_address_1_field").removeClass("wfacp-anim-wrap"),
                        e("#billing_city_field").removeClass("wfacp-anim-wrap"),
                        e("#billing_postcode_field").removeClass("wfacp-anim-wrap");
                    var o = e(".wfacp_billing_field_show");
                    o.addClass("validate-required"),
                        o.each(function () {
                            var t = e(this),
                                o = t.attr("id");
                            t.hasClass("validate-required") && void 0 !== a[o] && "wfacp_required_optional" === a[o] && t.removeClass("validate-required");
                        });
                } else {
                    e("#wfacp_billing_same_as_shipping").val(0),
                        e(".wfacp_billing_fields").each(function () {
                            e(this).addClass("wfacp_billing_field_hide"), e(this).removeClass("wfacp_shipping_field_show");
                        }),
                        e("#billing_first_name").val(e("#shipping_first_name").val()),
                        e("#billing_last_name").val(e("#shipping_last_name").val()),
                        e("#billing_address_1").val(e("#shipping_address_1").val()),
                        e("#billing_city").val(e("#shipping_city").val()),
                        e("#billing_state").val(e("#shipping_state").val()),
                        e("#billing_country").val(e("#shipping_country").val()).trigger("change"),
                        e("#billing_postcode").val(e("#shipping_postcode").val()),
                        e(".wfacp_billing_field_show").removeClass("woocommerce-invalid woocommerce-invalid-required-field validate-required");
                }
                q();
            }),
            e(document.body).on("checkout_error", function () {
                if (!0 === wfacp_frontend.hooks.applyFilters("disable_error_messages", !1)) return !0;
                if (!(e(".wfacp_amazon_checkout").length > 0 || e(".wfacp_paypal_express").length > 0))
                    if ((e("#account_password_field").removeClass("wfacp-create-account-label"), e(".wfacp_payment.wfacp_show_payment_part").length > 0 || 1 === e(".wfacp_page").length)) {
                        var a = e(".wfacp_custom_field_radio_wrap.validate-required");
                        a.length > 0 &&
                            a.each(function () {
                                0 == e(this).find("input[type=radio]:checked").length && e(this).removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field");
                            });
                    } else {
                        e(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(), e(".wfacp_input_error_msg").remove();
                        var t = e(".woocommerce-invalid:visible"),
                            o = [];
                        0 !== t.length &&
                            (t.each(function () {
                                var a = e(this),
                                    t = e(this).find("input"),
                                    n = a.children("label");
                                0 === n.length && (n = a.find("label").eq(0));
                                var r = n.clone().children().remove().end().text();
                                "" === (r = r.trim()) && (n.find(".required").remove(), (r = n.text().trim()));
                                var i = "",
                                    c = "<strong>" + r.trim() + "</strong> ";
                                (i = e(this).hasClass("woocommerce-invalid-email") ? p.invalid_email_field.replace("%s", c) : p.error_required_msg.replace("%s", c)),
                                    (i = wfacp_frontend.hooks.applyFilters("wfacp_field_error_message", i, a, t)),
                                    o.push("<li>" + i + "</li>");
                            }),
                            o.length > 0 && wfacp_submit_error('<ul class="woocommerce-error" role="alert">' + o.join(" ") + "</ul>", !1));
                    }
            }),
            e(".wfacp_qv-panel").on("click", ".wfacp_qv-close", P),
            e(document.body).on("click", ".wfacp_qv-inner-modal", P),
            e(document.body).on("click", ".wfacp_qv-button", function (a) {
                a.preventDefault();
                var t = e(this).parents(".wfacp_product_row");
                e(".wfacp_qv-opac").show();
                var o = e(".wfacp_qv-panel");
                o.addClass("wfacp_qv-panel-active"), o.find(".wfacp_qv-opl").addClass("wfacp_qv-pl-active");
                var n = e(this).attr("qv-id"),
                    r = {};
                t.length > 0 && ((r.item_key = t.attr("data-item-key")), (r.cart_key = t.attr("cart_key"))), (r.wfacp_id = e("._wfacp_post_id").val()), (r.product_id = n);
                var i = e(this).attr("qv-var-id");
                void 0 !== i && (r.variation_id = i), F(r);
            }),
            e(document.body).on("click", ".wfacp_single_add_to_cart_button", function () {
                var a = e(this).siblings(".quantity").children("[name=quantity]").val(),
                    t = e(".wfacp_qv-inner-modal"),
                    o = t.data("item-key"),
                    n = t.data("cart-key"),
                    r = !1;
                if ((e(".wfacp_qv-summary .variations_form").length > 0 && (r = !0), void 0 !== n && "" !== n)) {
                    var i = e('fieldset.wfacp_product_row[cart_key="' + n + '"]');
                    if (i.length > 0) {
                        var c = i.find(".wfacp_product_switcher_quantity");
                        c.length > 0 && c.val(a), !0 === r ? S(i) : c.trigger("change"), e(".wfacp_qv-close").trigger("click");
                    }
                } else if (void 0 !== o && "" !== o) {
                    var s = e('fieldset.wfacp_product_row[data-item-key="' + o + '"]');
                    if (s.length > 0) {
                        var _ = s.find(".wfacp_product_switcher_quantity");
                        _.length > 0 && _.val(a), !0 === r ? S(s) : s.find("[name=wfacp_product_choosen]").prop("checked", !0).trigger("change"), e(".wfacp_qv-close").trigger("click");
                    }
                }
            }),
            e(document.body).on("click", ".wfacp_edit_address", function (a) {
                a.preventDefault(),
                    e(".wfacp-form-control-wrapper").removeClass("hidden"),
                    "billing" === e(this).data("type") && e(".wfacp_express_billing_address").slideToggle(),
                    "shipping" === e(this).data("type") && e(".wfacp_express_shipping_address").slideToggle();
            }),
            e(document.body).on("click", "#place_order", function () {
                G(), e(".woocommerce-error").remove();
            }),
            e(document.body).on("click", ".wfacp_remove_item_from_cart", function (a) {
                a.preventDefault();
                var o = e(this),
                    n = e(this).parents(".cart_item"),
                    r = (e(this).parent(".wfacp_delete_item"), e(this).data("cart_key")),
                    i = e(this).data("item_key"),
                    c = e(".wfacp-product-switch-panel");
                c.block(t),
                    show_blocked_mini_cart(),
                    wfacp_send_ajax({ action: "remove_cart_item", type: "post", data: { cart_key: r, item_key: i, by: "product_switcher", wfacp_id: e("._wfacp_post_id").val() } }, function (a) {
                        if ((c.unblock(), a.hasOwnProperty("error") && a.hasOwnProperty("cart_key"))) {
                            var t = o.parents(".wfacp_min_cart_widget");
                            if (((n = e('.wfacp_product_row[cart_key="' + a.cart_key + '"]')), t.length > 0 && (n = o.parents("td")), n.length > 0)) return show_unblocked_mini_cart(), void wfacp_show_error(n, a);
                        }
                        e("#product_switcher_need_refresh").val(0), update_fragments(a), update_checkout();
                    });
            }),
            e(document.body).on("click", ".wfacp_restore_cart_item", function (a) {
                a.preventDefault();
                var o = e(this).data("cart_key");
                e(".wfacp-product-switch-panel").block(t);
                var n = "product_switcher";
                e(this).parents(".wfacp_min_cart_widget").length > 0 && (n = "mini_cart"),
                    show_blocked_mini_cart(),
                    wfacp_send_ajax({ action: "undo_cart_item", type: "post", data: { cart_key: o, wfacp_id: e("._wfacp_post_id").val(), by: n } }, function (a) {
                        e("#product_switcher_need_refresh").val(1), update_fragments(a), update_checkout();
                    });
            }),
            e(document.body).on("click", "span.wfacp_attr_value_not_available", function () {
                e(this).parents(".wfacp_product_sec").find("a.wfacp_qv-button").trigger("click");
            }),
            e(document).ready(function () {
                e(".wfacp_dummy_preview_heading").length > 0 &&
                    e(".wfacp_dummy_preview_heading").click(function (e) {
                        e.preventDefault();
                        var a = jQuery(".wfacp_notice_dismise_link").attr("data-notice-id"),
                            t = jQuery(".wfacp_notice_dismise_link").attr("page-id");
                        "undefined" != a &&
                            "" != a &&
                            jQuery.ajax({
                                url: wfacp_frontend.admin_ajax,
                                type: "POST",
                                data: { action: "notice_dismise_link", notice_dismise_link: a, page_id: t },
                                success: function (e) {
                                    "success" === e.status && jQuery("[data-notice-id=" + e.key + "]").slideUp();
                                },
                            });
                    }),
                    e(document.body).trigger("wfacp_front_ready", [_]);
                var a = e("body");
                if (
                    (a.hasClass("wfacp_main_wrapper") &&
                        "undefined" != typeof wfacp_elementor_data &&
                        "undefined" !== wfacp_elementor_data.wfacp_make_button_sticky_on_mobile &&
                        "" !== wfacp_elementor_data.wfacp_make_button_sticky_on_mobile &&
                        a.addClass("yes_sticky"),
                    o < 768 && "undefined" != typeof wfacp_elementor_data && (e("body").removeClass("yes_sticky"), "yes" == wfacp_elementor_data.wfacp_make_button_sticky_on_mobile))
                ) {
                    wfacp_elementor_data.wfacp_make_button_sticky_on_mobile;
                    e("body").addClass("yes_sticky");
                }
                if ("undefined" != typeof angelleye_in_content_param) {
                    if (((angelleye_in_content_param.set_express_checkout += "&wfacp_id=" + wfacp_frontend.id + "&wfacp_is_checkout_override=" + wfacp_frontend.wfacp_is_checkout_override), e("#wfacp_embed_form_page_id").length > 0)) {
                        var t = e("#wfacp_embed_form_page_id").val();
                        angelleye_in_content_param.set_express_checkout += "&wfacp_embed_form_page_id=" + t;
                    }
                    angelleye_in_content_param.cancel_page = wfacp_frontend.cancel_page_url;
                }
                e("#wfacp_exchange_keys").val(JSON.stringify(wfacp_frontend.exchange_keys)),
                    e(".wfacp_custom_field_radio_wrap input[type=radio]").click(function () {
                        e(this).is(":checked")
                            ? e(this).parents(".wfacp_custom_field_radio_wrap").removeClass("woocommerce-invalid woocommerce-invalid-required-field").addClass("woocommerce-validated")
                            : e(this).parents(".wfacp_custom_field_radio_wrap").removeClass("woocommerce-validated").addClass("woocommerce-invalid woocommerce-invalid-required-field");
                    });
                var n,
                    r = e(".wfacp_drop_list");
                r.length > 0 && r.find("select").hasClass("select2-hidden-accessible") && "object" === _typeof((n = r)) && (n.removeClass("wfacp_drop_list"), n.addClass("wfacp_add_select_2")),
                    _.on("input validate change", ".input-text, select, input:checkbox", function () {
                        s.html(""), e(".wfacp_input_error_msg").length > 0 && e(".wfacp_error_message").hide();
                        var a = e("#billing_state"),
                            t = e("#shipping_state");
                        a.length > 0 && a.addClass("wfacp-form-control"), t.length > 0 && t.addClass("wfacp-form-control");
                    }),
                    e(document.body).on("change", "#createaccount", function () {
                        e(this).is(":checked") ? e("#account_password_field").addClass("wfacp-create-account-label") : e("#account_password_field").removeClass("wfacp-create-account-label");
                    }),
                    e("#shipping_same_as_billing").trigger("change"),
                    e(document.body)
                        .off("click", ".wfacp_steps_wrap a")
                        .on("click", ".wfacp_steps_wrap a", function (a) {
                            if (!e(this).parent().hasClass("df_cart_link") && (a.preventDefault(), !e(this).parent().hasClass("ppec_express_checkout_m"))) {
                                for (var t = e(this).parent().attr("step"), o = ["single_step", "two_step", "third_step"], n = 0; n < o.length; n++) t == o[n] ? e("body").hasClass(t) || e("body").addClass(t) : e("body").removeClass(o[n]);
                                if (!e(".wfacp_page:visible").hasClass(t) && e(this).parent().hasClass("wfacp_bred_visited")) {
                                    e(".woocommerce-error").remove(),
                                        e(".wfacp_steps_sec ul li").removeClass("wfacp_bred_active"),
                                        e(this).parent().addClass("wfacp_bred_active"),
                                        z(e(this)),
                                        e(".wfacp_page:visible").fadeOut(300, function () {
                                            e(".wfacp_page." + t).fadeIn(600), q();
                                        }),
                                        e(".wfacp_page." + t).hasClass("wfacp_last_page") && e(".wfacp_payment").removeClass("wfacp_hide_payment_part");
                                    var r = e(this).data("text");
                                    "" === r && (r = t),
                                        setTimeout(function () {
                                            window.location.assign("#" + r);
                                        }, 700);
                                }
                            }
                        }),
                    e("#billing_country, #shipping_country, .country_to_state,#shipping_state,#billing_state").on("change", function (a, t) {
                        setTimeout(function () {
                            var a = e("#shipping_state"),
                                t = a.val(),
                                o = a.parents(".form-row");
                            a.hasClass("input-text") && a.addClass("wfacp-form-control");
                            var n = e("#billing_state"),
                                r = n.val(),
                                i = n.parents(".form-row");
                            N(o, t), N(i, r), n.hasClass("input-text") && n.addClass("wfacp-form-control");
                        }, 700);
                    }),
                    e("#billing_same_as_shipping").length > 0 &&
                        (e(document).on("change", "#shipping_country", function () {
                            e("#billing_same_as_shipping").is(":checked") || e("#billing_country").val(e(this).val()).trigger("change");
                        }),
                        e(document).on("change", "#shipping_state", function () {
                            e("#billing_same_as_shipping").is(":checked") || e("#billing_state").val(e(this).val()).trigger("change");
                        }));
            }),
            e(window).on("load", function () {
                A(),
                    -1 != navigator.userAgent.indexOf("Mac OS X") ? e("body").addClass("wfacp_mac") : e("body").addClass("wfacp_pc"),
                    setTimeout(function () {
                        C();
                    }, 700);
            }),
            e(document.body).on("wfacp_init", function () {
                A();
            }),
            e(document.body).on("change", ".shipping_method", function () {
                e(".wfacp_shipping_options").block(t);
            }),
            e(document.body).on("update_checkout", function () {
                var a;
                (a = e(".wfacp_order_total_field")).length > 0 && a.block(t);
                var o = e(".wfacp_shipping_options");
                o.length > 0 && o.block(t);
                var n = e(".foo_event_wrap");
                n.length > 0 && n.block(t), (c = !0), 0;
            }),
            e(document.body).on("updated_checkout", function (a, t) {
                e("#product_switcher_need_refresh").val(1), void 0 !== t && (c = !1);
                var o = e("#payment ul.wc_payment_methods");
                e("#payment ul.wc_payment_methods > li").length > 1 ? o.removeClass("wfacp_method_length_count_one") : o.addClass("wfacp_method_length_count_one"),
                    setTimeout(function () {
                        0 === e(".wfacp-selected-product").length && "yes" === window.wfacp_haschanges && refresh_page_data(wfacp_frontend.id), 0 !== e(".foo_event_wrap").length && populate_fields_value();
                    }, 600),
                    (function () {
                        if (0 != e(".shipmondo-shipping-field-wrap").length) {
                            var a = e(".wfacp_single_shipping_method");
                            a.each(function () {
                                a.each(function () {
                                    if (e(this).find(".shipmondo-shipping-field-wrap").length > 0) {
                                        var a = e(this).find(".wfacp_shipping_radio"),
                                            t = e(this).children(".wfacp_single_shipping_desc").html();
                                        e(this).children(".wfacp_single_shipping_desc").html(""), a.append(t);
                                    }
                                });
                            });
                        }
                    })();
            }),
            e(document.body).on("click", ".wfacp_preview_step_change", function () {
                x(e(this));
            }),
            e(document.body).on("wfacp_undo_cart_item", function (a, t) {
                t.data.hasOwnProperty("by") && "mini_cart" == t.data.by ? e("#product_switcher_need_refresh").val(1) : e("#product_switcher_need_refresh").val(0);
            }),
            e(document.body).on("change", ".wfacp_mini_cart_update_qty", function () {
                var a = this,
                    o = e(this),
                    n = o.val(),
                    r = o.parents(".wfacp_min_cart_widget").data("delete-enabled"),
                    i = o.parent(".cart_item"),
                    c = o.attr("cart_key"),
                    s = o.data("value");
                if ((void 0 != n && "" != n && 0 != n) || "1" == r) {
                    var _ = e(".wfacp-product-switch-panel");
                    _.block(t),
                        show_blocked_mini_cart(),
                        wfacp_send_ajax({ action: "update_cart_item_quantity", type: "post", data: { cart_key: c, quantity: n, old_qty: s, by: "mini_cart", wfacp_id: e("._wfacp_post_id").val() } }, function (t) {
                            if ((show_unblocked_mini_cart(), _.unblock(), t.hasOwnProperty("error") && t.hasOwnProperty("cart_key")))
                                return e(a).val(s), (i = e('.wfacp_min_cart_widget .cart_item[cart_key="' + t.cart_key + '"] .product-name-area')), void wfacp_show_error(i, t);
                            update_fragments(t);
                        });
                } else o.val(s);
            }),
            e(document.body).on("click", ".wfacp_mini_cart_remove_item_from_cart", function (a) {
                a.preventDefault();
                var o = e(this),
                    n = e(this).parents(".cart_item"),
                    r = e(this).data("cart_key"),
                    i = e(this).data("item_key");
                show_blocked_mini_cart();
                var c = e(".wfacp-product-switch-panel");
                c.block(t),
                    wfacp_send_ajax({ action: "remove_cart_item", type: "post", data: { cart_key: r, item_key: i, by: "mini_cart", wfacp_id: e("._wfacp_post_id").val() } }, function (a) {
                        if ((show_unblocked_mini_cart(), c.unblock(), a.hasOwnProperty("error") && a.hasOwnProperty("cart_key"))) {
                            var t = o.parents(".wfacp_elementor_mini_cart_widget");
                            return (
                                (n = e('.wfacp_min_cart_widget .cart_item[cart_key="' + a.cart_key + '"] .product-name')),
                                t.length > 0 && (n = e('.wfacp_min_cart_widget .cart_item[cart_key="' + a.cart_key + '"] .product-name-area')),
                                void wfacp_show_error(n, a)
                            );
                        }
                        e("#product_switcher_need_refresh").val(0), update_fragments(a), update_checkout();
                    });
            }),
            e(document.body).on("click", ".wfacp_force_last_delete", function (a) {
                a.preventDefault();
                var o = e(this).parents(".cart_item");
                if (0 != o.length) {
                    var n = o.attr("cart_key");
                    e("#product_switching_field").block(t),
                        ("" == n && void 0 == n) ||
                            wfacp_send_ajax({ action: "delete_last_item", type: "post", data: { cart_key: n } }, function (a) {
                                1 == a.status ? (window.location.href = a.redirect) : e("#product_switching_field").unblock(t);
                            });
                }
            }),
            e(window).bind("popstate", function () {
                if (!0 !== w) {
                    var a = location.hash;
                    if ("#" !== a && 1 != wfacp_frontend.hooks.applyFilters("disable_pop_state", !1, a)) {
                        var t = "",
                            o = e(".wfacp_step_text_have");
                        if (0 !== o.length) {
                            var n = !1,
                                r = null;
                            if (("" === a ? (n = !0) : ((t = a.replace("#", "")), 0 === (r = e('.wfacp_step_text_have[data-text="' + t + '"]')).length && (n = !0)), !0 === n && (r = o.eq(0)), null != r)) {
                                var i = r.parent(),
                                    c = i.attr("step"),
                                    s = e(".wfacp_page:visible");
                                if (!s.hasClass(c) && i.hasClass("wfacp_bred_visited")) {
                                    if ((e(".woocommerce-error").remove(), validate_fields(s.find(".wfacp-form-control:visible")), s.find(".woocommerce-invalid:visible").length > 0))
                                        return void e(".wfacp_payment").removeClass("wfacp_show_payment_part");
                                    e(".wfacp_page").hide(), e(".wfacp_steps_sec ul li").removeClass("wfacp_bred_active"), i.addClass("wfacp_bred_active");
                                    var _ = e(".wfacp_page." + c);
                                    e(_).fadeIn(600), _.hasClass("wfacp_last_page") && e(".wfacp_payment").removeClass("wfacp_hide_payment_part"), q();
                                }
                            }
                        }
                    }
                }
            }),
            (function () {
                var a = e(".mailchimp-newsletter");
                a.length > 0 && a.addClass("wfacp-form-control-wrapper wfacp-col-full wfacp_checkbox_field");
                var t = e(".mc4wp-checkbox");
                t.length > 0 && t.addClass("wfacp-form-control-wrapper wfacp-col-full wfacp_checkbox_field");
                var o = e("#ss_wc_mailchimp_opt_in");
                o.length > 0 && o.parents(".woocommerce-mailchimp-opt-in").addClass("wfacp-form-control-wrapper wfacp-col-full wfacp_checkbox_field"),
                    e(".address-field input,.address-field select").on("input", function () {
                        e(this).parents(".form-row").hasClass("wfacp-anim-wrap") || e(this).parents(".form-row").addClass("wfacp-anim-wrap");
                    }),
                    e(document.body).on("wfacp_sustain_multi_checkout_page_run", function () {
                        "undefined" == typeof b4_checkout_updating ? (window.b4_checkout_updating = !0) : (b4_checkout_updating = !0);
                    }),
                    e(document).on("wfacp_sustain_multi_checkout_page_finish", function () {
                        "undefined" != typeof b4_checkout_updating && update_checkout();
                    });
                var n = !1;
                e(document.body).on("wfacp_checkout_data", function () {
                    var a = e("#payment_method_woo-mercado-pago-custom");
                    a.length > 0 && "woo-mercado-pago-custom" === a.val() && ((n = !0), update_checkout());
                }),
                    _.on("click", 'input[name="payment_method"]', function () {
                        "woo-mercado-pago-custom" === e(this).val() && "object" == ("undefined" == typeof MPv1 ? "undefined" : _typeof(MPv1)) && 1 == n && (MPv1.guessingPaymentMethod({ event: "keyup" }), (n = !1));
                    }),
                    e(document.body).on("wfacp_coupon_apply", function () {
                        var a = e("#payment_method_woo-mercado-pago-custom");
                        a.length > 0 && "woo-mercado-pago-custom" === a.val() && ((n = !0), update_checkout());
                    }),
                    e(document.body).on("wfacp_coupon_form_removed", function () {
                        var a = e("#payment_method_woo-mercado-pago-custom");
                        a.length > 0 && "woo-mercado-pago-custom" === a.val() && ((n = !0), update_checkout());
                    });
                var r = "";
                e(document.body).on("change", ".iw_tcs_variable", function () {
                    var a = e(this).find("option:selected").text();
                    r = a.trim();
                }),
                    e(document.body).on("wfacp_after_fragment_received", function (a, t) {
                        !(function () {
                            if ("" !== r) {
                                var a = e(".iw_tcs_variable");
                                a.children("option").each(function () {
                                    var t = e(this).text();
                                    if ((t = t.trim()) == r) {
                                        var o = e(this).attr("value");
                                        a.val(o), a.trigger("change");
                                    }
                                });
                            }
                        })();
                    });
            })(),
            (function () {
                if (0 !== _.length) {
                    e(document.body).trigger("wfacp_sustain_multi_checkout_page_run", [_]);
                    var a = wfacp_frontend.id,
                        t = wfacp_frontend.id;
                    try {
                        if (!("sessionStorage" in window && null !== window.sessionStorage)) return;
                        window.localStorage.setItem("wfacp_checkout_page_id", wfacp_frontend.id),
                            window.addEventListener("storage", function (e) {
                                "wfacp_checkout_page_id" === e.key && ((t = e.newValue), (window.wfacp_haschanges = "yes"));
                            }),
                            window.addEventListener("focus", function (e) {
                                a !== t && t > 0 && "yes" === window.wfacp_haschanges && refresh_page_data(a);
                            });
                    } catch (e) {}
                }
            })(),
            (function () {
                var a = wfacp_frontend.show_on_next_step_fields,
                    t = e(".wfacp_step_preview");
                function o(e) {
                    var a = e.clone().children().remove().end().text();
                    return "" === (a = a.trim()) && (e.find(".required").remove(), (a = e.text().trim())), a;
                }
                function n(a) {
                    if ("select" === a[0].tagName || "SELECT" === a[0].tagName) {
                        if ("" != a.val()) return a.find("option:selected").text();
                    } else if ("INPUT" == a[0].tagName) {
                        if ("hidden" != a[0].getAttribute("type")) return a.val();
                        var t = e(a[0]).siblings("strong");
                        if (t.length > 0) return t.text();
                    }
                }
                function r(a, o, r) {
                    var i = "billing";
                    "shipping-address" === a && (i = "shipping");
                    var c,
                        s = "",
                        _ = e(".wfacp_divider_" + i).find("#" + i + "_first_name"),
                        p = e(".wfacp_divider_" + i).find("#" + i + "_last_name"),
                        l = e("#" + i + "_address_1"),
                        d = e("#" + i + "_address_2"),
                        f = e("#" + i + "_city"),
                        u = e("#" + i + "_postcode"),
                        w = e("#" + i + "_country"),
                        h = e("#" + i + "_state");
                    if (
                        (console.log(h),
                        _.length > 0 && "" !== _.val() && (s += " " + _.val()),
                        p.length > 0 && "" !== p.val() && (s += " " + p.val()),
                        l.length > 0 && "" !== l.val() && ("" != s.trim() ? (s += ", " + l.val()) : (s += l.val())),
                        d.length > 0 && "" !== d.val() && ("" != s.trim() ? (s += ", " + d.val()) : (s += d.val())),
                        f.length > 0 && "" !== f.val() && ("" != s.trim() ? (s += ", " + f.val()) : (s += f.val())),
                        h.length > 0 && "" !== h.val())
                    ) {
                        var m = n(h);
                        void 0 !== m && (s += " " + m), "" == s && (s += " " + h.val());
                    }
                    if ((u.length > 0 && "" !== u.val() && (s += " " + u.val()), w.length > 0 && "" !== w.val())) {
                        var v = "";
                        "" == (v = n(w)) && (v += w.val()), "" != s.trim() ? (s += ", " + v) : (s += v);
                    }
                    if ("" == (c = s)) return !1;
                    var g = e(".wfacp_divider_" + i)
                            .parents(".wfacp_page")
                            .data("step"),
                        y = "<div class='single_preview'><div class='single_preview_contents "
                            .concat(a, '\'>\n                                          <div class="single_preview_inner">')
                            .concat(wfacp_frontend.fields_label[a], '</div>\n                                          <div class="single_preview_inner">')
                            .concat(c, '</div></div>\n                                          <div class="single_preview_change"><a href="javascript:void(0);" data-next-step="')
                            .concat(g, '" data-current-step="')
                            .concat(r.current_step, '" class="wfacp_preview_step_change">')
                            .concat(wfacp_frontend.change_text_preview_fields, "</a></div>                                          \n                                       </div>");
                    return t.append(y), !0;
                }
                function i(a, o, n) {
                    var r = "",
                        i = e(".wfacp_shipping_calculator");
                    if (0 === i.length) return !1;
                    var c = i.find(".wfacp_shipping_table");
                    if (c.length > 0) {
                        var s = (c = c.eq(0)).find(".shipping_method:checked");
                        s.length > 0 && (r = s.siblings("label").text());
                    }
                    if ("" === r) return !1;
                    var _ = i.parents(".wfacp_page").data("step"),
                        p = "<div class='single_preview'><div class='single_preview_contents "
                            .concat(a, '\'>\n                                          <div class="single_preview_inner wfacp_label">')
                            .concat(wfacp_frontend.fields_label.shipping_calculator, '</div>\n                                          <div class="single_preview_inner wfacp_val">')
                            .concat(r, '</div></div>\n                                          <div class="single_preview_change">\n                                          <a href="javascript:void(0);" data-next-step="')
                            .concat(_, '" data-current-step="')
                            .concat(n.current_step, '" class="wfacp_preview_step_change">')
                            .concat(wfacp_frontend.change_text_preview_fields, "</a></div>\n                                       </div>");
                    return t.append(p), !0;
                }
                function c(a, n, r) {
                    var i = e("#" + a),
                        c = "",
                        s = "";
                    if (0 === i.length) {
                        var _ = e("#" + a + "_field");
                        if (0 === _.length) return !1;
                        if (_.hasClass("wfacp_custom_field_radio_wrap")) {
                            var p = _.find("input:checked");
                            if (0 === p.length) return !1;
                            var l = p.attr("id");
                            (c = e('label[for="' + l + '"]').text()), (s = o(e('label[for="' + a + '"]')));
                        }
                    } else {
                        if ("select" === i[0].tagName || "SELECT" === i[0].tagName) c = i.find("option:selected").text();
                        else if ("checkbox" === i.attr("type")) {
                            if (!0 !== i.is(":checked")) return !1;
                            c = "On";
                        } else {
                            var d = e(".single_preview_contents.billing_first_name");
                            if (d.length > 0 && "billing_last_name" === a && "" != i.val()) return d.find(".wfacp_val").append(" " + i.val()), !1;
                            c = i.val();
                        }
                        (s = o(i.parents(".form-row").find("label"))), "billing_first_name" === a && (s = wfacp_frontend.fields_label[a]);
                    }
                    if ("" !== c) {
                        var f = i.parents(".wfacp_page").data("step"),
                            u = "<div class='single_preview'><div class='single_preview_contents "
                                .concat(a, '\'>\n                                          <div class="single_preview_inner wfacp_label">')
                                .concat(s, '</div>\n                                          <div class="single_preview_inner wfacp_val">')
                                .concat(c, '</div></div>\n                                          <div class="single_preview_change">\n                                          <a href="javascript:void(0);" data-next-step="')
                                .concat(f, '" data-current-step="')
                                .concat(r.current_step, '" class="wfacp_preview_step_change">')
                                .concat(wfacp_frontend.change_text_preview_fields, "</a></div>\n                                       </div>");
                        return t.append(u), !0;
                    }
                    return !1;
                }
                function s(o) {
                    var n = "single_step";
                    "two_step" === o.current_step ? (n = "single_step") : "third_step" === o.current_step && (n = "two_step");
                    var s = "{}";
                    if (!0 === o.last_step) {
                        var _ = Object.assign({}, a.single_step, a.two_step, a.third_step);
                        s = JSON.stringify(_);
                    } else {
                        if (!a.hasOwnProperty(n)) return void e(".wfacp_preview_content_box").hide();
                        s = JSON.stringify(a[n]);
                    }
                    if (void 0 != s) {
                        var p = JSON.parse(s);
                        e(".wfacp_preview_content_box").hide(), t.html("");
                        var l = !1;
                        for (var d in p)
                            if ("true" === p[d])
                                if ("address" === d || "shipping-address" === d) {
                                    var f = e("#billing_same_as_shipping"),
                                        u = e("#shipping_same_as_billing");
                                    if ("address" === d && f.length > 0 && !1 === f.prop("checked")) continue;
                                    if ("shipping-address" === d && u.length > 0 && !1 === u.prop("checked")) continue;
                                    1 == r(d, 0, o) && (l = !0);
                                } else "shipping_calculator" === d ? 1 == i(d, 0, o) && (l = !0) : 1 == c(d, 0, o) && (l = !0);
                        !0 === l && e(".wfacp_preview_content_box[data-step='" + o.current_step + "']").show();
                    }
                }
                e(document.body).on("wfacp_step_switching", function (e, a) {
                    s(a);
                }),
                    e(document.body).on("click", ".wfacp_step_text_have", function (a, t) {
                        if ((a.preventDefault(), e(this).parent("li").hasClass("wfacp_bred_visited"))) {
                            var o = e(this).parent("li").attr("step");
                            if ("" !== o) {
                                var n = { current_step: o, last_step: !1 },
                                    r = e(".wfacp_step_text_have");
                                "two_step" === o && 2 == r.length ? (n.last_step = !0) : "third_step" === o && 4 == r.length && (n.last_step = !0), B(), s(n);
                            }
                        }
                    });
            })(),
            e(document).on("change", ".wfacp_product_choosen", function (a, o) {
                var n = e(".wfacp-product-switch-panel"),
                    r = e(this),
                    i = e(this).is(":checked"),
                    s = e(this).attr("type"),
                    _ = e(this).parents(".wfacp_product_row");
                "radio" === s && e(".wfacp-product-switch-panel .wfacp_product_row").removeClass("wfacp-selected-product");
                var p = "addon_product",
                    l = {};
                i || (p = "remove_addon_product"),
                    (l.type = s),
                    (l.wfacp_id = e("._wfacp_post_id").val()),
                    _.find(".wfacp_product_switcher_quantity"),
                    void 0 !== o && ("add" === o.action && ((p = "addon_product"), (l.quantity = o.qty)), "remove" === o.action && ((p = "remove_addon_product"), o.hasOwnProperty("old_qty") && (l.old_qty = o.old_qty))),
                    n.block(t);
                var d = e(this).data("item-key"),
                    f = e(this).attr("cart_key");
                (l.item_key = d),
                    void 0 !== f && "" !== f && (l.item_key = f),
                    (l = set_variation_data(l, o)),
                    e("#product_switcher_need_refresh").val(0),
                    show_blocked_mini_cart(),
                    wfacp_send_ajax({ action: p, type: "post", data: l }, function (a) {
                        if (a.hasOwnProperty("error")) return "addon_product" === p ? r.prop("checked", !1) : r.prop("checked", !0), wfacp_show_error(_, a), show_unblocked_mini_cart(), void n.unblock();
                        1 == a.status &&
                            (e("#product_switcher_need_refresh").val(1),
                            "addon_product" === p && e(document.body).trigger("wfacp_product_added", { item: a.cart_item, item_key: a.item_key, cart_key: a.new_cart_key }),
                            (c = !1),
                            update_checkout());
                    });
            }),
            e(document).on("change", ".wfacp_product_switcher_quantity", function (a, o) {
                if (!e(this).hasClass("wfacp_product_global_quantity_bump")) {
                    if (e(this).is(":disabled")) return !1;
                    var n = e(this).parents(".wfacp_product_row"),
                        r = n.find(".wfacp_product_choosen");
                    0 === r.length && (r = n.find(".wfacp_product_switch"));
                    var i = r.data("item-key"),
                        c = r.attr("cart_key"),
                        s = e("._wfacp_post_id").val(),
                        _ = e(this).val();
                    if ("" !== c)
                        if (0 !== parseInt(_) && "" !== _) {
                            var p = e(".wfacp-product-switch-panel");
                            p.block(t), show_blocked_mini_cart();
                            var l = { action: "update_product_qty", type: "post", data: { item_key: i, cart_key: c, qty: _, wfacp_id: s, is_hide: p.data("is-hide") } };
                            wfacp_send_ajax(l, function (a) {
                                if (("function" == typeof o && o(a), a.hasOwnProperty("error")))
                                    return (
                                        a.hasOwnProperty("item_key") ? (n = e('.wfacp_product_row[data-item-key="' + a.item_key + '"]')) : a.hasOwnProperty("cart_key") && (n = e('.wfacp_product_row[cart_key="' + a.cart_key + '"]')),
                                        wfacp_show_error(n, a),
                                        show_unblocked_mini_cart(),
                                        void p.unblock()
                                    );
                                e("#product_switcher_need_refresh").val(0), update_fragments(a), update_checkout();
                            });
                        } else {
                            var d = e(this).data("value");
                            if (wfacp_frontend.switcher_settings.hasOwnProperty("enable_delete_item") && "true" === wfacp_frontend.switcher_settings.enable_delete_item) r.trigger("change", { action: "remove", qty: 0, old_qty: d });
                            else {
                                var f = e(this).data("value");
                                e(this).val(f);
                            }
                        }
                    else {
                        if (0 === parseInt(_) || "" === _) return;
                        r.trigger("change", { action: "add", qty: _ });
                    }
                }
            }),
            e(document).on("change", ".wfacp_product_switch", function (a, t) {
                if (!e(this).is(":checked")) return !1;
                var o = e(this),
                    n = {},
                    r = o.data("item-key"),
                    i = e(".wfacp-selected-product");
                i.removeClass("wfacp-selected-product");
                var c = o.parents(".wfacp_product_row");
                if (
                    (c.addClass("wfacp-selected-product"),
                    (n.wfacp_id = e("._wfacp_post_id").val()),
                    (n.new_item = r),
                    (n.remove_item_key = i.attr("cart_key")),
                    (n.quantity = 1),
                    (n.variation_id = 0),
                    (n = set_variation_data(n, t)),
                    c.find("input.wfacp_product_switcher_quantity").length > 0)
                ) {
                    var s = c.find("input.wfacp_product_switcher_quantity").val();
                    s > 0 && (n.quantity = s);
                }
                "object" == _typeof(t) && (t.hasOwnProperty("old_qty") && (n.old_qty = t.old_qty), t.hasOwnProperty("variation_id") && t.hasOwnProperty("quantity") ? (n.quantity = t.quantity) : (n.quantity = t.qty)),
                    wfacp_product_switch(n, function (e) {
                        !1 === e.status && (wfacp_show_error(c, e), c.removeClass("wfacp-selected-product"), i.addClass("wfacp-selected-product"), i.find(".wfacp_product_switch").prop("checked", !0));
                    });
            }),
            e(document).on("change", ".wfacp_product_global_quantity_bump", function () {
                var a = e(this).val(),
                    o = e(this).parents(".cart_item"),
                    n = o.attr("cart_key"),
                    r = e(this).data("value");
                if ((void 0 != a && "" != a && 0 != a) || (wfacp_frontend.switcher_settings.hasOwnProperty("enable_delete_item") && "true" === wfacp_frontend.switcher_settings.enable_delete_item)) {
                    var i = e(".wfacp-product-switch-panel");
                    i.block(t),
                        show_blocked_mini_cart(),
                        wfacp_send_ajax({ action: "update_cart_item_quantity", type: "post", data: { cart_key: n, quantity: a, old_qty: r, by: "product_switcher", wfacp_id: e("._wfacp_post_id").val() } }, function (a) {
                            if ((i.unblock(), a.hasOwnProperty("error") && a.hasOwnProperty("cart_key"))) return (o = e('.wfacp_product_row[cart_key="' + a.cart_key + '"]')), void wfacp_show_error(o, a);
                            update_fragments(a);
                        });
                } else e(this).val(r);
            }),
            e(document).on("click", ".wfacp_mb_mini_cart_wrap .wfacp_mb_cart_accordian", function (a) {
                a.preventDefault();
                var t = e(".wfacp_mb_mini_cart_wrap .wfacp_mb_cart_accordian"),
                    o = e(t).siblings(".wfacp_mb_mini_cart_sec_accordion_content");
                o.hasClass("wfacp_display_none")
                    ? (o.slideDown("slow"), o.removeClass("wfacp_display_none"), e(t).find(".wfacp_show_icon_wrap img").addClass("wfacp_up_arrow"), e(t).find(".wfacp_show_icon_wrap a span").text(t.attr("attr-expend")))
                    : (o.slideUp("slow"), o.addClass("wfacp_display_none"), e(t).find(".wfacp_show_icon_wrap img").removeClass("wfacp_up_arrow"), e(t).find(".wfacp_show_icon_wrap a span").text(t.attr("attr-collaps")));
            }),
            (function () {
                var a = e(".wfacp-form-control");
                if ("undefined" != typeof Storage && a.length > 0 && wfacp_frontend.hasOwnProperty("autopopulate") && "yes" === wfacp_frontend.autopopulate) return populate_fields_value(), "";
                setTimeout(
                    function (a) {
                        a.each(function () {
                            var a = e(this);
                            !a.hasClass("address-field") || a.hasClass("wfacp-anim-wrap")
                                ? "" !== a.val() && null != a.val()
                                    ? a.parents(".wfacp-form-control-wrapper").hasClass("wfacp-anim-wrap") || a.parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap")
                                    : a.parents(".wfacp-form-control-wrapper").removeClass("wfacp-anim-wrap")
                                : a.addClass("wfacp-anim-wrap");
                        });
                    },
                    1e3,
                    a
                );
            })(),
            wfacp_frontend.hasOwnProperty("autopopulatestate") &&
                "yes" === wfacp_frontend.autopopulatestate &&
                (e(document.body).on("change", "#shipping_postcode", T), e(document.body).on("change", "#shipping_country", T), e(document.body).on("change", "#billing_country", D), e(document.body).on("change", "#billing_postcode", D)),
            e(window).on("load", function () {
                e(".wfacp_smart_buttons").removeClass("wfacp-dynamic-checkout-loading");
                var a = function () {
                    var a = e("#wc-stripe-payment-request-button");
                    a.length > 0 && a.children().length > 0 && (e("#wfacp_smart_buttons").block(t), update_checkout());
                };
                e(document.body).on("wfacp_coupon_apply", function () {
                    a();
                }),
                    e(document.body).on("wfacp_coupon_form_removed", function () {
                        a();
                    }),
                    e(document.body).on("updated_checkout", function () {
                        e("#wfacp_smart_buttons").unblock();
                    });
                var o = e("#wc-stripe-payment-request-button"),
                    n = e(".wfacp_smart_button_container");
                "yes" == wfacp_frontend.is_desktop && "yes" == wfacp_frontend.stripe_smart_show_on_desktop
                    ? setTimeout(function () {
                          0 != e("#wfacp_smart_button_stripe_gpay_apay").length && 1 == n.length && 0 == o.children().length && e("#wfacp_smart_buttons").hide();
                      }, wfacp_frontend.smart_button_hide_timeout)
                    : "no" == wfacp_frontend.is_desktop &&
                      setTimeout(function () {
                          0 != e("#wfacp_smart_button_stripe_gpay_apay").length && 1 == n.length && 0 == o.children().length && e("#wfacp_smart_buttons").hide();
                      }, wfacp_frontend.smart_button_hide_timeout_m);
            }),
            (a = !1),
            e(document).ajaxSend(function (e, t, o) {
                (o.url.indexOf("wc-ajax=wfacp_switch_product_addon") > -1 || o.url.indexOf("wc-ajax=wfacp_addon_product") > -1 || o.url.indexOf("wc-ajax=wfacp_remove_addon_product") > -1) && (a = !0);
            }),
            e(document).ajaxComplete(function (t, o, n) {
                n.url.indexOf("wc-ajax=update_order_review") > -1 &&
                    1 == a &&
                    (setTimeout(function () {
                        e("fieldset.wfacp_product_row").each(function () {
                            var a = e(this);
                            a.hasClass("wfacp-selected-product") || (a.find(".wfacp_best_value").length > 0 && a.find(".wfacp_best_value").addClass("shake_top"));
                        });
                    }, 300),
                    (a = !1));
            }),
            window.addEventListener("load", function () {
                try {
                    if (!("sessionStorage" in window && null !== window.sessionStorage)) return;
                    window.localStorage.setItem("wfacp_page_is_loaded", wfacp_frontend.id);
                } catch (e) {
                    console.log(e);
                }
            }),
            window.addEventListener("storage", function (e) {
                "wfacp_page_is_loaded" === e.key &&
                    e.newValue > 0 &&
                    wfacp_frontend.id !== e.newValue &&
                    1 == is_document_visible() &&
                    setTimeout(function () {
                        console.log("Run Trigger refresh page data."), refresh_page_data(wfacp_frontend.id);
                    }, 1e3);
            });
    })(jQuery),
    (function (e) {
        e(document.body).on("wfacp_step_switching", function (a, t) {
            if (void 0 !== t) {
                var o = t.next_shown,
                    n = t.hide_parent,
                    r = e(".wfacp-payment-tab-list");
                r.removeClass("wfacp-active");
                var i = e(".wfacp-payment-tab-list." + o);
                i.length > 0 && i.addClass("wfacp-active"), r.hasClass(n) && (e(".wfacp-payment-tab-list." + n).addClass("visited_cls"), i.addClass("visited_cls")), e(".wfacp_modal_container").scroll().animate({ scrollTop: 0 }, 1e3);
            }
        }),
            e(document.body).on("checkout_error", function () {
                e(".wfacp_modal_container").scroll().animate({ scrollTop: 0 }, 1e3);
                var a = e("ul.woocommerce_error.woocommerce-error.wc-stripe-error:visible");
                a.length > 0 && e.scroll_to_notices(a);
            }),
            e(document).ready(function (a) {
                e(document.body).on("click", ".wfacp-payment-tab-list", function (a) {
                    if ((a.preventDefault(), e(this).hasClass("visited_cls"))) {
                        var t = e(this).attr("step");
                        if (e(".wfacp_page:visible").hasClass(t)) return;
                        var o = e(".wfacp-payment-tab-list");
                        o.removeClass("wfacp-active"), e(this).addClass("wfacp-active"), e(".wfacp_page").fadeOut(300);
                        var n = e(".wfacp-payment-tab-list:last");
                        return (
                            e(this)[0] == n[0] && e(".wfacp_payment").removeClass("wfacp_hide_payment_part").addClass("wfacp_show_payment_part"),
                            void e(".wfacp_page." + t).fadeIn(600, function () {
                                var a = { next_shown: t, current_step: t, last_step: !1 };
                                "two_step" === t && 2 === o.length ? ((a.hide_step = "two_step"), (a.last_step = !0), (a.last_step = !0)) : "third_step" === t && 3 == o.length && ((a.hide_step = "two_step"), (a.last_step = !0)),
                                    e(document.body).trigger("wfacp_step_switching", a),
                                    e(".country_to_state").length > 0 && e(document.body).trigger("country_to_state_changed");
                            })
                        );
                    }
                }),
                    e(".wfacp_modal_open").on("click", function (a) {
                        a.preventDefault(), e(".wfacp_modal_overlay").removeClass("wfacp_display_none"), e(".wfacp_modal_outerwrap").fadeIn(300), e("body").addClass("wfacp_overflow_hide");
                    }),
                    e(".wfacp_modal_close").on("click", function (a) {
                        a.preventDefault(), e(".wfacp_modal_overlay").addClass("wfacp_display_none"), e(".wfacp_modal_outerwrap").fadeOut(300), e("body").removeClass("wfacp_overflow_hide");
                    }),
                    (function () {
                        var a = e(".woocommerce-form-login"),
                            t = e(".wfacp_modal_open");
                        if (t.length > 0) {
                            var o = localStorage.getItem("wfacp_embed_form_login");
                            null !== o && "yes" === o && (localStorage.removeItem("wfacp_embed_form_login"), t.trigger("click"));
                        }
                        a.on("submit", function () {
                            localStorage.setItem("wfacp_embed_form_login", "yes");
                        });
                    })();
            }),
            e(document.body).on("keyup", ".wfacp_dob", function () {
                var a = new Date(),
                    t = e(this).data("label");
                e(this).css("border", "1px solid #bfbfbf");
                var o = e(this).val(),
                    n = e(this).data("min"),
                    r = e(this).data("max");
                "" != o && ("day" == t || "month" == t) && n > o ? e(this).val(n) : "" != o && ("day" == t || "month" == t) && r < o && e(this).val(r);
                var i = new Date(o + "-1-1");
                (("year" == t && "Invalid Date" == i) || n > o || a < i) && e(this).css("border", "2px solid #d50000");
            });
    })(jQuery),
    (function (e) {
        var a = (function () {
                function a(e) {
                    _classCallCheck(this, a),
                        void 0 != e &&
                            ((this.track_name = ""),
                            (this.track_id = e.id),
                            (this.settings = e.settings),
                            (this.positions = e.positions),
                            (this.data = { add_to_cart: e.add_to_cart, checkout: e.checkout, payment_info: {}, last_checkout_data: null }),
                            (this.add_to_cart_run = !1),
                            (this.checkout_event_run = !1),
                            this.init(),
                            this.attach_triggers());
                }
                return (
                    _createClass(a, [
                        { key: "init", value: function () {} },
                        {
                            key: "fire_events",
                            value: function (e) {
                                this.positions.add_to_cart === e && 0 == this.add_to_cart_run && (this.add_to_cart(), (this.add_to_cart_run = !0)), this.positions.checkout === e && this.checkout();
                            },
                        },
                        {
                            key: "attach_triggers",
                            value: function () {
                                var a = this,
                                    t = this,
                                    o = !1,
                                    n = !1;
                                e("#billing_email").on("change", function () {
                                    wfacp_validate_email(e(this).val()) && t.fire_events("email");
                                }),
                                    e(window).on("load", function () {
                                        t.fire_events("load"), t.load();
                                    });
                                var r = e(".wfacp_next_page_button");
                                r.length > 0 &&
                                    e(document.body).on("wfacp_step_switching", function () {
                                        !1 === o && (t.fire_events("button"), (o = !0));
                                    }),
                                    wfacp_frontend.hooks.addAction("wfacp_checkout_place_order", function () {
                                        0 === r.length && 0 === e(".woocommerce-invalid-required-field:visible").length && t.fire_events("button"),
                                            !1 === n && (a.payment_info(), (n = !0)),
                                            0 == r.length && !1 === a.checkout_event_run && a.checkout();
                                    }),
                                    e(document.body).on("wfacp_product_added", function (e, a) {
                                        if (a.hasOwnProperty("item_key") && a.hasOwnProperty("item") && a.item.hasOwnProperty(a.item_key)) {
                                            var o = a.item_key;
                                            if (void 0 == t.data.add_to_cart) return;
                                            if (t.data.add_to_cart.hasOwnProperty(o)) return;
                                            a.item[o].hasOwnProperty(t.track_name) && t.single_add_to_cart(a.item[o][t.track_name], a.item.cart_key), (t.checkout_event_run = !1);
                                        }
                                    }),
                                    e(document.body).on("wfacp_checkout_data", function (e, a) {
                                        if (a.hasOwnProperty("checkout") && a.hasOwnProperty("checkout")) {
                                            if (void 0 === a.checkout) return;
                                            if (!a.checkout.hasOwnProperty(t.track_name)) return;
                                            (t.data.checkout = a.checkout[t.track_name]), (o = !1), (t.checkout_event_run = !1);
                                        }
                                    });
                            },
                        },
                        {
                            key: "single_add_to_cart",
                            value: function (e) {
                                "true" === this.settings.add_to_cart && this.event_single_add_to_cart(e);
                            },
                        },
                        { key: "event_single_add_to_cart", value: function (e) {} },
                        {
                            key: "add_to_cart",
                            value: function () {
                                "true" === this.settings.add_to_cart && this.event_add_to_cart();
                            },
                        },
                        { key: "event_add_to_cart", value: function () {} },
                        {
                            key: "checkout",
                            value: function () {
                                var e = JSON.stringify(this.data.checkout);
                                "true" === this.settings.checkout && e !== this.data.last_checkout_data && 0 == this.checkout_event_run && (this.event_checkout(e), (this.data.last_checkout_data = e), (this.checkout_event_run = !0));
                            },
                        },
                        { key: "event_checkout", value: function (e) {} },
                        {
                            key: "payment_info",
                            value: function () {
                                "true" === this.settings.payment && this.event_payment_info();
                            },
                        },
                        { key: "event_payment_info", value: function () {} },
                        { key: "load", value: function () {} },
                    ]),
                    a
                );
            })(),
            t = (function (e) {
                _inherits(o, a);
                var t = _createSuper(o);
                function o(e) {
                    var a;
                    return _classCallCheck(this, o), ((a = t.call(this, e)).track_name = "pixel"), a;
                }
                return (
                    _createClass(
                        o,
                        [
                            {
                                key: "init",
                                value: function () {
                                    fbq("init", this.track_id);
                                },
                            },
                            {
                                key: "event_add_to_cart",
                                value: function () {
                                    var e = this.data.add_to_cart;
                                    for (var a in e) this.event_single_add_to_cart(e[a], a);
                                },
                            },
                            {
                                key: "event_single_add_to_cart",
                                value: function (e, a) {
                                    "function" == typeof fbq && fbq("trackSingle", this.track_id, "AddToCart", e);
                                },
                            },
                            {
                                key: "event_checkout",
                                value: function (e) {
                                    "function" == typeof fbq && fbq("trackSingle", this.track_id, "InitiateCheckout", JSON.parse(e));
                                },
                            },
                            {
                                key: "event_payment_info",
                                value: function () {
                                    "function" == typeof fbq && fbq("trackSingle", this.track_id, "AddPaymentInfo", this.data.checkout);
                                },
                            },
                            {
                                key: "load",
                                value: function () {
                                    "function" == typeof fbq && "true" === this.settings.page_view && fbq("trackSingle", this.track_id, "PageView", { plugin: "AeroCheckout" });
                                },
                            },
                        ],
                        [
                            {
                                key: "enqueue_js",
                                value: function () {
                                    var e, a, t, o, n, r;
                                    (e = window),
                                        (a = document),
                                        (t = "script"),
                                        e.fbq ||
                                            ((o = e.fbq = function () {
                                                o.callMethod ? o.callMethod.apply(o, arguments) : o.queue.push(arguments);
                                            }),
                                            e._fbq || (e._fbq = o),
                                            (o.push = o),
                                            (o.loaded = !0),
                                            (o.version = "2.0"),
                                            (o.queue = []),
                                            ((n = a.createElement(t)).async = !0),
                                            (n.src = "https://connect.facebook.net/en_US/fbevents.js"),
                                            (r = a.getElementsByTagName(t)[0]).parentNode.insertBefore(n, r));
                                },
                            },
                        ]
                    ),
                    o
                );
            })(),
            o = (function (e) {
                _inherits(o, a);
                var t = _createSuper(o);
                function o(e) {
                    var a;
                    return _classCallCheck(this, o), ((a = t.call(this, e)).track_name = "google_ua"), a;
                }
                return (
                    _createClass(o, [
                        { key: "init", value: function () {} },
                        {
                            key: "event_checkout",
                            value: function (e) {
                                var a = { send_to: this.track_id, event_category: "ecommerce", items: JSON.parse(e), non_interaction: !0 };
                                gtag("event", "begin_checkout", a);
                            },
                        },
                        {
                            key: "event_single_add_to_cart",
                            value: function (e) {
                                var a = { send_to: this.track_id, event_category: "ecommerce", items: e, non_interaction: !0 };
                                gtag("event", "add_to_cart", a);
                            },
                        },
                        {
                            key: "event_add_to_cart",
                            value: function () {
                                var e = { send_to: this.track_id, event_category: "ecommerce", items: this.data.add_to_cart, non_interaction: !0 };
                                gtag("event", "add_to_cart", e);
                            },
                        },
                        {
                            key: "event_payment_info",
                            value: function () {
                                gtag("event", "add_payment_info", { send_to: this.track_id, non_interaction: !0 });
                            },
                        },
                    ]),
                    o
                );
            })();
        if (((wfacp_frontend.tracks = {}), wfacp_analytics_data.pixel.hasOwnProperty("id"))) {
            t.enqueue_js();
            var n = wfacp_analytics_data.pixel.id.split(",");
            if (n.length > 0) {
                wfacp_frontend.tracks.facebook = {};
                for (var r = 0; r < n.length; r++) {
                    var i = n[r],
                        c = JSON.stringify(wfacp_analytics_data.pixel);
                    ((c = JSON.parse(c)).id = i.trim()), (wfacp_frontend.tracks.facebook[i] = new t(c));
                }
            }
        }
        wfacp_analytics_data.google_ua.hasOwnProperty("id") && (wfacp_frontend.tracks.google = new o(wfacp_analytics_data.google_ua));
    })(jQuery),
    (function (e) {
        var a = (function () {
                function a() {
                    var e = this;
                    _classCallCheck(this, a),
                        wfacp_frontend.hooks.addFilter("wfacp_google_map_address_data", function (a, t) {
                            return e.map_data(a, t);
                        }),
                        wfacp_frontend.hooks.addFilter(
                            "wfacp_autocomplete_element",
                            function (a, t) {
                                return e.enable_on_street_name(a, t);
                            },
                            10,
                            "wfacp_change_element_for_netherland"
                        );
                }
                return (
                    _createClass(a, [
                        {
                            key: "state_not_matched_code_country",
                            value: function () {
                                return ["NZ", "ES", "BG", "HK", "MX"];
                            },
                        },
                        { key: "temp", value: function () {} },
                        {
                            key: "get_states",
                            value: function (e) {
                                var a = {};
                                return (
                                    (e = e.toLowerCase()),
                                    (a.nz = {
                                        auckland: "AK",
                                        northland: "NL",
                                        waikato: "WA",
                                        "bay-of-plenty": "BP",
                                        taranaki: "TK",
                                        "hawkes-bay": "HB",
                                        "manawatu-wanganui": "MW",
                                        wellington: "WE",
                                        nelson: "NS",
                                        marlborough: "MB",
                                        tasman: "TM",
                                        "west-coast": "WC",
                                        canterbury: "CT",
                                        ota: "OT",
                                        southland: "SL",
                                    }),
                                    (a.es = {
                                        "a-coruña": "C",
                                        araba: "VI",
                                        albacete: "AB",
                                        alicante: "A",
                                        almería: "AL",
                                        asturias: "O",
                                        ávila: "AV",
                                        badajoz: "BA",
                                        baleares: "PM",
                                        barcelona: "B",
                                        burgos: "BU",
                                        cáceres: "CC",
                                        cádiz: "CA",
                                        cantabria: "S",
                                        castellón: "CS",
                                        ceuta: "CE",
                                        "ciudad-real": "CR",
                                        córdoba: "CO",
                                        cuenca: "CU",
                                        girona: "GI",
                                        granada: "GR",
                                        guadalajara: "GU",
                                        gipuzkoa: "SS",
                                        huelva: "H",
                                        huesca: "HU",
                                        jaén: "J",
                                        "la-rioja": "LO",
                                        "las-palmas": "GC",
                                        león: "LE",
                                        lleida: "L",
                                        lugo: "LU",
                                        madrid: "M",
                                        málaga: "MA",
                                        melilla: "ML",
                                        murcia: "MU",
                                        navarra: "NA",
                                        ourense: "OR",
                                        palencia: "P",
                                        pontevedra: "PO",
                                        salamanca: "SA",
                                        "santa-cruz-de-tenerife": "TF",
                                        segovia: "SG",
                                        sevilla: "SE",
                                        soria: "SO",
                                        tarragona: "T",
                                        teruel: "TE",
                                        toledo: "TO",
                                        valencia: "V",
                                        valladolid: "VA",
                                        bizkaia: "BI",
                                        zamora: "ZA",
                                        zaragoza: "Z",
                                    }),
                                    (a.bg = {
                                        blagoevgrad: "BG-01",
                                        burgas: "BG-02",
                                        dobrich: "BG-08",
                                        gabrovo: "BG-07",
                                        haskovo: "BG-26",
                                        kardzhali: "BG-09",
                                        kyustendil: "BG-10",
                                        lovech: "BG-11",
                                        montana: "BG-12",
                                        pazardzhik: "BG-13",
                                        pernik: "BG-14",
                                        pleven: "BG-15",
                                        plovdiv: "BG-16",
                                        razgrad: "BG-17",
                                        ruse: "BG-18",
                                        shumen: "BG-27",
                                        silistra: "BG-19",
                                        sliven: "BG-20",
                                        smolyan: "BG-21",
                                        "sofia-city-province": "BG-23",
                                        "sofia-grad": "BG-22",
                                        "stara-zagora": "BG-24",
                                        targovishte: "BG-25",
                                        varna: "BG-03",
                                        "veliko-tarnovo": "BG-04",
                                        vidin: "BG-05",
                                        vratsa: "BG-06",
                                        yambol: "BG-28",
                                    }),
                                    (a.hk = { kowloon: "KOWLOON", "hong-kong-island": "HONG KONG", "new-territories": "NEW TERRITORIES" }),
                                    (a.mx = {
                                        "ags.": "AG",
                                        "b.c.": "BC",
                                        "b.c.s.": "BS",
                                        "camp.": "CM",
                                        "chis.": "CS",
                                        "chih.": "CH",
                                        "coah.": "CO",
                                        "col.": "CL",
                                        cdmx: "DF",
                                        "dgo.": "DG",
                                        "gto.": "GT",
                                        "gro.": "GR",
                                        "hgo.": "HG",
                                        "jal.": "JA",
                                        "méx.": "MX",
                                        "mich.": "MI",
                                        "mor.": "MO",
                                        "nay.": "NA",
                                        "n.l.": "NL",
                                        "oax.": "OA",
                                        "pue.": "PU",
                                        "qro.": "QT",
                                        "q.r.": "QR",
                                        "s.l.p.": "SL",
                                        "sin.": "SI",
                                        "son.": "SO",
                                        "tab.": "TB",
                                        "tamps.": "TM",
                                        "tlax.": "TL",
                                        "ver.": "VE",
                                        "yuc.": "YU",
                                        "zac.": "ZA",
                                    }),
                                    a.hasOwnProperty(e) ? a[e] : null
                                );
                            },
                        },
                        {
                            key: "map_data",
                            value: function (e, a) {
                                var t = a.get_country();
                                if (("RO" === t && "Municipiul București" == e._state && (e._state = "B"), this.state_not_matched_code_country().indexOf(t) > -1 && "" !== e._state)) {
                                    var o = this.get_states(t),
                                        n = e._state.replace(/ /g, "-").replace(/'/g, "").toLowerCase();
                                    if (null == o || !1 === o.hasOwnProperty(n)) return e;
                                    e._state = o[n];
                                }
                                return e;
                            },
                        },
                        {
                            key: "enable_on_street_name",
                            value: function (a, t) {
                                if ("NL" === t.get_country()) {
                                    var o = e("#" + t.type + "_street_name");
                                    o.length > 0 && (a = o);
                                }
                                return a;
                            },
                        },
                    ]),
                    a
                );
            })(),
            t = (function () {
                function a() {
                    var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "billing",
                        o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
                    _classCallCheck(this, a),
                        (this.type = t),
                        (this.country_key = "#" + t + "_country"),
                        (this.search_key = "#" + t + "_address_1"),
                        (this.postcode_key = "#" + t + "_postcode"),
                        (this.state_key = "#" + t + "_state"),
                        "" !== o && e(o).length > 0 && (this.search_key = o),
                        (this.search_key_placeholder = e(this.search_key).attr("placeholder")),
                        (this.address = null),
                        this.init();
                }
                return (
                    _createClass(a, [
                        {
                            key: "init",
                            value: function () {
                                this.change_events(),
                                    this.enable_autocomplete(),
                                    this.geoCode(),
                                    e(this.search_key).keydown(function (e) {
                                        if (13 == e.keyCode) return e.preventDefault(), !1;
                                    });
                            },
                        },
                        {
                            key: "excluded_countries",
                            value: function () {
                                return wfacp_frontend.gmaps.disallow_countries;
                            },
                        },
                        {
                            key: "clearListener",
                            value: function () {
                                if (null != this.address) {
                                    var a = e(this.search_key);
                                    google.maps.event.clearInstanceListeners(a[0]), (this.address = null);
                                }
                                e(this.search_key).removeAttr("placeholder"), e(this.search_key).removeAttr("disabled"), e(this.search_key).removeAttr("style");
                            },
                        },
                        {
                            key: "reset_event",
                            value: function () {
                                var e = this;
                                this.clearListener(),
                                    setTimeout(function () {
                                        e.enable_autocomplete();
                                    }, 200);
                            },
                        },
                        {
                            key: "change_events",
                            value: function () {
                                var a = this;
                                e(this.country_key).on("change", function () {
                                    a.reset_event();
                                });
                            },
                        },
                        {
                            key: "get_country",
                            value: function () {
                                return e(this.country_key).val();
                            },
                        },
                        {
                            key: "update_country",
                            value: function () {
                                var a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "us";
                                e(this.country_key).val(a), e(this.country_key).trigger("change");
                            },
                        },
                        {
                            key: "google_options",
                            value: function () {
                                var e = this.get_country(),
                                    a = { types: ["geocode"] };
                                return void 0 !== e && "" !== e && null !== e && (a.componentRestrictions = { country: e }), wfacp_frontend.hooks.applyFilters("wfacp_google_address_options", a, e);
                            },
                        },
                        {
                            key: "get_address_format",
                            value: function () {
                                var e = this.get_country();
                                e = null == e ? "" : e.toLowerCase();
                                var a = {
                                    us: {
                                        _address_1: { keys: { street_number: "long_name", route: "long_name" }, separator: " " },
                                        _address_2: { keys: { neighborhood: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                        _postcode: { keys: { postal_code: "long_name" }, separator: "-" },
                                    },
                                    gb: {
                                        _address_1: { keys: { street_number: "long_name", route: "long_name" }, separator: " " },
                                        _address_2: { keys: { neighborhood: "long_name" }, separator: " " },
                                        _city: { keys: { postal_town: "long_name" }, separator: " " },
                                        _postcode: { keys: { postal_code_prefix: "long_name", postal_code: "long_name" }, separator: " " },
                                    },
                                    de: {
                                        _address_1: { keys: { route: "long_name", street_number: "long_name" }, separator: " " },
                                        _address_2: { keys: { sublocality_level_3: "long_name", sublocality_level_2: "long_name", sublocality_level_1: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                    },
                                    fr: {
                                        _address_1: { keys: { street_number: "long_name", route: "long_name" }, separator: " " },
                                        _address_2: { keys: { sublocality_level_3: "long_name", sublocality_level_2: "long_name", sublocality_level_1: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                    },
                                    ca: {
                                        _address_1: { keys: { street_number: "long_name", route: "long_name" }, separator: " " },
                                        _address_2: { keys: { sublocality_level_3: "long_name", sublocality_level_2: "long_name", sublocality_level_1: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                    },
                                    nl: {
                                        _address_1: { keys: { route: "long_name", street_number: "long_name" }, separator: " " },
                                        _street_name: { keys: { street_number: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                    },
                                    si: { _address_1: { keys: { route: "long_name", street_number: "long_name" }, separator: " " }, _city: { keys: { postal_town: "long_name" }, separator: " " } },
                                    vn: {
                                        _address_1: { keys: { premise: "long_name", route: "long_name", street_number: "long_name", neighborhood: "long_name" }, separator: " " },
                                        _city: { keys: { administrative_area_level_1: "long_name" }, separator: " " },
                                    },
                                    it: {
                                        _address_1: { keys: { premise: "long_name", route: "long_name", street_number: "long_name", neighborhood: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_2: "short_name" }, separator: " " },
                                    },
                                };
                                (a.es = this.jsp(a.it)),
                                    (a.ro = this.jsp(a.it)),
                                    (a.ro._state = { keys: { administrative_area_level_1: "short_name" }, separator: " " }),
                                    (a.bg = this.jsp(a.ro)),
                                    (a.il = {
                                        _address_1: { keys: { premise: "long_name", route: "long_name", street_number: "long_name", neighborhood: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                    }),
                                    (a.in = {
                                        _address_1: { keys: { street_number: "long_name", route: "long_name", sublocality_level_3: "long_name", sublocality_level_2: "long_name", sublocality_level_1: "long_name" }, separator: " " },
                                        _city: { keys: { administrative_area_level_2: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                    }),
                                    (a.br = {
                                        _address_1: { keys: { route: "long_name", street_number: "long_name", sublocality_level_3: "short_name", sublocality_level_2: "short_name", sublocality_level_1: "short_name" }, separator: ", " },
                                        _city: { keys: { administrative_area_level_2: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                    }),
                                    (a.hk = {
                                        _address_1: { keys: { route: "long_name", street_number: "long_name", sublocality_level_3: "short_name", sublocality_level_2: "short_name", sublocality_level_1: "short_name" }, separator: ", " },
                                        _city: { keys: { neighborhood: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                    }),
                                    (a.mx = {
                                        _address_1: { keys: { route: "long_name", street_number: "long_name", sublocality_level_3: "long_name", sublocality_level_2: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                    }),
                                    (a.at = { _address_1: { keys: { route: "long_name", street_number: "long_name" }, separator: ", " }, _city: { keys: { locality: "long_name" }, separator: " " } }),
                                    (a.au = {
                                        _address_1: { keys: { street_number: "long_name", route: "long_name" }, separator: " " },
                                        _address_2: { keys: { neighborhood: "long_name" }, separator: " " },
                                        _city: { keys: { locality: "long_name" }, separator: " " },
                                        _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                        _postcode: { keys: { postal_code: "long_name" }, separator: "-" },
                                    });
                                var t = {};
                                return (
                                    ((t =
                                        !1 === (a = wfacp_frontend.hooks.applyFilters("wfacp_countries_address_format", a, this)).hasOwnProperty(e)
                                            ? {
                                                  _address_1: { keys: { route: "long_name", street_number: "long_name" }, separator: " " },
                                                  _address_2: { keys: { neighborhood: "long_name" }, separator: " " },
                                                  _city: { keys: { locality: "long_name" }, separator: " " },
                                                  _state: { keys: { administrative_area_level_1: "short_name" }, separator: " " },
                                                  _postcode: { keys: { postal_code: "long_name" }, separator: "-" },
                                              }
                                            : a[e])._country = { keys: { country: "short_name" }, separator: " " }),
                                    !1 === t.hasOwnProperty("_state") && (t._state = { keys: { administrative_area_level_2: "short_name" }, separator: " " }),
                                    !1 === t.hasOwnProperty("_postcode") && (t._postcode = { keys: { postal_code: "long_name" }, separator: "-" }),
                                    wfacp_frontend.hooks.applyFilters("wfacp_country_address_google_format", t, a)
                                );
                            },
                        },
                        {
                            key: "normalize_place_address_keys",
                            value: function (e) {
                                for (var a = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], t = {}, o = 0; o < e.length; o++) {
                                    var n = e[o].short_name,
                                        r = e[o].long_name;
                                    t[(0 === e[o].types.length && "" !== r ? "neighborhood" : e[o].types[0]).toLowerCase()] = { short_name: n, long_name: r };
                                }
                                return 1 == a && this.update_country(t.country.short_name), t;
                            },
                        },
                        {
                            key: "map_address_keys",
                            value: function (e) {
                                var a = this.get_address_format();
                                if ("object" != _typeof(a)) return {};
                                var t = {};
                                for (var o in a) {
                                    var n = a[o].keys,
                                        r = a[o].separator;
                                    if (0 !== Object.keys(n).length) {
                                        var i = [];
                                        for (var c in n) {
                                            var s = n[c];
                                            !1 !== e.hasOwnProperty(c) && i.push(e[c][s]);
                                        }
                                        i.length > 0 ? (t[o] = i.join(r)) : (t[o] = "");
                                    }
                                }
                                return wfacp_frontend.hooks.applyFilters("wfacp_google_map_address_data", t, this);
                            },
                        },
                        {
                            key: "generate_address_data",
                            value: function () {
                                var e = this,
                                    a = this.address.getPlace();
                                if (void 0 === a.address_components || 0 !== a.address_components.length) {
                                    console.log(a.address_components);
                                    var t = this.normalize_place_address_keys(a.address_components),
                                        o = this.map_address_keys(t);
                                    setTimeout(
                                        function (a) {
                                            e.fill_address(a);
                                        },
                                        600,
                                        o
                                    );
                                }
                            },
                        },
                        {
                            key: "fill_address",
                            value: function (a) {
                                var t = !1;
                                for (var o in a) {
                                    this.type + "_state" === this.type + o && (t = !0);
                                    var n = e("#" + this.type + o);
                                    n.length > 0 && n.val(a[o]);
                                }
                                this.add_animation_css(),
                                    t &&
                                        e("#" + this.type + "_state")
                                            .trigger("liszt:updated")
                                            .trigger("chosen:updated")
                                            .trigger("change"),
                                    e(this.search_key).attr("placeholder", this.search_key_placeholder);
                            },
                        },
                        {
                            key: "add_animation_css",
                            value: function () {
                                e(".wfacp-form-control").each(function () {
                                    "" !== e(this).val() && e(this).parents(".form-row").addClass("wfacp-anim-wrap");
                                });
                            },
                        },
                        {
                            key: "enable_autocomplete",
                            value: function () {
                                var a = this,
                                    t = e(this.search_key);
                                if (0 !== t.length && void 0 !== (t = wfacp_frontend.hooks.applyFilters("wfacp_autocomplete_element", t, this)) && void 0 != t) {
                                    var o = this.excluded_countries(),
                                        n = this.get_country();
                                    if (!(o.indexOf(n) > -1))
                                        try {
                                            (this.address = new google.maps.places.Autocomplete(t[0], this.google_options())),
                                                this.address.setFields(["address_component"]),
                                                google.maps.event.addListener(this.address, "place_changed", function () {
                                                    a.generate_address_data();
                                                });
                                        } catch (e) {}
                                }
                            },
                        },
                        {
                            key: "geoCodeComponents",
                            value: function (e, a) {
                                var t = this;
                                return new Promise(function (o, n) {
                                    t.geocoder.geocode({ componentRestrictions: { country: e, postalCode: a } }, function (e, a) {
                                        if ("OK" == a) {
                                            var r = t.normalize_place_address_keys(e[0].address_components, !1),
                                                i = t.map_address_keys(r);
                                            o(i);
                                        } else n(a);
                                    });
                                });
                            },
                        },
                        {
                            key: "prepareGeocode",
                            value: function () {
                                var a = e(this.state_key);
                                if (0 != a.length) {
                                    var t = e(this.postcode_key),
                                        o = e(this.country_key);
                                    if (o.length > 0 && t.length > 0 && "" !== o.val() && "" !== t.val())
                                        this.geoCodeComponents(o.val(), t.val())
                                            .then(function (e) {
                                                null !== e._state &&
                                                    "" !== e._state &&
                                                    void 0 !== e._state &&
                                                    ("select" === a[0].tagName || "SELECT" === a[0].tagName
                                                        ? a.children('option[value="' + e._state + '"]').length > 0 && (a.val(e._state), a.trigger("liszt:updated").trigger("chosen:updated").trigger("change"))
                                                        : (a.val(e._state), a.parents(".wfacp-form-control-wrapper").addClass("wfacp-anim-wrap")));
                                            })
                                            .catch(function (e) {});
                                }
                            },
                        },
                        {
                            key: "geoCode",
                            value: function () {
                                if (((this.geocode_interval = null), (this.geocoder = new google.maps.Geocoder()), null != this.geocoder)) {
                                    var a = this;
                                    e(this.postcode_key + "," + this.country_key).on("change", function () {
                                        clearTimeout(a.geocode_interval),
                                            (a.geocode_interval = setTimeout(function () {
                                                a.prepareGeocode();
                                            }, 500));
                                    }),
                                        setTimeout(function () {
                                            a.prepareGeocode();
                                        }, 500);
                                }
                            },
                        },
                        {
                            key: "jsp",
                            value: function (e) {
                                if ("object" === _typeof(e)) {
                                    var a = JSON.stringify(e);
                                    return (a = JSON.parse(a));
                                }
                                return e;
                            },
                        },
                    ]),
                    a
                );
            })();
        e(window).on("load", function () {
            "object" == ("undefined" == typeof google ? "undefined" : _typeof(google)) &&
                ((wfacp_frontend.google_billing_address = new t()), (wfacp_frontend.google_shipping_address = new t("shipping")), (wfacp_frontend.google_compatibility = new a()));
        }),
            (window.gm_authFailure = function () {
                void 0 != wfacp_frontend.google_billing_address && wfacp_frontend.google_billing_address.clearListener(), void 0 != wfacp_frontend.google_shipping_address && wfacp_frontend.google_shipping_address.clearListener();
            });
    })(jQuery);

Comments