import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import{useCurrentDevice as r}from"@gem-sdk/core";import{getAspectRatio as s,getGalleryCarouselRootId as m}from"../../common/common.js";import{getEditorMinHeightClass as i}from"../../common/productGallery.js";import{getProductImagesClassName as a}from"../../composables/getProductImagesClassName.js";import{getProductImagesStyles as l}from"../../composables/getProductImagesStyles.js";import{getProductImagesAttr as n}from"../../composables/getProductImagesAttr.js";import{isFeatureMedia as c}from"../../common/productFeaturedImage.js";import p from"../child/MediaIcon.js";import d from"../lightbox/ButtonOpenLightBox.js";import u from"../../../../../image/components/NextImage.js";import g from"../../../../../carousel-v3/components/root/Carousel.js";import y from"../../../../../carousel-v3/components/item/CarouselItem.js";import{useGalleryCarousel as h}from"../../hooks/useGalleryCarousel.js";import{If as f}from"@gem-sdk/system";let j=j=>{let{builderPropUID:I,productImages:C,onSwiperReady:b,activeIndexFormFeatureImage:P,onClickFeatureArrow:T,builderPropsClass:v,carouselInstanceUID:w,arrow:x,priorityFeatureImage:k,...q}=j,N=r(),{galleryItemClasses:A}=a(q),{galleryCarouselSettingAttrs:G}=n(q),{galleryCarouselStyle:S,galleryCarouselItemStyle:$}=l(q),{moveToIdx:B,isDisplay:H,shapeByLayout:L,isEnableBorderActive:M,isShowButtonLightbox:R,filteredProductImages:D,handleClickCarouselItem:E,safeMoveToIdx:F,setSliderReady:O}=h(j);return e(o,{children:H&&e(g,{parentClass:v,rootClass:v,setting:G,styles:S,slidesClass:i(N,q.position,q.navigationPosition),builderProps:{uid:`${I}-carousel`},rootId:m({carouselInstanceUID:w,builderPropUID:I}),moveToIdx:F,isHiddenArrowWhenDisabled:!0,disableMarginAuto:!0,isEnableCheckHasScrollableContent:!0,onLoaded:e=>{e&&O(!0)},onSwiperReady:b,children:D?.map((o,r)=>{let m=c(o.contentType)?o.previewImage:o.src;return t(y,{contentType:"productImage",className:A(`gp-gallery-image-item gem-slider-item-${I} ${r===B&&M?"gem-slider-item-active":""}`),onClickItem:()=>E(o?.id),style:$,"data-id":o?.id,children:[e(u,{draggable:"false",src:m,width:o?.width,height:o?.height,alt:o?.alt,setting:{aspectRatio:s(L),layout:q?.layout,qualityPercent:q?.qualityPercent,qualityType:q?.qualityType},style:{width:"100%",height:"100%",cursor:"pointer"},className:"product-list-image"}),e(p,{contentType:o?.contentType||""}),f(R,e(d,{}))]},o?.id)})})})};export{j as default};
