{"version":3,"file":"Border_Glow_Card.CUFqdrdm.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/eL5N3itUrdKRLaWFyeDX/XJiu8JV1eFmQKEiJONZs/Border_Glow_Card.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";function parseColor(color){const rgba=color.match(/rgba?\\(([\\d.]+),\\s*([\\d.]+),\\s*([\\d.]+)(?:,\\s*([\\d.]+))?\\)/);if(rgba)return[+rgba[1],+rgba[2],+rgba[3],rgba[4]!=null?+rgba[4]:1];const h=color.replace(\"#\",\"\");const full=h.length===3?h.split(\"\").map(c=>c+c).join(\"\"):h;return[parseInt(full.slice(0,2),16),parseInt(full.slice(2,4),16),parseInt(full.slice(4,6),16),1];}export default function GlowBorder(props){const{cardBackground=\"#1a1a2e\",baseBorderColor=\"rgba(255,255,255,0.1)\",borderWidth=2,glowColor=\"#7c3aed\",proximity=150,smoothing=.12,borderRadius=16,isMixed=false,topLeft=16,topRight=16,bottomRight=16,bottomLeft=16,style}=props;const[container,setContainer]=useState(null);const configRef=useRef({targetRgba:parseColor(glowColor),proximity,smoothing,borderWidth});configRef.current={targetRgba:parseColor(glowColor),proximity,smoothing,borderWidth};const radii=isMixed?[topLeft,topRight,bottomRight,bottomLeft]:[borderRadius,borderRadius,borderRadius,borderRadius];const innerRadii=radii.map(r=>Math.max(0,r-borderWidth));const outerBR=radii.map(r=>`${r}px`).join(\" \");const innerBR=innerRadii.map(r=>`${r}px`).join(\" \");useEffect(()=>{if(!container)return;const glowEl=container.querySelector(\"[data-glow]\");if(!glowEl)return;let rafId=null;let targetX=0;let targetY=0;let currentX=0;let currentY=0;let targetOpacity=0;let currentOpacity=0;let isVisible=false;const initRgba=configRef.current.targetRgba;let currentR=initRgba[0];let currentG=initRgba[1];let currentB=initRgba[2];let currentA=initRgba[3];let currentProximity=configRef.current.proximity;const loop=()=>{const{targetRgba,proximity,smoothing}=configRef.current;currentX+=(targetX-currentX)*smoothing;currentY+=(targetY-currentY)*smoothing;currentOpacity+=(targetOpacity-currentOpacity)*smoothing;currentR+=(targetRgba[0]-currentR)*smoothing;currentG+=(targetRgba[1]-currentG)*smoothing;currentB+=(targetRgba[2]-currentB)*smoothing;currentA+=(targetRgba[3]-currentA)*smoothing;currentProximity+=(proximity-currentProximity)*smoothing;const color=`rgba(${Math.round(currentR)},${Math.round(currentG)},${Math.round(currentB)},${currentA.toFixed(3)})`;glowEl.style.background=`radial-gradient(${currentProximity*1.5}px circle at ${currentX}px ${currentY}px, ${color}, transparent)`;glowEl.style.opacity=String(currentOpacity);rafId=requestAnimationFrame(loop);};const onMove=e=>{const{borderWidth,proximity}=configRef.current;const rect=container.getBoundingClientRect();targetX=e.clientX-rect.left;targetY=e.clientY-rect.top;const inside=targetX>=0&&targetX<=rect.width&&targetY>=0&&targetY<=rect.height;let dist;if(inside){dist=Math.min(targetX,targetY,rect.width-targetX,rect.height-targetY);targetOpacity=Math.min(1,1-Math.max(0,(dist-borderWidth)/proximity));}else{const cx=Math.max(0,Math.min(targetX,rect.width));const cy=Math.max(0,Math.min(targetY,rect.height));dist=Math.sqrt((targetX-cx)**2+(targetY-cy)**2);targetOpacity=Math.max(0,1-dist/proximity);}};const start=()=>{if(rafId!=null)return;glowEl.style.willChange=\"opacity, background\";document.addEventListener(\"mousemove\",onMove);rafId=requestAnimationFrame(loop);};const stop=()=>{if(rafId!=null){cancelAnimationFrame(rafId);rafId=null;}document.removeEventListener(\"mousemove\",onMove);glowEl.style.willChange=\"auto\";};const observer=new IntersectionObserver(([entry])=>{isVisible=entry.isIntersecting;if(isVisible){start();}else{stop();}},{threshold:0});observer.observe(container);return()=>{observer.disconnect();stop();};},[container]);return /*#__PURE__*/_jsxs(\"div\",{ref:setContainer,style:{...style,position:\"relative\",borderRadius:outerBR,overflow:\"hidden\",background:baseBorderColor},children:[/*#__PURE__*/_jsx(\"div\",{\"data-glow\":true,style:{position:\"absolute\",inset:0,opacity:0,pointerEvents:\"none\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:borderWidth,borderRadius:innerBR,background:cardBackground,pointerEvents:\"none\"}})]});}addPropertyControls(GlowBorder,{cardBackground:{type:ControlType.Color,title:\"Card Background\",defaultValue:\"#1a1a2e\"},baseBorderColor:{type:ControlType.Color,title:\"Base Border\",defaultValue:\"rgba(255,255,255,0.1)\"},borderRadius:{type:ControlType.FusedNumber,title:\"Radius\",defaultValue:16,toggleKey:\"isMixed\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeft\",\"topRight\",\"bottomRight\",\"bottomLeft\"],valueLabels:[\"TL\",\"TR\",\"BR\",\"BL\"],min:0},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:2,min:1,max:20,step:1},glowColor:{type:ControlType.Color,title:\"Glow Color\",defaultValue:\"#7c3aed\"},proximity:{type:ControlType.Number,title:\"Proximity\",defaultValue:150,min:50,max:500,step:10},smoothing:{type:ControlType.Number,title:\"Smoothing\",defaultValue:.12,min:.01,max:1,step:.01}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GlowBorder\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Border_Glow_Card.map"],"mappings":"+LAA0J,SAAS,EAAW,EAAM,CAAC,IAAM,EAAK,EAAM,MAAM,4DAA4D,EAAE,GAAG,EAAK,MAAM,CAAC,CAAC,EAAK,GAAG,CAAC,EAAK,GAAG,CAAC,EAAK,GAAG,EAAK,IAAI,KAAc,EAAT,CAAC,EAAK,EAAI,EAAE,IAAM,EAAE,EAAM,QAAQ,IAAI,EAAE,EAAQ,EAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,MA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