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