'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@gem-sdk/core"),r=require("react"),o=require("../../../../../image/components/NextImage.js"),s=require("./MediaIcon.js"),a=require("../../common/productFeaturedImage.js"),i=require("./ProductFeatureVideo.js");const c={src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",id:"noImageError",width:480,height:480,alt:"no image",contentType:"IMAGE"};var n=r.memo(({image:n,imageShowWhenHover:l,setting:u,aspectRatio:h})=>{var d;let f=t.useProduct(),g=t.useCurrentDevice(),p=t.useShopStore(e=>e.storefrontUrl),{isEditMode:m,isPreviewSharePageMode:y}=t.useRenderMode(),v=r.useMemo(()=>"none"!==t.getResponsiveValueByScreen(u.ftClickOpenLightBox,g),[g,u.ftClickOpenLightBox]),x=r.useMemo(()=>!m&&["VIDEO","EXTERNAL_VIDEO"].includes(n?.contentType||"")&&!v,[m,n?.contentType,v]),j=r.useMemo(()=>n?{...n,src:x?n.src:a.isFeatureMedia(n?.contentType)?n?.previewImage:n.src}:c,[n,x]),E=r.useMemo(()=>{if(y)return"javascript:void(0)";if(!p)return"#";let e=new URL(p);return f?`${e.protocol}//${e.host}/products/${f.handle}`:"#"},[p,f,y]),T=r.useMemo(()=>u?.hoverEffect!=="none"&&!a.isFeatureMedia(j?.contentType),[j?.contentType,u?.hoverEffect]),b=r.useMemo(()=>u?.hoverEffect=="zoom"&&u?.zoomType=="glasses"&&!a.isFeatureMedia(j?.contentType),[j?.contentType,u?.hoverEffect,u?.zoomType]);return e.jsx(e.Fragment,{children:(d=e.jsx(e.Fragment,{children:x?e.jsx(i.default,{type:j?.contentType,url:j.src??"",aspectRatio:h}):e.jsxs(e.Fragment,{children:[e.jsx(o.default,{draggable:"false",src:j.src,width:j?.width,height:j?.height,alt:j?.alt,setting:{aspectRatio:h,layout:u?.ftLayout},priority:u?.preload,className:"featured-image-only",style:{width:"100%",height:"100%",cursor:"pointer"}}),e.jsx(s.default,{contentType:j?.contentType??""}),T&&e.jsx(o.default,{draggable:"false",src:u?.hoverEffect==="other"?l?.src:j.src,width:u?.hoverEffect==="other"?l?.width:j.width,height:u?.hoverEffect==="other"?l?.height:j.height,alt:u?.hoverEffect==="other"?l?.alt:j.alt,setting:{layout:u.ftLayout,aspectRatio:h},style:{width:"100%",height:"100%"},className:t.cls("hover-image featured-image-only !gp-max-w-none",a.getZoomImageClass()),priority:u?.preload}),b&&e.jsx("div",{className:t.cls(a.getZoomLenClass(),"room-len"),style:{...t.makeStyle({bgi:`url("${j?.src}")`})}})]})}),"product-link"===t.getResponsiveValueByScreen(u.ftClickOpenLightBox,g)?e.jsx("a",{title:f?.title,href:E,className:"gp-w-full",children:d}):d)})});exports.default=n;
