{"version":3,"file":"CustomCursor.DdOi2Vmy.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/iQiIL23S7U0nKrNSvpS7/qAsbPTER0zb9NiASjRkW/CustomCursor.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";const INTERACTIVE_SELECTOR='a, button, [role=\"button\"], [data-cursor=\"hover\"], input[type=\"button\"], input[type=\"submit\"], summary, label[for]';function isTouchDevice(){if(typeof window===\"undefined\")return true;return\"ontouchstart\"in window||navigator.maxTouchPoints>0;}export default function CustomCursor({color=\"#ffffff\",dotSize=14,ringSize=48,ringThickness=2,ease=.2}){const dotRef=useRef(null);const ringRef=useRef(null);const posRef=useRef({x:-100,y:-100});const targetRef=useRef({x:-100,y:-100});const rafRef=useRef(null);const[enabled,setEnabled]=useState(false);const[hovering,setHovering]=useState(false);const[visible,setVisible]=useState(false);// True when the mouse is over an iframe — hide the cursor because\n// mousemove events are being consumed by the iframe.\nconst[overIframe,setOverIframe]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;if(isTouchDevice()||reduced)return;setEnabled(true);},[]);// Aggressive OS-cursor override — the `*` covers video, iframes, and\n// any child element the cursor may hover over.\nuseEffect(()=>{if(!enabled)return;const style=document.createElement(\"style\");style.setAttribute(\"data-custom-cursor\",\"true\");style.textContent=`\n            html, body { cursor: none !important; }\n            *, *::before, *::after { cursor: none !important; }\n        `;document.head.appendChild(style);return()=>{if(style.parentNode)style.parentNode.removeChild(style);};},[enabled]);useEffect(()=>{if(!enabled)return;const onMove=e=>{targetRef.current.x=e.clientX;targetRef.current.y=e.clientY;if(!visible)setVisible(true);// Any mousemove on the parent means we're not over an iframe.\nif(overIframe)setOverIframe(false);};const onEnter=()=>setVisible(true);const onLeave=()=>setVisible(false);const onOver=e=>{const t=e.target;if(!t)return;// Detect iframe entry — hide the cursor so it doesn't freeze\nif(t.tagName===\"IFRAME\"){setOverIframe(true);return;}setHovering(!!t.closest(INTERACTIVE_SELECTOR));};// When the window loses focus and the focus target is an iframe,\n// the mouse has almost certainly entered the iframe. Hide the cursor.\nconst onBlur=()=>{if(document.activeElement&&document.activeElement.tagName===\"IFRAME\"){setOverIframe(true);}};// If the window regains focus (user clicked back into the parent),\n// clear the iframe state so the cursor comes back on next move.\nconst onFocus=()=>{setOverIframe(false);};window.addEventListener(\"mousemove\",onMove);window.addEventListener(\"mouseover\",onOver);window.addEventListener(\"blur\",onBlur);window.addEventListener(\"focus\",onFocus);document.documentElement.addEventListener(\"mouseenter\",onEnter);document.documentElement.addEventListener(\"mouseleave\",onLeave);return()=>{window.removeEventListener(\"mousemove\",onMove);window.removeEventListener(\"mouseover\",onOver);window.removeEventListener(\"blur\",onBlur);window.removeEventListener(\"focus\",onFocus);document.documentElement.removeEventListener(\"mouseenter\",onEnter);document.documentElement.removeEventListener(\"mouseleave\",onLeave);};},[enabled,visible,overIframe]);useEffect(()=>{if(!enabled)return;const tick=()=>{posRef.current.x+=(targetRef.current.x-posRef.current.x)*ease;posRef.current.y+=(targetRef.current.y-posRef.current.y)*ease;if(dotRef.current){dotRef.current.style.transform=`translate3d(${targetRef.current.x}px, ${targetRef.current.y}px, 0) translate(-50%, -50%)`;}if(ringRef.current){ringRef.current.style.transform=`translate3d(${posRef.current.x}px, ${posRef.current.y}px, 0) translate(-50%, -50%)`;}rafRef.current=requestAnimationFrame(tick);};rafRef.current=requestAnimationFrame(tick);return()=>{if(rafRef.current)cancelAnimationFrame(rafRef.current);};},[enabled,ease]);if(!enabled){return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{width:0,height:0,opacity:0,pointerEvents:\"none\"}});}const dotDiameter=hovering?6:dotSize;const currentRingSize=hovering?ringSize:dotSize;// Cursor is visible only when: enabled + visible in viewport + NOT over iframe\nconst shouldShow=visible&&!overIframe;return /*#__PURE__*/_jsxs(\"div\",{\"aria-hidden\":\"true\",style:{position:\"fixed\",inset:0,pointerEvents:\"none\",zIndex:2147483647,opacity:shouldShow?1:0,transition:\"opacity 0.15s ease\",mixBlendMode:\"difference\"},children:[/*#__PURE__*/_jsx(\"div\",{ref:ringRef,style:{position:\"fixed\",top:0,left:0,width:currentRingSize,height:currentRingSize,borderRadius:\"50%\",border:`${ringThickness}px solid ${color}`,backgroundColor:\"transparent\",transition:\"width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease\",willChange:\"transform, width, height\",opacity:hovering?1:0}}),/*#__PURE__*/_jsx(\"div\",{ref:dotRef,style:{position:\"fixed\",top:0,left:0,width:dotDiameter,height:dotDiameter,borderRadius:\"50%\",backgroundColor:color,boxShadow:\"0 0 0 0.5px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.25)\",transition:\"width 0.18s cubic-bezier(0.16, 1, 0.3, 1), height 0.18s cubic-bezier(0.16, 1, 0.3, 1)\",willChange:\"transform, width, height\"}})]});}addPropertyControls(CustomCursor,{color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#ffffff\"},dotSize:{type:ControlType.Number,title:\"Dot Size\",defaultValue:14,min:4,max:28,step:1,unit:\"px\"},ringSize:{type:ControlType.Number,title:\"Ring Size\",defaultValue:48,min:24,max:96,step:2,unit:\"px\"},ringThickness:{type:ControlType.Number,title:\"Ring Thickness\",defaultValue:2,min:1,max:6,step:.5,unit:\"px\"},ease:{type:ControlType.Number,title:\"Trail Ease\",defaultValue:.2,min:.05,max:.5,step:.01}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomCursor\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomCursor.map"],"mappings":"+MAA0S,SAAS,GAAe,CAA4C,OAAjC,IAAS,QAA8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