{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/jRryFWxgo35JJliJ71gH/Hq7semBIqdrUFKRJpcU9/HoverForce_Prod.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{ControlType,addPropertyControls,RenderTarget}from\"framer\";import{useEffect,useRef,useCallback,useState}from\"react\";import{animate,useMotionValue,useTransform}from\"framer-motion\";// ------------------------------------------------------------ //\n// PROPERTY CONTROLS\n// ------------------------------------------------------------ //\naddPropertyControls(HoverForce,{threshold:{type:ControlType.Number,defaultValue:200,min:0,max:800,title:\"Area\",unit:\"px\",hidden:props=>!props.enabled},animationDistance:{type:ControlType.Number,defaultValue:200,min:0,max:800,title:\"Movement\",unit:\"px\",hidden:props=>!props.enabled},mode:{type:ControlType.Enum,defaultValue:\"repel\",options:[\"attract\",\"repel\"],optionTitles:[\"Attract\",\"Repel\"],title:\"Mode\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",hidden:props=>!props.enabled},direction:{type:ControlType.Enum,defaultValue:\"vertical\",options:[\"vertical\",\"horizontal\",\"both\"],displaySegmentedControl:true,hidden:props=>!props.enabled},smoothness:{type:ControlType.Number,defaultValue:10,min:0,max:20,step:1,title:\"Smoothing\",hidden:props=>!props.enabled},enabled:{type:ControlType.Boolean,defaultValue:true,title:\"Enabled\",description:\"More components at [Framer University](https://frameruni.link/cc).\"}});// ------------------------------------------------------------ //\n// DEFAULT PROPS\n// ------------------------------------------------------------ //\nHoverForce.defaultProps={enabled:true,threshold:200,animationDistance:200,mode:\"repel\",direction:\"vertical\",smoothness:10};// ------------------------------------------------------------ //\n// MAIN COMPONENT\n// ------------------------------------------------------------ //\n/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */export default function HoverForce(props){const isOnFramerCanvas=RenderTarget.hasRestrictions();const id=useRef(generateRandomId());const mainRef=useRef(null);const parentRef=useRef(null);const subparentRef=useRef(null);const anchorRef=useRef(null);const breakpoint=useBreakpoint();const isMobile=breakpoint===\"mobile\";// Constants\nconst ANIMATION_CONFIG=getAnimationConfig(props.smoothness);const ANIMATION_CONFIG_2={type:\"spring\",stiffness:1e3,damping:100,mass:1};const THROTTLE_INTERVAL=16// ~60fps\n;// Motion values\nconst distance=useMotionValue(props.threshold);const yDirection=useMotionValue(1);const xDirection=useMotionValue(1);const modeMultiplier=props.mode===\"attract\"?1:-1;// Transform functions\nconst yPosition=useTransform([distance,yDirection],([dist,dir])=>{if(props.direction===\"horizontal\")return 0;if(props.direction===\"both\"){if(!anchorRef.current)return 0;const mouseY=window.mouseY||0;const progress=Math.max(0,1-dist/props.threshold);const targetY=mouseY-anchorRef.current.y;return targetY*progress*modeMultiplier;}const progress=Math.max(0,1-dist/props.threshold);const baseMovement=progress*props.animationDistance;return baseMovement*dir*modeMultiplier;});const xPosition=useTransform([distance,xDirection],([dist,dir])=>{if(props.direction===\"vertical\")return 0;if(props.direction===\"both\"){if(!anchorRef.current)return 0;const mouseX=window.mouseX||0;const progress=Math.max(0,1-dist/props.threshold);const targetX=mouseX-anchorRef.current.x;return targetX*progress*modeMultiplier;}const progress=Math.max(0,1-dist/props.threshold);const baseMovement=progress*props.animationDistance;return baseMovement*dir*modeMultiplier;});// Add window mouse position tracking\nconst[mousePos,setMousePos]=useState({x:0,y:0});// ------------------------------------------------------------ //\n// CALLBACKS\n// ------------------------------------------------------------ //\nconst initializeParent=useCallback(()=>{if(!mainRef.current||!props.enabled||isMobile)return;const subparent=mainRef.current.parentElement;if(!subparent)return;subparentRef.current=subparent;const parent=subparent.parentElement;if(!parent)return;parentRef.current=parent;parent.setAttribute(\"data-hover-force\",id.current);const rect=parent.getBoundingClientRect();anchorRef.current={x:rect.left+rect.width/2,y:rect.top+rect.height/2};// Remove the initial transform and transition\nparent.style.willChange=\"transform\";parent.style.transform=\"none\";// Don't set initial transition to allow Framer Motion to handle it\n},[]);const handleMouseMove=useCallback(e=>{if(!anchorRef.current||!props.enabled||isMobile||!window)return;window.mouseX=e.clientX;window.mouseY=e.clientY;const mousePoint={x:e.clientX,y:e.clientY};const newDistance=calculateDistance(mousePoint,anchorRef.current);if(props.direction===\"both\"){// For \"both\" direction, we only need the distance for threshold calculation\nanimate(distance,// @ts-expect-error want motion value, but don't work with it\nMath.min(newDistance,props.threshold),ANIMATION_CONFIG_2);}else{// Original behavior for vertical/horizontal\nconst newYDirection=e.clientY>anchorRef.current.y?1:-1;const newXDirection=e.clientX>anchorRef.current.x?1:-1;// @ts-expect-error want motion value, but don't work with it\nanimate(yDirection,newYDirection,ANIMATION_CONFIG_2);// @ts-expect-error want motion value, but don't work with it\nanimate(xDirection,newXDirection,ANIMATION_CONFIG_2);animate(distance,// @ts-expect-error want motion value, but don't work with it\nMath.min(newDistance,props.threshold),ANIMATION_CONFIG_2);}},[props.threshold,props.direction]);const createThrottledMouseHandler=useCallback(()=>{let timeout=null;return e=>{if(timeout)return;timeout=setTimeout(()=>{handleMouseMove(e);timeout=null;},THROTTLE_INTERVAL);};},[handleMouseMove]);// ------------------------------------------------------------ //\n// EFFECTS\n// ------------------------------------------------------------ //\n// Initialize parent element\nuseEffect(()=>{initializeParent();},[initializeParent]);// Setup mouse move handler\nuseEffect(()=>{if(isOnFramerCanvas||!anchorRef.current||!props.enabled||isMobile)return;const throttledHandler=createThrottledMouseHandler();window.addEventListener(\"mousemove\",throttledHandler);// Update parent transform based on positions\nconst unsubscribe=()=>{const yUnsub=yPosition.on(\"change\",latestY=>{const latestX=xPosition.get();if(parentRef.current){animate(parentRef.current,// @ts-expect-error overloads\n{x:latestX,y:latestY},{...ANIMATION_CONFIG,immediate:true});}});const xUnsub=xPosition.on(\"change\",latestX=>{const latestY=yPosition.get();if(parentRef.current){animate(parentRef.current,// @ts-expect-error overloads\n{x:latestX,y:latestY},{...ANIMATION_CONFIG,immediate:true});}});return()=>{yUnsub();xUnsub();};};const cleanup=unsubscribe();return()=>{window.removeEventListener(\"mousemove\",throttledHandler);if(cleanup)cleanup();};},[props.threshold,props.animationDistance,props.mode,props.direction,isOnFramerCanvas,createThrottledMouseHandler,yPosition,xPosition]);return /*#__PURE__*/_jsx(\"div\",{ref:mainRef,style:{width:\"0px\",height:\"0px\"}});}// ------------------------------------------------------------ //\n// UTILITY FUNCTIONS\n// ------------------------------------------------------------ //\nconst generateRandomId=()=>Math.random().toString(36).substring(2,15);const calculateDistance=(point1,point2)=>{return Math.sqrt(Math.pow(point2.x-point1.x,2)+Math.pow(point2.y-point1.y,2));};const getAnimationConfig=smoothness=>{const stiffness=800+smoothness*20;const damping=50+smoothness*10;const mass=1;return{type:\"spring\",stiffness,damping,mass};};function useBreakpoint(){// const [isMobile, setIsMobile] = useState(false);\nconst[breakpoint,setBreakpoint]=useState(null);useEffect(()=>{const checkBreakpoint=()=>{if(window.innerWidth<=809){setBreakpoint(\"mobile\");}else if(window.innerWidth<=1199){setBreakpoint(\"tablet\");}else{setBreakpoint(\"desktop\");}};checkBreakpoint();window.addEventListener(\"resize\",checkBreakpoint);return()=>window.removeEventListener(\"resize\",checkBreakpoint);},[]);return breakpoint;}HoverForce.displayName=\"Hover Force\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HoverForce\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HoverForce_Prod.map"],
  "mappings": "0LAGAA,EAAoBC,EAAW,CAAC,UAAU,CAAC,KAAKC,EAAY,OAAO,aAAa,IAAI,IAAI,EAAE,IAAI,IAAI,MAAM,OAAO,KAAK,KAAK,OAAOC,GAAO,CAACA,EAAM,OAAO,EAAE,kBAAkB,CAAC,KAAKD,EAAY,OAAO,aAAa,IAAI,IAAI,EAAE,IAAI,IAAI,MAAM,WAAW,KAAK,KAAK,OAAOC,GAAO,CAACA,EAAM,OAAO,EAAE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,GAAe,CAC3X,GAAK,CAACkD,EAAWC,CAAa,EAAE9B,EAAS,IAAI,EAAE,OAAAgB,EAAU,IAAI,CAAC,IAAMe,EAAgB,IAAI,CAAIrC,EAAO,YAAY,IAAKoC,EAAc,QAAQ,EAAWpC,EAAO,YAAY,KAAMoC,EAAc,QAAQ,EAAQA,EAAc,SAAS,CAAG,EAAE,OAAAC,EAAgB,EAAErC,EAAO,iBAAiB,SAASqC,CAAe,EAAQ,IAAIrC,EAAO,oBAAoB,SAASqC,CAAe,CAAE,EAAE,CAAC,CAAC,EAASF,CAAW,CAAC/D,EAAW,YAAY",
  "names": ["addPropertyControls", "HoverForce", "ControlType", "props", "isOnFramerCanvas", "RenderTarget", "id", "pe", "generateRandomId", "mainRef", "parentRef", "subparentRef", "anchorRef", "isMobile", "useBreakpoint", "ANIMATION_CONFIG", "getAnimationConfig", "ANIMATION_CONFIG_2", "THROTTLE_INTERVAL", "distance", "useMotionValue", "yDirection", "xDirection", "modeMultiplier", "yPosition", "useTransform", "dist", "dir", "mouseY", "window", "progress", "xPosition", "mouseX", "mousePos", "setMousePos", "ye", "initializeParent", "te", "subparent", "parent", "rect", "handleMouseMove", "e", "mousePoint", "newDistance", "calculateDistance", "animate", "newYDirection", "newXDirection", "createThrottledMouseHandler", "timeout", "ue", "throttledHandler", "cleanup", "yUnsub", "latestY", "latestX", "xUnsub", "p", "point1", "point2", "smoothness", "stiffness", "damping", "breakpoint", "setBreakpoint", "checkBreakpoint"]
}
