{"version":3,"file":"ShinyCursor_Prod.tsvIQH8G.mjs","names":[],"sources":["https:/framerusercontent.com/modules/wB2oToZ9G1i63TtPaRQh/t9jojM2oLROfoLOBfs3Z/ShinyCursor_Prod.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useEffect,useMemo,useState}from\"react\";import{cubicBezier}from\"framer-motion\";const brightnessCurve=cubicBezier(.6,.18,.84,.7);/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n *\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n */export default function ShinyCursor(props){const{color,size,brightness,edgeBlur}=props;const id=useMemo(generateId,[]);const filterRef=useRef(null);const ref=useRef(null);const pointLightRef=useRef(null);const mousePosition=useRef({x:0,y:0});const parentRef=useRef(null);const[initialized,setInitialized]=useState(false);useEffect(()=>{if(ref.current){const container=ref.current.parentElement;if(container){const parentElement=container.parentElement;if(parentElement){parentRef.current=parentElement;parentElement.style.filter=`url(#${id})`;parentElement.style.isolation=\"isolate\";}}}if(filterRef.current){filterRef.current.id=id;}},[ref.current,id]);useEffect(()=>{const handlePointerMove=event=>{mousePosition.current={x:event.pageX-window.pageXOffset,y:event.pageY-window.pageYOffset};setInitialized(true);if(!parentRef.current||!pointLightRef.current)return;const rect=parentRef.current.getBoundingClientRect();pointLightRef.current.setAttribute(\"y\",(mousePosition.current.y-rect.top).toString());pointLightRef.current.setAttribute(\"x\",(mousePosition.current.x-rect.left).toString());};const handleScroll=()=>{if(!parentRef.current||!pointLightRef.current)return;const rect=parentRef.current.getBoundingClientRect();pointLightRef.current.setAttribute(\"y\",(mousePosition.current.y-rect.top).toString());pointLightRef.current.setAttribute(\"x\",(mousePosition.current.x-rect.left).toString());};document.addEventListener(\"pointermove\",handlePointerMove);document.addEventListener(\"scroll\",handleScroll);return()=>{document.removeEventListener(\"pointermove\",handlePointerMove);document.removeEventListener(\"scroll\",handleScroll);};},[]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...props.style,width:0,height:0},children:initialized&&/*#__PURE__*/_jsx(\"svg\",{width:\"0\",height:\"0\",children:/*#__PURE__*/_jsxs(\"filter\",{id:id,ref:filterRef,colorInterpolationFilters:\"sRGB\",children:[/*#__PURE__*/_jsx(\"feGaussianBlur\",{in:\"SourceAlpha\",stdDeviation:edgeBlur,result:\"blur1\"}),/*#__PURE__*/_jsx(\"feSpecularLighting\",{result:\"spec1\",in:\"blur1\",surfaceScale:5,specularConstant:brightnessCurve(brightness/100),specularExponent:100,lightingColor:color,children:/*#__PURE__*/_jsx(\"fePointLight\",{ref:pointLightRef,x:\"0\",y:\"0\",z:mapRange(size,10,200,100,600)})}),/*#__PURE__*/_jsx(\"feComposite\",{in:\"spec1\",in2:\"SourceAlpha\",operator:\"in\",result:\"specOut2\"}),/*#__PURE__*/_jsx(\"feComposite\",{in:\"SourceGraphic\",in2:\"specOut2\",operator:\"arithmetic\",k1:\"0\",k2:\"1\",k3:\"1\",k4:\"0\",result:\"litPaint\"})]})})});}ShinyCursor.displayName=\"Shiny Cursor\";addPropertyControls(ShinyCursor,{color:{type:ControlType.Color,defaultValue:\"#ffffff\"},size:{type:ControlType.Number,defaultValue:100,min:10,max:200,step:1},brightness:{type:ControlType.Number,defaultValue:75,min:0,max:100,step:1,unit:\"%\"},edgeBlur:{type:ControlType.Number,defaultValue:10,min:0,max:25,step:.1,description:\"More components at [Framer University](https://frameruni.link/cc).\"}});function mapRange(value,fromLow,fromHigh,toLow,toHigh){if(fromLow===fromHigh){return toLow;}const percentage=(value-fromLow)/(fromHigh-fromLow);return toLow+percentage*(toHigh-toLow);}const CHARACTERS=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";function generateId(){let result=\"\";for(let i=0;i<8;i++){const randomIndex=Math.floor(Math.random()*CHARACTERS.length);result+=CHARACTERS.charAt(randomIndex);}return result;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShinyCursor\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShinyCursor_Prod.map"],"mappings":"8ZAQG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,OAAK,aAAW,WAAS,CAAC,EAAY,EAAG,EAAQ,EAAW,CAAE,EAAC,CAAO,EAAU,EAAO,KAAK,CAAO,EAAI,EAAO,KAAK,CAAO,EAAc,EAAO,KAAK,CAAO,EAAc,EAAO,CAAC,EAAE,EAAE,EAAE,CAAE,EAAC,CAAO,EAAU,EAAO,KAAK,CAAM,CAAC,EAAY,EAAe,CAAC,GAAS,EAAM,CAAsyC,MAAryC,GAAU,IAAI,CAAC,GAAG,EAAI,QAAQ,CAAC,IAAM,EAAU,EAAI,QAAQ,cAAc,GAAG,EAAU,CAAC,IAAM,EAAc,EAAU,cAAc,AAAG,IAAe,EAAU,QAAQ,EAAc,EAAc,MAAM,QAAQ,OAAO,EAAG,GAAG,EAAc,MAAM,UAAU,UAAY,CAAC,CAAG,EAAU,UAAS,EAAU,QAAQ,GAAG,EAAK,EAAC,CAAC,EAAI,QAAQ,CAAG,EAAC,CAAC,EAAU,IAAI,CAAC,IAAM,EAAkB,GAAO,CAAgH,GAA/G,EAAc,QAAQ,CAAC,EAAE,EAAM,MAAM,EAAO,YAAY,EAAE,EAAM,MAAM,EAAO,WAAY,EAAC,GAAe,EAAK,EAAK,EAAU,UAAU,EAAc,QAAQ,OAAO,IAAM,EAAK,EAAU,QAAQ,uBAAuB,CAAuF,AAAtF,EAAc,QAAQ,aAAa,IAAI,CAAC,EAAc,QAAQ,EAAE,EAAK,KAAK,UAAU,C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