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