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