'use client';
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useProduct as o,useCurrentDevice as a,useShopStore as c,useRenderMode as i,getResponsiveValueByScreen as n,cls as l,makeStyle as s}from"@gem-sdk/core";import{memo as h,useMemo as f}from"react";import m from"../../../../../image/components/NextImage.js";import p from"./MediaIcon.js";import{isFeatureMedia as d,getZoomImageClass as g,getZoomLenClass as u}from"../../common/productFeaturedImage.js";import y from"./ProductFeatureVideo.js";let 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:h,imageShowWhenHover:v,setting:E,aspectRatio:I})=>{let T=o(),b=a(),w=c(e=>e.storefrontUrl),{isEditMode:O,isPreviewSharePageMode:x}=i(),L=f(()=>"none"!==n(E.ftClickOpenLightBox,b),[b,E.ftClickOpenLightBox]),j=f(()=>!O&&["VIDEO","EXTERNAL_VIDEO"].includes(h?.contentType||"")&&!L,[O,h?.contentType,L]),F=f(()=>h?{...h,src:j?h.src:d(h?.contentType)?h?.previewImage:h.src}:defaultImage,[h,j]),N=f(()=>{if(x)return"javascript:void(0)";if(!w)return"#";let e=new URL(w);return T?`${e.protocol}//${e.host}/products/${T.handle}`:"#"},[w,T,x]),$=t=>"product-link"===n(E.ftClickOpenLightBox,b)?e("a",{title:T?.title,href:N,className:"gp-w-full",children:t}):t,k=f(()=>E?.hoverEffect!=="none"&&!d(F?.contentType),[F?.contentType,E?.hoverEffect]),P=f(()=>E?.hoverEffect=="zoom"&&E?.zoomType=="glasses"&&!d(F?.contentType),[F?.contentType,E?.hoverEffect,E?.zoomType]);return e(t,{children:$(e(t,{children:j?e(y,{type:F?.contentType,url:F.src??"",aspectRatio:I}):r(t,{children:[e(m,{draggable:"false",src:F.src,width:F?.width,height:F?.height,alt:F?.alt,setting:{aspectRatio:I,layout:E?.ftLayout},priority:E?.preload,className:"featured-image-only",style:{width:"100%",height:"100%",cursor:"pointer"}}),e(p,{contentType:F?.contentType??""}),k&&e(m,{draggable:"false",src:E?.hoverEffect==="other"?v?.src:F.src,width:E?.hoverEffect==="other"?v?.width:F.width,height:E?.hoverEffect==="other"?v?.height:F.height,alt:E?.hoverEffect==="other"?v?.alt:F.alt,setting:{layout:E.ftLayout,aspectRatio:I},style:{width:"100%",height:"100%"},className:l("hover-image featured-image-only !gp-max-w-none",g()),priority:E?.preload}),P&&e("div",{className:l(u(),"room-len"),style:{...s({bgi:`url("${F?.src}")`})}})]})}))})};var ProductFeaturedImageOnly$1=h(ProductFeaturedImageOnly);export{ProductFeaturedImageOnly$1 as default};
