'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),helpers=require("../common/helpers.js"),system=require("@gem-sdk/system"),classes=require("../common/classes.js"),styles=require("../common/styles.js");const AdaptiveImage=e=>{let{alt:s,style:t,srcSet:a,layout:r,priority:m,className:l,aspectRatio:i,borderRadius:c,pictureClass:u,enableLazyLoadImage:d,...n}=e,{getDeviceSource:p}=helpers.getAdaptiveImageData(e),{srcTablet:x,srcMobile:j}=p(),o=system.createAttr({loading:m?"eager":"lazy",src:a?.desktop?.src||helpers.FALLBACK_IMAGE}),y=system.createStyleReact({...styles.getAdaptivePictureStyles()}),g=system.createStyle({...styles.getAdaptiveImageStyles({layout:r,aspectRatio:i,borderRadius:c}),...t}),A=system.createClass({...classes.getAdaptiveImageClasses({className:l,hasLazyLoad:!m&&d})}),h=()=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[j&&jsxRuntime.jsx("source",{media:"(max-width: 767px)",srcSet:d?helpers.IMAGE_PLACEHOLDER:j}),x&&jsxRuntime.jsx("source",{media:"(max-width: 1024px)",srcSet:d?helpers.IMAGE_PLACEHOLDER:x})]}),R=()=>jsxRuntime.jsx("img",{...n,...o,alt:s,width:"100%",style:g,className:A,draggable:"false"});return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("picture",{style:y,className:u,children:[h(),R()]})})};AdaptiveImage.defaultProps={layout:{desktop:"cover"}},exports.default=AdaptiveImage;
