{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/gh5xmpM9GHT9MXnnMpPc/yx3Yu3CvNlklDmNPtEF9/Animator.js"],
  "sourcesContent": ["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Children } from \"react\";\nimport { addPropertyControls, ControlType, RenderTarget } from \"framer\";\nimport { motion, useMotionValue, useTransform } from \"framer-motion\"; /**\n                                                                      * ANIMATOR\n                                                                      *\n                                                                      * @framerIntrinsicWidth 200\n                                                                      * @framerIntrinsicHeight 200\n                                                                      * @framerDisableUnlink\n                                                                      *\n                                                                      * @framerSupportedLayoutWidth fixed\n                                                                      * @framerSupportedLayoutHeight fixed\n                                                                      */\nexport default function Animator(props) {\n  /* Properties */const {\n    pathAnimation,\n    from,\n    to,\n    animate,\n    shouldLoop,\n    loopOptions,\n    slots = [],\n    endCircle\n  } = props; /* State */\n  const hasChildren = Children.count(slots) > 0; /* Empty State */\n  let customShape = /*#__PURE__*/_jsxs(\"div\", {\n    style: placeholderStyles,\n    children: [/*#__PURE__*/_jsx(\"div\", {\n      style: emojiStyles,\n      children: \"\u270D\uFE0F\"\n    }), /*#__PURE__*/_jsx(\"p\", {\n      style: titleStyles,\n      children: \"Connect to Graphic\"\n    }), /*#__PURE__*/_jsx(\"p\", {\n      style: subtitleStyles,\n      children: \"Animates single or joined paths on Web Pages only.\"\n    })]\n  });\n  if (hasChildren) {\n    /* Grab the SVG from the Graphic */const firstChild = getFirstChild(slots);\n    const svgChild = getFirstChild(firstChild.props.svg);\n    const isSpring = pathAnimation.type === \"spring\"; /* Shape transition properties */ /* Dividing stiffness and damping by 1000 is a trick I got from Matt \n                                                                                        which helps with pathLength animations, which otherwise are so fast \n                                                                                        you never even see them happen in the preview. */\n    const shapeTransition = {\n      pathLength: {\n        ...pathAnimation,\n        repeat: shouldLoop ? Infinity : 0,\n        repeatType: loopOptions,\n        stiffness: isSpring ? pathAnimation.stiffness / 1e3 : pathAnimation.stiffness,\n        damping: isSpring ? pathAnimation.damping / 1e3 : pathAnimation.damping\n      }\n    }; /* Add our own properties to the Path */\n    const pathLength = useMotionValue(0);\n    const opacity = useTransform(pathLength, [0, .025], [0, 1]);\n    const shapeProps = {\n      variants: {\n        start: {\n          pathLength: from / 100\n        },\n        end: {\n          pathLength: to / 100\n        }\n      },\n      transition: shapeTransition\n    }; /* Prevent animating or adjusting pathLength on the Canvas */\n    const isCanvas = RenderTarget.current() === RenderTarget.canvas; /* Just render the full connected Graphic on Canvas, when connected */\n    if (isCanvas) {\n      customShape = firstChild;\n    } /* If on a web page */\n    if (!isCanvas && svgChild) {\n      /* Pass Attributes */let attributes = svgChild.match(/[\\w-]+=\"[^\"]*\"/g);\n      let pathD;\n      let stroke;\n      let strokeWidth;\n      let strokeLinecap;\n      let strokeLinejoin;\n      for (const element of attributes) {\n        if (element.includes(\"d=\")) {\n          pathD = splitAndReplace(element);\n        }\n        if (element.includes(\"stroke=\")) {\n          stroke = splitAndReplace(element);\n        }\n        if (element.includes(\"stroke-width=\")) {\n          strokeWidth = splitAndReplace(element);\n        }\n        if (element.includes(\"stroke-linecap=\")) {\n          strokeLinecap = splitAndReplace(element);\n        }\n        if (element.includes(\"stroke-linejoin=\")) {\n          strokeLinejoin = splitAndReplace(element);\n        }\n      } /* Grab viewbox */\n      let svgViewbox;\n      svgViewbox = svgChild.split(\"viewBox=\")[1];\n      svgViewbox = svgViewbox.split(\">\")[0];\n      svgViewbox = svgViewbox.replace(/^\"(.+(?=\"$))\"$/, \"$1\");\n      customShape = /*#__PURE__*/_jsx(motion.div, {\n        initial: isCanvas || animate === false ? false : \"start\",\n        animate: isCanvas || animate === false ? false : \"end\",\n        style: {\n          width: \"100%\",\n          height: \"100%\",\n          display: \"flex\",\n          placeContent: \"center\",\n          placeItems: \"center\",\n          backgroundColor: \"transparent\",\n          overflow: \"hidden\"\n        },\n        children: /*#__PURE__*/_jsx(motion.svg, {\n          xmlns: \"http://www.w3.org/2000/svg\",\n          width: \"100%\",\n          height: \"100%\",\n          viewBox: svgViewbox,\n          children: /*#__PURE__*/_jsx(motion.path, {\n            ...shapeProps,\n            d: pathD,\n            stroke: stroke,\n            strokeWidth: strokeWidth,\n            strokeLinejoin: strokeLinejoin,\n            strokeLinecap: strokeLinecap,\n            fill: \"transparent\",\n            style: !endCircle && {\n              pathLength,\n              opacity\n            }\n          })\n        })\n      });\n    }\n  }\n  return customShape;\n}\n; /* Default Properties */\nAnimator.defaultProps = {\n  animate: true,\n  shouldLoop: false,\n  loopOptions: \"reverse\",\n  from: 0,\n  to: 100,\n  pathAnimation: {\n    type: \"tween\",\n    duration: 2\n  },\n  endCircle: true\n}; /* Property Controls */\naddPropertyControls(Animator, {\n  slots: {\n    type: ControlType.ComponentInstance,\n    title: \"Children\"\n  },\n  animate: {\n    title: \"Animate\",\n    type: ControlType.Boolean,\n    defaultValue: Animator.defaultProps.animate,\n    enabledTitle: \"True\",\n    disabledTitle: \"False\"\n  },\n  shouldLoop: {\n    title: \"Loop\",\n    type: ControlType.Boolean,\n    defaultValue: Animator.defaultProps.shouldLoop,\n    enabledTitle: \"True\",\n    disabledTitle: \"False\",\n    hidden(props) {\n      return props.animate === false;\n    }\n  },\n  loopOptions: {\n    type: ControlType.Enum,\n    title: \"Type\",\n    defaultValue: Animator.defaultProps.loopOptions,\n    options: [\"loop\", \"reverse\", \"mirror\"],\n    optionTitles: [\"Loop\", \"Reverse\", \"Mirror\"],\n    hidden(props) {\n      return props.shouldLoop === false;\n    }\n  },\n  endCircle: {\n    title: \"End Circle\",\n    type: ControlType.Boolean,\n    defaultValue: Animator.defaultProps.endCircle,\n    enabledTitle: \"Show\",\n    disabledTitle: \"Hide\",\n    hidden(props) {\n      return props.animate === false;\n    }\n  },\n  from: {\n    title: \"From\",\n    type: ControlType.Number,\n    min: 0,\n    max: 100,\n    displayStepper: true,\n    step: 1,\n    defaultValue: Animator.defaultProps.from,\n    unit: \"%\",\n    hidden(props) {\n      return props.animate === false;\n    }\n  },\n  to: {\n    title: \"To\",\n    type: ControlType.Number,\n    min: 0,\n    max: 100,\n    displayStepper: true,\n    step: 1,\n    defaultValue: Animator.defaultProps.to,\n    unit: \"%\",\n    hidden(props) {\n      return props.animate === false;\n    }\n  },\n  pathAnimation: {\n    title: \" \",\n    type: ControlType.Transition,\n    defaultValue: Animator.defaultProps.pathAnimation,\n    hidden(props) {\n      return props.animate === false;\n    }\n  }\n}); /* Method to get stringless attributes */\nconst splitAndReplace = string => {\n  return string.split(\"=\")[1].replace(/['\"]+/g, \"\");\n}; /* Method to get the first child */\nfunction getFirstChild(slots) {\n  let firstChild;\n  Children.map(slots, child => {\n    if (firstChild === undefined) {\n      firstChild = child;\n    }\n  });\n  return firstChild;\n} /* Styles */\nconst placeholderStyles = {\n  display: \"flex\",\n  width: \"100%\",\n  height: \"100%\",\n  placeContent: \"center\",\n  placeItems: \"center\",\n  flexDirection: \"column\",\n  color: \"#96F\",\n  background: \"rgba(136, 85, 255, 0.1)\",\n  fontSize: 11,\n  overflow: \"hidden\"\n};\nconst emojiStyles = {\n  fontSize: 32,\n  marginBottom: 10\n};\nconst titleStyles = {\n  margin: 0,\n  marginBottom: 10,\n  fontWeight: 600,\n  textAlign: \"center\"\n};\nconst subtitleStyles = {\n  margin: 0,\n  opacity: .7,\n  maxWidth: 150,\n  lineHeight: 1.5,\n  textAlign: \"center\"\n};\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"default\": {\n      \"type\": \"reactComponent\",\n      \"name\": \"Animator\",\n      \"slots\": [],\n      \"annotations\": {\n        \"framerIntrinsicWidth\": \"200\",\n        \"framerIntrinsicHeight\": \"200\",\n        \"framerDisableUnlink\": \"*\",\n        \"framerSupportedLayoutWidth\": \"fixed\",\n        \"framerSupportedLayoutHeight\": \"fixed\",\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./Animator.map"],
  "mappings": "8HAae,SAARA,EAA0BC,EAAO,C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AAO,OACP,WAAY,0BACZ,SAAU,GACV,SAAU,QACZ,EACME,EAAc,CAClB,SAAU,GACV,aAAc,EAChB,EACMC,EAAc,CAClB,OAAQ,EACR,aAAc,GACd,WAAY,IACZ,UAAW,QACb,EACMC,EAAiB,CACrB,OAAQ,EACR,QAAS,GACT,SAAU,IACV,WAAY,IACZ,UAAW,QACb",
  "names": ["Animator", "props", "pathAnimation", "from", "to", "animate", "shouldLoop", "loopOptions", "slots", "endCircle", "hasChildren", "j", "customShape", "u", "placeholderStyles", "p", "emojiStyles", "titleStyles", "subtitleStyles", "firstChild", "getFirstChild", "svgChild", "isSpring", "shapeTransition", "pathLength", "useMotionValue", "opacity", "useTransform", "shapeProps", "isCanvas", "RenderTarget", "attributes", "pathD", "stroke", "strokeWidth", "strokeLinecap", "strokeLinejoin", "element", "splitAndReplace", "svgViewbox", "motion", "addPropertyControls", "ControlType", "string", "child"]
}
