{"version":3,"file":"CursorLayer.BZG4dP2-.mjs","names":[],"sources":["https:/framerusercontent.com/modules/p3D4H3CyCQ5NXwexO6Yo/AbDZ7bM9xZTJ38PDjiFr/CursorLayer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";const TRAIL_EMOJIS=[\"🐻\",\"✨\",\"🌟\",\"💫\",\"⭐\",\"🌈\",\"🦋\",\"🌸\"];const MAX_TRAIL=12;const SPAWN_INTERVAL=15;function getLuminance(el){let cur=el;while(cur&&cur!==document.body){const bg=getComputedStyle(cur).backgroundColor;if(bg&&bg!==\"rgba(0, 0, 0, 0)\"&&bg!==\"transparent\"){const m=bg.match(/\\d+/g);if(m){const[r,g,b]=m.map(Number);return(.299*r+.587*g+.114*b)/255;}}cur=cur.parentElement;}// fallback: check body\nconst bodyBg=getComputedStyle(document.body).backgroundColor;const m=bodyBg.match(/\\d+/g);if(m){const[r,g,b]=m.map(Number);return(.299*r+.587*g+.114*b)/255;}return 1// default light\n;}export default function CursorLayer({emojiTrail}){useEffect(()=>{const dot=document.createElement(\"div\");dot.style.cssText=`\n      position: fixed;\n      width: 6px;\n      height: 6px;\n      background: #111;\n      border-radius: 50%;\n      pointer-events: none;\n      z-index: 9999;\n      transform: translate(-50%, -50%);\n      transition: width 0.15s ease, height 0.15s ease, opacity 0.2s ease, background 0.15s ease;\n      will-change: left, top;\n      left: -100px;\n      top: -100px;\n    `;document.body.appendChild(dot);const ring=document.createElement(\"div\");ring.style.cssText=`\n      position: fixed;\n      width: 32px;\n      height: 32px;\n      border: 1.5px solid rgba(17,17,17,0.38);\n      border-radius: 50%;\n      pointer-events: none;\n      z-index: 9998;\n      transform: translate(-50%, -50%);\n      transition: width 0.2s ease, height 0.2s ease, border-color 0.15s ease, opacity 0.2s ease;\n      will-change: left, top;\n      left: -100px;\n      top: -100px;\n    `;document.body.appendChild(ring);const styleEl=document.createElement(\"style\");styleEl.id=\"ph-cursor-none\";styleEl.textContent=`@media (pointer: fine) { * { cursor: none !important; } }`;if(!document.getElementById(\"ph-cursor-none\")){document.head.appendChild(styleEl);}let mouseX=window.innerWidth/2;let mouseY=window.innerHeight/2;let ringX=mouseX;let ringY=mouseY;let raf;let lastSpawn=0;const trail=[];let isDark=false;const updateTheme=(x,y)=>{const el=document.elementFromPoint(x,y);if(!el)return;const lum=getLuminance(el);const dark=lum<.5;if(dark!==isDark){isDark=dark;dot.style.background=dark?\"#ffffff\":\"#111111\";ring.style.borderColor=dark?\"rgba(255,255,255,0.5)\":\"rgba(17,17,17,0.38)\";}};const onMove=e=>{mouseX=e.clientX;mouseY=e.clientY;dot.style.left=mouseX+\"px\";dot.style.top=mouseY+\"px\";updateTheme(mouseX,mouseY);};const spawnTrail=(x,y)=>{const now=Date.now();if(now-lastSpawn<SPAWN_INTERVAL)return;lastSpawn=now;const el=document.createElement(\"div\");el.textContent=TRAIL_EMOJIS[Math.floor(Math.random()*TRAIL_EMOJIS.length)];const size=16+Math.random()*12;const driftY=-(20+Math.random()*20);const scale=.4+Math.random()*.4;el.style.cssText=`position:fixed;left:${x}px;top:${y}px;pointer-events:none;z-index:99998;font-size:${size}px;transform:translate(-50%,-50%);transition:opacity 0.6s ease,transform 0.6s ease;opacity:1;user-select:none;line-height:1;`;document.body.appendChild(el);trail.push(el);requestAnimationFrame(()=>requestAnimationFrame(()=>{el.style.opacity=\"0\";el.style.transform=`translate(-50%,-50%) translateY(${driftY}px) scale(${scale})`;}));setTimeout(()=>{el.remove();const idx=trail.indexOf(el);if(idx!==-1)trail.splice(idx,1);},600);if(trail.length>MAX_TRAIL){const old=trail.shift();old?.remove();}};const animateRing=()=>{ringX+=(mouseX-ringX)*.12;ringY+=(mouseY-ringY)*.12;ring.style.left=ringX+\"px\";ring.style.top=ringY+\"px\";raf=requestAnimationFrame(animateRing);};animateRing();const onMoveWithTrail=e=>{onMove(e);if(emojiTrail!==false)spawnTrail(e.clientX,e.clientY);};const onLeave=()=>{dot.style.opacity=\"0\";ring.style.opacity=\"0\";};const onEnter=()=>{dot.style.opacity=\"1\";ring.style.opacity=\"1\";};const resetCursor=()=>{dot.style.width=\"6px\";dot.style.height=\"6px\";ring.style.width=\"32px\";ring.style.height=\"32px\";};const expandCursor=()=>{dot.style.width=\"6px\";dot.style.height=\"6px\";ring.style.width=\"64px\";ring.style.height=\"64px\";};document.querySelectorAll(\"a, button\").forEach(el=>{el.addEventListener(\"mouseenter\",expandCursor);el.addEventListener(\"mouseleave\",resetCursor);});document.querySelectorAll(\"img\").forEach(el=>{el.addEventListener(\"mouseenter\",expandCursor);el.addEventListener(\"mouseleave\",resetCursor);});document.addEventListener(\"mousemove\",onMoveWithTrail);document.addEventListener(\"mouseleave\",onLeave);document.addEventListener(\"mouseenter\",onEnter);return()=>{cancelAnimationFrame(raf);document.removeEventListener(\"mousemove\",onMoveWithTrail);document.removeEventListener(\"mouseleave\",onLeave);document.removeEventListener(\"mouseenter\",onEnter);dot.remove();ring.remove();trail.forEach(el=>el.remove());document.getElementById(\"ph-cursor-none\")?.remove();};},[emojiTrail]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",inset:0,pointerEvents:\"none\"}});}addPropertyControls(CursorLayer,{emojiTrail:{type:ControlType.Boolean,title:\"Emoji Trail\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CursorLayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CursorLayer.map"],"mappings":"mLAAkO,SAAS,EAAa,EAAG,CAAC,IAAI,EAAI,EAAG,KAAM,GAAK,IAAM,SAAS,MAAK,CAAC,IAAM,EAAG,iBAAiB,CAAG,CAAC,CAAC,gBAAgB,GAAG,GAAI,IAAK,oBAAoB,IAAK,cAAc,CAAC,IAAM,EAAE,EAAG,MAAM,MAAM,EAAE,GAAG,EAAE,CAAC,GAAK,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