"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),S=require("swiper/react");;/* empty css                                                                               */const k=require("../../../../utils/useSwiper/useSwiper.cjs.js"),s=require("../../../../src/modules/Reviews/components/ReviewList/reviewList.module.css"),c=require("../../../../components/Skeleton/Skeleton.cjs.js"),q=require("../ReviewCard/ReviewCard.cjs.js"),f=({reviews:h,page:i,pagesCount:n,isLoading:w,onPageChange:x})=>{const t=o.useRef("external"),{activeIndex:a,onSwiperInit:m,handleSlideTo:u,handleSlideChange:j,handleSwiperResize:p}=k.useSwiper();o.useEffect(()=>{t.current==="external"&&a!==i-1&&u(i-1),t.current="external"},[a,i,u]);const v=o.useMemo(()=>Array.from({length:n}),[n]);return e.jsx(S.Swiper,{onSwiper:m,onResize:p,onSlideChange:l=>{const r=l.activeIndex+1;r!==i&&(t.current="swiper",x(r)),j(l)},slidesPerView:1,allowTouchMove:n>1,spaceBetween:0,initialSlide:i-1,className:s.swiper,children:v.map((l,r)=>e.jsx(S.SwiperSlide,{children:r===i-1?e.jsx("div",{className:s.reviewsContainer,children:w?e.jsxs("div",{className:s.loadingContainer,children:[e.jsx(c.Skeleton,{height:"130px",className:s.skeleton}),e.jsx(c.Skeleton,{height:"110px",className:s.skeleton}),e.jsx(c.Skeleton,{height:"90px",className:s.skeleton})]}):h.map(({review:d},R)=>e.jsx(q.ReviewCard,{review:d},`${d.author}_${R}`))}):null},r))})};exports.ReviewList=f;
