{"version":3,"file":"WithCursorBend.DsJIFQVD.mjs","names":["forwardRef","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/M2R9DNe4D4DfzDb1bu5N/DmaFtlH3D9qye958UYlq/WithCursorBend.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{forwardRef,useCallback,useEffect,useMemo,useRef}from\"react\";import{useInView}from\"framer-motion\";// User request: Create a Framer code override named withCursorBend that applies a smooth cursor-tracked bend/warp effect (CSS transform based) with reset on leave, local per-instance behavior, and configurable intensity + damping.\n// @framerDisableUnlink true\nexport function withCursorBend(Component){const Wrapped=/*#__PURE__*/forwardRef(function WithCursorBend(props,ref){const{bendIntensity=10,bendDamping=.16,onPointerMove,onMouseMove,onPointerLeave,onMouseLeave,style,...rest}=props;const localRef=useRef(null);const baseTransformRef=useRef(\"\");const baseFilterRef=useRef(\"\");const isStatic=useIsStaticRenderer();const isInView=useInView(localRef,{margin:\"100px\"});const frameRef=useRef(null);const currentRef=useRef({x:0,y:0,glow:0});const targetRef=useRef({x:0,y:0,glow:0});const hoveringRef=useRef(false);const damping=useMemo(()=>Math.min(.45,Math.max(.04,bendDamping)),[bendDamping]);const intensity=useMemo(()=>Math.min(30,Math.max(2,bendIntensity)),[bendIntensity]);const applyTransform=useCallback(()=>{const node=localRef.current;if(!node)return;const current=currentRef.current;const target=targetRef.current;const dx=target.x-current.x;const dy=target.y-current.y;const dg=target.glow-current.glow;current.x+=dx*damping;current.y+=dy*damping;current.glow+=dg*(damping*.85);const effectTransform=`perspective(900px) rotateX(${(-current.y).toFixed(3)}deg) rotateY(${current.x.toFixed(3)}deg) scale3d(${(1+Math.abs(current.glow)*.003).toFixed(4)}, ${(1+Math.abs(current.glow)*.003).toFixed(4)}, 1)`;const effectFilter=`saturate(${(1+current.glow*.03).toFixed(3)}) contrast(${(1+current.glow*.02).toFixed(3)})`;const baseTransform=baseTransformRef.current;const baseFilter=baseFilterRef.current;node.style.transform=baseTransform?`${baseTransform} ${effectTransform}`:effectTransform;node.style.filter=baseFilter?`${baseFilter} ${effectFilter}`:effectFilter;node.style.transformStyle=\"preserve-3d\";node.style.willChange=\"transform, filter\";node.style.transition=hoveringRef.current?\"none\":\"transform 420ms cubic-bezier(0.22, 1, 0.36, 1), filter 420ms cubic-bezier(0.22, 1, 0.36, 1)\";const settled=Math.abs(dx)<.005&&Math.abs(dy)<.005&&Math.abs(dg)<.005;if(!settled){frameRef.current=requestAnimationFrame(applyTransform);}else{frameRef.current=null;}},[damping]);const startAnimationLoop=useCallback(()=>{if(frameRef.current!==null||isStatic||!isInView)return;frameRef.current=requestAnimationFrame(applyTransform);},[applyTransform,isInView,isStatic]);const handlePointerMove=useCallback(event=>{onPointerMove?.(event);onMouseMove?.(event);if(isStatic||!isInView)return;const node=localRef.current;if(!node)return;const rect=node.getBoundingClientRect();if(!rect.width||!rect.height)return;const px=(event.clientX-rect.left)/rect.width;const py=(event.clientY-rect.top)/rect.height;const nx=(px-.5)*2;const ny=(py-.5)*2;hoveringRef.current=true;targetRef.current.x=nx*intensity;targetRef.current.y=ny*intensity;targetRef.current.glow=Math.min(1,Math.sqrt(nx*nx+ny*ny));startAnimationLoop();},[intensity,isInView,isStatic,onMouseMove,onPointerMove,startAnimationLoop]);const reset=useCallback(event=>{if(event){onPointerLeave?.(event);onMouseLeave?.(event);}hoveringRef.current=false;targetRef.current.x=0;targetRef.current.y=0;targetRef.current.glow=0;startAnimationLoop();},[onMouseLeave,onPointerLeave,startAnimationLoop]);useEffect(()=>{return()=>{if(frameRef.current!==null)cancelAnimationFrame(frameRef.current);};},[]);useEffect(()=>{if(!isInView)reset();},[isInView,reset]);useEffect(()=>{baseTransformRef.current=typeof style?.transform===\"string\"?style.transform:\"\";baseFilterRef.current=typeof style?.filter===\"string\"?style.filter:\"\";},[style]);return /*#__PURE__*/_jsx(\"div\",{ref:localRef,style:{...style||{},position:style?.position??\"relative\",transformOrigin:\"50% 50%\",cursor:style?.cursor??\"default\",width:style?.width??\"100%\",height:style?.height??\"100%\"},onPointerMove:handlePointerMove,onMouseMove:handlePointerMove,onPointerLeave:reset,onMouseLeave:reset,children:/*#__PURE__*/_jsx(Component,{...rest,ref:ref,style:{width:\"100%\",height:\"100%\"}})});});return Wrapped;}addPropertyControls(withCursorBend,{bendIntensity:{type:ControlType.Number,title:\"Intensity\",defaultValue:10,min:2,max:30,step:1},bendDamping:{type:ControlType.Number,title:\"Damping\",defaultValue:.16,min:.04,max:.45,step:.01}});\nexport const __FramerMetadata__ = {\"exports\":{\"withCursorBend\":{\"type\":\"reactHoc\",\"name\":\"withCursorBend\",\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithCursorBend.map"],"mappings":"+PAEA,SAAgB,EAAe,EAAU,CAAwsH,OAA5qHA,EAAW,SAAwB,EAAM,EAAI,CAAC,GAAK,CAAC,gBAAc,GAAG,cAAY,IAAI,gBAAc,cAAY,iBAAe,eAAa,QAAM,GAAG,GAAM,EAAY,EAASC,EAAO,IAAI,EAAQ,EAAiBA,EAAO,EAAE,EAAQ,EAAcA,EAAO,EAAE,EAAQ,EAAS,EAAoB,EAAQ,EAAS,EAAU,EAAS,CAAC,OAAO,OAAO,CAAC,EAAQ,EAASA,EAAO,IAAI,EAAQ,EAAWA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAQ,EAAUA,EAAO,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAQ,EAAYA,EAAO,EAAK,EAAQ,EAAQC,MAAY,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,CAAW,CAAC,EAAE,CAAC,CAAW,CAAC,EAAQ,EAAUA,MAAY,KAAK,IAAI,GAAG,KAAK,IAAI,EAAE,CAAa,CAAC,EAAE,CAAC,CAAa,CAAC,EAAQ,EAAeC,MAAgB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