"use client";
import { jsxs as m, jsx as r } from "react/jsx-runtime";
import { useEffect as p } from "react";
import { Navigation as k } from "swiper/modules";
import { Swiper as v, SwiperSlide as b } from "swiper/react";
import { cn as h } from "../../utils/cn/cn.es.js";
import { useSwiper as P } from "../../utils/useSwiper/useSwiper.es.js";
/* empty css                                                                       */
/* empty css                                                                                   */
/* empty css                                                                                   */
import e from "../../components/ProductGallery/productGallery.module.css";
import { ProgressButton as f } from "../ProgressButton/ProgressButton.es.js";
import { ProductGalleryCard as E } from "../ProductGalleryCard/ProductGalleryCard.es.js";
const I = [k], $ = ({ slides: n, header: w, isTabbed: t = !1 }) => {
  const {
    swiper: o,
    activeIndex: a,
    isEnd: l,
    setIsEnd: u,
    hideNav: C,
    handleSlideChange: S,
    handlePrevClick: s,
    handleNextClick: d,
    onSwiperInit: N,
    handleSwiperResize: g,
    handleSlideTo: c
  } = P();
  return p(() => {
    o == null || o.setProgress(0, 300);
  }, [o]), p(() => {
    n.length && c(0);
  }, [n, c]), /* @__PURE__ */ m("div", { className: e.root, children: [
    /* @__PURE__ */ m(
      "div",
      {
        className: h(e.topRow, {
          [e.topRowTabbed]: t
        }),
        children: [
          /* @__PURE__ */ r("div", { className: e.headerWrapper, children: w }),
          /* @__PURE__ */ r(
            "div",
            {
              className: h(e.swiperControlsDesktop, {
                [e.swiperControlsHidden]: C,
                [e.swiperControlsTabbed]: t
              }),
              children: /* @__PURE__ */ r(
                f,
                {
                  left: {
                    disabled: a <= 0,
                    onClick: s
                  },
                  right: {
                    disabled: l,
                    onClick: d
                  }
                }
              )
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ r("div", { className: e.carouselArea, children: /* @__PURE__ */ r(
      v,
      {
        onSwiper: N,
        onResize: g,
        onSlideChange: S,
        onReachEnd: () => u(!0),
        modules: I,
        spaceBetween: 0,
        slidesPerView: "auto",
        className: e.swiper,
        children: n.map((i) => /* @__PURE__ */ r(b, { className: e.swiperSlide, children: /* @__PURE__ */ r(
          E,
          {
            name: i.name,
            price: i.price,
            image: i.image,
            link: i.link,
            buttons: i.buttons,
            zenpatientId: i.zenpatientId
          }
        ) }, `${i.name}_${i.link}`))
      }
    ) }),
    /* @__PURE__ */ r("div", { className: e.swiperControlsMobile, children: /* @__PURE__ */ r(
      f,
      {
        left: {
          disabled: a <= 0,
          onClick: s
        },
        right: {
          disabled: l,
          onClick: d
        }
      }
    ) })
  ] });
};
export {
  $ as ProductGallery
};
