{"version":3,"file":"DothPath.CckF4bDj.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/E0eDeaOmjTiZxvpUrbuF/I4zl63n3Spv11OKvC1Ek/DothPath.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import{useRef,useEffect,useState}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function PathSVGAnimation(props){const{pathSVG,loopMode,dotSize,gap,borderColor,animatedDotSize,animatedDotColor,speed,animatedElementType,animatedSVG,style,showTrail,trailLength,trailColor}=props;const pathRef=useRef(null);const[pathLength,setPathLength]=useState(0);const[dottedLine,setDottedLine]=useState([]);const[extractedPath,setExtractedPath]=useState(\"\");const[viewBox,setViewBox]=useState(\"0 0 100 100\");const[dimensions,setDimensions]=useState({width:100,height:100});const[animatedSVGContent,setAnimatedSVGContent]=useState(null);const[animatedSVGViewBox,setAnimatedSVGViewBox]=useState(null);const[animatedSVGDimensions,setAnimatedSVGDimensions]=useState({width:100,height:100});const[pathStyle,setPathStyle]=useState(\"dotted\");useEffect(()=>{if(pathSVG===null||pathSVG===void 0?void 0:pathSVG.src){fetch(pathSVG.src).then(response=>response.text()).then(svgText=>{const parser=new DOMParser;const svgDoc=parser.parseFromString(svgText,\"image/svg+xml\");const svgElement=svgDoc.querySelector(\"svg\");const pathElement=svgDoc.querySelector(\"path\");if(svgElement){var _svgElement_viewBox_baseVal,_svgElement_viewBox,_svgElement_viewBox_baseVal1,_svgElement_viewBox1;const newViewBox=svgElement.getAttribute(\"viewBox\");if(newViewBox){setViewBox(newViewBox);}// Get original width and height from SVG\nconst width=svgElement.getAttribute(\"width\")||((_svgElement_viewBox=svgElement.viewBox)===null||_svgElement_viewBox===void 0?void 0:(_svgElement_viewBox_baseVal=_svgElement_viewBox.baseVal)===null||_svgElement_viewBox_baseVal===void 0?void 0:_svgElement_viewBox_baseVal.width)||100;const height=svgElement.getAttribute(\"height\")||((_svgElement_viewBox1=svgElement.viewBox)===null||_svgElement_viewBox1===void 0?void 0:(_svgElement_viewBox_baseVal1=_svgElement_viewBox1.baseVal)===null||_svgElement_viewBox_baseVal1===void 0?void 0:_svgElement_viewBox_baseVal1.height)||100;setDimensions({width:Number(width),height:Number(height)});// Only set viewBox if it doesn't exist in the original SVG\nif(!newViewBox){setViewBox(`0 0 ${width} ${height}`);}}if(pathElement){setExtractedPath(pathElement.getAttribute(\"d\")||\"\");}}).catch(error=>console.error(\"Error loading SVG:\",error));}},[pathSVG]);useEffect(()=>{if(pathRef.current){setPathLength(pathRef.current.getTotalLength());const dots=[];const totalLength=pathRef.current.getTotalLength();let offset=0;while(offset<totalLength){const point=pathRef.current.getPointAtLength(offset);dots.push(/*#__PURE__*/_jsx(\"circle\",{cx:point.x,cy:point.y,r:dotSize/2,fill:borderColor},offset));offset+=dotSize+gap;}setDottedLine(dots);}},[extractedPath,dotSize,gap,borderColor]);useEffect(()=>{if(animatedElementType===\"svg\"&&(animatedSVG===null||animatedSVG===void 0?void 0:animatedSVG.src)){fetch(animatedSVG.src).then(response=>response.text()).then(svgText=>{const parser=new DOMParser;const svgDoc=parser.parseFromString(svgText,\"image/svg+xml\");const svgElement=svgDoc.querySelector(\"svg\");if(svgElement){var _svgElement_viewBox_baseVal,_svgElement_viewBox,_svgElement_viewBox_baseVal1,_svgElement_viewBox1;const width=svgElement.getAttribute(\"width\")||((_svgElement_viewBox=svgElement.viewBox)===null||_svgElement_viewBox===void 0?void 0:(_svgElement_viewBox_baseVal=_svgElement_viewBox.baseVal)===null||_svgElement_viewBox_baseVal===void 0?void 0:_svgElement_viewBox_baseVal.width)||100;const height=svgElement.getAttribute(\"height\")||((_svgElement_viewBox1=svgElement.viewBox)===null||_svgElement_viewBox1===void 0?void 0:(_svgElement_viewBox_baseVal1=_svgElement_viewBox1.baseVal)===null||_svgElement_viewBox_baseVal1===void 0?void 0:_svgElement_viewBox_baseVal1.height)||100;setAnimatedSVGDimensions({width:Number(width),height:Number(height)});setAnimatedSVGContent(svgElement.innerHTML);setAnimatedSVGViewBox(svgElement.getAttribute(\"viewBox\")||`0 0 ${width} ${height}`);}}).catch(error=>console.error(\"Error loading animated SVG:\",error));}},[animatedElementType,animatedSVG]);const animationVariants={loop:{repeat:Infinity,repeatType:\"loop\"},cycle:{repeat:Infinity,repeatType:\"mirror\"},once:{repeat:0}};return /*#__PURE__*/_jsxs(\"svg\",{viewBox:viewBox,style:{...style,overflow:\"visible\",display:\"block\",width:\"100%\",height:\"100%\",preserveAspectRatio:\"xMidYMid meet\"},width:dimensions.width,height:dimensions.height,children:[/*#__PURE__*/_jsx(\"path\",{ref:pathRef,d:extractedPath,fill:\"none\",stroke:\"transparent\",strokeWidth:0}),props.pathStyle===\"solid\"?/*#__PURE__*/_jsx(\"path\",{d:extractedPath,fill:\"none\",stroke:borderColor,strokeWidth:dotSize}):/*#__PURE__*/_jsx(\"g\",{children:dottedLine}),showTrail&&pathLength>0&&/*#__PURE__*/_jsx(motion.path,{d:extractedPath,fill:\"none\",stroke:trailColor,strokeWidth:dotSize,strokeDasharray:`${trailLength}% ${pathLength}`,animate:{strokeDashoffset:[pathLength,0]},transition:{duration:2/speed,ease:\"linear\",delay:props.delay,...animationVariants[loopMode]},style:{pathLength:pathLength}}),pathLength>0&&/*#__PURE__*/_jsx(motion.g,{animate:{x:Array.from({length:101},(_,i)=>{var _pathRef_current_getPointAtLength,_pathRef_current;return((_pathRef_current=pathRef.current)===null||_pathRef_current===void 0?void 0:(_pathRef_current_getPointAtLength=_pathRef_current.getPointAtLength(pathLength*i/100))===null||_pathRef_current_getPointAtLength===void 0?void 0:_pathRef_current_getPointAtLength.x)||0;}),y:Array.from({length:101},(_,i)=>{var _pathRef_current_getPointAtLength,_pathRef_current;return((_pathRef_current=pathRef.current)===null||_pathRef_current===void 0?void 0:(_pathRef_current_getPointAtLength=_pathRef_current.getPointAtLength(pathLength*i/100))===null||_pathRef_current_getPointAtLength===void 0?void 0:_pathRef_current_getPointAtLength.y)||0;})},transition:{duration:2/speed,ease:\"easeInOut\",delay:props.delay,...animationVariants[loopMode]},children:animatedElementType===\"dot\"?/*#__PURE__*/_jsx(\"circle\",{r:animatedDotSize,fill:animatedDotColor}):animatedSVGContent&&/*#__PURE__*/_jsx(\"svg\",{viewBox:animatedSVGViewBox||\"0 0 100 100\",width:animatedSVGDimensions.width,height:animatedSVGDimensions.height,x:-animatedSVGDimensions.width/2,y:-animatedSVGDimensions.height/2,dangerouslySetInnerHTML:{__html:animatedSVGContent}})})]});}PathSVGAnimation.displayName=\"Path SVG Animation\";addPropertyControls(PathSVGAnimation,{pathSVG:{type:ControlType.ResponsiveImage,title:\"Path SVG\"},loopMode:{type:ControlType.Enum,defaultValue:\"once\",options:[\"once\",\"loop\",\"cycle\"],optionTitles:[\"Once\",\"Loop\",\"Cycle\"],displaySegmentedControl:true},// Background dots controls\ndotSize:{type:ControlType.Number,defaultValue:4,min:1,max:10,step:1,displayStepper:true,title:\"Path Size\"},gap:{type:ControlType.Number,defaultValue:4,min:0,max:20,step:1,displayStepper:true,title:\"Dot Gap\",hidden:props=>props.pathStyle===\"solid\"},borderColor:{type:ControlType.Color,defaultValue:\"#000\",title:\"Path Color\"},// Animated dot controls\nanimatedDotSize:{type:ControlType.Number,defaultValue:6,min:1,max:20,step:1,displayStepper:true,title:\"Element Size\"},animatedDotColor:{type:ControlType.Color,defaultValue:\"#FF0000\",title:\"Dot Color\",hidden:props=>props.animatedElementType===\"svg\"},speed:{type:ControlType.Number,defaultValue:1,min:.1,max:5,step:.1,displayStepper:true,title:\"Animation Speed\"},animatedElementType:{type:ControlType.Enum,defaultValue:\"dot\",options:[\"dot\",\"svg\"],optionTitles:[\"Dot\",\"Custom\"],displaySegmentedControl:true,title:\"Animated Element\"},animatedSVG:{type:ControlType.ResponsiveImage,title:\"Animated SVG\",hidden:props=>props.animatedElementType===\"dot\"},delay:{type:ControlType.Number,defaultValue:0,min:0,max:10,step:.1,displayStepper:true,title:\"Start Delay\"},pathStyle:{type:ControlType.Enum,defaultValue:\"dotted\",options:[\"dotted\",\"solid\"],optionTitles:[\"Dotted\",\"Solid\"],displaySegmentedControl:true,title:\"Path Style\"},showTrail:{type:ControlType.Boolean,defaultValue:false,title:\"Show Trail\"},trailLength:{type:ControlType.Number,defaultValue:20,min:1,max:100,step:1,displayStepper:true,title:\"Trail Length\",hidden:props=>!props.showTrail},trailColor:{type:ControlType.Color,defaultValue:\"#0066FF\",title:\"Trail Color\",hidden:props=>!props.showTrail}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PathSVGAnimation\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DothPath.map"],"mappings":"gPAGG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,UAAQ,WAAS,UAAQ,MAAI,cAAY,kBAAgB,mBAAiB,QAAM,sBAAoB,cAAY,QAAM,YAAU,cAAY,cAAY,EAAY,EAAQA,EAAO,IAAI,EAAO,CAAC,EAAW,GAAeC,EAAS,CAAC,EAAO,CAAC,EAAW,GAAeA,EAAS,CAAC,CAAC,EAAO,CAAC,EAAc,GAAkBA,EAAS,EAAE,EAAO,CAAC,EAAQ,GAAYA,EAAS,aAAa,EAAO,CAAC,EAAW,GAAeA,EAAS,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,EAAO,CAAC,EAAmB,GAAuBA,EAAS,IAAI,EAAO,CAAC,EAAmB,GAAuBA,EAAS,IAAI,EAAO,CAAC,EAAsB,GAA0BA,EAAS,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,EAAO,CAAC,EAAU,GAAcA,EAAS,QAAQ,EAAE,MAAc,CAAI,GAAgD,KAAK,MAAM,EAAQ,GAAG,CAAC,CAAC,KAAK,GAA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