{"version":3,"file":"ImageRotator.DFSAZfma.mjs","names":["useRef","useMemo","useState","useCallback","startTransition","useEffect","_jsx","__esmMin","init_ssg_sandbox_shims","te","ne","_e","de","init_jsx_runtime","pe","init_npm_react_18_3_1","ce","window","addPropertyControls","useIsStaticRenderer","ControlType","init_framer_ChujFWHC","useInView","init_framer_motion_1EwlFBEG","motion","ImageRotator","props","image1","image2","image3","delaySeconds","fitMode","style","rootRef","isInView","isStaticRenderer","images","image","currentIndex","setCurrentIndex","normalizedDelayMs","shouldAnimate","goToNext","prev","intervalId","firstImage","index","init_ImageRotator"],"sources":["https:/framerusercontent.com/modules/dQEzCYW9WQ3TIlGJiOfO/jD0cRyzbRSkdEtYXAoXC/ImageRotator.js"],"sourcesContent":["// User request: Create a new Framer code component named ImageRotator for use inside the existing “Image Right Feature” canvas component. It needs three optional image controls (image1 required-ish, image2 and image3 optional) and a numeric delaySeconds control that represents seconds between frames, default 4, with sensible minimum 1 and step 0.5. Rotate only through supplied images in sequence, using a soft cross-fade transition between frames. Preserve cover cropping, fill its parent width and height, use rounded-corner clipping inherited from the parent, and render a stable static first image in the Framer canvas/editor where animation is inappropriate. Make no external network calls. Expose the images and timing as editable Framer property controls. This will be placed inside a canvas Frame with an existing rounded media surface, so avoid hardcoding page-level margins, colors, or dimensions.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ImageRotator(props){const{image1,image2,image3,delaySeconds=4,fitMode=\"cover\",style}=props;const rootRef=useRef(null);const isInView=useInView(rootRef,{amount:.2});const isStaticRenderer=useIsStaticRenderer();const images=useMemo(()=>{return[image1,image2,image3].filter(image=>Boolean(image));},[image1,image2,image3]);const[currentIndex,setCurrentIndex]=useState(0);const normalizedDelayMs=useMemo(()=>Math.max(1,delaySeconds)*1e3,[delaySeconds]);const shouldAnimate=useMemo(()=>{return!isStaticRenderer&&isInView&&images.length>1;},[images.length,isInView,isStaticRenderer]);const goToNext=useCallback(()=>{startTransition(()=>{setCurrentIndex(prev=>(prev+1)%images.length);});},[images.length]);useEffect(()=>{if(!shouldAnimate)return;const intervalId=window.setInterval(goToNext,normalizedDelayMs);return()=>window.clearInterval(intervalId);},[goToNext,normalizedDelayMs,shouldAnimate]);useEffect(()=>{if(currentIndex<images.length)return;startTransition(()=>{setCurrentIndex(0);});},[currentIndex,images.length]);const firstImage=images[0];if(!firstImage){return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",...style}});}if(!shouldAnimate){return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:\"inherit\",...style},children:/*#__PURE__*/_jsx(\"img\",{src:firstImage,alt:\"\",style:{width:\"100%\",height:\"100%\",objectFit:fitMode,display:\"block\"}})});}return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:\"inherit\",...style},children:images.map((image,index)=>/*#__PURE__*/_jsx(motion.img,{src:image,alt:\"\",initial:false,animate:{opacity:index===currentIndex?1:0},transition:{duration:.8,ease:\"easeInOut\"},style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fitMode,display:\"block\"}},`${image}-${index}`))});}addPropertyControls(ImageRotator,{image1:{type:ControlType.Image,title:\"Image 1\"},image2:{type:ControlType.Image,title:\"Image 2\"},image3:{type:ControlType.Image,title:\"Image 3\"},delaySeconds:{type:ControlType.Number,title:\"Delay\",defaultValue:4,min:1,step:.5,unit:\"s\"},fitMode:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageRotator\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageRotator.map"],"mappings":"A,2RAIG,SAAwByB,EAAaC,EAAM,CAAC,GAAK,CAACC,SAAOC,SAAOC,SAAOC,eAAa,EAAEC,UAAQ,QAAQC,SAAON,EAAYO,EAAQjC,EAAO,IAAI,EAAQkC,EAASZ,EAAUW,EAAQ,CAAC,OAAO,EAAE,CAAC,EAAQE,EAAiBhB,EAAoB,EAAQiB,EAAOnC,MAAmB,CAAC0B,EAAOC,EAAOC,CAAM,CAAC,CAAC,OAAOQ,GAAO,EAAQA,CAAM,EAAI,CAACV,EAAOC,EAAOC,CAAM,CAAC,EAAO,CAACS,EAAaC,GAAiBrC,EAAS,CAAC,EAAQsC,EAAkBvC,MAAY,KAAK,IAAI,EAAE6B,CAAY,EAAE,IAAI,CAACA,CAAY,CAAC,EAAQW,EAAcxC,MAAmB,CAACkC,GAAkBD,GAAUE,EAAO,OAAO,EAAI,CAACA,EAAO,OAAOF,EAASC,CAAgB,CAAC,EAAQO,EAASvC,MAAgB,CAACC,MAAoB,CAACmC,EAAgBI,IAAOA,EAAK,GAAGP,EAAO,MAAM,CAAE,CAAC,CAAE,EAAE,CAACA,EAAO,MAAM,CAAC,EAAE/B,MAAc,CAAC,GAAG,CAACoC,EAAc,OAAO,IAAMG,EAAW3B,EAAO,YAAYyB,EAASF,CAAiB,EAAE,UAAUvB,EAAO,cAAc2B,CAAU,CAAE,EAAE,CAACF,EAASF,EAAkBC,CAAa,CAAC,EAAEpC,MAAc,CAAIiC,EAAaF,EAAO,QAAchC,MAAoB,CAACmC,EAAgB,CAAC,CAAE,CAAC,CAAE,EAAE,CAACD,EAAaF,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