{"version":3,"file":"GradientBorder.hpsGiBbT.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/hDPOcO4ksbV9c7bpvHpY/LuwJrbBEeEIeQgyIw1rb/GradientBorder.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{animate,motion,useInView,useMotionValue,useReducedMotion,useTransform}from\"framer-motion\";import{useEffect,useRef}from\"react\";/**\n * Gradient-stroke layer with a transparent inside. Place it absolutely\n * behind the button content (pinned to all four edges) and switch\n * \"Rotating\" on in the Hover variant, or in every variant for a\n * constant glow.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function GradientBorder(props){const{type=\"linear\",centerX=50,centerY=50,rotating=false,duration=3,startColor=\"rgb(79, 83, 254)\",endColor=\"rgb(241, 69, 255)\",startPosition=42,endPosition=100,angle=59,borderWidth=1,radius=6,style}=props;const ref=useRef(null);const isStatic=useIsStaticRenderer();const reduceMotion=useReducedMotion();// Pause off-screen so always-on layers don't burn frames.\nconst isInView=useInView(ref);const shouldRotate=rotating&&!isStatic&&!reduceMotion&&isInView;// Extra rotation on top of the resting angle, in degrees.\nconst offset=useMotionValue(0);const background=useTransform(offset,value=>{const stops=`${startColor} ${startPosition}%, ${endColor} ${endPosition}%`;return type===\"conic\"?`conic-gradient(from ${angle+value}deg at ${centerX}% ${centerY}%, ${stops})`:`linear-gradient(${angle+value}deg, ${stops})`;});useEffect(()=>{if(!shouldRotate){// Ease back to the resting angle along the shortest way round.\nconst current=offset.get()%360;offset.set(current);const target=current>180?360:0;const controls=animate(offset,target,{duration:.6,ease:\"easeOut\",onComplete:()=>offset.set(0)});return()=>controls.stop();}const degreesPerMs=360/(Math.max(duration,.1)*1e3);let frame=0;let last=performance.now();const tick=now=>{offset.set((offset.get()+(now-last)*degreesPerMs)%360);last=now;frame=requestAnimationFrame(tick);};frame=requestAnimationFrame(tick);return()=>cancelAnimationFrame(frame);},[shouldRotate,duration,offset]);const ringMask=\"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)\";return /*#__PURE__*/_jsx(motion.div,{ref:ref,\"aria-hidden\":\"true\",style:{position:\"relative\",width:\"100%\",height:\"100%\",boxSizing:\"border-box\",padding:borderWidth,borderRadius:radius,pointerEvents:\"none\",background,// Cut the inside out so only the stroke shows.\nWebkitMask:ringMask,WebkitMaskComposite:\"xor\",mask:ringMask,maskComposite:\"exclude\",...style}});}addPropertyControls(GradientBorder,{type:{type:ControlType.Enum,title:\"Type\",options:[\"linear\",\"conic\"],optionTitles:[\"Linear\",\"Conic\"],defaultValue:\"linear\",displaySegmentedControl:true},centerX:{type:ControlType.Number,title:\"Center X\",defaultValue:50,min:0,max:100,unit:\"%\",hidden:props=>props.type!==\"conic\"},centerY:{type:ControlType.Number,title:\"Center Y\",defaultValue:50,min:0,max:100,unit:\"%\",hidden:props=>props.type!==\"conic\"},rotating:{type:ControlType.Boolean,title:\"Rotating\",defaultValue:false,description:\"Turn on in the Hover variant.\"},duration:{type:ControlType.Number,title:\"Speed\",defaultValue:3,min:.5,max:10,step:.1,unit:\"s\",description:\"Seconds per full rotation.\"},startColor:{type:ControlType.Color,title:\"Start\",defaultValue:\"rgb(79, 83, 254)\"},startPosition:{type:ControlType.Number,title:\"Start at\",defaultValue:42,min:0,max:100,unit:\"%\"},endColor:{type:ControlType.Color,title:\"End\",defaultValue:\"rgb(241, 69, 255)\"},endPosition:{type:ControlType.Number,title:\"End at\",defaultValue:100,min:0,max:100,unit:\"%\"},angle:{type:ControlType.Number,title:\"Angle\",defaultValue:59,min:0,max:360,unit:\"\\xb0\"},borderWidth:{type:ControlType.Number,title:\"Border\",defaultValue:1,min:.5,max:10,step:.5,unit:\"px\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:6,min:0,max:100,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GradientBorder\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GradientBorder.map"],"mappings":"gRAQG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,SAAS,UAAQ,GAAG,UAAQ,GAAG,WAAS,GAAM,WAAS,EAAE,aAAW,mBAAmB,WAAS,oBAAoB,gBAAc,GAAG,cAAY,IAAI,QAAM,GAAG,cAAY,EAAE,SAAO,EAAE,SAAO,EAAY,EAAIA,EAAO,IAAI,EAAQ,EAAS,EAAoB,EAAQ,EAAa,EAAiB,EACxV,EAAS,EAAU,CAAG,EAAQ,EAAa,GAAU,CAAC,GAAU,CAAC,GAAc,EAC/E,EAAO,EAAe,CAAC,EAAQ,EAAW,EAAa,EAAO,GAAO,CAAC,IAAM,EAAM,GAAG,EAAW,GAAG,EAAc,KAAK,EAAS,GAAG,EAAY,GAAG,OAAO,IAAO,QAAQ,uBAAuB,EAAM,EAAM,SAAS,EAAQ,IAAI,EAAQ,KAAK,EAAM,GAAG,mBAAmB,EAAM,EAAM,OAAO,EAAM,EAAG,CAAC,EAAE,MAAc,CAAC,GAAG,CAAC,EAAa,CAC7U,IAAM,EAAQ,EAAO,IAAI,EAAE,IAAI,EAAO,IAAI,CAAO,EAAiC,IAAM,EAAS,EAAQ,EAAzC,EAAQ,IAAI,IAAI,EAAuC,CAAC,SAAS,GAAG,KAAK,UAAU,eAAe,EAAO,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAS,KAAK,CAAE,CAAC,IAAM,EAAa,KAAK,KAAK,IAAI,EAAS,EAAE,EAAE,KAAS,EAAM,EAAM,EAAK,YAAY,IAAI,EAAQ,EAAK,GAAK,CAAC,EAAO,KAAK,EAAO,IAAI,GAAG,EAAI,GAAM,GAAc,GAAG,EAAE,EAAK,EAAI,EAAM,sBAA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