{"version":3,"file":"LazyImage.KoDoBJCW.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/BrWT84WNctEvCzgYbBeW/Jnth5jbBZbAWOef7krxm/LazyImage.js"],"sourcesContent":["// Lazy load images with pixelated low-res placeholder\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Lazy Image Loader\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function LazyImage(props){const{lowResImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Low resolution placeholder\"},highResImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"High resolution image\"},threshold=.1,transitionDuration=.5,transitionTimingFunction=\"ease-in-out\",transitionDelay=0,pixelated=true,instantAnimation=false,borderRadius=0}=props;const[isLoaded,setIsLoaded]=useState(false);const[isInView,setIsInView]=useState(false);const imgRef=useRef(null);const effectiveDuration=instantAnimation?0:transitionDuration;useEffect(()=>{if(typeof window===\"undefined\")return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){startTransition(()=>setIsInView(true));}});},{threshold});if(imgRef.current){observer.observe(imgRef.current);}return()=>{if(imgRef.current){observer.unobserve(imgRef.current);}};},[threshold]);useEffect(()=>{if(!isInView)return;const img=new Image;img.src=highResImage.src;img.onload=()=>{startTransition(()=>setIsLoaded(true));};},[isInView,highResImage.src]);return /*#__PURE__*/_jsxs(\"div\",{ref:imgRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:`${borderRadius}px`},children:[/*#__PURE__*/_jsx(\"img\",{src:lowResImage.src,alt:lowResImage.alt||\"\",className:\"lazy-image-placeholder\",style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",imageRendering:pixelated?\"pixelated\":\"auto\",opacity:isLoaded?0:1,transition:`opacity ${effectiveDuration}s ${transitionTimingFunction} ${transitionDelay}s`}}),isInView&&/*#__PURE__*/_jsx(\"img\",{src:highResImage.src,alt:highResImage.alt||\"\",className:\"lazy-image-full\",style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",opacity:isLoaded?1:0,transition:`opacity ${effectiveDuration}s ${transitionTimingFunction} ${transitionDelay}s`}})]});}addPropertyControls(LazyImage,{lowResImage:{type:ControlType.ResponsiveImage,title:\"Low Res Image\"},highResImage:{type:ControlType.ResponsiveImage,title:\"High Res Image\"},pixelated:{type:ControlType.Boolean,title:\"Pixelated\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:100,step:1,unit:\"px\"},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:.1,min:0,max:1,step:.1},instantAnimation:{type:ControlType.Boolean,title:\"Instant\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},transitionDuration:{type:ControlType.Number,title:\"Transition\",defaultValue:.5,min:0,max:3,step:.1,unit:\"s\",hidden:({instantAnimation})=>instantAnimation},transitionTimingFunction:{type:ControlType.Enum,title:\"Timing\",defaultValue:\"ease-in-out\",options:[\"linear\",\"ease\",\"ease-in\",\"ease-out\",\"ease-in-out\"],optionTitles:[\"Linear\",\"Ease\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],hidden:({instantAnimation})=>instantAnimation},transitionDelay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:2,step:.1,unit:\"s\",hidden:({instantAnimation})=>instantAnimation}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LazyImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrins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