!(function (a) {
    function b(a) {
        (this.markup = null),
            (this.selector = null),
            (this.fixed = !0),
            (this.visible = !1),
            (this.init = function () {
                if (this.valid()) {
                    void 0 !== a && void 0 !== a.fixed && (this.fixed = a.fixed), (this.selector = a && a.selector ? a.selector : "#go-top"), this.getMarkup();
                    var b = this;
                    if ((jQuery("body").append(this.markup), this.fixed)) {
                        jQuery(this.selector).hide();
                        var c = jQuery(window).height();
                        jQuery(window).scroll(function () {
                            jQuery(window).scrollTop() > c - 100 ? 0 == b.visible && (jQuery(b.selector).fadeIn(), (b.visible = !0)) : 1 == b.visible && (jQuery(b.selector).fadeOut(), (b.visible = !1));
                        }),
                            jQuery(this.selector).scrollTo();
                    }
                }
            }),
            (this.getMarkup = function () {
                var b = this.fixed ? "fixed" : "absolute",
                    c = 'style="position: ' + b + '; z-index:999999; bottom: 20px; right: 20px;"',
                    d = "<div " + c + ' id="go-top"><span style="cursor:pointer;display: inline-block;padding: 10px 20px;background: #f15151;color: #fff;border-radius: 2px;">Scroll To Top</span></div>';
                this.markup = a && a.markup ? a.markup : d;
            }),
            (this.valid = function () {
                return !(a && a.markup && !a.selector) || (alert('Please provide selector. eg. { markup: "<div id=\'scroll-top\'></div>", selector: "#scroll-top"}'), !1);
            });
    }
    function c(b) {
        var c = b + " .menu-item-has-children > a";
        a(c).each(function () {
            var b = a(this).text();
            (b += '<span class="kfi kfi-arrow-carrot-down-alt2 triangle"></span>'), a(this).html(b);
        }),
            a(document).on("click", c + " span.triangle", function (b) {
                b.preventDefault(),
                    b.stopPropagation(),
                    ($parentLi = a(this).parent().parent("li")),
                    ($childLi = $parentLi.find("li")),
                    $parentLi.hasClass("open")
                        ? ($parentLi.removeClass("open"), $childLi.removeClass("open"), a(this).parent("a").next().slideUp(), a(this).parent("a").next().find("ul").slideUp())
                        : ($parentLi.addClass("open"), a(this).parent("a").next().slideDown());
            });
    }
    +(function () {
        function a() {
            for (var a = this; -1 === a.className.indexOf("nav-menu"); )
                "li" === a.tagName.toLowerCase() && (-1 !== a.className.indexOf("focus") ? (a.className = a.className.replace(" focus-item", "")) : (a.className += " focus-item")), (a = a.parentElement);
        }
        var b, c, d, e, f, g;
        if ((b = document.getElementById("site-navigation")) && void 0 !== (c = b.getElementsByTagName("button")[0])) {
            if (void 0 === (d = b.getElementsByTagName("ul")[0])) return void (c.style.display = "none");
            for (
                d.setAttribute("aria-expanded", "false"),
                    -1 === d.className.indexOf("nav-menu") && (d.className += " nav-menu"),
                    c.onclick = function () {
                        -1 !== b.className.indexOf("toggled")
                            ? ((b.className = b.className.replace(" toggled", "")), c.setAttribute("aria-expanded", "false"), d.setAttribute("aria-expanded", "false"))
                            : ((b.className += " toggled"), c.setAttribute("aria-expanded", "true"), d.setAttribute("aria-expanded", "true"));
                    },
                    e = d.getElementsByTagName("a"),
                    f = 0,
                    g = e.length;
                f < g;
                f++
            )
                e[f].addEventListener("focus", a, !0), e[f].addEventListener("blur", a, !0);
            !(function (a) {
                var b,
                    c,
                    d = a.querySelectorAll(".menu-item-has-children > a, .page_item_has_children > a");
                if ("ontouchstart" in window)
                    for (
                        b = function (a) {
                            var b,
                                c = this.parentNode;
                            if (c.classList.contains("focus")) c.classList.remove("focus");
                            else {
                                for (a.preventDefault(), b = 0; b < c.parentNode.children.length; ++b) c !== c.parentNode.children[b] && c.parentNode.children[b].classList.remove("focus");
                                c.classList.add("focus");
                            }
                        },
                            c = 0;
                        c < d.length;
                        ++c
                    )
                        d[c].addEventListener("touchstart", b, !1);
            })(b);
        }
    })(),
        (jQuery.fn.scrollTo = function (a) {
            return (
                jQuery(document).on("click", '.scroll-to', function (b) {
                    b.preventDefault();
                    var c = jQuery(this).attr("href");
                    if (void 0 !== c) {
                        a || (a = 0);
                        var d = jQuery(c).offset().top - a;
                        jQuery("html, body").animate({ scrollTop: d }, 800);
                    }
                }),
                this
            );
        }),
        jQuery(document).on("added_to_cart", function () {
            $ele = a(".cart-icon .count");
            var b = $ele.text();
            $ele.text(parseInt(b) + 1);
        }),
        jQuery(document).on("click", ".search-icon a", function (a) {
            a.preventDefault(), jQuery("#search-form").toggleClass("search-slide");
        }),
        (function (a) {
            var b = function () {
                    var b = 0;
                    return (
                        jQuery(a).height("auto"),
                        jQuery(a).each(function () {
                            jQuery(this).height() > b && (b = jQuery(this).height());
                        }),
                        b
                    );
                },
                c = function () {
                    var c = (jQuery(window).width(), b());
                    jQuery(a).each(function () {
                        jQuery(this).height(c);
                    });
                };
            jQuery(document).ready(function () {
                c();
            }),
                jQuery(window).resize(function () {
                    c();
                }),
                jQuery(window).load(function () {
                    c();
                });
        })(".block-slider .slide-item"),
        jQuery(".kt-contact-form-area input, .kt-contact-form-area textarea").on("focus", function () {
            var a = jQuery(this).attr("id");
            jQuery('label[for="' + a + '"]').addClass("move");
        }),
        jQuery(".kt-contact-form-area input, .kt-contact-form-area textarea").on("blur", function () {
            var a = jQuery(this).attr("id");
            jQuery('label[for="' + a + '"]').removeClass("move");
        });
    var d;
    !(function (b) {
        var c = a("<button />", { class: "dropdown-arrow", "aria-expanded": !1 }).append('<span class="kfi kfi-arrow-carrot-down"></span>');
        b.find(".menu-item-has-children > a, .page_item_has_children > a").after(c),
            b.find(".current-menu-ancestor > button").addClass("toggled-on"),
            b.find(".current-menu-ancestor > .sub-menu").addClass("toggled-on"),
            b.find(".menu-item-has-children, .page_item_has_children").attr("aria-haspopup", "true"),
            b.find(".dropdown-arrow").click(function (b) {
                var c = a(this);
                b.preventDefault(), c.toggleClass("toggled-on"), c.parent().first().toggleClass("focus"), c.attr("aria-expanded", "false" === c.attr("aria-expanded") ? "true" : "false");
            });
    })(a(".main-navigation")),
        (d = a("#masthead")),
        d.find("#site-navigation"),
        d.find("#social-navigation"),
        jQuery(document).ready(function () {
            a(".scroll-to").scrollTo(),
                new b({ markup: '<a href="#page" class="scroll-to ' + (0 == BLOGTO.enable_scroll_top_in_mobile ? "hidden-xs" : "") + '" id="go-top"><span class="kfi kfi-arrow-up"></span></a>', selector: "#go-top" }).init(),
                c("#offcanvas-menu"),
                a(document).on("click", ".offcanvas-menu-toggler, .close-offcanvas-menu, .kt-offcanvas-overlay", function (b) {
                    b.preventDefault(), a("body").toggleClass("offcanvas-menu-open");
                }),
                jQuery("body").append('<div class="kt-offcanvas-overlay"></div>'),
                a("#masthead #s").attr("placeholder", BLOGTO.search_placeholder),
                a("#searchform #s").attr("placeholder", BLOGTO.search_default_placeholder);
        }),
        jQuery(window).load(function () {
            jQuery(".masonry-wrapper").length > 0 && ($grid = jQuery(".masonry-wrapper").masonry({ itemSelector: ".masonry-grid", percentPosition: !0 })),
                (infinite_count = 0),
                a(document.body).on("post-load", function () {
                    infinite_count += 1;
                    var b = "#infinite-view-" + infinite_count;
                    a(b).hide(),
                        a(a(b + " .masonry-grid")).each(function () {
                            ($items = a(this)), $grid.append($items).masonry("appended", $items);
                        }),
                        setTimeout(function () {
                            $grid.masonry("layout");
                        }, 500);
                }),
                "undefined" != typeof $grid && ($grid.masonry("reloadItems"), $grid.masonry("layout"));
        }),
        jQuery(window).load(function () {
            jQuery("#site-loader").fadeOut(500);
        });
})(jQuery);
