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