"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),s=require("react"),t=require("../gallery-carousel/GalleryCarousel.js"),a=require("../child/ProductGalleryGrid.js"),i=require("../child/ProductFeaturedImageCarousel.js"),u=require("../../composables/getProductImagesStyles.js"),l=require("../../composables/getProductImagesClassName.js"),d=require("../../hooks/useFeatureImageWithGallery.js");exports.default=o=>{let{setting:c,styles:n,builderProps:m,gallery:g,onHandleClickImage:p,priorityFeatureImage:I,children:h,noDataChildren:b,isFilterByVariantEnabled:j}=o,{isEditMode:y}=r.useRenderMode(),x=s.useRef(null),f=r.useCurrentDevice(),C=s.useCallback(e=>{if(!x.current)return;let r=x.current.getSwiper();r&&r.thumbs&&r.thumbs.swiper&&r.thumbs.swiper?.realIndex===void 0&&e&&(r.thumbs.swiper=e,r.thumbs.init(),r.thumbs.update(!0),r.update())},[]),P={...c,...n},{isShowCarousel:v,featureImageHeight:F,featureWrapperImage:q,onClickFeatureArrow:k,activeIndexFromFeatureImage:w,setOnClickFeatureArrow:H,onHandleLoadedFeatureImage:N,setActiveIndexFromFeatureImage:G}=d.useFeatureImageWithGallery(o);if(g?.[0]?.id==="noImageError"&&y)return e.jsx(e.Fragment,{children:b});let{ftImageGalleryClasses:S,imageGalleryWrapperClasses:D}=l.getProductImagesClassName(o),{wrapperFeaturedImageStyle:R,featureImageStyle:U,galleryImageStyle:A}=u.getProductImagesStyles(P,{gallery:g,featureImageHeight:F}),M=JSON.stringify(P?.position)+f+v;return e.jsxs("div",{className:r.cls("gp-grid gp-w-full gp-relative"),style:R,children:[e.jsxs("div",{className:S,style:U,children:[h,e.jsx(i.default,{ref:x,imgRef:q,productImages:g,...P,onHandleClick:(e,r)=>p(e||"",r),onHandleLoaded:N,onHandleUpdateActiveIndex:G,onClickArrow:e=>H(e),builderPropUID:m?.uid,builderPropsClass:`gp-product-images-feature-${m?.uid}`})]}),g.length>(j?0:1)&&e.jsx("div",{className:D,style:A,children:v?e.jsx(t.default,{productImages:g,position:P?.position,...P,builderPropUID:m?.uid,onHandleClick:(e,r)=>p(e||"",r),onSwiperReady:C,activeIndexFormFeatureImage:w,priorityFeatureImage:I,onClickFeatureArrow:k,builderPropsClass:`gp-product-images-gallery-${m?.uid}`}):e.jsx(a.default,{productImages:g,...P,builderPropUID:m?.uid,onHandleClick:(e,r)=>p(e||"",r),activeIndexFromFeatureImage:w,isHiddenInteraction:!0})})]},M)};
