(function($) {
    'use strict';

    $(document).ready(function() {

        $(window).on('scroll', function() {
            if ($(this).scrollTop() > 200) {
                $('.scrollingUp').addClass('is-active');
            } else {
                $('.scrollingUp').removeClass('is-active');
            }
        });
        $(window).on('scroll', function() {
            if ($(window).scrollTop() >= 250) {
                $('.is-sticky-on').addClass('is-sticky-menu');
            } else {
                $('.is-sticky-on').removeClass('is-sticky-menu');
            }
        });

        $(window).bind("scroll", function() {
            if ($(".scrollingUp").length) {
                let b = $("body").height(),
                    c = $(window).height(),
                    d = b - c,
                    e = $(window).scrollTop(),
                    f = 250 - e / d * 150;
                $(".scrollingUp circle").css("stroke-dashoffset", f + "px")
            }
        }), $('.scrollingUp').click(function(b) {
            return b.preventDefault(), $('html, body').animate({
                scrollTop: 0
            }, 320), !1
        });

        // Sticky Header
        $(window).on('scroll', function() {
            if ($(window).scrollTop() >= 250) {
                $('.is-sticky-on').addClass('is-sticky-menu');
            } else {
                $('.is-sticky-on').removeClass('is-sticky-menu');
            }
        });

        // Home Slider
        var $owlHome = $('.home-slider');
        $owlHome.owlCarousel({
            rtl: $("html").attr("dir") == 'rtl' ? true : false,
            items: 1,
            autoplay: true,
            autoplayTimeout: 10000,
            margin: 0,
            loop: true,
            dots: $(".slider-section").is(".owl-dot-1") ? true : false,
            dotsData: true,
            dotsEach: 5,
            nav: true,
            navText: $(".slider-section").is(".owl-nav-2") ? ['<span class="icon"></span>', '<span class="icon"></span>'] : ['<i class="fas fa-angle-left"></i>', '<i class="fas fa-angle-right"></i>'],
            singleItem: true,
            transitionStyle: "fade",
            touchDrag: true,
            mouseDrag: true,
            onInitialized: function(event) {
                var itemsCount = event.item.count; // Total number of items
                var dotsContainer = $('.owl-dot-1 .owl-dots'); // Dots container

                // Clear current dots
                dotsContainer.empty();

                // Generate and append numbered dots
                for (var i = 0; i < itemsCount; i++) {
                    dotsContainer.append('<button role="button" class="owl-dot">' + (i + 1) + '</button>');
                }

                // Optionally highlight the active dot
                dotsContainer.on('click', '.owl-dot', function() {
                    var index = $(this).index();
                    $owlHome.trigger('to.owl.carousel', index);
                });
            },
            responsive: {
                0: {
                    nav: false
                },
                768: {
                    nav: false
                },
                992: {
                    nav: true
                }
            }
        });
        $owlHome.owlCarousel();
        $owlHome.on('translate.owl.carousel', function(event) {
            var data_anim = $("[data-animation]");
            data_anim.each(function() {
                var anim_name = $(this).data('animation');
                $(this).removeClass('animated ' + anim_name).css('opacity', '0');
            });
        });
        $("[data-delay]").each(function() {
            var anim_del = $(this).data('delay');
            $(this).css('animation-delay', anim_del);
        });
        $("[data-duration]").each(function() {
            var anim_dur = $(this).data('duration');
            $(this).css('animation-duration', anim_dur);
        });
        $owlHome.on('translated.owl.carousel', function() {
            var data_anim = $owlHome.find('.owl-item.active').find("[data-animation]");
            data_anim.each(function() {
                var anim_name = $(this).data('animation');
                $(this).addClass('animated ' + anim_name).css('opacity', '1');
            });
        });

        var titles = document.querySelectorAll('.slider-section .main-content h4');

        titles.forEach(function(e) {
            var childNodes = [].slice.call(e.childNodes),
                txtContent = childNodes.shift().textContent,
                span;
            e.childNodes[0].textContent = '';
            txtContent.split(' ').forEach(function(s, i) {
                if (i > 0) {
                    e.insertBefore(document.createTextNode(" " + s), e.children[1]);
                } else {
                    span = document.createElement('span');
                    span.textContent = s;
                    e.insertBefore(span, e.firstChild);
                }
            })
        });

    });

    $(document).ready(function() {
        function marquee() {
            jQuery('.marquee').marquee({
                speed: 2000,
                direction: 'left',
                delayBeforeStart: 0,
                duplicated: true,
                pauseOnHover: true,
                startVisible: true
            });
        }
        marquee();
    });
}(jQuery));


! function(e, t) {
    "use strict";
    ({
        customID: "abizCoreScript",
        $document: e(document),
        $window: e(window),
        $body: e("body"),
        classes: {
            overlayActive: "overlay-enabled",
            collapsed: "collapsed",
            mainHeaderMenuActive: "header-menu-active",
            searchPopUpActive: "header-search-active"
        },
        init: function() {
            this.$document.on("ready", this.abizIsDocumentReady.bind(this)),
                this.$document.on("ready", this.abizMobileMenuClone.bind(this)),
                this.$window.on("ready", this.abizIsDocumentReady.bind(this))
        },
        abizIsDocumentReady: function() {
            this.$document
                .on("click." + this.customID, ".menu-collapsed", this.abizMenuCollapse.bind(this))
                .on("click." + this.customID, ".header-close-menu", this.abizMenuCollapse.bind(this))
                .on("click." + this.customID, this.abizMenuHideMobilePopup.bind(this))
                .on("click." + this.customID, ".mobile-collapsed", this.abizMobileSubmenuCollapse.bind(this))
                .on("click." + this.customID, ".header-close-menu", this.abizResetMobileMenuCollapse.bind(this))
                .on("abizMenuHideMobilePopup." + this.customID, this.abizResetMobileMenuCollapse.bind(this))
                .on("click." + this.customID, ".header-search-toggle", this.abizSearchPopUpToggle.bind(this))
                .on("click." + this.customID, ".header-search-close", this.abizSearchPopUpToggle.bind(this)), this.$window.on("load." + this.customID, this.abizMenuAccessibility.bind(this))
        },
        abizSearchPopUpToggle: function(t) {
            var i = e(".header-search-toggle"),
                n = e(".header-search-field");
            this.$body.toggleClass(this.classes.searchPopUpActive), this.$body.hasClass(this.classes.searchPopUpActive) ? n.focus() : i.focus(), this.abizSearchPopupAccessibility()
        },
        abizSearchPopupAccessibility: function() {
            var e, t, i, n = document.querySelector(".header-search-popup");
            let a = document.querySelector(".header-search-field"),
                s = n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),
                o = s[s.length - 1];
            if (!n) return !1;
            for (t = 0, i = (e = n.getElementsByTagName("button")).length; t < i; t++) e[t].addEventListener("focus", c, !0), e[t].addEventListener("blur", c, !0);

            function c() {
                for (var e = this; - 1 === e.className.indexOf("header-search-popup");) "input" === e.tagName.toLowerCase() && (-1 !== e.className.indexOf("focus") ? e.className = e.className.replace("focus", "") : e.className += " focus"), e = e.parentElement
            }
            document.addEventListener("keydown", function(e) {
                ("Tab" === e.key || 9 === e.keyCode) && (e.shiftKey ? document.activeElement === a && (o.focus(), e.preventDefault()) : document.activeElement === o && (a.focus(), e.preventDefault()))
            })
        },
        abizMobileMenuClone: function(t) {
            e(".main-navbar:not(.breadcrumb-menu) .main-menu").clone().appendTo(".main-mobile-build")
        },
        abizMenuAccessibility: function(t) {
            e(".main-navbar, .widget_nav_menu").find("a").on("focus blur", function() {
                e(this).parents("ul, li").toggleClass("focus")
            })
        },
        abizMenuCollapse: function(t) {
            var i = e(".menu-collapsed");
            this.$body.toggleClass(this.classes.mainHeaderMenuActive), this.$body.toggleClass(this.classes.overlayActive), i.toggleClass(this.classes.collapsed), this.$body.hasClass(this.classes.mainHeaderMenuActive) ? e(".header-close-menu").focus() : i.focus(), this.abizMainMenuAccessibility()
        },
        abizMainMenuAccessibility: function() {
            var e, t, i, n = document.querySelector(".main-mobile-build");
            let a = document.querySelector(".header-close-menu"),
                s = n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),
                o = s[s.length - 1];
            if (!n) return !1;
            for (t = 0, i = (e = n.getElementsByTagName("a")).length; t < i; t++) e[t].addEventListener("focus", c, !0), e[t].addEventListener("blur", c, !0);

            function c() {
                for (var e = this; - 1 === e.className.indexOf("main-mobile-build");) "li" === e.tagName.toLowerCase() && (-1 !== e.className.indexOf("focus") ? e.className = e.className.replace(" focus", "") : e.className += " focus"), e = e.parentElement
            }
            document.addEventListener("keydown", function(e) {
                ("Tab" === e.key || 9 === e.keyCode) && (e.shiftKey ? document.activeElement === a && (o.focus(), e.preventDefault()) : document.activeElement === o && (a.focus(), e.preventDefault()))
            })
        },
        abizMenuHideMobilePopup: function(t) {
            var i = e(".menu-collapsed"),
                n = e(".main-mobile-build");
            e(t.target).closest(i).length || e(t.target).closest(n).length || this.$body.hasClass(this.classes.mainHeaderMenuActive) && (this.$body.removeClass(this.classes.mainHeaderMenuActive), this.$body.removeClass(this.classes.overlayActive), i.removeClass(this.classes.collapsed), this.$document.trigger("abizMenuHideMobilePopup." + this.customID), t.stopPropagation())
        },
        abizMobileSubmenuCollapse: function(t) {
            t.preventDefault();
            var i = e(t.currentTarget);
            i.closest(".main-mobile-build .main-menu"), i.parents(".dropdown-menu").length;
            this.isRTL, setTimeout(function() {
                i.parent().toggleClass("current"), i.next().slideToggle()
            }, 250)
        },
        abizResetMobileMenuCollapse: function(t) {
            e(".main-mobile-build .main-menu");
            var i = e(".main-mobile-build  .menu-item"),
                n = e(".main-mobile-build .dropdown-menu");
            setTimeout(function() {
                i.removeClass("current"), n.hide()
            }, 250)
        }
    }).init()
}(jQuery, window.abizCoreScript);