"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@gem-sdk/core"),s=require("../../common/hoverAction.js"),o=require("../../composables/getProductImagesStyles.js"),a=require("../../composables/getProductImagesClassName.js"),l=require("../../composables/getProductImagesAttr.js"),u=require("@gem-sdk/system"),i=require("../../common/styles.js"),n=require("../../../../../carousel-v3/components/root/Carousel.js"),d=require("../../../../../carousel-v3/components/item/CarouselItem.js"),c=require("./ProductFeaturedImageOnly.js"),m=require("../../hooks/useProductFeaturedImageCarousel.js");const g=t.forwardRef((g,p)=>{let{productImages:h,imgRef:v,onHandleClick:f,onClickArrow:j,onHandleLoaded:y,onHandleUpdateActiveIndex:I,swiperUpdateTrigger:x,builderPropUID:C,builderPropsClass:M,parentUid:q,isFilterByVariantEnabled:S,...w}=g,P=t.useRef(null),{ref:b,imageActive:O,imageActiveIndex:k,imageShowWhenHover:R,enableOpenLightBox:A,filteredProductImages:H,isRenderFeatureCarousel:N,genRandomKey:B,getAspectRatioFinal:F,emitUpdateActiveIndex:W}=m.useProductFeaturedImageCarousel(g);t.useImperativeHandle(p,()=>({getSwiper:()=>P.current?.getSwiper()||null}));let D=r.useCurrentDevice(),{galleryItemClasses:L,featureImageOnlyOneImageClasses:T}=a.getProductImagesClassName(w),{featuredImageCarouselStyle:_,featureImageCarouselItemStyle:V}=o.getProductImagesStyles(w),$=u.createStyle({...i.getFeaturedImageOnlyOneImageStyle({setting:w,options:{enableRadius:!0,enableHeight:!0}})}),{featuredImageCarouselSettingAttrs:z}=l.getProductImagesAttr(w);return e.jsx("div",{ref:b,"data-slot":"children",className:"product-feature-image",children:N?e.jsx(n.default,{ref:P,parentClass:M,elmRef:v,setting:z,styles:_,builderProps:{uid:C},isHiddenArrowWhenDisabled:!0,onLoaded:e=>y&&y(e),onChangeActive:e=>W(e),onClickArrow:()=>j&&j(B()),moveToIdx:k,disableMarginAuto:!0,thumbsSwiper:`#gp-carousel-${C}-carousel`,onHandleChangeSlideByInteraction:e=>{let t=H?.length??0;f(H?.[e>=t?0:e]?.id??"",A)},children:H?.map(t=>e.jsx(d.default,{contentType:"productImage",className:L("gp-ft-image-item !gp-min-w-full !gp-max-w-full"),onClickItem:()=>{let e=r.getResponsiveValueByScreen(w?.ftClickOpenLightBox,D);"none"!==e&&f(t?.id??"",A)},style:V,onMouseMove:e=>s.handleMouseMove(e,w),onMouseOut:e=>s.handleMouseOut(e),children:e.jsx(c.default,{image:t,imageShowWhenHover:R,setting:w,aspectRatio:F()})},t?.id))}):e.jsx("div",{ref:v,className:"gp-flex gp-w-full",style:{...r.makeStyleResponsive("jc",w?.align)},"data-id":C,children:e.jsx("div",{"aria-hidden":"true",className:T,style:$,onMouseMove:e=>s.handleMouseMove(e,w),onMouseOut:e=>s.handleMouseOut(e),onBlur:()=>void 0,onClick:()=>{f(O?.id??"",A)},children:e.jsx(c.default,{image:S?h?.[0]:O,imageShowWhenHover:R,setting:w,aspectRatio:F(S?h?.[0]:O)})})})})});var p=t.memo(g);exports.default=p;
