"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),common=require("../../common/common.js"),productGallery=require("../../common/productGallery.js"),getProductImagesClassName=require("../../composables/getProductImagesClassName.js"),getProductImagesStyles=require("../../composables/getProductImagesStyles.js"),getProductImagesAttr=require("../../composables/getProductImagesAttr.js"),productFeaturedImage=require("../../common/productFeaturedImage.js"),MediaIcon=require("../child/MediaIcon.js"),ButtonOpenLightBox=require("../lightbox/ButtonOpenLightBox.js"),NextImage=require("../../../../../image/components/NextImage.js"),Carousel=require("../../../../../carousel/components/root/Carousel.js"),CarouselItem=require("../../../../../carousel/components/item/CarouselItem.js"),useGalleryCarousel=require("../../hooks/useGalleryCarousel.js"),system=require("@gem-sdk/system");const ProductGalleryCarousel=e=>{let{builderPropUID:t,productImages:s,activeIndexFormFeatureImage:r,onClickFeatureArrow:a,builderPropsClass:o,arrow:u,priorityFeatureImage:i,...l}=e,m=core.useCurrentDevice(),{galleryItemClasses:c}=getProductImagesClassName.getProductImagesClassName(l),{galleryCarouselSettingAttrs:d}=getProductImagesAttr.getProductImagesAttr(l),{galleryCarouselStyle:n,galleryCarouselItemStyle:g}=getProductImagesStyles.getProductImagesStyles(l),{moveToIdx:p,isDisplay:y,shapeByLayout:I,isEnableBorderActive:j,isShowButtonLightbox:x,filteredProductImages:C,handleClickCarouselItem:h,safeMoveToIdx:q,setSliderReady:P}=useGalleryCarousel.useGalleryCarousel(e);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:y&&jsxRuntime.jsx(Carousel.default,{parentClass:o,rootClass:o,setting:d,styles:n,slidesClass:productGallery.getEditorMinHeightClass(m,l.position,l.navigationPosition),builderProps:{uid:`${t}-carousel`},moveToIdx:q,isHiddenArrowWhenDisabled:!0,disableMarginAuto:!0,onLoaded:e=>{e&&P(!0)},children:C?.map((e,s)=>{let r=s===p,a=productFeaturedImage.isFeatureMedia(e.contentType)?e.previewImage:e.src;return jsxRuntime.jsxs(CarouselItem.default,{contentType:"productImage",className:c(`gp-gallery-image-item gem-slider-item-${t} ${r&&j?"gem-slider-item-active":""}`),onClickItem:()=>h(e?.id),style:g,"data-id":e?.id,"data-border":r&&l?.borderActive?"active":"deactive",children:[jsxRuntime.jsx(NextImage.default,{draggable:"false",src:a,width:e?.width,height:e?.height,alt:e?.alt,setting:{aspectRatio:common.getAspectRatio(I),layout:l?.layout,qualityPercent:l?.qualityPercent,qualityType:l?.qualityType},style:{width:"100%",height:"100%",cursor:"pointer"},className:"product-list-image"}),jsxRuntime.jsx(MediaIcon.default,{contentType:e?.contentType||""}),system.If(x,jsxRuntime.jsx(ButtonOpenLightBox.default,{}))]},e?.id)})})})};exports.default=ProductGalleryCarousel;
