'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),Carousel=require("../../../../../carousel-v3/components/root/Carousel.js"),CarouselItem=require("../../../../../carousel-v3/components/item/CarouselItem.js"),NextImage=require("../../../../../image/components/NextImage.js");require("../../../../../modal/components/confirm.js");var Modal=require("../../../../../modal/components/Modal.js"),React=require("react"),productFeaturedImage=require("../../common/productFeaturedImage.js"),ProductFeatureVideo=require("../child/ProductFeatureVideo.js"),MediaIcon=require("../child/MediaIcon.js");const ProductImagesLightBox=({builderPropUID:e,productImages:t,open:o,imageRatio:i,onHandleClose:s})=>{let l=core.useFeaturedImageGlobal(),r=React.useMemo(()=>{let e=t?.findIndex(e=>e.id===l?.id);return e&&e>0?e:0},[t,l]),d={desktop:t&&t.length>1,mobile:t&&t?.length>1,tablet:t&&t?.length>1},a={desktop:!1,mobile:!1,tablet:!1},n=core.useEditorMode(),u=e=>"edit"!==n&&["VIDEO","EXTERNAL_VIDEO"].includes(e?.contentType||"");return jsxRuntime.jsx(Modal.default,{setting:{open:o},styles:{width:"80%"},closeOnClickOutside:!0,onClose:()=>{s(),console.log("onHandleClose")},disableIframeClickEvent:!0,contentClass:"mobile:!gp-w-[100%] gp-px-2 gp-pb-10",children:jsxRuntime.jsx(Carousel.default,{setting:{loop:a,slidesToShow:{desktop:1,tablet:1,mobile:1},defaultCurrentSlider:r,dot:{desktop:!0,mobile:!0,tablet:!0},dotStyle:{desktop:"outside",mobile:"outside",tablet:"outside"},dotColor:{desktop:"#E2E2E2",mobile:"#E2E2E2",tablet:"#E2E2E2"},dotActiveColor:{desktop:"#121212",mobile:"#121212",tablet:"#121212"},dotSize:{desktop:12},dotGapToCarousel:{desktop:12},navigationEnable:d,navigationStyle:{desktop:"outside"},arrowIconSize:{desktop:24},initialSlide:r},styles:{sizeSetting:{desktop:{height:"80vh"},tablet:{height:"80vh"},mobile:{height:"60vh"}},playSpeed:0},moveToIdx:r,hiddenDotWhenOnlyOne:!0,isHiddenArrowWhenDisabled:!0,isDisableResetSlide:!0,builderProps:{uid:e},fullHeight:!0,children:t?.map(t=>jsxRuntime.jsx(CarouselItem.default,{className:`gem-slider-item gem-slider-item-${e} gp-flex gp-items-center gp-justify-center gp-px-4`,children:u(t)?jsxRuntime.jsx(ProductFeatureVideo.default,{type:t?.contentType,url:t.src??"",aspectRatio:i}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(NextImage.default,{src:productFeaturedImage.isFeatureMedia(t?.contentType)?t?.previewImage:t?.src,width:t?.width,height:t?.height,alt:t?.alt,"content-type":t?.contentType,setting:{aspectRatio:i},className:core.cls("gp-h-full gp-w-full gp-object-contain")},t?.id),jsxRuntime.jsx(MediaIcon.default,{contentType:t?.contentType??""})]})},t?.id))})})};exports.default=ProductImagesLightBox;
