{"version":3,"file":"AnimatedBeam.DcQ41Av8.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/op8ezlvDAOayOGnw9cf7/05CE5jafttZ5csJs2ak9/AnimatedBeam.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useAnimation}from\"framer-motion\";// Function to extract relevant attributes from SVG content\nconst parseSVG=async svgUrl=>{const response=await fetch(svgUrl);const svgContent=await response.text();const parser=new DOMParser;const svgDoc=parser.parseFromString(svgContent,\"image/svg+xml\");const svgEl=svgDoc.querySelector(\"svg\");const pathEl=svgDoc.querySelector(\"path\");const width=svgEl?svgEl.getAttribute(\"width\")||\"100%\":\"100%\";const height=svgEl?svgEl.getAttribute(\"height\")||\"100%\":\"100%\";const viewBox=svgEl?svgEl.getAttribute(\"viewBox\")||`0 0 ${width} ${height}`:`0 0 ${width} ${height}`;const path=pathEl?pathEl.getAttribute(\"d\")||\"\":\"\";return{width,height,viewBox,path};};/**\n * AnimatedBeam Component for Framer by Noman (https://framercrafts.com/)\n *\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function AnimatedBeam(props){const{svgFile,color,strokeWidth,duration,loop,segmentLength,loopDelay,gradientStart,gradientEnd,useGradient}=props;const controls=useAnimation();const[svgAttributes,setSvgAttributes]=React.useState({width:\"100%\",height:\"100%\",viewBox:\"0 0 100 100\",path:\"\",pathLength:0});React.useEffect(()=>{if(svgFile){parseSVG(svgFile).then(attributes=>{setSvgAttributes(attributes);}).catch(error=>console.error(\"Error parsing SVG:\",error));}},[svgFile]);React.useEffect(()=>{if(svgAttributes.path){const pathElement=document.createElementNS(\"http://www.w3.org/2000/svg\",\"path\");pathElement.setAttribute(\"d\",svgAttributes.path);const totalLength=pathElement.getTotalLength();setSvgAttributes(prev=>({...prev,pathLength:totalLength}));controls.start({strokeDasharray:`${segmentLength} ${totalLength-0}`,strokeDashoffset:[totalLength,+segmentLength],transition:{duration:duration,repeat:loop?Infinity:0,repeatDelay:loopDelay,ease:\"linear\"}});}},[controls,svgAttributes.path,duration,loop,segmentLength,loopDelay,svgAttributes.pathLength]);// Default empty state when no SVG file is provided\nif(!svgFile){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#f5f5f5\",borderRadius:\"8px\",border:\"1px dashed #ccc\",padding:\"20px\",textAlign:\"center\",color:\"#666\",fontFamily:\"sans-serif\"},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 5px 0\",fontSize:\"14px\",fontWeight:\"bold\"},children:\"No SVG File Selected\"}),/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0\",fontSize:\"12px\"},children:\"Please upload an SVG file to animate\"})]});}return /*#__PURE__*/_jsxs(\"svg\",{width:\"100%\",height:\"100%\",viewBox:svgAttributes.viewBox,overflow:\"visible\",children:[useGradient&&/*#__PURE__*/_jsx(\"defs\",{children:/*#__PURE__*/_jsxs(\"linearGradient\",{id:\"gradient\",x1:\"0%\",y1:\"0%\",x2:\"100%\",y2:\"0%\",children:[/*#__PURE__*/_jsx(\"stop\",{offset:\"0%\",style:{stopColor:gradientStart,stopOpacity:1}}),/*#__PURE__*/_jsx(\"stop\",{offset:\"100%\",style:{stopColor:gradientEnd,stopOpacity:1}})]})}),/*#__PURE__*/_jsx(motion.path,{d:svgAttributes.path,fill:\"none\",stroke:useGradient?\"url(#gradient)\":color,strokeWidth:strokeWidth,strokeDasharray:`${segmentLength} ${svgAttributes.pathLength-segmentLength}`,strokeDashoffset:segmentLength,animate:controls})]});}AnimatedBeam.defaultProps={color:\"#000\",strokeWidth:2,duration:2,loop:true,segmentLength:20,loopDelay:1,gradientStart:\"#ff00ff\",gradientEnd:\"#00ff00\",useGradient:false};addPropertyControls(AnimatedBeam,{svgFile:{type:ControlType.File,allowedFileTypes:[\"svg\"],title:\"SVG File\"},color:{type:ControlType.Color,title:\"Beam\",defaultValue:AnimatedBeam.defaultProps.color,hidden:({useGradient})=>useGradient},useGradient:{type:ControlType.Boolean,title:\"Use Gradient\",defaultValue:AnimatedBeam.defaultProps.useGradient},gradientStart:{type:ControlType.Color,title:\"Gradient Start\",defaultValue:AnimatedBeam.defaultProps.gradientStart,hidden:({useGradient})=>!useGradient},gradientEnd:{type:ControlType.Color,title:\"Gradient End\",defaultValue:AnimatedBeam.defaultProps.gradientEnd,hidden:({useGradient})=>!useGradient},strokeWidth:{type:ControlType.Number,title:\"Beam Width\",defaultValue:AnimatedBeam.defaultProps.strokeWidth,min:.1,// max: 20,\nstep:.1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:AnimatedBeam.defaultProps.duration,min:.1,// max: 10,\nstep:.1},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:AnimatedBeam.defaultProps.loop,enabledTitle:\"Yes\",disabledTitle:\"No\"},segmentLength:{type:ControlType.Number,title:\"Beam Length\",defaultValue:AnimatedBeam.defaultProps.segmentLength,min:1,// max: 1000,\nstep:1},loopDelay:{type:ControlType.Number,title:\"Loop Delay\",defaultValue:AnimatedBeam.defaultProps.loopDelay,min:0,// max: 10,\nstep:.1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedBeam\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedBeam.map"],"mappings":"2OAOG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,UAAQ,QAAM,cAAY,WAAS,OAAK,gBAAc,YAAU,gBAAc,cAAY,eAAa,EAAY,EAAS,GAAc,CAAM,CAAC,EAAc,GAAkBA,EAAe,CAAC,MAAM,OAAO,OAA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