"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),common=require("../../common/common.js"),NextImage=require("../../../../../image/components/NextImage.js"),ButtonOpenLightBox=require("../lightbox/ButtonOpenLightBox.js"),MediaIcon=require("./MediaIcon.js"),productFeaturedImage=require("../../common/productFeaturedImage.js"),hoverAction=require("../../common/hoverAction.js"),getProductImagesClassName=require("../../composables/getProductImagesClassName.js"),getProductImagesStyles=require("../../composables/getProductImagesStyles.js"),useProductGalleryGrid=require("../../hooks/useProductGalleryGrid.js");const ProductGalleryGrid=e=>{let{builderPropUID:t,productImages:o,onHandleClick:r,activeIndexFormFeatureImage:a,children:s,isHiddenInteraction:i,...c}=e,{isDisplay:u,shapeByLayout:l,imageActiveIndex:d,enableOpenLightBox:m,isEnableBorderActive:n,filteredProductImages:g}=useProductGalleryGrid.useProductGalleryGrid(e),y=core.useCurrentDevice(),{galleryGridWrapperClasses:p,galleryItemClasses:h}=getProductImagesClassName.getProductImagesClassName(c),{galleryGridStyles:x,galleryGridItemStyles:j}=getProductImagesStyles.getProductImagesStyles(c);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:u&&jsxRuntime.jsxs("div",{"data-slot":"children","data-id":t,className:p,style:x,"gp-data-hidden":`${i}`,children:[g?.map((e,o)=>{let a=o===d,s=productFeaturedImage.isFeatureMedia(e.contentType)?e.previewImage:e.src;return jsxRuntime.jsxs("div",{"aria-hidden":!0,className:h(`gem-slider-item-${t}
                  ${a&&n?"gem-slider-item-active":""}`),onClick:()=>r(e?.id||"",m),style:j,onMouseMove:e=>hoverAction.handleMouseMove(e,{hoverEffect:c.galleryHoverEffect,zoom:c.galleryZoom,zoomType:c.galleryZoomType}),onMouseOut:e=>hoverAction.handleMouseOut(e),"data-border":a&&c?.borderActive?"active":"deactive",children:[jsxRuntime.jsx(NextImage.default,{src:s,width:e?.width,height:e?.height,alt:e?.alt,setting:{aspectRatio:common.getAspectRatio(l),layout:c?.layout},style:{width:"100%",height:"100%"}},e?.id),jsxRuntime.jsx(MediaIcon.default,{contentType:e?.contentType||""}),c?.galleryHoverEffect!=="none"&&!productFeaturedImage.isFeatureMedia(e?.contentType)&&jsxRuntime.jsx(NextImage.default,{src:s,width:e?.width,height:e?.height,alt:e?.alt,setting:{layout:c.layout,aspectRatio:common.getAspectRatio(l)},className:core.cls("hover-image !gp-max-w-none",productFeaturedImage.getZoomImageClass())}),c?.galleryHoverEffect=="zoom"&&c?.galleryZoomType=="glasses"&&["one-col","two-col"].includes(core.getResponsiveValueByScreen(c.position,y)||"")&&!productFeaturedImage.isFeatureMedia(e?.contentType)&&jsxRuntime.jsx("div",{className:core.cls(productFeaturedImage.getZoomLenClass(),"room-len"),style:{...core.makeStyle({bgi:`url("${e?.src}")`})}}),core.getResponsiveValueByScreen(c?.clickOpenLightBox,y)&&jsxRuntime.jsx(ButtonOpenLightBox.default,{})]},e?.id)}),s]})})};var ProductGalleryGrid$1=React.memo(ProductGalleryGrid);exports.default=ProductGalleryGrid$1;
