{"version":3,"file":"RandomImage.CvchTAQE.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/fsqJca8Zx8HrDZzYk5td/I1NS9Olu25rpWICK0vgf/RandomImage.js"],"sourcesContent":["// Component that displays a random image from a set of images on each refresh\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function RandomImage(props){const{images=[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"}],rotationInterval=3}=props;const[currentIndex,setCurrentIndex]=useState(0);const[imageError,setImageError]=useState(false);// Rotate through images based on time interval\nuseEffect(()=>{const interval=setInterval(()=>{startTransition(()=>{setCurrentIndex(prevIndex=>(prevIndex+1)%images.length);setImageError(false);});},rotationInterval*1e3);return()=>clearInterval(interval);},[images.length,rotationInterval]);const currentImage=images[currentIndex]||{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Default image\"};const fallbackImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Fallback image\"};const displayImage=imageError?fallbackImage:currentImage;return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"img\",{src:displayImage.src,alt:displayImage.alt,onError:()=>setImageError(true),style:{width:\"100%\",height:\"100%\",objectFit:\"fill\"}})});}addPropertyControls(RandomImage,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.ResponsiveImage},defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"},{src:\"https://framerusercontent.com/images/2uTNEj5aTl2K3NJaEFWMbnrA.jpg\",alt:\"Gradient 4 - Yellow\"},{src:\"https://framerusercontent.com/images/f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\",alt:\"Gradient 5 - Green\"}]},rotationInterval:{type:ControlType.Number,title:\"Rotation Interval\",defaultValue:3,min:1,max:60,step:1,unit:\"s\",displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RandomImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RandomImage.map"],"mappings":"mLAIG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,CAAC,mBAAiB,GAAG,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAC1R,MAAc,CAAC,IAAM,EAAS,gBAAgB,CAAC,MAAoB,CAAC,EAAgB,IAAY,EAAU,GAAG,EAAO,OAAO,CAAC,EAAc,GAAM,EAAG,EAAG,EAAiB,IAAI,CAAC,UAAU,cAAc,EAAS,EAAG,CAAC,EAAO,OAAO,EAAiB,CAAC,CAAC,IAAM,EAAa,EAAO,IAAe,CAAC,IAAI,sEAAsE,IAAI,gBAAgB,CAA4H,EAAa,EAApH,CAAC,IAAI,sEAAsE,IAAI,iBAAiB,CAA6C,EAAa,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,SAAS,WAAW,SAAS,SAAS,CAAC,SAAsB,EAAK,MAAM,CAAC,IAAI,EAAa,IAAI,IAAI,EAAa,IA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