{"version":3,"file":"FollowCursorGlow.DRPmkRYb.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/s47Sk7uFYU5hbqZUkObj/uXdadeBNNFqbVQK53NE4/FollowCursorGlow.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useMemo,useRef}from\"react\";import{useIsStaticRenderer}from\"framer\";/**\n * User request:\n * Create a Framer code override named FollowCursorGlow for an existing canvas glow wrapper inside a button component.\n * The canvas layer must remain editable; the override should only add runtime pointer-follow movement.\n */const DEFAULT_STRENGTH=.75;const DEFAULT_SMOOTHING=.16;const DEFAULT_RESET_DURATION=.28;function getNearestInteractiveContainer(startElement){const selector=\"button, a, [role='button'], [role='link']\";const matched=startElement.closest(selector);if(matched instanceof HTMLElement)return matched;if(startElement.parentElement instanceof HTMLElement)return startElement.parentElement;return null;}export function FollowCursorGlow(Component){return /*#__PURE__*/forwardRef(function FollowCursorGlowOverride(props,forwardedRef){const localRef=useRef(null);const isStatic=useIsStaticRenderer();const prefersReducedMotion=useMemo(()=>{if(typeof window===\"undefined\")return false;return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;},[]);const strength=typeof props.strength===\"number\"?Math.max(0,Math.min(1.5,props.strength)):DEFAULT_STRENGTH;const smoothing=typeof props.smoothing===\"number\"?Math.max(.02,Math.min(1,props.smoothing)):DEFAULT_SMOOTHING;const resetDuration=typeof props.resetDuration===\"number\"?Math.max(.05,Math.min(2,props.resetDuration)):DEFAULT_RESET_DURATION;useEffect(()=>{const node=localRef.current;if(!node)return;const inlineBaseTransform=node.style.transform;const computedBaseTransform=typeof window!==\"undefined\"?window.getComputedStyle(node).transform:\"\";const baseTransform=inlineBaseTransform&&inlineBaseTransform!==\"none\"?inlineBaseTransform:computedBaseTransform&&computedBaseTransform!==\"none\"?computedBaseTransform:\"\";if(isStatic||prefersReducedMotion){node.style.transform=baseTransform||\"none\";return;}const container=getNearestInteractiveContainer(node);if(!container)return;const target={x:0,y:0};const current={x:0,y:0};let isHovering=false;let raf=0;const render=()=>{const easing=isHovering?smoothing:Math.min(1,16.67/(resetDuration*1e3));current.x+=(target.x-current.x)*easing;current.y+=(target.y-current.y)*easing;const followTransform=`translate3d(${current.x.toFixed(2)}px, ${current.y.toFixed(2)}px, 0)`;node.style.transform=baseTransform?`${baseTransform} ${followTransform}`:followTransform;raf=window.requestAnimationFrame(render);};const onPointerMove=event=>{const bounds=container.getBoundingClientRect();const localX=event.clientX-bounds.left;const localY=event.clientY-bounds.top;const deltaX=localX-bounds.width/2;const deltaY=localY-bounds.height/2;target.x=deltaX*strength;target.y=deltaY*strength;};const onPointerEnter=event=>{isHovering=true;onPointerMove(event);};const onPointerLeave=()=>{isHovering=false;target.x=0;target.y=0;};container.addEventListener(\"pointerenter\",onPointerEnter);container.addEventListener(\"pointermove\",onPointerMove);container.addEventListener(\"pointerleave\",onPointerLeave);raf=window.requestAnimationFrame(render);return()=>{container.removeEventListener(\"pointerenter\",onPointerEnter);container.removeEventListener(\"pointermove\",onPointerMove);container.removeEventListener(\"pointerleave\",onPointerLeave);if(raf)window.cancelAnimationFrame(raf);node.style.transform=baseTransform||\"none\";};},[isStatic,prefersReducedMotion,resetDuration,smoothing,strength]);return /*#__PURE__*/_jsx(Component,{...props,ref:instance=>{localRef.current=instance;if(typeof forwardedRef===\"function\"){forwardedRef(instance);}else if(forwardedRef&&\"current\"in forwardedRef){forwardedRef.current=instance;}},style:{...props.style,pointerEvents:\"none\",willChange:\"transform\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"FollowCursorGlow\":{\"type\":\"reactHoc\",\"name\":\"FollowCursorGlow\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FollowCursorGlow.map"],"mappings":"kMAI2F,SAAS,EAA+B,EAAa,CAA4D,IAAM,EAAQ,EAAa,QAAQ,2CAAQ,EAA0I,OAArI,aAAmB,YAAmB,EAAW,EAAa,y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