{"version":3,"file":"IconSlideshow.BWRf0CUm.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/T92WashNkA0omexWsxlC/RvTHdCsCodcAn5vbStpS/IconSlideshow.js"],"sourcesContent":["// Slideshow that cycles through user-provided 64x64 icons, one at a time, switching every 0.1s, no controls or indicators\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Icon Slideshow\n *\n * @framerIntrinsicWidth 64\n * @framerIntrinsicHeight 64\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function IconSlideshow(props){const{icons=[null],speed=.1,loopMode=\"infinite\",loopCount=1,style}=props;const[index,setIndex]=useState(0);const[loops,setLoops]=useState(0);const intervalRef=useRef(null);const iconCount=icons.length;useEffect(()=>{setIndex(0);setLoops(0);},[iconCount,loopMode,loopCount]);useEffect(()=>{if(iconCount<2)return;if(intervalRef.current)clearInterval(intervalRef.current);if(loopMode===\"count\"&&loopCount<=0)return;intervalRef.current=window.setInterval(()=>{startTransition(()=>{setIndex(i=>{const next=i+1;if(next>=iconCount){if(loopMode===\"infinite\"){setLoops(l=>l+1);return 0;}else{setLoops(l=>{if(l+1>=loopCount){if(intervalRef.current)clearInterval(intervalRef.current);return l+1;}else{return l+1;}});if(loops+1>=loopCount){return iconCount-1;}return 0;}}return next;});});},Math.max(50,speed*1e3));return()=>{if(intervalRef.current)clearInterval(intervalRef.current);};},[iconCount,speed,loopMode,loopCount,loops]);const icon=icons[index]||icons[0];return /*#__PURE__*/_jsx(\"div\",{style:{...style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:icon&&typeof icon===\"object\"&&\"type\"in icon?// If it's a React element, clone with size props if possible\n// Try to pass width/height if supported\n// Otherwise, just render as is\n// This will work for most SVG/icon components\n// @ts-ignore\nicon.type&&(icon.props?.width!==undefined||icon.props?.height!==undefined)?// @ts-ignore\n/*#__PURE__*/React.cloneElement(icon,{width:\"100%\",height:\"100%\",style:{width:\"100%\",height:\"100%\",maxWidth:\"100%\",maxHeight:\"100%\",display:\"block\",...icon.props?.style||{}}}):/*#__PURE__*/React.cloneElement(icon,{style:{width:\"100%\",height:\"100%\",maxWidth:\"100%\",maxHeight:\"100%\",display:\"block\",...icon.props?.style||{}}}):icon})});}addPropertyControls(IconSlideshow,{icons:{type:ControlType.Array,title:\"Icons\",control:{type:ControlType.ComponentInstance},defaultValue:[],maxCount:20},speed:{type:ControlType.Number,title:\"Speed (s)\",defaultValue:.1,min:.05,max:2,step:.01,unit:\"s\",displayStepper:false},loopMode:{type:ControlType.Enum,title:\"Loop\",options:[\"infinite\",\"count\"],optionTitles:[\"Infinite\",\"Count\"],defaultValue:\"infinite\",displaySegmentedControl:true},loopCount:{type:ControlType.Number,title:\"Loop Count\",defaultValue:1,min:1,max:100,step:1,displayStepper:true,hidden:({loopMode})=>loopMode!==\"count\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"IconSlideshow\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"64\",\"framerIntrinsicWidth\":\"64\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./IconSlideshow.map"],"mappings":"oNASG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,EAAE,QAAM,GAAG,WAAS,WAAW,YAAU,EAAE,SAAO,EAAW,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAO,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAQ,EAAYC,EAAO,IAAI,EAA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