{"version":3,"file":"WithFadeCarousel.RxtLhhCe.mjs","names":["useMemo","Children","useState","WrappedComponent"],"sources":["https:/framerusercontent.com/modules/lQAR8s3aJQATjOb2zTWt/Ep8E53C9vLYOAM3Wmz6d/WithFadeCarousel.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{Children,cloneElement,forwardRef,isValidElement,startTransition,useEffect,useMemo,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";// ── Carousel timing (edit these) ──\nconst INTERVAL_SECONDS=1.2// how long each image stays fully visible\n;const FADE_SECONDS=.6// crossfade duration\n;export function withFadeCarousel(Component){return /*#__PURE__*/forwardRef(function WithFadeCarousel(props,ref){const isStaticRenderer=useIsStaticRenderer();const slides=useMemo(()=>Children.toArray(props.children),[props.children]);const slideCount=slides.length;const[activeIndex,setActiveIndex]=useState(0);useEffect(()=>{if(slideCount<=0){startTransition(()=>setActiveIndex(0));return;}startTransition(()=>{setActiveIndex(prev=>prev>=slideCount?0:prev);});},[slideCount]);useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;if(isStaticRenderer)return;if(slideCount<2)return;const intervalId=window.setInterval(()=>{startTransition(()=>{setActiveIndex(prev=>(prev+1)%slideCount);});},INTERVAL_SECONDS*1e3);return()=>{window.clearInterval(intervalId);};},[isStaticRenderer,slideCount]);const mappedChildren=useMemo(()=>{return Children.map(slides,(child,index)=>{const isActive=index===(slideCount>0?activeIndex:0);if(!/*#__PURE__*/isValidElement(child))return child;const childStyle=child.props?.style??{};return /*#__PURE__*/cloneElement(child,{style:{...childStyle,opacity:isActive?1:0,transition:`opacity ${FADE_SECONDS}s ease-in-out`,pointerEvents:isActive?\"auto\":\"none\"},\"aria-hidden\":!isActive});});},[activeIndex,slideCount,slides]);const WrappedComponent=Component;return /*#__PURE__*/_jsx(WrappedComponent,{ref:ref,...props,children:mappedChildren});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withFadeCarousel\":{\"type\":\"reactHoc\",\"name\":\"withF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