{"version":3,"file":"WithCursorFollow.C5xWBbOC.mjs","names":["forwardRef","React.useRef","React.useState","React.useCallback","React.useEffect","React.startTransition","_jsx","__esmMin","init_ssg_sandbox_shims","te","ne","window","_e","J","init_jsx_runtime","ce","init_npm_react_18_3_1","de","init_framer_BWzg2IRg","useIsStaticRenderer","useInView","init_framer_motion_1EwlFBEG","setComposedRef","ref","value","withCursorFollow","Component","props","isStatic","rootRef","isInView","rotation","setRotation","currentRotationRef","targetRotationRef","rafRef","assignRef","node","updateTarget","clientX","clientY","element","rect","centerX","centerY","dx","dy","angleDeg","onMouseMove","event","mounted","tick","next","appliedRotation","existingTransform","mergedTransform","c","init_WithCursorFollow"],"sources":["https:/framerusercontent.com/modules/MIbK4cR1lt0iFfkTFm3a/giW20Uiyt17LlITWgSvj/WithCursorFollow.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{forwardRef}from\"react\";import{useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";// User request: Create a new Framer code override export named \"withCursorFollow\" as an HOC that tracks mouse position, computes angle from element center, applies smoothed rotate transform with +90deg offset, supports SSR/static render safety, pauses offscreen, and preserves wrapped component styling/size/appearance.\nfunction setComposedRef(ref,value){if(typeof ref===\"function\"){ref(value);return;}if(ref&&typeof ref===\"object\"){ref.current=value;}}export function withCursorFollow(Component){return /*#__PURE__*/forwardRef(function WithCursorFollow(props,ref){const isStatic=useIsStaticRenderer();const rootRef=React.useRef(null);const isInView=useInView(rootRef,{amount:.1});const[rotation,setRotation]=React.useState(0);const currentRotationRef=React.useRef(0);const targetRotationRef=React.useRef(0);const rafRef=React.useRef(null);const assignRef=React.useCallback(node=>{rootRef.current=node;setComposedRef(ref,node);},[ref]);const updateTarget=React.useCallback((clientX,clientY)=>{const element=rootRef.current;if(!element)return;const rect=element.getBoundingClientRect();const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;const dx=clientX-centerX;const dy=clientY-centerY;const angleDeg=Math.atan2(dy,dx)*180/Math.PI+90;targetRotationRef.current=angleDeg;},[]);React.useEffect(()=>{if(isStatic)return;if(typeof window===\"undefined\")return;const onMouseMove=event=>{updateTarget(event.clientX,event.clientY);};window.addEventListener(\"mousemove\",onMouseMove);return()=>{window.removeEventListener(\"mousemove\",onMouseMove);};},[isStatic,updateTarget]);React.useEffect(()=>{if(isStatic||!isInView)return;if(typeof window===\"undefined\")return;let mounted=true;const smoothing=.06;const tick=()=>{if(!mounted)return;const next=currentRotationRef.current+(targetRotationRef.current-currentRotationRef.current)*smoothing;currentRotationRef.current=next;React.startTransition(()=>{setRotation(next);});rafRef.current=window.requestAnimationFrame(tick);};rafRef.current=window.requestAnimationFrame(tick);return()=>{mounted=false;if(rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);}};},[isStatic,isInView]);const appliedRotation=isStatic?0:rotation;const existingTransform=props?.style?.transform;const mergedTransform=existingTransform?`rotate(${appliedRotation}deg) ${existingTransform}`:`rotate(${appliedRotation}deg)`;return /*#__PURE__*/_jsx(Component,{ref:assignRef,...props,style:{...props.style,transform:mergedTransform,transformOrigin:props?.style?.transformOrigin??\"50% 50%\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCursorFollow\":{\"type\":\"reactHoc\",\"name\":\"withCursorFollow\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithCursorFollow.map"],"mappings":"A,iQACA,SAASsB,EAAeC,EAAIC,EAAM,CAAI,OAAOD,GAAM,WAAYA,EAAIC,CAAK,EAAaD,GAAK,OAAOA,GAAM,WAAUA,EAAI,QAAQC,EAAO,CAAC,SAAgBC,EAAiBC,EAAU,CAAC,MAAoB1B,gBAAW,SAA0B2B,EAAMJ,EAAI,CAAC,IAAMK,EAAST,EAAoB,EAAQU,EAAQ5B,EAAa,IAAI,EAAQ6B,EAASV,EAAUS,EAAQ,CAAC,OAAO,EAAE,CAAC,EAAO,CAACE,EAASC,GAA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