text: (function ($) {
    "use strict";
  
    // Header scroll class
    $(window).scroll(function () {
      if ($(this).scrollTop() > 100) {
        $("#header").addClass("header-scrolled");
      } else {
        $("#header").removeClass("header-scrolled");
      }
    });
  
    if ($(window).scrollTop() > 100) {
      $("#header").addClass("header-scrolled");
    }
  
    // Smooth scroll for the navigation and links with .scrollto classes
    $(".main-nav a, .mobile-nav a, .scrollto").on("click", function () {
      if (
        location.pathname.replace(/^\//, "") ==
          this.pathname.replace(/^\//, "") &&
        location.hostname == this.hostname
      ) {
        var target = $(this.hash);
        if (target.length) {
          var top_space = 0;
  
          if ($("#header").length) {
            top_space = $("#header").outerHeight();
  
            if (!$("#header").hasClass("header-scrolled")) {
              top_space = top_space - 20;
            }
          }
  
          $("html, body").animate(
            {
              scrollTop: target.offset().top - top_space,
            },
            1500,
            "easeInOutExpo"
          );
  
          if ($(this).parents(".main-nav, .mobile-nav").length) {
            $(".main-nav .active, .mobile-nav .active").removeClass("active");
            $(this).closest("li").addClass("active");
          }
  
          if ($("body").hasClass("mobile-nav-active")) {
            $("body").removeClass("mobile-nav-active");
            $(".mobile-nav-toggle i").toggleClass("fa-times fa-bars");
            $(".mobile-nav-overly").fadeOut();
          }
          return false;
        }
      }
    });
  
    // Navigation active state on scroll
    var nav_sections = $("section");
    var main_nav = $(".main-nav, .mobile-nav");
    var main_nav_height = $("#header").outerHeight();
  
    $(window).on("scroll", function () {
      var cur_pos = $(this).scrollTop();
  
      nav_sections.each(function () {
        var top = $(this).offset().top - main_nav_height,
          bottom = top + $(this).outerHeight();
  
        if (cur_pos >= top && cur_pos <= bottom) {
          main_nav.find("li").removeClass("active");
          main_nav
            .find('a[href="#' + $(this).attr("id") + '"]')
            .parent("li")
            .addClass("active");
        }
      });
    });
  
    // Counter Animation
  
    const counters = document.querySelectorAll(".counterP");
    const speed = 500;
  
    counters.forEach((counter) => {
      const updateCount = () => {
        const target = +counter.getAttribute("data-count");
        const count = +counter.innerText;
        const inc = target / speed;
  
        if (count < target) {
          counter.innerText = Math.ceil(count + inc);
          setTimeout(updateCount, 1);
        } else {
          count.innerText = target;
        }
      };
      updateCount();
    });
  
    //------- Lets --------//
  
    var TxtRotate = function (el, toRotate, period) {
      this.toRotate = toRotate;
      this.el = el;
      this.loopNum = 0;
      this.period = parseInt(period, 10) || 2000;
      this.txt = "";
      this.tick();
      this.isDeleting = false;
    };
  
    TxtRotate.prototype.tick = function () {
      var i = this.loopNum % this.toRotate.length;
      var fullTxt = this.toRotate[i];
  
      if (this.isDeleting) {
        this.txt = fullTxt.substring(0, this.txt.length - 1);
      } else {
        this.txt = fullTxt.substring(0, this.txt.length + 1);
      }
  
      this.el.innerHTML = '<span class="wrap">' + this.txt + "</span>";
  
      var that = this;
      var delta = 300 - Math.random() * 100;
  
      if (this.isDeleting) {
        delta /= 2;
      }
  
      if (!this.isDeleting && this.txt === fullTxt) {
        delta = this.period;
        this.isDeleting = true;
      } else if (this.isDeleting && this.txt === "") {
        this.isDeleting = false;
        this.loopNum++;
        delta = 500;
      }
  
      setTimeout(function () {
        that.tick();
      }, delta);
    };
  
    window.onload = function () {
      var elements = document.getElementsByClassName("txt-rotate");
      for (var i = 0; i < elements.length; i++) {
        var toRotate = elements[i].getAttribute("data-rotate");
        var period = elements[i].getAttribute("data-period");
        if (toRotate) {
          new TxtRotate(elements[i], JSON.parse(toRotate), period);
        }
      }
      // INJECT CSS
      var css = document.createElement("style");
      css.type = "text/css";
      css.innerHTML = ".txt-rotate > .wrap { border-right: 0.08em solid #666 }";
      document.body.appendChild(css);
    };
  })(jQuery);
  