{"version":3,"file":"CrossfadeSlideshow.CmwBHjGd.mjs","names":["useState","__esmMin","te","init_npm_react_18_3_1","ce","init_jsx_runtime","c","_e","AnimatePresence","init_framer_motion_DhsWWWsN","motion","useIsStaticRenderer","addPropertyControls","ControlType","init_framer_BL9pqxmF","CrossfadeSlideshow","props","currentIndex","setCurrentIndex","isStatic","isStarted","setIsStarted","startTimer","delay","timer","nextIndex","current","imagesPerView","interval","imageIndex","i","spacing","init_CrossfadeSlideshow"],"sources":["https:/framerusercontent.com/modules/iPksPUfpFoKkxZ6q91MM/LcX3Cvx6zTxCZshRRy16/CrossfadeSlideshow.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CrossfadeSlideshow(props){const{interval=3e3,delay=0,imagesPerView=1,spacing=0}=props;const[currentIndex,setCurrentIndex]=useState(0);const isStatic=useIsStaticRenderer();const[isStarted,setIsStarted]=useState(false);useEffect(()=>{if(isStatic)return;// Initial delay before starting the slideshow\nconst startTimer=setTimeout(()=>{setIsStarted(true);},delay);return()=>clearTimeout(startTimer);},[delay,isStatic]);useEffect(()=>{if(isStatic||!isStarted)return;const timer=setInterval(()=>{startTransition(()=>{setCurrentIndex(current=>{const nextIndex=current+imagesPerView;return nextIndex>=props.images.length?0:nextIndex;});});},interval);return()=>clearInterval(timer);},[interval,props.images.length,isStatic,isStarted,imagesPerView]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:Array.from({length:imagesPerView}).map((_,i)=>{const imageIndex=(currentIndex+i)%props.images.length;return /*#__PURE__*/_jsx(motion.img,{src:props.images[imageIndex]?.src,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},style:{width:`calc(${100/imagesPerView}% - ${spacing*(imagesPerView-1)/imagesPerView}px)`,height:\"100%\",position:\"absolute\",top:0,left:`calc(${i*100/imagesPerView}% + ${spacing*i}px)`,objectFit:\"cover\"}},`${imageIndex}-${i}`);})})});}addPropertyControls(CrossfadeSlideshow,{images:{type:ControlType.Array,control:{type:ControlType.ResponsiveImage},defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\"},{src:\"https://framerusercontent.com/images/2uTNEj5aTl2K3NJaEFWMbnrA.jpg\"},{src:\"https://framerusercontent.com/images/f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\"}],maxCount:10},interval:{type:ControlType.Number,title:\"Interval\",defaultValue:3e3,min:1e3,max:1e4,unit:\"ms\",step:100,displayStepper:true},delay:{type:ControlType.Number,title:\"Initial Delay\",defaultValue:0,min:0,max:1e4,unit:\"ms\",step:100,displayStepper:true},imagesPerView:{type:ControlType.Number,title:\"Images Per View\",defaultValue:1,min:1,max:4,step:1,displayStepper:true},spacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:0,min:0,max:50,unit:\"px\",step:1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CrossfadeSlideshow\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CrossfadeSlideshow.map"],"mappings":"A,wPAGG,SAAwBe,EAAmB,EAAM,CAAC,GAAK,CAAC,WAAS,IAAI,QAAM,EAAE,gBAAc,EAAE,UAAQ,GAAGC,EAAW,CAACC,EA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