{"version":3,"file":"WithCursorFollow.Bc4B_5Ce.mjs","names":["React.useRef","React.useState","React.useCallback","__esmMin","init_ssg_sandbox_shims","te","ne","window","_e","J","init_jsx_runtime","ce","init_npm_react_18_3_1","de","useInView","init_framer_motion_DhsWWWsN","init_framer_Bf4_tcb2","useIsStaticRenderer","setComposedRef","ref","value","withCursorFollow","isStatic","rootRef","isInView","rotation","setRotation","currentRotationRef","targetRotationRef","rafRef","assignRef","node","updateTarget","element","rect","centerX","centerY","dx","clientX","dy","clientY","angleDeg","onMouseMove","event","mounted","tick","next","appliedRotation","existingTransform","props","mergedTransform","Component","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,SAASkB,EAAe,EAAI,EAAM,CAAI,OAAOC,GAAM,WAAYA,EAAIC,CAAK,EAAaD,GAAK,OAAOA,GAAM,WAAU,EAAI,QAAQC,EAAO,CAAC,SAAgBC,EAAiB,EAAU,CAAC,MAAoB,gBAAW,SAA0B,EAAM,EAAI,CAAC,IAAMC,EAASL,EAAoB,EAAQM,EAAQvB,EAAa,IAAI,EAAQwB,EAASV,EAAUS,EAAQ,CAAC,OAAO,EAAE,CAAC,EAAO,CAACE,EAASC,GAAazB,EAAe,CAAC,EAAQ0B,EAAmB3B,EAAa,CA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