{"version":3,"file":"AspectRatioImage.DNsuCubO.mjs","names":["useState","useMemo","startTransition"],"sources":["https:/framerusercontent.com/modules/sM1kVRuOT5U7NsKDR0Ha/ObYGRYnkQ8J7ILSZ78kb/AspectRatioImage.js"],"sourcesContent":["// Image component that respects its own aspect ratio\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo,useState,useEffect,startTransition}from\"react\";/**\n * Responsive Image with Aspect Ratio\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AspectRatioImage(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},objectFit=\"cover\",style}=props;// Memoize aspect ratio calculation\nconst[aspectRatio,setAspectRatio]=useState(4/3);const[lightboxOpen,setLightboxOpen]=useState(false);useEffect(()=>{if(!image?.src)return;const img=new window.Image;img.onload=function(){if(img.naturalWidth&&img.naturalHeight){setAspectRatio(img.naturalWidth/img.naturalHeight);}};img.src=image.src;},[image?.src]);// Calculate height based on width and aspect ratio\nconst containerStyle=useMemo(()=>{const width=style?.width||\"100%\";let height=style?.height;if(!height&&typeof width===\"number\"){height=width/aspectRatio;}else if(!height){height=`calc(100% / ${aspectRatio})`;}return{...style,width,height,position:\"relative\",overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:\"#F5F5F5\",borderRadius:0};},[style,aspectRatio]);return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Image\",style:{width:\"100%\",height:\"100%\",objectFit,display:\"block\",cursor:\"pointer\"},draggable:false,onClick:()=>startTransition(()=>setLightboxOpen(true))}),lightboxOpen&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",background:\"rgba(0,0,0,0.8)\",zIndex:9999,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},onClick:()=>startTransition(()=>setLightboxOpen(false)),\"aria-modal\":\"true\",role:\"dialog\",children:/*#__PURE__*/_jsx(\"img\",{src:image.src,alt:image.alt||\"Image\",style:{maxWidth:\"90vw\",maxHeight:\"90vh\",objectFit:\"contain\",borderRadius:0,boxShadow:\"0 4px 32px rgba(0,0,0,0.3)\",background:\"#fff\"},draggable:false})})]});}addPropertyControls(AspectRatioImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AspectRatioImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"300\",\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AspectRatioImage.map"],"mappings":"oNASG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,YAAU,QAAQ,SAAO,EACvL,CAAC,EAAY,GAAgBA,EAAS,EAAE,EAAE,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CACyS,OADxS,MAAc,CAAC,GAAG,CAAC,GAAO,IAAI,OAAO,IAAM,EAAI,IAAI,EAAO,MAAM,EAAI,OAAO,UAAU,CAAI,EAAI,cAAc,EAAI,eAAe,EAAe,EAAI,aAAa,EAAI,cAAc,EAAI,EAAI,IAAI,EAAM,KAAM,CAAC,GAAO,IAAI,CAAC,CACuG,EAAM,MAAM,CAAC,MAAxZ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