import initAccordion from "./components/accordion.js";
import { Case } from "./components/case.js";

import lightboxVideo from "./components/g-lightbox/popup-video.js";
import { lightBoxImg } from "./components/g-lightbox/popup-img.js";
import { HeaderMenu } from "./components/HeaderMenu.js";
import initTextToggle from "./handlers/initTextToggle.js";
import scrollHeader from "./handlers/scrollHeader.js";
import { initMask } from "./components/imask.js";
// import { waitForYandexApi } from "./components/map.js";
// import { handleClickPartnersButton } from "./components/partners-button.js";
// import { Popover } from "./components/popover.js";
import initLogos from "./components/clients.js";
import { lazyLoadMap } from "./components/map.js";
import { initSliders } from "./components/sliders.js";
import { Tabs } from "./components/tabs.js";

import { VideoSquare } from "./components/video-square.js";
import { Form } from "./components/form.js";
import { initModal, showSuccessModal } from "./components/modals.js";

function app() {
   new HeaderMenu();
   scrollHeader();

   new Case();

   // new Accordion();
   // new Popover();

   initSliders();
   initLogos();

   initTextToggle({
      buttonSelector: ".awards-slide__btn-more",
      cardSelector: ".awards-slide",
      textSelector: ".awards-slide__text",
      btnTextSelector: ".btn-more__text",
      openText: "свернуть",
      closeText: "развернуть",
      marginBottom: 20,
   });

   initTextToggle({
      buttonSelector: ".reviews-card__show-more",
      cardSelector: ".reviews-card",
      textSelector: ".reviews-card__text",
      btnTextSelector: ".arrow-link__text",
      lines: 7,
      openText: "свернуть",
      closeText: "читать полностью",
   });

   initAccordion();

   lightBoxImg();
   // handleClickPartnersButton();

   // waitForYandexApi();
   initMask();
   const tabs = document.querySelectorAll(".zr-tabs");
   tabs.forEach((tab) => new Tabs(tab));

   lazyLoadMap(".js-map");

   const videos = document.querySelectorAll(".case-gallery");
   videos.forEach((v) => new VideoSquare(v));

   const lightbox = GLightbox();
   lightboxVideo();

   Form.initForms();

   initModal();
   //showSuccessModal();
}

export { app };
