{"version":3,"file":"RandomMove.Bki0MUcT.mjs","names":["useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/ggB0sLy0pjGInulQCuC6/W3NszDV6Q2Ezk1iFdgXd/RandomMove.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useAnimation}from\"framer\";import{useEffect,useRef}from\"react\";export function SmoothHorizontalMove(){const animation=useAnimation();const screenWidth=1100;const minPosition=-600;const maxPosition=screenWidth-300;const directionRef=useRef(1);let animationTimeout;let resizeTimeout;useEffect(()=>{let isMounted=true;let animationRunning=false;const move=()=>{if(!isMounted)return;const newPosition=directionRef.current===1?maxPosition:minPosition;animation.start({x:newPosition,y:Math.random()*400-200,transition:{duration:10}}).then(()=>{if(isMounted){directionRef.current*=-1;animationTimeout=window.setTimeout(move,100);}});};const handleResize=()=>{clearTimeout(resizeTimeout);resizeTimeout=window.setTimeout(()=>{const width=window.innerWidth;if(width>809){if(!animationRunning){animationRunning=true;move();}}else{animation.stop();animationRunning=false;clearTimeout(animationTimeout);}},200)// Debounced resize handling\n;};window.addEventListener(\"resize\",handleResize);handleResize();return()=>{isMounted=false;clearTimeout(animationTimeout);clearTimeout(resizeTimeout);window.removeEventListener(\"resize\",handleResize);};},[animation]);return{animate:animation};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withSmoothHorizontalMove(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SmoothHorizontalMove(props)});};}withSmoothHorizontalMove.displayName=\"SmoothHorizontalMove\";\nexport const __FramerMetadata__ = {\"exports\":{\"SmoothHorizontalMove\":{\"type\":\"override\",\"name\":\"SmoothHorizontalMove\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSmoothHorizontalMove\":{\"type\":\"reactHoc\",\"name\":\"withSmoothHorizontalMove\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RandomMove.map"],"mappings":"yOAAgH,SAAgB,GAAsB,CAAC,IAAM,EAAU,GAAc,CAAuF,EAAaA,EAAO,EAAE,CAAK,EAAqB,EAClG,OADgH,MAAc,CAAC,IAAI,EAAU,GAAS,EAAiB,GAAY,MAAS,CAAC,GAAG,CAAC,EAAU,OAAO,IAAM,EAAY,EAAa,UAAU,EAAE,IAAY,KAAY,EAAU,MAAM,CAAC,EAAE,EAAY,EAAE,KAAK,QAAQ,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAI,IAAW,EAAa,SAAS,GAAG,EAAiB,EAAO,WAAW,EAAK,IAAI,GAAI,EAAS,MAAiB,CAAC,aAAa,EAAc,CAAC,EAAc,EAAO,eAAe,CAAa,EAAO,WAAoB,IAAS,IAAkB,EAAiB,GAAK,GAAM,GAAQ,EAAU,MAAM,CAAC,EAAiB,GAAM,aAAa,EAAiB,GAAI,IAAI,EACj3B,OAA9D,EAAO,iBAAiB,SAAS,EAAa,CAAC,GAAc,KAAW,CAAC,EAAU,GAAM,aAAa,EAAiB,CAAC,aAAa,EAAc,CAAC,EAAO,oBAAoB,SAAS,EAAa,GAAK,CAAC,EAAU,CAAC,CAAO,CAAC,QAAQ,EAAU,CAAqJ,SAAgB,EAAyB,EAAE,CAAC,MAAO,KAAQ,EAA+BC,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAqB,EAAM,CAAC,CAAC,uBADxhB,IAAiC,IAAoC,CACud,EAAyB,YAAY"}