{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///react-trend.min.js","webpack:///webpack/bootstrap de949c71486dfc09201d","webpack:///./src/index.js","webpack:///./src/components/Trend/index.js","webpack:///./src/components/Trend/Trend.js","webpack:///external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\"}","webpack:///./~/prop-types/index.js","webpack:///./~/prop-types/factoryWithThrowingShims.js","webpack:///./~/prop-types/lib/ReactPropTypesSecret.js","webpack:///./src/utils/index.js","webpack:///./src/helpers/DOM.helpers.js","webpack:///./src/helpers/math.helpers.js","webpack:///./src/helpers/misc.helpers.js","webpack:///./src/components/Trend/Trend.helpers.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_4__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_Trend","Object","defineProperty","enumerable","get","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","prototype","create","constructor","value","writable","configurable","setPrototypeOf","__proto__","_extends","assign","target","i","arguments","length","source","key","hasOwnProperty","_react","_react2","_propTypes","_propTypes2","_utils","_DOM","_math","_misc","propTypes","data","PropTypes","arrayOf","oneOfType","number","shape","isRequired","smooth","bool","autoDraw","autoDrawDuration","autoDrawEasing","string","width","height","padding","radius","gradient","defaultProps","stroke","strokeWidth","Trend","_Component","props","_this","trendId","generateId","gradientId","componentDidMount","_props","lineLength","path","getTotalLength","css","generateAutoDrawCss","duration","easing","injectStyleTag","getDelegatedProps","omit","keys","renderGradientDefinition","createElement","x1","y1","x2","y2","slice","reverse","map","index","offset","normalize","min","max","stopColor","render","_this2","_props2","plainValues","point","viewBoxWidth","viewBoxHeight","svgWidth","svgHeight","normalizedValues","normalizeDataset","minX","maxX","minY","maxY","buildSmoothPath","buildLinearPath","viewBox","ref","elem","d","fill","undefined","Component","emptyFunction","emptyFunctionWithReset","ReactPropTypesSecret","resetWarningCache","shim","propName","componentName","location","propFullName","secret","err","Error","name","getShim","ReactPropTypes","array","func","object","symbol","any","element","elementType","instanceOf","node","objectOf","oneOf","exact","checkPropTypes","range","to","concat","Array","pick","reduce","acc","_extends2","_extends3","indexOf","styleTag","_ref","x","y","isFirstInstruction","instruction","_ref2","firstPoint","otherPoints","next","prev","isCollinear","checkForCollinearPoints","distanceFromPrev","getDistanceBetween","distanceFromNext","threshold","Math","isTooCloseForRadius","radiusForPoint","before","moveTo","after","join","cssContents","document","querySelector","head","getElementsByTagName","type","setAttribute","appendChild","createTextNode","_ref$scaleMin","scaleMin","_ref$scaleMax","scaleMax","from","vector","sqrt","unitVector","p1","p2","pow","p3","round","random","boundariesX","boundariesY","apply","normalizedData","autodrawKeyframeAnimation","cleanupKeyframeAnimation"],"mappings":";;;;CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,UACA,kBAAAC,gBAAAC,IACAD,QAAA,SAAAJ,GACA,gBAAAC,SACAA,QAAA,MAAAD,EAAAG,QAAA,UAEAJ,EAAA,MAAAC,EAAAD,EAAA,QACCO,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAT,WACAW,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,QAAA,EAGAX,EAAAD,QAvBA,GAAAU,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASP,EAAQD,EAASQ,GAE/BP,EAAOD,QAAUQ,EAAoB,IAKhC,SAASP,EAAQD,EAASQ,GAE/B,YAaA,SAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,Q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C,QAQ+CsF,EAR/C","file":"react-trend.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Trend\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"Trend\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_4__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Trend\"] = factory(require(\"react\"));\n\telse\n\t\troot[\"Trend\"] = factory(root[\"React\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_4__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(1);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\texports.__esModule = true;\n\t\n\tvar _Trend = __webpack_require__(2);\n\t\n\tObject.defineProperty(exports, 'default', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_Trend).default;\n\t }\n\t});\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\texports.__esModule = true;\n\t\n\tvar _Trend = __webpack_require__(3);\n\t\n\tObject.defineProperty(exports, 'default', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_Trend).default;\n\t }\n\t});\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\texports.__esModule = true;\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar _react = __webpack_require__(4);\n\t\n\tvar _react2 = _interopRequireDefault(_react);\n\t\n\tvar _propTypes = __webpack_require__(5);\n\t\n\tvar _propTypes2 = _interopRequireDefault(_propTypes);\n\t\n\tvar _utils = __webpack_require__(8);\n\t\n\tvar _DOM = __webpack_require__(9);\n\t\n\tvar _math = __webpack_require__(10);\n\t\n\tvar _misc = __webpack_require__(11);\n\t\n\tvar _Trend = __webpack_require__(12);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar propTypes = {\n\t data: _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({\n\t value: _propTypes2.default.number\n\t })]).isRequired).isRequired,\n\t smooth: _propTypes2.default.bool,\n\t autoDraw: _propTypes2.default.bool,\n\t autoDrawDuration: _propTypes2.default.number,\n\t autoDrawEasing: _propTypes2.default.string,\n\t width: _propTypes2.default.number,\n\t height: _propTypes2.default.number,\n\t padding: _propTypes2.default.number,\n\t radius: _propTypes2.default.number,\n\t gradient: _propTypes2.default.arrayOf(_propTypes2.default.string)\n\t};\n\t\n\tvar defaultProps = {\n\t radius: 10,\n\t stroke: 'black',\n\t padding: 8,\n\t strokeWidth: 1,\n\t autoDraw: false,\n\t autoDrawDuration: 2000,\n\t autoDrawEasing: 'ease'\n\t};\n\t\n\tvar Trend = function (_Component) {\n\t _inherits(Trend, _Component);\n\t\n\t function Trend(props) {\n\t _classCallCheck(this, Trend);\n\t\n\t // Generate a random ID. This is important for distinguishing between\n\t // Trend components on a page, so that they can have different keyframe\n\t // animations.\n\t var _this = _possibleConstructorReturn(this, _Component.call(this, props));\n\t\n\t _this.trendId = (0, _misc.generateId)();\n\t _this.gradientId = 'react-trend-vertical-gradient-' + _this.trendId;\n\t return _this;\n\t }\n\t\n\t Trend.prototype.componentDidMount = function componentDidMount() {\n\t var _props = this.props,\n\t autoDraw = _props.autoDraw,\n\t autoDrawDuration = _props.autoDrawDuration,\n\t autoDrawEasing = _props.autoDrawEasing;\n\t\n\t\n\t if (autoDraw) {\n\t this.lineLength = this.path.getTotalLength();\n\t\n\t var css = (0, _Trend.generateAutoDrawCss)({\n\t id: this.trendId,\n\t lineLength: this.lineLength,\n\t duration: autoDrawDuration,\n\t easing: autoDrawEasing\n\t });\n\t\n\t (0, _DOM.injectStyleTag)(css);\n\t }\n\t };\n\t\n\t Trend.prototype.getDelegatedProps = function getDelegatedProps() {\n\t return (0, _utils.omit)(this.props, Object.keys(propTypes));\n\t };\n\t\n\t Trend.prototype.renderGradientDefinition = function renderGradientDefinition() {\n\t var gradient = this.props.gradient;\n\t\n\t\n\t return _react2.default.createElement(\n\t 'defs',\n\t null,\n\t _react2.default.createElement(\n\t 'linearGradient',\n\t {\n\t id: this.gradientId,\n\t x1: '0%',\n\t y1: '0%',\n\t x2: '0%',\n\t y2: '100%'\n\t },\n\t gradient.slice().reverse().map(function (c, index) {\n\t return _react2.default.createElement('stop', {\n\t key: index,\n\t offset: (0, _math.normalize)({\n\t value: index,\n\t min: 0,\n\t // If we only supply a single colour, it will try to normalize\n\t // between 0 and 0, which will create NaN. By making the `max`\n\t // at least 1, we ensure single-color \"gradients\" work.\n\t max: gradient.length - 1 || 1\n\t }),\n\t stopColor: c\n\t });\n\t })\n\t )\n\t );\n\t };\n\t\n\t Trend.prototype.render = function render() {\n\t var _this2 = this;\n\t\n\t var _props2 = this.props,\n\t data = _props2.data,\n\t smooth = _props2.smooth,\n\t width = _props2.width,\n\t height = _props2.height,\n\t padding = _props2.padding,\n\t radius = _props2.radius,\n\t gradient = _props2.gradient;\n\t\n\t // We need at least 2 points to draw a graph.\n\t\n\t if (!data || data.length < 2) {\n\t return null;\n\t }\n\t\n\t // `data` can either be an array of numbers:\n\t // [1, 2, 3]\n\t // or, an array of objects containing a value:\n\t // [ { value: 1 }, { value: 2 }, { value: 3 }]\n\t //\n\t // For now, we're just going to convert the second form to the first.\n\t // Later on, if/when we support tooltips, we may adjust.\n\t var plainValues = data.map(function (point) {\n\t return typeof point === 'number' ? point : point.value;\n\t });\n\t\n\t // Our viewbox needs to be in absolute units, so we'll default to 300x75\n\t // Our SVG can be a %, though; this is what makes it scalable.\n\t // By defaulting to percentages, the SVG will grow to fill its parent\n\t // container, preserving a 1/4 aspect ratio.\n\t var viewBoxWidth = width || 300;\n\t var viewBoxHeight = height || 75;\n\t var svgWidth = width || '100%';\n\t var svgHeight = height || '25%';\n\t\n\t var normalizedValues = (0, _Trend.normalizeDataset)(plainValues, {\n\t minX: padding,\n\t maxX: viewBoxWidth - padding,\n\t // NOTE: Because SVGs are indexed from the top left, but most data is\n\t // indexed from the bottom left, we're inverting the Y min/max.\n\t minY: viewBoxHeight - padding,\n\t maxY: padding\n\t });\n\t\n\t var path = smooth ? (0, _DOM.buildSmoothPath)(normalizedValues, { radius: radius }) : (0, _DOM.buildLinearPath)(normalizedValues);\n\t\n\t return _react2.default.createElement(\n\t 'svg',\n\t _extends({\n\t width: svgWidth,\n\t height: svgHeight,\n\t viewBox: '0 0 ' + viewBoxWidth + ' ' + viewBoxHeight\n\t }, this.getDelegatedProps()),\n\t gradient && this.renderGradientDefinition(),\n\t _react2.default.createElement('path', {\n\t ref: function ref(elem) {\n\t _this2.path = elem;\n\t },\n\t id: 'react-trend-' + this.trendId,\n\t d: path,\n\t fill: 'none',\n\t stroke: gradient ? 'url(#' + this.gradientId + ')' : undefined\n\t })\n\t );\n\t };\n\t\n\t return Trend;\n\t}(_react.Component);\n\t\n\tTrend.defaultProps = defaultProps;\n\t\n\texports.default = Trend;\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Copyright (c) 2013-present, Facebook, Inc.\n\t *\n\t * This source code is licensed under the MIT license found in the\n\t * LICENSE file in the root directory of this source tree.\n\t */\n\t\n\tif (false) {\n\t var ReactIs = require('react-is');\n\t\n\t // By explicitly using `prop-types` you are opting into new development behavior.\n\t // http://fb.me/prop-types-in-prod\n\t var throwOnDirectAccess = true;\n\t module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n\t} else {\n\t // By explicitly using `prop-types` you are opting into new production behavior.\n\t // http://fb.me/prop-types-in-prod\n\t module.exports = __webpack_require__(6)();\n\t}\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Copyright (c) 2013-present, Facebook, Inc.\n\t *\n\t * This source code is licensed under the MIT license found in the\n\t * LICENSE file in the root directory of this source tree.\n\t */\n\t\n\t'use strict';\n\t\n\tvar ReactPropTypesSecret = __webpack_require__(7);\n\t\n\tfunction emptyFunction() {}\n\tfunction emptyFunctionWithReset() {}\n\temptyFunctionWithReset.resetWarningCache = emptyFunction;\n\t\n\tmodule.exports = function() {\n\t function shim(props, propName, componentName, location, propFullName, secret) {\n\t if (secret === ReactPropTypesSecret) {\n\t // It is still safe when called from React.\n\t return;\n\t }\n\t var err = new Error(\n\t 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n\t 'Use PropTypes.checkPropTypes() to call them. ' +\n\t 'Read more at http://fb.me/use-check-prop-types'\n\t );\n\t err.name = 'Invariant Violation';\n\t throw err;\n\t };\n\t shim.isRequired = shim;\n\t function getShim() {\n\t return shim;\n\t };\n\t // Important!\n\t // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n\t var ReactPropTypes = {\n\t array: shim,\n\t bool: shim,\n\t func: shim,\n\t number: shim,\n\t object: shim,\n\t string: shim,\n\t symbol: shim,\n\t\n\t any: shim,\n\t arrayOf: getShim,\n\t element: shim,\n\t elementType: shim,\n\t instanceOf: getShim,\n\t node: shim,\n\t objectOf: getShim,\n\t oneOf: getShim,\n\t oneOfType: getShim,\n\t shape: getShim,\n\t exact: getShim,\n\t\n\t checkPropTypes: emptyFunctionWithReset,\n\t resetWarningCache: emptyFunction\n\t };\n\t\n\t ReactPropTypes.PropTypes = ReactPropTypes;\n\t\n\t return ReactPropTypes;\n\t};\n\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Copyright (c) 2013-present, Facebook, Inc.\n\t *\n\t * This source code is licensed under the MIT license found in the\n\t * LICENSE file in the root directory of this source tree.\n\t */\n\t\n\t'use strict';\n\t\n\tvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\t\n\tmodule.exports = ReactPropTypesSecret;\n\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\texports.__esModule = true;\n\t\n\tvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\t\n\tvar range = exports.range = function range(to) {\n\t return [].concat(Array(to).keys());\n\t};\n\t\n\tvar pick = exports.pick = function pick(obj, keys) {\n\t return keys.reduce(function (acc, key) {\n\t var _extends2;\n\t\n\t return _extends({}, acc, (_extends2 = {}, _extends2[key] = obj[key], _extends2));\n\t }, {});\n\t};\n\t\n\tvar omit = exports.omit = function omit(obj, keys) {\n\t return Object.keys(obj).reduce(function (acc, key) {\n\t var _extends3;\n\t\n\t if (keys.indexOf(key) !== -1) {\n\t return acc;\n\t }\n\t\n\t return _extends({}, acc, (_extends3 = {}, _extends3[key] = obj[key], _extends3));\n\t }, {});\n\t};\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\texports.__esModule = true;\n\texports.injectStyleTag = exports.buildSmoothPath = exports.buildLinearPath = undefined;\n\t\n\tvar _math = __webpack_require__(10);\n\t\n\tvar buildLinearPath = exports.buildLinearPath = function buildLinearPath(data) {\n\t return data.reduce(function (path, _ref, index) {\n\t var x = _ref.x,\n\t y = _ref.y;\n\t\n\t // The very first instruction needs to be a \"move\".\n\t // The rest will be a \"line\".\n\t var isFirstInstruction = index === 0;\n\t var instruction = isFirstInstruction ? 'M' : 'L';\n\t\n\t return '' + path + instruction + ' ' + x + ',' + y + '\\n';\n\t }, '');\n\t};\n\t\n\tvar buildSmoothPath = exports.buildSmoothPath = function buildSmoothPath(data, _ref2) {\n\t var radius = _ref2.radius;\n\t var firstPoint = data[0],\n\t otherPoints = data.slice(1);\n\t\n\t\n\t return otherPoints.reduce(function (path, point, index) {\n\t var next = otherPoints[index + 1];\n\t var prev = otherPoints[index - 1] || firstPoint;\n\t\n\t var isCollinear = next && (0, _math.checkForCollinearPoints)(prev, point, next);\n\t\n\t if (!next || isCollinear) {\n\t // The very last line in the sequence can just be a regular line.\n\t return path + '\\nL ' + point.x + ',' + point.y;\n\t }\n\t\n\t var distanceFromPrev = (0, _math.getDistanceBetween)(prev, point);\n\t var distanceFromNext = (0, _math.getDistanceBetween)(next, point);\n\t var threshold = Math.min(distanceFromPrev, distanceFromNext);\n\t\n\t var isTooCloseForRadius = threshold / 2 < radius;\n\t\n\t var radiusForPoint = isTooCloseForRadius ? threshold / 2 : radius;\n\t\n\t var before = (0, _math.moveTo)(prev, point, radiusForPoint);\n\t var after = (0, _math.moveTo)(next, point, radiusForPoint);\n\t\n\t return [path, 'L ' + before.x + ',' + before.y, 'S ' + point.x + ',' + point.y + ' ' + after.x + ',' + after.y].join('\\n');\n\t }, 'M ' + firstPoint.x + ',' + firstPoint.y);\n\t};\n\t\n\t// Taken from Khan Academy's Aphrodite\n\t// https://github.com/Khan/aphrodite/blob/master/src/inject.js\n\tvar styleTag = void 0;\n\tvar injectStyleTag = exports.injectStyleTag = function injectStyleTag(cssContents) {\n\t if (styleTag == null) {\n\t // Try to find a style tag with the `data-react-trend` attribute first.\n\t styleTag = document.querySelector('style[data-react-trend]');\n\t\n\t // If that doesn't work, generate a new style tag.\n\t if (styleTag == null) {\n\t // Taken from\n\t // http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript\n\t var head = document.head || document.getElementsByTagName('head')[0];\n\t styleTag = document.createElement('style');\n\t\n\t styleTag.type = 'text/css';\n\t styleTag.setAttribute('data-react-trend', '');\n\t head.appendChild(styleTag);\n\t }\n\t }\n\t\n\t styleTag.appendChild(document.createTextNode(cssContents));\n\t};\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\texports.__esModule = true;\n\t/* eslint-disable no-restricted-properties */\n\t\n\t/** normalize\n\t * This lets us translate a value from one scale to another.\n\t *\n\t * @param {Number} value - Our initial value to translate\n\t * @param {Number} min - the current minimum value possible\n\t * @param {Number} max - the current maximum value possible\n\t * @param {Number} scaleMin - the min value of the scale we're translating to\n\t * @param {Number} scaleMax - the max value of the scale we're translating to\n\t *\n\t * @returns {Number} the value on its new scale\n\t */\n\tvar normalize = exports.normalize = function normalize(_ref) {\n\t var value = _ref.value,\n\t min = _ref.min,\n\t max = _ref.max,\n\t _ref$scaleMin = _ref.scaleMin,\n\t scaleMin = _ref$scaleMin === undefined ? 0 : _ref$scaleMin,\n\t _ref$scaleMax = _ref.scaleMax,\n\t scaleMax = _ref$scaleMax === undefined ? 1 : _ref$scaleMax;\n\t\n\t // If the `min` and `max` are the same value, it means our dataset is flat.\n\t // For now, let's assume that flat data should be aligned to the bottom.\n\t if (min === max) {\n\t return scaleMin;\n\t }\n\t\n\t return scaleMin + (value - min) * (scaleMax - scaleMin) / (max - min);\n\t};\n\t\n\t/** moveTo\n\t * the coordinate that lies at a midpoint between 2 lines, based on the radius\n\t *\n\t * @param {Object} to - Our initial point\n\t * @param {Number} to.x - The x value of our initial point\n\t * @param {Number} to.y - The y value of our initial point\n\t * @param {Object} from - Our final point\n\t * @param {Number} from.x - The x value of our final point\n\t * @param {Number} from.y - The y value of our final point\n\t * @param {Number} radius - The distance away from the final point\n\t *\n\t * @returns {Object} an object holding the x/y coordinates of the midpoint.\n\t */\n\tvar moveTo = exports.moveTo = function moveTo(to, from, radius) {\n\t var vector = { x: to.x - from.x, y: to.y - from.y };\n\t var length = Math.sqrt(vector.x * vector.x + vector.y * vector.y);\n\t var unitVector = { x: vector.x / length, y: vector.y / length };\n\t\n\t return {\n\t x: from.x + unitVector.x * radius,\n\t y: from.y + unitVector.y * radius\n\t };\n\t};\n\t\n\t/** getDistanceBetween\n\t * Simple formula derived from pythagoras to calculate the distance between\n\t * 2 points on a plane.\n\t *\n\t * @param {Object} p1 - Our initial point\n\t * @param {Number} p1.x - The x value of our initial point\n\t * @param {Number} p1.y - The y value of our initial point\n\t * @param {Object} p2 - Our final point\n\t * @param {Number} p2.x - The x value of our final point\n\t * @param {Number} p2.y - The y value of our final point\n\t *\n\t * @returns {Number} the distance between the points.\n\t */\n\tvar getDistanceBetween = exports.getDistanceBetween = function getDistanceBetween(p1, p2) {\n\t return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n\t};\n\t\n\t/** checkForCollinearPoints\n\t * Figure out if the midpoint fits perfectly on a line between the two others.\n\t *\n\t * @param {Object} p1 - Our initial point\n\t * @param {Number} p1.x - The x value of our initial point\n\t * @param {Number} p1.y - The y value of our initial point\n\t * @param {Object} p2 - Our mid-point\n\t * @param {Number} p2.x - The x value of our mid-point\n\t * @param {Number} p2.y - The y value of our mid-point\n\t * @param {Object} p3 - Our final point\n\t * @param {Number} p3.x - The x value of our final point\n\t * @param {Number} p3.y - The y value of our final point\n\t\n\t * @returns {Boolean} whether or not p2 sits on the line between p1 and p3.\n\t */\n\tvar checkForCollinearPoints = exports.checkForCollinearPoints = function checkForCollinearPoints(p1, p2, p3) {\n\t return (p1.y - p2.y) * (p1.x - p3.x) === (p1.y - p3.y) * (p1.x - p2.x);\n\t};\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\texports.__esModule = true;\n\t// eslint-disable-next-line no-restricted-properties\n\tvar generateId = exports.generateId = function generateId() {\n\t return Math.round(Math.random() * Math.pow(10, 16));\n\t};\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\texports.__esModule = true;\n\texports.generateAutoDrawCss = exports.normalizeDataset = undefined;\n\t\n\tvar _math = __webpack_require__(10);\n\t\n\tvar normalizeDataset = exports.normalizeDataset = function normalizeDataset(data, _ref) {\n\t var minX = _ref.minX,\n\t maxX = _ref.maxX,\n\t minY = _ref.minY,\n\t maxY = _ref.maxY;\n\t\n\t // For the X axis, we want to normalize it based on its index in the array.\n\t // For the Y axis, we want to normalize it based on the element's value.\n\t //\n\t // X axis is easy: just evenly-space each item in the array.\n\t // For the Y axis, we first need to find the min and max of our array,\n\t // and then normalize those values between 0 and 1.\n\t var boundariesX = { min: 0, max: data.length - 1 };\n\t var boundariesY = { min: Math.min.apply(Math, data), max: Math.max.apply(Math, data) };\n\t\n\t var normalizedData = data.map(function (point, index) {\n\t return {\n\t x: (0, _math.normalize)({\n\t value: index,\n\t min: boundariesX.min,\n\t max: boundariesX.max,\n\t scaleMin: minX,\n\t scaleMax: maxX\n\t }),\n\t y: (0, _math.normalize)({\n\t value: point,\n\t min: boundariesY.min,\n\t max: boundariesY.max,\n\t scaleMin: minY,\n\t scaleMax: maxY\n\t })\n\t };\n\t });\n\t\n\t // According to the SVG spec, paths with a height/width of `0` can't have\n\t // linear gradients applied. This means that our lines are invisible when\n\t // the dataset is flat (eg. [0, 0, 0, 0]).\n\t //\n\t // The hacky solution is to apply a very slight offset to the first point of\n\t // the dataset. As ugly as it is, it's the best solution we can find (there\n\t // are ways within the SVG spec of changing it, but not without causing\n\t // breaking changes).\n\t if (boundariesY.min === boundariesY.max) {\n\t // eslint-disable-next-line no-param-reassign\n\t normalizedData[0].y += 0.0001;\n\t }\n\t\n\t return normalizedData;\n\t};\n\t\n\tvar generateAutoDrawCss = exports.generateAutoDrawCss = function generateAutoDrawCss(_ref2) {\n\t var id = _ref2.id,\n\t lineLength = _ref2.lineLength,\n\t duration = _ref2.duration,\n\t easing = _ref2.easing;\n\t\n\t // We do the animation using the dash array/offset trick\n\t // https://css-tricks.com/svg-line-animation-works/\n\t var autodrawKeyframeAnimation = '\\n @keyframes react-trend-autodraw-' + id + ' {\\n 0% {\\n stroke-dasharray: ' + lineLength + ';\\n stroke-dashoffset: ' + lineLength + '\\n }\\n 100% {\\n stroke-dasharray: ' + lineLength + ';\\n stroke-dashoffset: 0;\\n }\\n 100% {\\n stroke-dashoffset: \\'\\';\\n stroke-dasharray: \\'\\';\\n }\\n }\\n ';\n\t\n\t // One unfortunate side-effect of the auto-draw is that the line is\n\t // actually 1 big dash, the same length as the line itself. If the\n\t // line length changes (eg. radius change, new data), that dash won't\n\t // be the same length anymore. We can fix that by removing those\n\t // properties once the auto-draw is completed.\n\t var cleanupKeyframeAnimation = '\\n @keyframes react-trend-autodraw-cleanup-' + id + ' {\\n to {\\n stroke-dasharray: \\'\\';\\n stroke-dashoffset: \\'\\';\\n }\\n }\\n ';\n\t\n\t return '\\n ' + autodrawKeyframeAnimation + '\\n\\n ' + cleanupKeyframeAnimation + '\\n\\n #react-trend-' + id + ' {\\n animation:\\n react-trend-autodraw-' + id + ' ' + duration + 'ms ' + easing + ',\\n react-trend-autodraw-cleanup-' + id + ' 1ms ' + duration + 'ms\\n ;\\n }\\n ';\n\t};\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// react-trend.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap de949c71486dfc09201d","export { default } from './components/Trend';\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","export { default } from './Trend';\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/Trend/index.js","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { omit } from '../../utils';\nimport {\n buildSmoothPath,\n buildLinearPath,\n injectStyleTag,\n} from '../../helpers/DOM.helpers';\nimport { normalize } from '../../helpers/math.helpers';\nimport { generateId } from '../../helpers/misc.helpers';\nimport { normalizeDataset, generateAutoDrawCss } from './Trend.helpers';\n\nconst propTypes = {\n data: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.number,\n PropTypes.shape({\n value: PropTypes.number,\n }),\n ]).isRequired\n ).isRequired,\n smooth: PropTypes.bool,\n autoDraw: PropTypes.bool,\n autoDrawDuration: PropTypes.number,\n autoDrawEasing: PropTypes.string,\n width: PropTypes.number,\n height: PropTypes.number,\n padding: PropTypes.number,\n radius: PropTypes.number,\n gradient: PropTypes.arrayOf(PropTypes.string),\n};\n\nconst defaultProps = {\n radius: 10,\n stroke: 'black',\n padding: 8,\n strokeWidth: 1,\n autoDraw: false,\n autoDrawDuration: 2000,\n autoDrawEasing: 'ease',\n};\n\nclass Trend extends Component {\n constructor(props) {\n super(props);\n\n // Generate a random ID. This is important for distinguishing between\n // Trend components on a page, so that they can have different keyframe\n // animations.\n this.trendId = generateId();\n this.gradientId = `react-trend-vertical-gradient-${this.trendId}`;\n }\n\n componentDidMount() {\n const { autoDraw, autoDrawDuration, autoDrawEasing } = this.props;\n\n if (autoDraw) {\n this.lineLength = this.path.getTotalLength();\n\n const css = generateAutoDrawCss({\n id: this.trendId,\n lineLength: this.lineLength,\n duration: autoDrawDuration,\n easing: autoDrawEasing,\n });\n\n injectStyleTag(css);\n }\n }\n\n getDelegatedProps() {\n return omit(this.props, Object.keys(propTypes));\n }\n\n renderGradientDefinition() {\n const { gradient } = this.props;\n\n return (\n \n \n {gradient.slice().reverse().map((c, index) => (\n \n ))}\n \n \n );\n }\n\n render() {\n const {\n data,\n smooth,\n width,\n height,\n padding,\n radius,\n gradient,\n } = this.props;\n\n // We need at least 2 points to draw a graph.\n if (!data || data.length < 2) {\n return null;\n }\n\n // `data` can either be an array of numbers:\n // [1, 2, 3]\n // or, an array of objects containing a value:\n // [ { value: 1 }, { value: 2 }, { value: 3 }]\n //\n // For now, we're just going to convert the second form to the first.\n // Later on, if/when we support tooltips, we may adjust.\n const plainValues = data.map(point => (\n typeof point === 'number' ? point : point.value\n ));\n\n // Our viewbox needs to be in absolute units, so we'll default to 300x75\n // Our SVG can be a %, though; this is what makes it scalable.\n // By defaulting to percentages, the SVG will grow to fill its parent\n // container, preserving a 1/4 aspect ratio.\n const viewBoxWidth = width || 300;\n const viewBoxHeight = height || 75;\n const svgWidth = width || '100%';\n const svgHeight = height || '25%';\n\n const normalizedValues = normalizeDataset(plainValues, {\n minX: padding,\n maxX: viewBoxWidth - padding,\n // NOTE: Because SVGs are indexed from the top left, but most data is\n // indexed from the bottom left, we're inverting the Y min/max.\n minY: viewBoxHeight - padding,\n maxY: padding,\n });\n\n const path = smooth\n ? buildSmoothPath(normalizedValues, { radius })\n : buildLinearPath(normalizedValues);\n\n return (\n \n );\n }\n}\n\nTrend.propTypes = propTypes;\nTrend.defaultProps = defaultProps;\n\nexport default Trend;\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/Trend/Trend.js","module.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"React\",\"commonjs2\":\"react\",\"commonjs\":\"react\",\"amd\":\"react\"}\n// module id = 4\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/prop-types/index.js\n// module id = 5\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/prop-types/factoryWithThrowingShims.js\n// module id = 6\n// module chunks = 0","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/prop-types/lib/ReactPropTypesSecret.js\n// module id = 7\n// module chunks = 0","export const range = to => [...Array(to).keys()];\n\nexport const pick = (obj, keys) => (\n keys.reduce((acc, key) => ({\n ...acc,\n [key]: obj[key],\n }), {})\n);\n\nexport const omit = (obj, keys) => (\n Object.keys(obj).reduce((acc, key) => {\n if (keys.indexOf(key) !== -1) {\n return acc;\n }\n\n return {\n ...acc,\n [key]: obj[key],\n };\n }, {})\n);\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils/index.js","import {\n moveTo,\n getDistanceBetween,\n checkForCollinearPoints,\n} from './math.helpers';\n\nexport const buildLinearPath = data => (\n data.reduce((path, { x, y }, index) => {\n // The very first instruction needs to be a \"move\".\n // The rest will be a \"line\".\n const isFirstInstruction = index === 0;\n const instruction = isFirstInstruction ? 'M' : 'L';\n\n return `${path}${instruction} ${x},${y}\\n`;\n }, '')\n);\n\nexport const buildSmoothPath = (data, { radius }) => {\n const [firstPoint, ...otherPoints] = data;\n\n return otherPoints.reduce((path, point, index) => {\n const next = otherPoints[index + 1];\n const prev = otherPoints[index - 1] || firstPoint;\n\n const isCollinear = next && checkForCollinearPoints(prev, point, next);\n\n if (!next || isCollinear) {\n // The very last line in the sequence can just be a regular line.\n return `${path}\\nL ${point.x},${point.y}`;\n }\n\n const distanceFromPrev = getDistanceBetween(prev, point);\n const distanceFromNext = getDistanceBetween(next, point);\n const threshold = Math.min(distanceFromPrev, distanceFromNext);\n\n const isTooCloseForRadius = (threshold / 2) < radius;\n\n const radiusForPoint = isTooCloseForRadius ? threshold / 2 : radius;\n\n const before = moveTo(prev, point, radiusForPoint);\n const after = moveTo(next, point, radiusForPoint);\n\n return [\n path,\n `L ${before.x},${before.y}`,\n `S ${point.x},${point.y} ${after.x},${after.y}`,\n ].join('\\n');\n }, `M ${firstPoint.x},${firstPoint.y}`);\n};\n\n// Taken from Khan Academy's Aphrodite\n// https://github.com/Khan/aphrodite/blob/master/src/inject.js\nlet styleTag;\nexport const injectStyleTag = (cssContents) => {\n if (styleTag == null) {\n // Try to find a style tag with the `data-react-trend` attribute first.\n styleTag = document.querySelector('style[data-react-trend]');\n\n // If that doesn't work, generate a new style tag.\n if (styleTag == null) {\n // Taken from\n // http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript\n const head = document.head || document.getElementsByTagName('head')[0];\n styleTag = document.createElement('style');\n\n styleTag.type = 'text/css';\n styleTag.setAttribute('data-react-trend', '');\n head.appendChild(styleTag);\n }\n }\n\n styleTag.appendChild(document.createTextNode(cssContents));\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/helpers/DOM.helpers.js","/* eslint-disable no-restricted-properties */\n\n/** normalize\n * This lets us translate a value from one scale to another.\n *\n * @param {Number} value - Our initial value to translate\n * @param {Number} min - the current minimum value possible\n * @param {Number} max - the current maximum value possible\n * @param {Number} scaleMin - the min value of the scale we're translating to\n * @param {Number} scaleMax - the max value of the scale we're translating to\n *\n * @returns {Number} the value on its new scale\n */\nexport const normalize = ({ value, min, max, scaleMin = 0, scaleMax = 1 }) => {\n // If the `min` and `max` are the same value, it means our dataset is flat.\n // For now, let's assume that flat data should be aligned to the bottom.\n if (min === max) {\n return scaleMin;\n }\n\n return scaleMin + (value - min) * (scaleMax - scaleMin) / (max - min);\n};\n\n/** moveTo\n * the coordinate that lies at a midpoint between 2 lines, based on the radius\n *\n * @param {Object} to - Our initial point\n * @param {Number} to.x - The x value of our initial point\n * @param {Number} to.y - The y value of our initial point\n * @param {Object} from - Our final point\n * @param {Number} from.x - The x value of our final point\n * @param {Number} from.y - The y value of our final point\n * @param {Number} radius - The distance away from the final point\n *\n * @returns {Object} an object holding the x/y coordinates of the midpoint.\n */\nexport const moveTo = (to, from, radius) => {\n const vector = { x: to.x - from.x, y: to.y - from.y };\n const length = Math.sqrt((vector.x * vector.x) + (vector.y * vector.y));\n const unitVector = { x: vector.x / length, y: vector.y / length };\n\n return {\n x: from.x + unitVector.x * radius,\n y: from.y + unitVector.y * radius,\n };\n};\n\n/** getDistanceBetween\n * Simple formula derived from pythagoras to calculate the distance between\n * 2 points on a plane.\n *\n * @param {Object} p1 - Our initial point\n * @param {Number} p1.x - The x value of our initial point\n * @param {Number} p1.y - The y value of our initial point\n * @param {Object} p2 - Our final point\n * @param {Number} p2.x - The x value of our final point\n * @param {Number} p2.y - The y value of our final point\n *\n * @returns {Number} the distance between the points.\n */\nexport const getDistanceBetween = (p1, p2) => (\n Math.sqrt(\n Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)\n )\n);\n\n/** checkForCollinearPoints\n * Figure out if the midpoint fits perfectly on a line between the two others.\n *\n * @param {Object} p1 - Our initial point\n * @param {Number} p1.x - The x value of our initial point\n * @param {Number} p1.y - The y value of our initial point\n * @param {Object} p2 - Our mid-point\n * @param {Number} p2.x - The x value of our mid-point\n * @param {Number} p2.y - The y value of our mid-point\n * @param {Object} p3 - Our final point\n * @param {Number} p3.x - The x value of our final point\n * @param {Number} p3.y - The y value of our final point\n\n * @returns {Boolean} whether or not p2 sits on the line between p1 and p3.\n */\nexport const checkForCollinearPoints = (p1, p2, p3) => (\n (p1.y - p2.y) * (p1.x - p3.x) ===\n (p1.y - p3.y) * (p1.x - p2.x)\n);\n\n\n\n// WEBPACK FOOTER //\n// ./src/helpers/math.helpers.js","// eslint-disable-next-line no-restricted-properties\nexport const generateId = () => Math.round(Math.random() * Math.pow(10, 16));\n\n\n\n// WEBPACK FOOTER //\n// ./src/helpers/misc.helpers.js","import { normalize } from '../../helpers/math.helpers';\n\nexport const normalizeDataset = (data, { minX, maxX, minY, maxY }) => {\n // For the X axis, we want to normalize it based on its index in the array.\n // For the Y axis, we want to normalize it based on the element's value.\n //\n // X axis is easy: just evenly-space each item in the array.\n // For the Y axis, we first need to find the min and max of our array,\n // and then normalize those values between 0 and 1.\n const boundariesX = { min: 0, max: data.length - 1 };\n const boundariesY = { min: Math.min(...data), max: Math.max(...data) };\n\n const normalizedData = data.map((point, index) => ({\n x: normalize({\n value: index,\n min: boundariesX.min,\n max: boundariesX.max,\n scaleMin: minX,\n scaleMax: maxX,\n }),\n y: normalize({\n value: point,\n min: boundariesY.min,\n max: boundariesY.max,\n scaleMin: minY,\n scaleMax: maxY,\n }),\n }));\n\n // According to the SVG spec, paths with a height/width of `0` can't have\n // linear gradients applied. This means that our lines are invisible when\n // the dataset is flat (eg. [0, 0, 0, 0]).\n //\n // The hacky solution is to apply a very slight offset to the first point of\n // the dataset. As ugly as it is, it's the best solution we can find (there\n // are ways within the SVG spec of changing it, but not without causing\n // breaking changes).\n if (boundariesY.min === boundariesY.max) {\n // eslint-disable-next-line no-param-reassign\n normalizedData[0].y += 0.0001;\n }\n\n return normalizedData;\n};\n\nexport const generateAutoDrawCss = ({ id, lineLength, duration, easing }) => {\n // We do the animation using the dash array/offset trick\n // https://css-tricks.com/svg-line-animation-works/\n const autodrawKeyframeAnimation = `\n @keyframes react-trend-autodraw-${id} {\n 0% {\n stroke-dasharray: ${lineLength};\n stroke-dashoffset: ${lineLength}\n }\n 100% {\n stroke-dasharray: ${lineLength};\n stroke-dashoffset: 0;\n }\n 100% {\n stroke-dashoffset: '';\n stroke-dasharray: '';\n }\n }\n `;\n\n // One unfortunate side-effect of the auto-draw is that the line is\n // actually 1 big dash, the same length as the line itself. If the\n // line length changes (eg. radius change, new data), that dash won't\n // be the same length anymore. We can fix that by removing those\n // properties once the auto-draw is completed.\n const cleanupKeyframeAnimation = `\n @keyframes react-trend-autodraw-cleanup-${id} {\n to {\n stroke-dasharray: '';\n stroke-dashoffset: '';\n }\n }\n `;\n\n return `\n ${autodrawKeyframeAnimation}\n\n ${cleanupKeyframeAnimation}\n\n #react-trend-${id} {\n animation:\n react-trend-autodraw-${id} ${duration}ms ${easing},\n react-trend-autodraw-cleanup-${id} 1ms ${duration}ms\n ;\n }\n `;\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/Trend/Trend.helpers.js"],"sourceRoot":""}