(function ($) {
  "use strict";

  // Scroll Animations
  const logistics_firm_observer = new IntersectionObserver((entries) => {
    entries.forEach((entry) => {
      if (entry.isIntersecting) {
        entry.target.classList.add('animations-show-item');
        logistics_firm_observer.unobserve(entry.target);
      } else {
        entry.target.classList.remove('animations-show-item');
      }
    });
  });

  const logistics_firm_hiddenElements = document.querySelectorAll('.animations-hidden-item');
  logistics_firm_hiddenElements.forEach((el) =>
    logistics_firm_observer.observe(el)
  );

  // Slider
  $(document).ready(function () {
    let logistics_firm_swiper = new Swiper(".mySwiper", {
      slidesPerView: 1,
      spaceBetween: 30,
      autoplay: true,

      pagination: {
        el: ".swiper-pagination",
        type: "progressbar"
      },

      navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev"
      },

      on: {
        init: function () {
          let current = this.realIndex + 1;
          $('.current-slide').text(current.toString().padStart(2, '0'));
        },
        slideChange: function () {
          let current = this.realIndex + 1;
          $('.current-slide').text(current.toString().padStart(2, '0'));
        }
      }
    });
  });

})(jQuery);