{"ast":null,"code":"import _objectSpread from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2\";\nimport _assertThisInitialized from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _get from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/get\";\nimport _getPrototypeOf from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _inherits from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createSuper\";\nimport _slicedToArray from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nimport _defineProperty from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _createForOfIteratorHelper from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper\";\nimport _toConsumableArray from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass\";\n\n/*!\n * Chart.js v3.3.2\n * https://www.chartjs.org\n * (c) 2021 Chart.js Contributors\n * Released under the MIT License\n */\nimport { r as requestAnimFrame, a as resolve, e as effects, c as _color, i as isObject, b as isArray, d as defaults, v as valueOrDefault, u as unlistenArrayEvents, l as listenArrayEvents, f as resolveObjectKey, g as isNumberFinite, h as defined, s as sign, j as isNullOrUndef, k as clipArea, m as unclipArea, _ as _arrayUnique, t as toRadians, n as toPercentage, o as toDimension, T as TAU, p as formatNumber, q as _angleBetween, H as HALF_PI, P as PI, w as isNumber, x as _limitValue, y as _lookupByKey, z as getRelativePosition$1, A as _isPointInArea, B as _rlookupByKey, C as toPadding, D as each, E as _getMaximumSize, F as _getParentNode, G as readUsedSize, I as throttled, J as supportsEventListenerOptions, K as log10, L as _factorize, M as finiteOrDefault, N as callback, O as _addGrace, Q as toDegrees, R as _measureText, S as _int16Range, U as _alignPixel, V as renderText, W as toFont, X as _toLeftRightCenter, Y as _alignStartEnd, Z as overrides, $ as merge, a0 as _capitalize, a1 as descriptors, a2 as isFunction, a3 as _attachContext, a4 as _createResolver, a5 as _descriptors, a6 as mergeIf, a7 as uid, a8 as debounce, a9 as retinaScale, aa as clearCanvas, ab as setsEqual, ac as _elementsEqual, ad as getAngleFromPoint, ae as _readValueToProps, af as _updateBezierControlPoints, ag as _computeSegments, ah as _boundSegments, ai as _steppedInterpolation, aj as _bezierInterpolation, ak as _pointInLine, al as _steppedLineTo, am as _bezierCurveTo, an as drawPoint, ao as addRoundedRectPath, ap as toTRBL, aq as toTRBLCorners, ar as _boundSegment, as as _normalizeAngle, at as getRtlAdapter, au as overrideTextDirection, av as _textX, aw as restoreTextDirection, ax as noop, ay as distanceBetweenPoints, az as _setMinAndMaxByKey, aA as niceNum, aB as almostWhole, aC as almostEquals, aD as _decimalPlaces, aE as _longestText, aF as _filterBetween, aG as _lookup } from './chunks/helpers.segment.js';\nexport { d as defaults } from './chunks/helpers.segment.js';\n\nvar Animator = /*#__PURE__*/function () {\n function Animator() {\n _classCallCheck(this, Animator);\n\n this._request = null;\n this._charts = new Map();\n this._running = false;\n this._lastDate = undefined;\n }\n\n _createClass(Animator, [{\n key: \"_notify\",\n value: function _notify(chart, anims, date, type) {\n var callbacks = anims.listeners[type];\n var numSteps = anims.duration;\n callbacks.forEach(function (fn) {\n return fn({\n chart: chart,\n initial: anims.initial,\n numSteps: numSteps,\n currentStep: Math.min(date - anims.start, numSteps)\n });\n });\n }\n }, {\n key: \"_refresh\",\n value: function _refresh() {\n var me = this;\n\n if (me._request) {\n return;\n }\n\n me._running = true;\n me._request = requestAnimFrame.call(window, function () {\n me._update();\n\n me._request = null;\n\n if (me._running) {\n me._refresh();\n }\n });\n }\n }, {\n key: \"_update\",\n value: function _update() {\n var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Date.now();\n var me = this;\n var remaining = 0;\n\n me._charts.forEach(function (anims, chart) {\n if (!anims.running || !anims.items.length) {\n return;\n }\n\n var items = anims.items;\n var i = items.length - 1;\n var draw = false;\n var item;\n\n for (; i >= 0; --i) {\n item = items[i];\n\n if (item._active) {\n if (item._total > anims.duration) {\n anims.duration = item._total;\n }\n\n item.tick(date);\n draw = true;\n } else {\n items[i] = items[items.length - 1];\n items.pop();\n }\n }\n\n if (draw) {\n chart.draw();\n\n me._notify(chart, anims, date, 'progress');\n }\n\n if (!items.length) {\n anims.running = false;\n\n me._notify(chart, anims, date, 'complete');\n\n anims.initial = false;\n }\n\n remaining += items.length;\n });\n\n me._lastDate = date;\n\n if (remaining === 0) {\n me._running = false;\n }\n }\n }, {\n key: \"_getAnims\",\n value: function _getAnims(chart) {\n var charts = this._charts;\n var anims = charts.get(chart);\n\n if (!anims) {\n anims = {\n running: false,\n initial: true,\n items: [],\n listeners: {\n complete: [],\n progress: []\n }\n };\n charts.set(chart, anims);\n }\n\n return anims;\n }\n }, {\n key: \"listen\",\n value: function listen(chart, event, cb) {\n this._getAnims(chart).listeners[event].push(cb);\n }\n }, {\n key: \"add\",\n value: function add(chart, items) {\n var _this$_getAnims$items;\n\n if (!items || !items.length) {\n return;\n }\n\n (_this$_getAnims$items = this._getAnims(chart).items).push.apply(_this$_getAnims$items, _toConsumableArray(items));\n }\n }, {\n key: \"has\",\n value: function has(chart) {\n return this._getAnims(chart).items.length > 0;\n }\n }, {\n key: \"start\",\n value: function start(chart) {\n var anims = this._charts.get(chart);\n\n if (!anims) {\n return;\n }\n\n anims.running = true;\n anims.start = Date.now();\n anims.duration = anims.items.reduce(function (acc, cur) {\n return Math.max(acc, cur._duration);\n }, 0);\n\n this._refresh();\n }\n }, {\n key: \"running\",\n value: function running(chart) {\n if (!this._running) {\n return false;\n }\n\n var anims = this._charts.get(chart);\n\n if (!anims || !anims.running || !anims.items.length) {\n return false;\n }\n\n return true;\n }\n }, {\n key: \"stop\",\n value: function stop(chart) {\n var anims = this._charts.get(chart);\n\n if (!anims || !anims.items.length) {\n return;\n }\n\n var items = anims.items;\n var i = items.length - 1;\n\n for (; i >= 0; --i) {\n items[i].cancel();\n }\n\n anims.items = [];\n\n this._notify(chart, anims, Date.now(), 'complete');\n }\n }, {\n key: \"remove\",\n value: function remove(chart) {\n return this._charts.delete(chart);\n }\n }]);\n\n return Animator;\n}();\n\nvar animator = new Animator();\nvar transparent = 'transparent';\nvar interpolators = {\n boolean: function boolean(from, to, factor) {\n return factor > 0.5 ? to : from;\n },\n color: function color(from, to, factor) {\n var c0 = _color(from || transparent);\n\n var c1 = c0.valid && _color(to || transparent);\n\n return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to;\n },\n number: function number(from, to, factor) {\n return from + (to - from) * factor;\n }\n};\n\nvar Animation = /*#__PURE__*/function () {\n function Animation(cfg, target, prop, to) {\n _classCallCheck(this, Animation);\n\n var currentValue = target[prop];\n to = resolve([cfg.to, to, currentValue, cfg.from]);\n var from = resolve([cfg.from, currentValue, to]);\n this._active = true;\n this._fn = cfg.fn || interpolators[cfg.type || typeof from];\n this._easing = effects[cfg.easing] || effects.linear;\n this._start = Math.floor(Date.now() + (cfg.delay || 0));\n this._duration = this._total = Math.floor(cfg.duration);\n this._loop = !!cfg.loop;\n this._target = target;\n this._prop = prop;\n this._from = from;\n this._to = to;\n this._promises = undefined;\n }\n\n _createClass(Animation, [{\n key: \"active\",\n value: function active() {\n return this._active;\n }\n }, {\n key: \"update\",\n value: function update(cfg, to, date) {\n var me = this;\n\n if (me._active) {\n me._notify(false);\n\n var currentValue = me._target[me._prop];\n var elapsed = date - me._start;\n var remain = me._duration - elapsed;\n me._start = date;\n me._duration = Math.floor(Math.max(remain, cfg.duration));\n me._total += elapsed;\n me._loop = !!cfg.loop;\n me._to = resolve([cfg.to, to, currentValue, cfg.from]);\n me._from = resolve([cfg.from, currentValue, to]);\n }\n }\n }, {\n key: \"cancel\",\n value: function cancel() {\n var me = this;\n\n if (me._active) {\n me.tick(Date.now());\n me._active = false;\n\n me._notify(false);\n }\n }\n }, {\n key: \"tick\",\n value: function tick(date) {\n var me = this;\n var elapsed = date - me._start;\n var duration = me._duration;\n var prop = me._prop;\n var from = me._from;\n var loop = me._loop;\n var to = me._to;\n var factor;\n me._active = from !== to && (loop || elapsed < duration);\n\n if (!me._active) {\n me._target[prop] = to;\n\n me._notify(true);\n\n return;\n }\n\n if (elapsed < 0) {\n me._target[prop] = from;\n return;\n }\n\n factor = elapsed / duration % 2;\n factor = loop && factor > 1 ? 2 - factor : factor;\n factor = me._easing(Math.min(1, Math.max(0, factor)));\n me._target[prop] = me._fn(from, to, factor);\n }\n }, {\n key: \"wait\",\n value: function wait() {\n var promises = this._promises || (this._promises = []);\n return new Promise(function (res, rej) {\n promises.push({\n res: res,\n rej: rej\n });\n });\n }\n }, {\n key: \"_notify\",\n value: function _notify(resolved) {\n var method = resolved ? 'res' : 'rej';\n var promises = this._promises || [];\n\n for (var i = 0; i < promises.length; i++) {\n promises[i][method]();\n }\n }\n }]);\n\n return Animation;\n}();\n\nvar numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];\nvar colors = ['color', 'borderColor', 'backgroundColor'];\ndefaults.set('animation', {\n delay: undefined,\n duration: 1000,\n easing: 'easeOutQuart',\n fn: undefined,\n from: undefined,\n loop: undefined,\n to: undefined,\n type: undefined\n});\nvar animationOptions = Object.keys(defaults.animation);\ndefaults.describe('animation', {\n _fallback: false,\n _indexable: false,\n _scriptable: function _scriptable(name) {\n return name !== 'onProgress' && name !== 'onComplete' && name !== 'fn';\n }\n});\ndefaults.set('animations', {\n colors: {\n type: 'color',\n properties: colors\n },\n numbers: {\n type: 'number',\n properties: numbers\n }\n});\ndefaults.describe('animations', {\n _fallback: 'animation'\n});\ndefaults.set('transitions', {\n active: {\n animation: {\n duration: 400\n }\n },\n resize: {\n animation: {\n duration: 0\n }\n },\n show: {\n animations: {\n colors: {\n from: 'transparent'\n },\n visible: {\n type: 'boolean',\n duration: 0\n }\n }\n },\n hide: {\n animations: {\n colors: {\n to: 'transparent'\n },\n visible: {\n type: 'boolean',\n easing: 'linear',\n fn: function fn(v) {\n return v | 0;\n }\n }\n }\n }\n});\n\nvar Animations = /*#__PURE__*/function () {\n function Animations(chart, config) {\n _classCallCheck(this, Animations);\n\n this._chart = chart;\n this._properties = new Map();\n this.configure(config);\n }\n\n _createClass(Animations, [{\n key: \"configure\",\n value: function configure(config) {\n if (!isObject(config)) {\n return;\n }\n\n var animatedProps = this._properties;\n Object.getOwnPropertyNames(config).forEach(function (key) {\n var cfg = config[key];\n\n if (!isObject(cfg)) {\n return;\n }\n\n var resolved = {};\n\n var _iterator = _createForOfIteratorHelper(animationOptions),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var option = _step.value;\n resolved[option] = cfg[option];\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n (isArray(cfg.properties) && cfg.properties || [key]).forEach(function (prop) {\n if (prop === key || !animatedProps.has(prop)) {\n animatedProps.set(prop, resolved);\n }\n });\n });\n }\n }, {\n key: \"_animateOptions\",\n value: function _animateOptions(target, values) {\n var newOptions = values.options;\n var options = resolveTargetOptions(target, newOptions);\n\n if (!options) {\n return [];\n }\n\n var animations = this._createAnimations(options, newOptions);\n\n if (newOptions.$shared) {\n awaitAll(target.options.$animations, newOptions).then(function () {\n target.options = newOptions;\n }, function () {});\n }\n\n return animations;\n }\n }, {\n key: \"_createAnimations\",\n value: function _createAnimations(target, values) {\n var animatedProps = this._properties;\n var animations = [];\n var running = target.$animations || (target.$animations = {});\n var props = Object.keys(values);\n var date = Date.now();\n var i;\n\n for (i = props.length - 1; i >= 0; --i) {\n var prop = props[i];\n\n if (prop.charAt(0) === '$') {\n continue;\n }\n\n if (prop === 'options') {\n animations.push.apply(animations, _toConsumableArray(this._animateOptions(target, values)));\n continue;\n }\n\n var value = values[prop];\n var animation = running[prop];\n var cfg = animatedProps.get(prop);\n\n if (animation) {\n if (cfg && animation.active()) {\n animation.update(cfg, value, date);\n continue;\n } else {\n animation.cancel();\n }\n }\n\n if (!cfg || !cfg.duration) {\n target[prop] = value;\n continue;\n }\n\n running[prop] = animation = new Animation(cfg, target, prop, value);\n animations.push(animation);\n }\n\n return animations;\n }\n }, {\n key: \"update\",\n value: function update(target, values) {\n if (this._properties.size === 0) {\n Object.assign(target, values);\n return;\n }\n\n var animations = this._createAnimations(target, values);\n\n if (animations.length) {\n animator.add(this._chart, animations);\n return true;\n }\n }\n }]);\n\n return Animations;\n}();\n\nfunction awaitAll(animations, properties) {\n var running = [];\n var keys = Object.keys(properties);\n\n for (var i = 0; i < keys.length; i++) {\n var anim = animations[keys[i]];\n\n if (anim && anim.active()) {\n running.push(anim.wait());\n }\n }\n\n return Promise.all(running);\n}\n\nfunction resolveTargetOptions(target, newOptions) {\n if (!newOptions) {\n return;\n }\n\n var options = target.options;\n\n if (!options) {\n target.options = newOptions;\n return;\n }\n\n if (options.$shared) {\n target.options = options = Object.assign({}, options, {\n $shared: false,\n $animations: {}\n });\n }\n\n return options;\n}\n\nfunction scaleClip(scale, allowedOverflow) {\n var opts = scale && scale.options || {};\n var reverse = opts.reverse;\n var min = opts.min === undefined ? allowedOverflow : 0;\n var max = opts.max === undefined ? allowedOverflow : 0;\n return {\n start: reverse ? max : min,\n end: reverse ? min : max\n };\n}\n\nfunction defaultClip(xScale, yScale, allowedOverflow) {\n if (allowedOverflow === false) {\n return false;\n }\n\n var x = scaleClip(xScale, allowedOverflow);\n var y = scaleClip(yScale, allowedOverflow);\n return {\n top: y.end,\n right: x.end,\n bottom: y.start,\n left: x.start\n };\n}\n\nfunction toClip(value) {\n var t, r, b, l;\n\n if (isObject(value)) {\n t = value.top;\n r = value.right;\n b = value.bottom;\n l = value.left;\n } else {\n t = r = b = l = value;\n }\n\n return {\n top: t,\n right: r,\n bottom: b,\n left: l\n };\n}\n\nfunction getSortedDatasetIndices(chart, filterVisible) {\n var keys = [];\n\n var metasets = chart._getSortedDatasetMetas(filterVisible);\n\n var i, ilen;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n keys.push(metasets[i].index);\n }\n\n return keys;\n}\n\nfunction _applyStack(stack, value, dsIndex, options) {\n var keys = stack.keys;\n var singleMode = options.mode === 'single';\n var i, ilen, datasetIndex, otherValue;\n\n if (value === null) {\n return;\n }\n\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n datasetIndex = +keys[i];\n\n if (datasetIndex === dsIndex) {\n if (options.all) {\n continue;\n }\n\n break;\n }\n\n otherValue = stack.values[datasetIndex];\n\n if (isNumberFinite(otherValue) && (singleMode || value === 0 || sign(value) === sign(otherValue))) {\n value += otherValue;\n }\n }\n\n return value;\n}\n\nfunction convertObjectDataToArray(data) {\n var keys = Object.keys(data);\n var adata = new Array(keys.length);\n var i, ilen, key;\n\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n adata[i] = {\n x: key,\n y: data[key]\n };\n }\n\n return adata;\n}\n\nfunction isStacked(scale, meta) {\n var stacked = scale && scale.options.stacked;\n return stacked || stacked === undefined && meta.stack !== undefined;\n}\n\nfunction getStackKey(indexScale, valueScale, meta) {\n return \"\".concat(indexScale.id, \".\").concat(valueScale.id, \".\").concat(meta.stack || meta.type);\n}\n\nfunction getUserBounds(scale) {\n var _scale$getUserBounds = scale.getUserBounds(),\n min = _scale$getUserBounds.min,\n max = _scale$getUserBounds.max,\n minDefined = _scale$getUserBounds.minDefined,\n maxDefined = _scale$getUserBounds.maxDefined;\n\n return {\n min: minDefined ? min : Number.NEGATIVE_INFINITY,\n max: maxDefined ? max : Number.POSITIVE_INFINITY\n };\n}\n\nfunction getOrCreateStack(stacks, stackKey, indexValue) {\n var subStack = stacks[stackKey] || (stacks[stackKey] = {});\n return subStack[indexValue] || (subStack[indexValue] = {});\n}\n\nfunction getLastIndexInStack(stack, vScale, positive) {\n var _iterator2 = _createForOfIteratorHelper(vScale.getMatchingVisibleMetas('bar').reverse()),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var meta = _step2.value;\n var value = stack[meta.index];\n\n if (positive && value > 0 || !positive && value < 0) {\n return meta.index;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return null;\n}\n\nfunction updateStacks(controller, parsed) {\n var chart = controller.chart,\n meta = controller._cachedMeta;\n var stacks = chart._stacks || (chart._stacks = {});\n var iScale = meta.iScale,\n vScale = meta.vScale,\n datasetIndex = meta.index;\n var iAxis = iScale.axis;\n var vAxis = vScale.axis;\n var key = getStackKey(iScale, vScale, meta);\n var ilen = parsed.length;\n var stack;\n\n for (var i = 0; i < ilen; ++i) {\n var item = parsed[i];\n var index = item[iAxis],\n value = item[vAxis];\n var itemStacks = item._stacks || (item._stacks = {});\n stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index);\n stack[datasetIndex] = value;\n stack._top = getLastIndexInStack(stack, vScale, true);\n stack._bottom = getLastIndexInStack(stack, vScale, false);\n }\n}\n\nfunction getFirstScaleId(chart, axis) {\n var scales = chart.scales;\n return Object.keys(scales).filter(function (key) {\n return scales[key].axis === axis;\n }).shift();\n}\n\nfunction createDatasetContext(parent, index) {\n return Object.assign(Object.create(parent), {\n active: false,\n dataset: undefined,\n datasetIndex: index,\n index: index,\n mode: 'default',\n type: 'dataset'\n });\n}\n\nfunction createDataContext(parent, index, element) {\n return Object.assign(Object.create(parent), {\n active: false,\n dataIndex: index,\n parsed: undefined,\n raw: undefined,\n element: element,\n index: index,\n mode: 'default',\n type: 'data'\n });\n}\n\nfunction clearStacks(meta, items) {\n var axis = meta.vScale && meta.vScale.axis;\n\n if (!axis) {\n return;\n }\n\n items = items || meta._parsed;\n\n var _iterator3 = _createForOfIteratorHelper(items),\n _step3;\n\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var parsed = _step3.value;\n var stacks = parsed._stacks;\n\n if (!stacks || stacks[axis] === undefined || stacks[axis][meta.index] === undefined) {\n return;\n }\n\n delete stacks[axis][meta.index];\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n}\n\nvar isDirectUpdateMode = function isDirectUpdateMode(mode) {\n return mode === 'reset' || mode === 'none';\n};\n\nvar cloneIfNotShared = function cloneIfNotShared(cached, shared) {\n return shared ? cached : Object.assign({}, cached);\n};\n\nvar DatasetController = /*#__PURE__*/function () {\n function DatasetController(chart, datasetIndex) {\n _classCallCheck(this, DatasetController);\n\n this.chart = chart;\n this._ctx = chart.ctx;\n this.index = datasetIndex;\n this._cachedDataOpts = {};\n this._cachedMeta = this.getMeta();\n this._type = this._cachedMeta.type;\n this.options = undefined;\n this._parsing = false;\n this._data = undefined;\n this._objectData = undefined;\n this._sharedOptions = undefined;\n this._drawStart = undefined;\n this._drawCount = undefined;\n this.enableOptionSharing = false;\n this.$context = undefined;\n this._syncList = [];\n this.initialize();\n }\n\n _createClass(DatasetController, [{\n key: \"initialize\",\n value: function initialize() {\n var me = this;\n var meta = me._cachedMeta;\n me.configure();\n me.linkScales();\n meta._stacked = isStacked(meta.vScale, meta);\n me.addElements();\n }\n }, {\n key: \"updateIndex\",\n value: function updateIndex(datasetIndex) {\n if (this.index !== datasetIndex) {\n clearStacks(this._cachedMeta);\n }\n\n this.index = datasetIndex;\n }\n }, {\n key: \"linkScales\",\n value: function linkScales() {\n var me = this;\n var chart = me.chart;\n var meta = me._cachedMeta;\n var dataset = me.getDataset();\n\n var chooseId = function chooseId(axis, x, y, r) {\n return axis === 'x' ? x : axis === 'r' ? r : y;\n };\n\n var xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, 'x'));\n var yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, 'y'));\n var rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, 'r'));\n var indexAxis = meta.indexAxis;\n var iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);\n var vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);\n meta.xScale = me.getScaleForId(xid);\n meta.yScale = me.getScaleForId(yid);\n meta.rScale = me.getScaleForId(rid);\n meta.iScale = me.getScaleForId(iid);\n meta.vScale = me.getScaleForId(vid);\n }\n }, {\n key: \"getDataset\",\n value: function getDataset() {\n return this.chart.data.datasets[this.index];\n }\n }, {\n key: \"getMeta\",\n value: function getMeta() {\n return this.chart.getDatasetMeta(this.index);\n }\n }, {\n key: \"getScaleForId\",\n value: function getScaleForId(scaleID) {\n return this.chart.scales[scaleID];\n }\n }, {\n key: \"_getOtherScale\",\n value: function _getOtherScale(scale) {\n var meta = this._cachedMeta;\n return scale === meta.iScale ? meta.vScale : meta.iScale;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this._update('reset');\n }\n }, {\n key: \"_destroy\",\n value: function _destroy() {\n var meta = this._cachedMeta;\n\n if (this._data) {\n unlistenArrayEvents(this._data, this);\n }\n\n if (meta._stacked) {\n clearStacks(meta);\n }\n }\n }, {\n key: \"_dataCheck\",\n value: function _dataCheck() {\n var me = this;\n var dataset = me.getDataset();\n var data = dataset.data || (dataset.data = []);\n var _data = me._data;\n\n if (isObject(data)) {\n me._data = convertObjectDataToArray(data);\n } else if (_data !== data) {\n if (_data) {\n unlistenArrayEvents(_data, me);\n var meta = me._cachedMeta;\n clearStacks(meta);\n meta._parsed = [];\n }\n\n if (data && Object.isExtensible(data)) {\n listenArrayEvents(data, me);\n }\n\n me._syncList = [];\n me._data = data;\n }\n }\n }, {\n key: \"addElements\",\n value: function addElements() {\n var me = this;\n var meta = me._cachedMeta;\n\n me._dataCheck();\n\n if (me.datasetElementType) {\n meta.dataset = new me.datasetElementType();\n }\n }\n }, {\n key: \"buildOrUpdateElements\",\n value: function buildOrUpdateElements(resetNewElements) {\n var me = this;\n var meta = me._cachedMeta;\n var dataset = me.getDataset();\n var stackChanged = false;\n\n me._dataCheck();\n\n var oldStacked = meta._stacked;\n meta._stacked = isStacked(meta.vScale, meta);\n\n if (meta.stack !== dataset.stack) {\n stackChanged = true;\n clearStacks(meta);\n meta.stack = dataset.stack;\n }\n\n me._resyncElements(resetNewElements);\n\n if (stackChanged || oldStacked !== meta._stacked) {\n updateStacks(me, meta._parsed);\n }\n }\n }, {\n key: \"configure\",\n value: function configure() {\n var me = this;\n var config = me.chart.config;\n var scopeKeys = config.datasetScopeKeys(me._type);\n var scopes = config.getOptionScopes(me.getDataset(), scopeKeys, true);\n me.options = config.createResolver(scopes, me.getContext());\n me._parsing = me.options.parsing;\n }\n }, {\n key: \"parse\",\n value: function parse(start, count) {\n var me = this;\n var meta = me._cachedMeta,\n data = me._data;\n var iScale = meta.iScale,\n _stacked = meta._stacked;\n var iAxis = iScale.axis;\n var sorted = start === 0 && count === data.length ? true : meta._sorted;\n var prev = start > 0 && meta._parsed[start - 1];\n var i, cur, parsed;\n\n if (me._parsing === false) {\n meta._parsed = data;\n meta._sorted = true;\n parsed = data;\n } else {\n if (isArray(data[start])) {\n parsed = me.parseArrayData(meta, data, start, count);\n } else if (isObject(data[start])) {\n parsed = me.parseObjectData(meta, data, start, count);\n } else {\n parsed = me.parsePrimitiveData(meta, data, start, count);\n }\n\n var isNotInOrderComparedToPrev = function isNotInOrderComparedToPrev() {\n return cur[iAxis] === null || prev && cur[iAxis] < prev[iAxis];\n };\n\n for (i = 0; i < count; ++i) {\n meta._parsed[i + start] = cur = parsed[i];\n\n if (sorted) {\n if (isNotInOrderComparedToPrev()) {\n sorted = false;\n }\n\n prev = cur;\n }\n }\n\n meta._sorted = sorted;\n }\n\n if (_stacked) {\n updateStacks(me, parsed);\n }\n }\n }, {\n key: \"parsePrimitiveData\",\n value: function parsePrimitiveData(meta, data, start, count) {\n var iScale = meta.iScale,\n vScale = meta.vScale;\n var iAxis = iScale.axis;\n var vAxis = vScale.axis;\n var labels = iScale.getLabels();\n var singleScale = iScale === vScale;\n var parsed = new Array(count);\n var i, ilen, index;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n var _parsed$i;\n\n index = i + start;\n parsed[i] = (_parsed$i = {}, _defineProperty(_parsed$i, iAxis, singleScale || iScale.parse(labels[index], index)), _defineProperty(_parsed$i, vAxis, vScale.parse(data[index], index)), _parsed$i);\n }\n\n return parsed;\n }\n }, {\n key: \"parseArrayData\",\n value: function parseArrayData(meta, data, start, count) {\n var xScale = meta.xScale,\n yScale = meta.yScale;\n var parsed = new Array(count);\n var i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(item[0], index),\n y: yScale.parse(item[1], index)\n };\n }\n\n return parsed;\n }\n }, {\n key: \"parseObjectData\",\n value: function parseObjectData(meta, data, start, count) {\n var xScale = meta.xScale,\n yScale = meta.yScale;\n var _this$_parsing = this._parsing,\n _this$_parsing$xAxisK = _this$_parsing.xAxisKey,\n xAxisKey = _this$_parsing$xAxisK === void 0 ? 'x' : _this$_parsing$xAxisK,\n _this$_parsing$yAxisK = _this$_parsing.yAxisKey,\n yAxisKey = _this$_parsing$yAxisK === void 0 ? 'y' : _this$_parsing$yAxisK;\n var parsed = new Array(count);\n var i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(resolveObjectKey(item, xAxisKey), index),\n y: yScale.parse(resolveObjectKey(item, yAxisKey), index)\n };\n }\n\n return parsed;\n }\n }, {\n key: \"getParsed\",\n value: function getParsed(index) {\n return this._cachedMeta._parsed[index];\n }\n }, {\n key: \"getDataElement\",\n value: function getDataElement(index) {\n return this._cachedMeta.data[index];\n }\n }, {\n key: \"applyStack\",\n value: function applyStack(scale, parsed, mode) {\n var chart = this.chart;\n var meta = this._cachedMeta;\n var value = parsed[scale.axis];\n var stack = {\n keys: getSortedDatasetIndices(chart, true),\n values: parsed._stacks[scale.axis]\n };\n return _applyStack(stack, value, meta.index, {\n mode: mode\n });\n }\n }, {\n key: \"updateRangeFromParsed\",\n value: function updateRangeFromParsed(range, scale, parsed, stack) {\n var parsedValue = parsed[scale.axis];\n var value = parsedValue === null ? NaN : parsedValue;\n var values = stack && parsed._stacks[scale.axis];\n\n if (stack && values) {\n stack.values = values;\n range.min = Math.min(range.min, value);\n range.max = Math.max(range.max, value);\n value = _applyStack(stack, parsedValue, this._cachedMeta.index, {\n all: true\n });\n }\n\n range.min = Math.min(range.min, value);\n range.max = Math.max(range.max, value);\n }\n }, {\n key: \"getMinMax\",\n value: function getMinMax(scale, canStack) {\n var me = this;\n var meta = me._cachedMeta;\n var _parsed = meta._parsed;\n var sorted = meta._sorted && scale === meta.iScale;\n var ilen = _parsed.length;\n\n var otherScale = me._getOtherScale(scale);\n\n var stack = canStack && meta._stacked && {\n keys: getSortedDatasetIndices(me.chart, true),\n values: null\n };\n var range = {\n min: Number.POSITIVE_INFINITY,\n max: Number.NEGATIVE_INFINITY\n };\n\n var _getUserBounds = getUserBounds(otherScale),\n otherMin = _getUserBounds.min,\n otherMax = _getUserBounds.max;\n\n var i, value, parsed, otherValue;\n\n function _skip() {\n parsed = _parsed[i];\n value = parsed[scale.axis];\n otherValue = parsed[otherScale.axis];\n return !isNumberFinite(value) || otherMin > otherValue || otherMax < otherValue;\n }\n\n for (i = 0; i < ilen; ++i) {\n if (_skip()) {\n continue;\n }\n\n me.updateRangeFromParsed(range, scale, parsed, stack);\n\n if (sorted) {\n break;\n }\n }\n\n if (sorted) {\n for (i = ilen - 1; i >= 0; --i) {\n if (_skip()) {\n continue;\n }\n\n me.updateRangeFromParsed(range, scale, parsed, stack);\n break;\n }\n }\n\n return range;\n }\n }, {\n key: \"getAllParsedValues\",\n value: function getAllParsedValues(scale) {\n var parsed = this._cachedMeta._parsed;\n var values = [];\n var i, ilen, value;\n\n for (i = 0, ilen = parsed.length; i < ilen; ++i) {\n value = parsed[i][scale.axis];\n\n if (isNumberFinite(value)) {\n values.push(value);\n }\n }\n\n return values;\n }\n }, {\n key: \"getMaxOverflow\",\n value: function getMaxOverflow() {\n return false;\n }\n }, {\n key: \"getLabelAndValue\",\n value: function getLabelAndValue(index) {\n var me = this;\n var meta = me._cachedMeta;\n var iScale = meta.iScale;\n var vScale = meta.vScale;\n var parsed = me.getParsed(index);\n return {\n label: iScale ? '' + iScale.getLabelForValue(parsed[iScale.axis]) : '',\n value: vScale ? '' + vScale.getLabelForValue(parsed[vScale.axis]) : ''\n };\n }\n }, {\n key: \"_update\",\n value: function _update(mode) {\n var me = this;\n var meta = me._cachedMeta;\n me.configure();\n me._cachedDataOpts = {};\n me.update(mode || 'default');\n meta._clip = toClip(valueOrDefault(me.options.clip, defaultClip(meta.xScale, meta.yScale, me.getMaxOverflow())));\n }\n }, {\n key: \"update\",\n value: function update(mode) {}\n }, {\n key: \"draw\",\n value: function draw() {\n var me = this;\n var ctx = me._ctx;\n var chart = me.chart;\n var meta = me._cachedMeta;\n var elements = meta.data || [];\n var area = chart.chartArea;\n var active = [];\n var start = me._drawStart || 0;\n var count = me._drawCount || elements.length - start;\n var i;\n\n if (meta.dataset) {\n meta.dataset.draw(ctx, area, start, count);\n }\n\n for (i = start; i < start + count; ++i) {\n var element = elements[i];\n\n if (element.active) {\n active.push(element);\n } else {\n element.draw(ctx, area);\n }\n }\n\n for (i = 0; i < active.length; ++i) {\n active[i].draw(ctx, area);\n }\n }\n }, {\n key: \"getStyle\",\n value: function getStyle(index, active) {\n var mode = active ? 'active' : 'default';\n return index === undefined && this._cachedMeta.dataset ? this.resolveDatasetElementOptions(mode) : this.resolveDataElementOptions(index || 0, mode);\n }\n }, {\n key: \"getContext\",\n value: function getContext(index, active, mode) {\n var me = this;\n var dataset = me.getDataset();\n var context;\n\n if (index >= 0 && index < me._cachedMeta.data.length) {\n var element = me._cachedMeta.data[index];\n context = element.$context || (element.$context = createDataContext(me.getContext(), index, element));\n context.parsed = me.getParsed(index);\n context.raw = dataset.data[index];\n context.index = context.dataIndex = index;\n } else {\n context = me.$context || (me.$context = createDatasetContext(me.chart.getContext(), me.index));\n context.dataset = dataset;\n context.index = context.datasetIndex = me.index;\n }\n\n context.active = !!active;\n context.mode = mode;\n return context;\n }\n }, {\n key: \"resolveDatasetElementOptions\",\n value: function resolveDatasetElementOptions(mode) {\n return this._resolveElementOptions(this.datasetElementType.id, mode);\n }\n }, {\n key: \"resolveDataElementOptions\",\n value: function resolveDataElementOptions(index, mode) {\n return this._resolveElementOptions(this.dataElementType.id, mode, index);\n }\n }, {\n key: \"_resolveElementOptions\",\n value: function _resolveElementOptions(elementType) {\n var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';\n var index = arguments.length > 2 ? arguments[2] : undefined;\n var me = this;\n var active = mode === 'active';\n var cache = me._cachedDataOpts;\n var cacheKey = elementType + '-' + mode;\n var cached = cache[cacheKey];\n var sharing = me.enableOptionSharing && defined(index);\n\n if (cached) {\n return cloneIfNotShared(cached, sharing);\n }\n\n var config = me.chart.config;\n var scopeKeys = config.datasetElementScopeKeys(me._type, elementType);\n var prefixes = active ? [\"\".concat(elementType, \"Hover\"), 'hover', elementType, ''] : [elementType, ''];\n var scopes = config.getOptionScopes(me.getDataset(), scopeKeys);\n var names = Object.keys(defaults.elements[elementType]);\n\n var context = function context() {\n return me.getContext(index, active);\n };\n\n var values = config.resolveNamedOptions(scopes, names, context, prefixes);\n\n if (values.$shared) {\n values.$shared = sharing;\n cache[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));\n }\n\n return values;\n }\n }, {\n key: \"_resolveAnimations\",\n value: function _resolveAnimations(index, transition, active) {\n var me = this;\n var chart = me.chart;\n var cache = me._cachedDataOpts;\n var cacheKey = \"animation-\".concat(transition);\n var cached = cache[cacheKey];\n\n if (cached) {\n return cached;\n }\n\n var options;\n\n if (chart.options.animation !== false) {\n var config = me.chart.config;\n var scopeKeys = config.datasetAnimationScopeKeys(me._type, transition);\n var scopes = config.getOptionScopes(me.getDataset(), scopeKeys);\n options = config.createResolver(scopes, me.getContext(index, active, transition));\n }\n\n var animations = new Animations(chart, options && options.animations);\n\n if (options && options._cacheable) {\n cache[cacheKey] = Object.freeze(animations);\n }\n\n return animations;\n }\n }, {\n key: \"getSharedOptions\",\n value: function getSharedOptions(options) {\n if (!options.$shared) {\n return;\n }\n\n return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));\n }\n }, {\n key: \"includeOptions\",\n value: function includeOptions(mode, sharedOptions) {\n return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;\n }\n }, {\n key: \"updateElement\",\n value: function updateElement(element, index, properties, mode) {\n if (isDirectUpdateMode(mode)) {\n Object.assign(element, properties);\n } else {\n this._resolveAnimations(index, mode).update(element, properties);\n }\n }\n }, {\n key: \"updateSharedOptions\",\n value: function updateSharedOptions(sharedOptions, mode, newOptions) {\n if (sharedOptions && !isDirectUpdateMode(mode)) {\n this._resolveAnimations(undefined, mode).update(sharedOptions, newOptions);\n }\n }\n }, {\n key: \"_setStyle\",\n value: function _setStyle(element, index, mode, active) {\n element.active = active;\n var options = this.getStyle(index, active);\n\n this._resolveAnimations(index, mode, active).update(element, {\n options: !active && this.getSharedOptions(options) || options\n });\n }\n }, {\n key: \"removeHoverStyle\",\n value: function removeHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', false);\n }\n }, {\n key: \"setHoverStyle\",\n value: function setHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', true);\n }\n }, {\n key: \"_removeDatasetHoverStyle\",\n value: function _removeDatasetHoverStyle() {\n var element = this._cachedMeta.dataset;\n\n if (element) {\n this._setStyle(element, undefined, 'active', false);\n }\n }\n }, {\n key: \"_setDatasetHoverStyle\",\n value: function _setDatasetHoverStyle() {\n var element = this._cachedMeta.dataset;\n\n if (element) {\n this._setStyle(element, undefined, 'active', true);\n }\n }\n }, {\n key: \"_resyncElements\",\n value: function _resyncElements(resetNewElements) {\n var me = this;\n var data = me._data;\n var elements = me._cachedMeta.data;\n\n var _iterator4 = _createForOfIteratorHelper(me._syncList),\n _step4;\n\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var _step4$value = _slicedToArray(_step4.value, 3),\n method = _step4$value[0],\n arg1 = _step4$value[1],\n arg2 = _step4$value[2];\n\n me[method](arg1, arg2);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n\n me._syncList = [];\n var numMeta = elements.length;\n var numData = data.length;\n var count = Math.min(numData, numMeta);\n\n if (count) {\n me.parse(0, count);\n }\n\n if (numData > numMeta) {\n me._insertElements(numMeta, numData - numMeta, resetNewElements);\n } else if (numData < numMeta) {\n me._removeElements(numData, numMeta - numData);\n }\n }\n }, {\n key: \"_insertElements\",\n value: function _insertElements(start, count) {\n var resetNewElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var me = this;\n var meta = me._cachedMeta;\n var data = meta.data;\n var end = start + count;\n var i;\n\n var move = function move(arr) {\n arr.length += count;\n\n for (i = arr.length - 1; i >= end; i--) {\n arr[i] = arr[i - count];\n }\n };\n\n move(data);\n\n for (i = start; i < end; ++i) {\n data[i] = new me.dataElementType();\n }\n\n if (me._parsing) {\n move(meta._parsed);\n }\n\n me.parse(start, count);\n\n if (resetNewElements) {\n me.updateElements(data, start, count, 'reset');\n }\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(element, start, count, mode) {}\n }, {\n key: \"_removeElements\",\n value: function _removeElements(start, count) {\n var me = this;\n var meta = me._cachedMeta;\n\n if (me._parsing) {\n var removed = meta._parsed.splice(start, count);\n\n if (meta._stacked) {\n clearStacks(meta, removed);\n }\n }\n\n meta.data.splice(start, count);\n }\n }, {\n key: \"_onDataPush\",\n value: function _onDataPush() {\n var count = arguments.length;\n\n this._syncList.push(['_insertElements', this.getDataset().data.length - count, count]);\n }\n }, {\n key: \"_onDataPop\",\n value: function _onDataPop() {\n this._syncList.push(['_removeElements', this._cachedMeta.data.length - 1, 1]);\n }\n }, {\n key: \"_onDataShift\",\n value: function _onDataShift() {\n this._syncList.push(['_removeElements', 0, 1]);\n }\n }, {\n key: \"_onDataSplice\",\n value: function _onDataSplice(start, count) {\n this._syncList.push(['_removeElements', start, count]);\n\n this._syncList.push(['_insertElements', start, arguments.length - 2]);\n }\n }, {\n key: \"_onDataUnshift\",\n value: function _onDataUnshift() {\n this._syncList.push(['_insertElements', 0, arguments.length]);\n }\n }]);\n\n return DatasetController;\n}();\n\nDatasetController.defaults = {};\nDatasetController.prototype.datasetElementType = null;\nDatasetController.prototype.dataElementType = null;\n\nfunction getAllScaleValues(scale) {\n if (!scale._cache.$bar) {\n var metas = scale.getMatchingVisibleMetas('bar');\n var values = [];\n\n for (var i = 0, ilen = metas.length; i < ilen; i++) {\n values = values.concat(metas[i].controller.getAllParsedValues(scale));\n }\n\n scale._cache.$bar = _arrayUnique(values.sort(function (a, b) {\n return a - b;\n }));\n }\n\n return scale._cache.$bar;\n}\n\nfunction computeMinSampleSize(scale) {\n var values = getAllScaleValues(scale);\n var min = scale._length;\n var i, ilen, curr, prev;\n\n var updateMinAndPrev = function updateMinAndPrev() {\n if (curr === 32767 || curr === -32768) {\n return;\n }\n\n if (defined(prev)) {\n min = Math.min(min, Math.abs(curr - prev) || min);\n }\n\n prev = curr;\n };\n\n for (i = 0, ilen = values.length; i < ilen; ++i) {\n curr = scale.getPixelForValue(values[i]);\n updateMinAndPrev();\n }\n\n prev = undefined;\n\n for (i = 0, ilen = scale.ticks.length; i < ilen; ++i) {\n curr = scale.getPixelForTick(i);\n updateMinAndPrev();\n }\n\n return min;\n}\n\nfunction computeFitCategoryTraits(index, ruler, options, stackCount) {\n var thickness = options.barThickness;\n var size, ratio;\n\n if (isNullOrUndef(thickness)) {\n size = ruler.min * options.categoryPercentage;\n ratio = options.barPercentage;\n } else {\n size = thickness * stackCount;\n ratio = 1;\n }\n\n return {\n chunk: size / stackCount,\n ratio: ratio,\n start: ruler.pixels[index] - size / 2\n };\n}\n\nfunction computeFlexCategoryTraits(index, ruler, options, stackCount) {\n var pixels = ruler.pixels;\n var curr = pixels[index];\n var prev = index > 0 ? pixels[index - 1] : null;\n var next = index < pixels.length - 1 ? pixels[index + 1] : null;\n var percent = options.categoryPercentage;\n\n if (prev === null) {\n prev = curr - (next === null ? ruler.end - ruler.start : next - curr);\n }\n\n if (next === null) {\n next = curr + curr - prev;\n }\n\n var start = curr - (curr - Math.min(prev, next)) / 2 * percent;\n var size = Math.abs(next - prev) / 2 * percent;\n return {\n chunk: size / stackCount,\n ratio: options.barPercentage,\n start: start\n };\n}\n\nfunction parseFloatBar(entry, item, vScale, i) {\n var startValue = vScale.parse(entry[0], i);\n var endValue = vScale.parse(entry[1], i);\n var min = Math.min(startValue, endValue);\n var max = Math.max(startValue, endValue);\n var barStart = min;\n var barEnd = max;\n\n if (Math.abs(min) > Math.abs(max)) {\n barStart = max;\n barEnd = min;\n }\n\n item[vScale.axis] = barEnd;\n item._custom = {\n barStart: barStart,\n barEnd: barEnd,\n start: startValue,\n end: endValue,\n min: min,\n max: max\n };\n}\n\nfunction parseValue(entry, item, vScale, i) {\n if (isArray(entry)) {\n parseFloatBar(entry, item, vScale, i);\n } else {\n item[vScale.axis] = vScale.parse(entry, i);\n }\n\n return item;\n}\n\nfunction parseArrayOrPrimitive(meta, data, start, count) {\n var iScale = meta.iScale;\n var vScale = meta.vScale;\n var labels = iScale.getLabels();\n var singleScale = iScale === vScale;\n var parsed = [];\n var i, ilen, item, entry;\n\n for (i = start, ilen = start + count; i < ilen; ++i) {\n entry = data[i];\n item = {};\n item[iScale.axis] = singleScale || iScale.parse(labels[i], i);\n parsed.push(parseValue(entry, item, vScale, i));\n }\n\n return parsed;\n}\n\nfunction isFloatBar(custom) {\n return custom && custom.barStart !== undefined && custom.barEnd !== undefined;\n}\n\nvar BarController = /*#__PURE__*/function (_DatasetController) {\n _inherits(BarController, _DatasetController);\n\n var _super = _createSuper(BarController);\n\n function BarController() {\n _classCallCheck(this, BarController);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(BarController, [{\n key: \"parsePrimitiveData\",\n value: function parsePrimitiveData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n }, {\n key: \"parseArrayData\",\n value: function parseArrayData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n }, {\n key: \"parseObjectData\",\n value: function parseObjectData(meta, data, start, count) {\n var iScale = meta.iScale,\n vScale = meta.vScale;\n var _this$_parsing2 = this._parsing,\n _this$_parsing2$xAxis = _this$_parsing2.xAxisKey,\n xAxisKey = _this$_parsing2$xAxis === void 0 ? 'x' : _this$_parsing2$xAxis,\n _this$_parsing2$yAxis = _this$_parsing2.yAxisKey,\n yAxisKey = _this$_parsing2$yAxis === void 0 ? 'y' : _this$_parsing2$yAxis;\n var iAxisKey = iScale.axis === 'x' ? xAxisKey : yAxisKey;\n var vAxisKey = vScale.axis === 'x' ? xAxisKey : yAxisKey;\n var parsed = [];\n var i, ilen, item, obj;\n\n for (i = start, ilen = start + count; i < ilen; ++i) {\n obj = data[i];\n item = {};\n item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i);\n parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i));\n }\n\n return parsed;\n }\n }, {\n key: \"updateRangeFromParsed\",\n value: function updateRangeFromParsed(range, scale, parsed, stack) {\n _get(_getPrototypeOf(BarController.prototype), \"updateRangeFromParsed\", this).call(this, range, scale, parsed, stack);\n\n var custom = parsed._custom;\n\n if (custom && scale === this._cachedMeta.vScale) {\n range.min = Math.min(range.min, custom.min);\n range.max = Math.max(range.max, custom.max);\n }\n }\n }, {\n key: \"getLabelAndValue\",\n value: function getLabelAndValue(index) {\n var me = this;\n var meta = me._cachedMeta;\n var iScale = meta.iScale,\n vScale = meta.vScale;\n var parsed = me.getParsed(index);\n var custom = parsed._custom;\n var value = isFloatBar(custom) ? '[' + custom.start + ', ' + custom.end + ']' : '' + vScale.getLabelForValue(parsed[vScale.axis]);\n return {\n label: '' + iScale.getLabelForValue(parsed[iScale.axis]),\n value: value\n };\n }\n }, {\n key: \"initialize\",\n value: function initialize() {\n var me = this;\n me.enableOptionSharing = true;\n\n _get(_getPrototypeOf(BarController.prototype), \"initialize\", this).call(this);\n\n var meta = me._cachedMeta;\n meta.stack = me.getDataset().stack;\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var me = this;\n var meta = me._cachedMeta;\n me.updateElements(meta.data, 0, meta.data.length, mode);\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(bars, start, count, mode) {\n var me = this;\n var reset = mode === 'reset';\n var vScale = me._cachedMeta.vScale;\n var base = vScale.getBasePixel();\n var horizontal = vScale.isHorizontal();\n\n var ruler = me._getRuler();\n\n var firstOpts = me.resolveDataElementOptions(start, mode);\n var sharedOptions = me.getSharedOptions(firstOpts);\n var includeOptions = me.includeOptions(mode, sharedOptions);\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n\n for (var i = start; i < start + count; i++) {\n var parsed = me.getParsed(i);\n var vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {\n base: base,\n head: base\n } : me._calculateBarValuePixels(i);\n\n var ipixels = me._calculateBarIndexPixels(i, ruler);\n\n var stack = (parsed._stacks || {})[vScale.axis];\n var properties = {\n horizontal: horizontal,\n base: vpixels.base,\n enableBorderRadius: !stack || isFloatBar(parsed._custom) || me.index === stack._top || me.index === stack._bottom,\n x: horizontal ? vpixels.head : ipixels.center,\n y: horizontal ? ipixels.center : vpixels.head,\n height: horizontal ? ipixels.size : undefined,\n width: horizontal ? undefined : ipixels.size\n };\n\n if (includeOptions) {\n properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);\n }\n\n me.updateElement(bars[i], i, properties, mode);\n }\n }\n }, {\n key: \"_getStacks\",\n value: function _getStacks(last, dataIndex) {\n var me = this;\n var meta = me._cachedMeta;\n var iScale = meta.iScale;\n var metasets = iScale.getMatchingVisibleMetas(me._type);\n var stacked = iScale.options.stacked;\n var ilen = metasets.length;\n var stacks = [];\n var i, item;\n\n for (i = 0; i < ilen; ++i) {\n item = metasets[i];\n\n if (typeof dataIndex !== 'undefined') {\n var val = item.controller.getParsed(dataIndex)[item.controller._cachedMeta.vScale.axis];\n\n if (isNullOrUndef(val) || isNaN(val)) {\n continue;\n }\n }\n\n if (stacked === false || stacks.indexOf(item.stack) === -1 || stacked === undefined && item.stack === undefined) {\n stacks.push(item.stack);\n }\n\n if (item.index === last) {\n break;\n }\n }\n\n if (!stacks.length) {\n stacks.push(undefined);\n }\n\n return stacks;\n }\n }, {\n key: \"_getStackCount\",\n value: function _getStackCount(index) {\n return this._getStacks(undefined, index).length;\n }\n }, {\n key: \"_getStackIndex\",\n value: function _getStackIndex(datasetIndex, name, dataIndex) {\n var stacks = this._getStacks(datasetIndex, dataIndex);\n\n var index = name !== undefined ? stacks.indexOf(name) : -1;\n return index === -1 ? stacks.length - 1 : index;\n }\n }, {\n key: \"_getRuler\",\n value: function _getRuler() {\n var me = this;\n var opts = me.options;\n var meta = me._cachedMeta;\n var iScale = meta.iScale;\n var pixels = [];\n var i, ilen;\n\n for (i = 0, ilen = meta.data.length; i < ilen; ++i) {\n pixels.push(iScale.getPixelForValue(me.getParsed(i)[iScale.axis], i));\n }\n\n var barThickness = opts.barThickness;\n var min = barThickness || computeMinSampleSize(iScale);\n return {\n min: min,\n pixels: pixels,\n start: iScale._startPixel,\n end: iScale._endPixel,\n stackCount: me._getStackCount(),\n scale: iScale,\n grouped: opts.grouped,\n ratio: barThickness ? 1 : opts.categoryPercentage * opts.barPercentage\n };\n }\n }, {\n key: \"_calculateBarValuePixels\",\n value: function _calculateBarValuePixels(index) {\n var me = this;\n var _me$_cachedMeta = me._cachedMeta,\n vScale = _me$_cachedMeta.vScale,\n _stacked = _me$_cachedMeta._stacked;\n var _me$options = me.options,\n baseValue = _me$options.base,\n minBarLength = _me$options.minBarLength;\n var parsed = me.getParsed(index);\n var custom = parsed._custom;\n var floating = isFloatBar(custom);\n var value = parsed[vScale.axis];\n var start = 0;\n var length = _stacked ? me.applyStack(vScale, parsed, _stacked) : value;\n var head, size;\n\n if (length !== value) {\n start = length - value;\n length = value;\n }\n\n if (floating) {\n value = custom.barStart;\n length = custom.barEnd - custom.barStart;\n\n if (value !== 0 && sign(value) !== sign(custom.barEnd)) {\n start = 0;\n }\n\n start += value;\n }\n\n var startValue = !isNullOrUndef(baseValue) && !floating ? baseValue : start;\n var base = vScale.getPixelForValue(startValue);\n\n if (this.chart.getDataVisibility(index)) {\n head = vScale.getPixelForValue(start + length);\n } else {\n head = base;\n }\n\n size = head - base;\n\n if (minBarLength !== undefined && Math.abs(size) < minBarLength) {\n size = size < 0 ? -minBarLength : minBarLength;\n\n if (value === 0) {\n base -= size / 2;\n }\n\n head = base + size;\n }\n\n var actualBase = baseValue || 0;\n\n if (base === vScale.getPixelForValue(actualBase)) {\n var halfGrid = vScale.getLineWidthForValue(actualBase) / 2;\n\n if (size > 0) {\n base += halfGrid;\n size -= halfGrid;\n } else if (size < 0) {\n base -= halfGrid;\n size += halfGrid;\n }\n }\n\n return {\n size: size,\n base: base,\n head: head,\n center: head + size / 2\n };\n }\n }, {\n key: \"_calculateBarIndexPixels\",\n value: function _calculateBarIndexPixels(index, ruler) {\n var me = this;\n var scale = ruler.scale;\n var options = me.options;\n var skipNull = options.skipNull;\n var maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);\n var center, size;\n\n if (ruler.grouped) {\n var stackCount = skipNull ? me._getStackCount(index) : ruler.stackCount;\n var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options, stackCount) : computeFitCategoryTraits(index, ruler, options, stackCount);\n\n var stackIndex = me._getStackIndex(me.index, me._cachedMeta.stack, skipNull ? index : undefined);\n\n center = range.start + range.chunk * stackIndex + range.chunk / 2;\n size = Math.min(maxBarThickness, range.chunk * range.ratio);\n } else {\n center = scale.getPixelForValue(me.getParsed(index)[scale.axis], index);\n size = Math.min(maxBarThickness, ruler.min * ruler.ratio);\n }\n\n return {\n base: center - size / 2,\n head: center + size / 2,\n center: center,\n size: size\n };\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var me = this;\n var chart = me.chart;\n var meta = me._cachedMeta;\n var vScale = meta.vScale;\n var rects = meta.data;\n var ilen = rects.length;\n var i = 0;\n clipArea(chart.ctx, chart.chartArea);\n\n for (; i < ilen; ++i) {\n if (me.getParsed(i)[vScale.axis] !== null) {\n rects[i].draw(me._ctx);\n }\n }\n\n unclipArea(chart.ctx);\n }\n }]);\n\n return BarController;\n}(DatasetController);\n\nBarController.id = 'bar';\nBarController.defaults = {\n datasetElementType: false,\n dataElementType: 'bar',\n categoryPercentage: 0.8,\n barPercentage: 0.9,\n grouped: true,\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'base', 'width', 'height']\n }\n }\n};\nBarController.overrides = {\n interaction: {\n mode: 'index'\n },\n scales: {\n _index_: {\n type: 'category',\n offset: true,\n grid: {\n offset: true\n }\n },\n _value_: {\n type: 'linear',\n beginAtZero: true\n }\n }\n};\n\nvar BubbleController = /*#__PURE__*/function (_DatasetController2) {\n _inherits(BubbleController, _DatasetController2);\n\n var _super2 = _createSuper(BubbleController);\n\n function BubbleController() {\n _classCallCheck(this, BubbleController);\n\n return _super2.apply(this, arguments);\n }\n\n _createClass(BubbleController, [{\n key: \"initialize\",\n value: function initialize() {\n this.enableOptionSharing = true;\n\n _get(_getPrototypeOf(BubbleController.prototype), \"initialize\", this).call(this);\n }\n }, {\n key: \"parseObjectData\",\n value: function parseObjectData(meta, data, start, count) {\n var xScale = meta.xScale,\n yScale = meta.yScale;\n var _this$_parsing3 = this._parsing,\n _this$_parsing3$xAxis = _this$_parsing3.xAxisKey,\n xAxisKey = _this$_parsing3$xAxis === void 0 ? 'x' : _this$_parsing3$xAxis,\n _this$_parsing3$yAxis = _this$_parsing3.yAxisKey,\n yAxisKey = _this$_parsing3$yAxis === void 0 ? 'y' : _this$_parsing3$yAxis;\n var parsed = [];\n var i, ilen, item;\n\n for (i = start, ilen = start + count; i < ilen; ++i) {\n item = data[i];\n parsed.push({\n x: xScale.parse(resolveObjectKey(item, xAxisKey), i),\n y: yScale.parse(resolveObjectKey(item, yAxisKey), i),\n _custom: item && item.r && +item.r\n });\n }\n\n return parsed;\n }\n }, {\n key: \"getMaxOverflow\",\n value: function getMaxOverflow() {\n var _this$_cachedMeta = this._cachedMeta,\n data = _this$_cachedMeta.data,\n _parsed = _this$_cachedMeta._parsed;\n var max = 0;\n\n for (var i = data.length - 1; i >= 0; --i) {\n max = Math.max(max, data[i].size() / 2, _parsed[i]._custom);\n }\n\n return max > 0 && max;\n }\n }, {\n key: \"getLabelAndValue\",\n value: function getLabelAndValue(index) {\n var me = this;\n var meta = me._cachedMeta;\n var xScale = meta.xScale,\n yScale = meta.yScale;\n var parsed = me.getParsed(index);\n var x = xScale.getLabelForValue(parsed.x);\n var y = yScale.getLabelForValue(parsed.y);\n var r = parsed._custom;\n return {\n label: meta.label,\n value: '(' + x + ', ' + y + (r ? ', ' + r : '') + ')'\n };\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var me = this;\n var points = me._cachedMeta.data;\n me.updateElements(points, 0, points.length, mode);\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(points, start, count, mode) {\n var me = this;\n var reset = mode === 'reset';\n var _me$_cachedMeta2 = me._cachedMeta,\n iScale = _me$_cachedMeta2.iScale,\n vScale = _me$_cachedMeta2.vScale;\n var firstOpts = me.resolveDataElementOptions(start, mode);\n var sharedOptions = me.getSharedOptions(firstOpts);\n var includeOptions = me.includeOptions(mode, sharedOptions);\n var iAxis = iScale.axis;\n var vAxis = vScale.axis;\n\n for (var i = start; i < start + count; i++) {\n var point = points[i];\n var parsed = !reset && me.getParsed(i);\n var properties = {};\n var iPixel = properties[iAxis] = reset ? iScale.getPixelForDecimal(0.5) : iScale.getPixelForValue(parsed[iAxis]);\n var vPixel = properties[vAxis] = reset ? vScale.getBasePixel() : vScale.getPixelForValue(parsed[vAxis]);\n properties.skip = isNaN(iPixel) || isNaN(vPixel);\n\n if (includeOptions) {\n properties.options = me.resolveDataElementOptions(i, mode);\n\n if (reset) {\n properties.options.radius = 0;\n }\n }\n\n me.updateElement(point, i, properties, mode);\n }\n\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n }, {\n key: \"resolveDataElementOptions\",\n value: function resolveDataElementOptions(index, mode) {\n var parsed = this.getParsed(index);\n\n var values = _get(_getPrototypeOf(BubbleController.prototype), \"resolveDataElementOptions\", this).call(this, index, mode);\n\n if (values.$shared) {\n values = Object.assign({}, values, {\n $shared: false\n });\n }\n\n var radius = values.radius;\n\n if (mode !== 'active') {\n values.radius = 0;\n }\n\n values.radius += valueOrDefault(parsed && parsed._custom, radius);\n return values;\n }\n }]);\n\n return BubbleController;\n}(DatasetController);\n\nBubbleController.id = 'bubble';\nBubbleController.defaults = {\n datasetElementType: false,\n dataElementType: 'point',\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'borderWidth', 'radius']\n }\n }\n};\nBubbleController.overrides = {\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: function title() {\n return '';\n }\n }\n }\n }\n};\n\nfunction getRatioAndOffset(rotation, circumference, cutout) {\n var ratioX = 1;\n var ratioY = 1;\n var offsetX = 0;\n var offsetY = 0;\n\n if (circumference < TAU) {\n var startAngle = rotation;\n var endAngle = startAngle + circumference;\n var startX = Math.cos(startAngle);\n var startY = Math.sin(startAngle);\n var endX = Math.cos(endAngle);\n var endY = Math.sin(endAngle);\n\n var calcMax = function calcMax(angle, a, b) {\n return _angleBetween(angle, startAngle, endAngle, true) ? 1 : Math.max(a, a * cutout, b, b * cutout);\n };\n\n var calcMin = function calcMin(angle, a, b) {\n return _angleBetween(angle, startAngle, endAngle, true) ? -1 : Math.min(a, a * cutout, b, b * cutout);\n };\n\n var maxX = calcMax(0, startX, endX);\n var maxY = calcMax(HALF_PI, startY, endY);\n var minX = calcMin(PI, startX, endX);\n var minY = calcMin(PI + HALF_PI, startY, endY);\n ratioX = (maxX - minX) / 2;\n ratioY = (maxY - minY) / 2;\n offsetX = -(maxX + minX) / 2;\n offsetY = -(maxY + minY) / 2;\n }\n\n return {\n ratioX: ratioX,\n ratioY: ratioY,\n offsetX: offsetX,\n offsetY: offsetY\n };\n}\n\nvar DoughnutController = /*#__PURE__*/function (_DatasetController3) {\n _inherits(DoughnutController, _DatasetController3);\n\n var _super3 = _createSuper(DoughnutController);\n\n function DoughnutController(chart, datasetIndex) {\n var _this;\n\n _classCallCheck(this, DoughnutController);\n\n _this = _super3.call(this, chart, datasetIndex);\n _this.enableOptionSharing = true;\n _this.innerRadius = undefined;\n _this.outerRadius = undefined;\n _this.offsetX = undefined;\n _this.offsetY = undefined;\n return _this;\n }\n\n _createClass(DoughnutController, [{\n key: \"linkScales\",\n value: function linkScales() {}\n }, {\n key: \"parse\",\n value: function parse(start, count) {\n var data = this.getDataset().data;\n var meta = this._cachedMeta;\n var i, ilen;\n\n for (i = start, ilen = start + count; i < ilen; ++i) {\n meta._parsed[i] = +data[i];\n }\n }\n }, {\n key: \"_getRotation\",\n value: function _getRotation() {\n return toRadians(this.options.rotation - 90);\n }\n }, {\n key: \"_getCircumference\",\n value: function _getCircumference() {\n return toRadians(this.options.circumference);\n }\n }, {\n key: \"_getRotationExtents\",\n value: function _getRotationExtents() {\n var min = TAU;\n var max = -TAU;\n var me = this;\n\n for (var i = 0; i < me.chart.data.datasets.length; ++i) {\n if (me.chart.isDatasetVisible(i)) {\n var controller = me.chart.getDatasetMeta(i).controller;\n\n var rotation = controller._getRotation();\n\n var circumference = controller._getCircumference();\n\n min = Math.min(min, rotation);\n max = Math.max(max, rotation + circumference);\n }\n }\n\n return {\n rotation: min,\n circumference: max - min\n };\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var me = this;\n var chart = me.chart;\n var chartArea = chart.chartArea;\n var meta = me._cachedMeta;\n var arcs = meta.data;\n var spacing = me.getMaxBorderWidth() + me.getMaxOffset(arcs);\n var maxSize = Math.max((Math.min(chartArea.width, chartArea.height) - spacing) / 2, 0);\n var cutout = Math.min(toPercentage(me.options.cutout, maxSize), 1);\n\n var chartWeight = me._getRingWeight(me.index);\n\n var _me$_getRotationExten = me._getRotationExtents(),\n circumference = _me$_getRotationExten.circumference,\n rotation = _me$_getRotationExten.rotation;\n\n var _getRatioAndOffset = getRatioAndOffset(rotation, circumference, cutout),\n ratioX = _getRatioAndOffset.ratioX,\n ratioY = _getRatioAndOffset.ratioY,\n offsetX = _getRatioAndOffset.offsetX,\n offsetY = _getRatioAndOffset.offsetY;\n\n var maxWidth = (chartArea.width - spacing) / ratioX;\n var maxHeight = (chartArea.height - spacing) / ratioY;\n var maxRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);\n var outerRadius = toDimension(me.options.radius, maxRadius);\n var innerRadius = Math.max(outerRadius * cutout, 0);\n\n var radiusLength = (outerRadius - innerRadius) / me._getVisibleDatasetWeightTotal();\n\n me.offsetX = offsetX * outerRadius;\n me.offsetY = offsetY * outerRadius;\n meta.total = me.calculateTotal();\n me.outerRadius = outerRadius - radiusLength * me._getRingWeightOffset(me.index);\n me.innerRadius = Math.max(me.outerRadius - radiusLength * chartWeight, 0);\n me.updateElements(arcs, 0, arcs.length, mode);\n }\n }, {\n key: \"_circumference\",\n value: function _circumference(i, reset) {\n var me = this;\n var opts = me.options;\n var meta = me._cachedMeta;\n\n var circumference = me._getCircumference();\n\n if (reset && opts.animation.animateRotate || !this.chart.getDataVisibility(i) || meta._parsed[i] === null) {\n return 0;\n }\n\n return me.calculateCircumference(meta._parsed[i] * circumference / TAU);\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(arcs, start, count, mode) {\n var me = this;\n var reset = mode === 'reset';\n var chart = me.chart;\n var chartArea = chart.chartArea;\n var opts = chart.options;\n var animationOpts = opts.animation;\n var centerX = (chartArea.left + chartArea.right) / 2;\n var centerY = (chartArea.top + chartArea.bottom) / 2;\n var animateScale = reset && animationOpts.animateScale;\n var innerRadius = animateScale ? 0 : me.innerRadius;\n var outerRadius = animateScale ? 0 : me.outerRadius;\n var firstOpts = me.resolveDataElementOptions(start, mode);\n var sharedOptions = me.getSharedOptions(firstOpts);\n var includeOptions = me.includeOptions(mode, sharedOptions);\n\n var startAngle = me._getRotation();\n\n var i;\n\n for (i = 0; i < start; ++i) {\n startAngle += me._circumference(i, reset);\n }\n\n for (i = start; i < start + count; ++i) {\n var circumference = me._circumference(i, reset);\n\n var arc = arcs[i];\n var properties = {\n x: centerX + me.offsetX,\n y: centerY + me.offsetY,\n startAngle: startAngle,\n endAngle: startAngle + circumference,\n circumference: circumference,\n outerRadius: outerRadius,\n innerRadius: innerRadius\n };\n\n if (includeOptions) {\n properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);\n }\n\n startAngle += circumference;\n me.updateElement(arc, i, properties, mode);\n }\n\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n }, {\n key: \"calculateTotal\",\n value: function calculateTotal() {\n var meta = this._cachedMeta;\n var metaData = meta.data;\n var total = 0;\n var i;\n\n for (i = 0; i < metaData.length; i++) {\n var value = meta._parsed[i];\n\n if (value !== null && !isNaN(value) && this.chart.getDataVisibility(i)) {\n total += Math.abs(value);\n }\n }\n\n return total;\n }\n }, {\n key: \"calculateCircumference\",\n value: function calculateCircumference(value) {\n var total = this._cachedMeta.total;\n\n if (total > 0 && !isNaN(value)) {\n return TAU * (Math.abs(value) / total);\n }\n\n return 0;\n }\n }, {\n key: \"getLabelAndValue\",\n value: function getLabelAndValue(index) {\n var me = this;\n var meta = me._cachedMeta;\n var chart = me.chart;\n var labels = chart.data.labels || [];\n var value = formatNumber(meta._parsed[index], chart.options.locale);\n return {\n label: labels[index] || '',\n value: value\n };\n }\n }, {\n key: \"getMaxBorderWidth\",\n value: function getMaxBorderWidth(arcs) {\n var me = this;\n var max = 0;\n var chart = me.chart;\n var i, ilen, meta, controller, options;\n\n if (!arcs) {\n for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\n if (chart.isDatasetVisible(i)) {\n meta = chart.getDatasetMeta(i);\n arcs = meta.data;\n controller = meta.controller;\n\n if (controller !== me) {\n controller.configure();\n }\n\n break;\n }\n }\n }\n\n if (!arcs) {\n return 0;\n }\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n options = controller.resolveDataElementOptions(i);\n\n if (options.borderAlign !== 'inner') {\n max = Math.max(max, options.borderWidth || 0, options.hoverBorderWidth || 0);\n }\n }\n\n return max;\n }\n }, {\n key: \"getMaxOffset\",\n value: function getMaxOffset(arcs) {\n var max = 0;\n\n for (var i = 0, ilen = arcs.length; i < ilen; ++i) {\n var options = this.resolveDataElementOptions(i);\n max = Math.max(max, options.offset || 0, options.hoverOffset || 0);\n }\n\n return max;\n }\n }, {\n key: \"_getRingWeightOffset\",\n value: function _getRingWeightOffset(datasetIndex) {\n var ringWeightOffset = 0;\n\n for (var i = 0; i < datasetIndex; ++i) {\n if (this.chart.isDatasetVisible(i)) {\n ringWeightOffset += this._getRingWeight(i);\n }\n }\n\n return ringWeightOffset;\n }\n }, {\n key: \"_getRingWeight\",\n value: function _getRingWeight(datasetIndex) {\n return Math.max(valueOrDefault(this.chart.data.datasets[datasetIndex].weight, 1), 0);\n }\n }, {\n key: \"_getVisibleDatasetWeightTotal\",\n value: function _getVisibleDatasetWeightTotal() {\n return this._getRingWeightOffset(this.chart.data.datasets.length) || 1;\n }\n }]);\n\n return DoughnutController;\n}(DatasetController);\n\nDoughnutController.id = 'doughnut';\nDoughnutController.defaults = {\n datasetElementType: false,\n dataElementType: 'arc',\n animation: {\n animateRotate: true,\n animateScale: false\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['circumference', 'endAngle', 'innerRadius', 'outerRadius', 'startAngle', 'x', 'y', 'offset', 'borderWidth']\n }\n },\n cutout: '50%',\n rotation: 0,\n circumference: 360,\n radius: '100%',\n indexAxis: 'r'\n};\nDoughnutController.overrides = {\n aspectRatio: 1,\n plugins: {\n legend: {\n labels: {\n generateLabels: function generateLabels(chart) {\n var data = chart.data;\n\n if (data.labels.length && data.datasets.length) {\n return data.labels.map(function (label, i) {\n var meta = chart.getDatasetMeta(0);\n var style = meta.controller.getStyle(i);\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n lineWidth: style.borderWidth,\n hidden: !chart.getDataVisibility(i),\n index: i\n };\n });\n }\n\n return [];\n }\n },\n onClick: function onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n },\n tooltip: {\n callbacks: {\n title: function title() {\n return '';\n },\n label: function label(tooltipItem) {\n var dataLabel = tooltipItem.label;\n var value = ': ' + tooltipItem.formattedValue;\n\n if (isArray(dataLabel)) {\n dataLabel = dataLabel.slice();\n dataLabel[0] += value;\n } else {\n dataLabel += value;\n }\n\n return dataLabel;\n }\n }\n }\n }\n};\n\nvar LineController = /*#__PURE__*/function (_DatasetController4) {\n _inherits(LineController, _DatasetController4);\n\n var _super4 = _createSuper(LineController);\n\n function LineController() {\n _classCallCheck(this, LineController);\n\n return _super4.apply(this, arguments);\n }\n\n _createClass(LineController, [{\n key: \"initialize\",\n value: function initialize() {\n this.enableOptionSharing = true;\n\n _get(_getPrototypeOf(LineController.prototype), \"initialize\", this).call(this);\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var me = this;\n var meta = me._cachedMeta;\n var line = meta.dataset,\n _meta$data = meta.data,\n points = _meta$data === void 0 ? [] : _meta$data,\n _dataset = meta._dataset;\n var animationsDisabled = me.chart._animationsDisabled;\n\n var _getStartAndCountOfVi = getStartAndCountOfVisiblePoints(meta, points, animationsDisabled),\n start = _getStartAndCountOfVi.start,\n count = _getStartAndCountOfVi.count;\n\n me._drawStart = start;\n me._drawCount = count;\n\n if (scaleRangesChanged(meta)) {\n start = 0;\n count = points.length;\n }\n\n line._decimated = !!_dataset._decimated;\n line.points = points;\n var options = me.resolveDatasetElementOptions(mode);\n\n if (!me.options.showLine) {\n options.borderWidth = 0;\n }\n\n options.segment = me.options.segment;\n me.updateElement(line, undefined, {\n animated: !animationsDisabled,\n options: options\n }, mode);\n me.updateElements(points, start, count, mode);\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(points, start, count, mode) {\n var me = this;\n var reset = mode === 'reset';\n var _me$_cachedMeta3 = me._cachedMeta,\n iScale = _me$_cachedMeta3.iScale,\n vScale = _me$_cachedMeta3.vScale,\n _stacked = _me$_cachedMeta3._stacked;\n var firstOpts = me.resolveDataElementOptions(start, mode);\n var sharedOptions = me.getSharedOptions(firstOpts);\n var includeOptions = me.includeOptions(mode, sharedOptions);\n var iAxis = iScale.axis;\n var vAxis = vScale.axis;\n var spanGaps = me.options.spanGaps;\n var maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;\n var directUpdate = me.chart._animationsDisabled || reset || mode === 'none';\n var prevParsed = start > 0 && me.getParsed(start - 1);\n\n for (var i = start; i < start + count; ++i) {\n var point = points[i];\n var parsed = me.getParsed(i);\n var properties = directUpdate ? point : {};\n var nullData = isNullOrUndef(parsed[vAxis]);\n var iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);\n var vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? me.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);\n properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;\n properties.stop = i > 0 && parsed[iAxis] - prevParsed[iAxis] > maxGapLength;\n properties.parsed = parsed;\n\n if (includeOptions) {\n properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);\n }\n\n if (!directUpdate) {\n me.updateElement(point, i, properties, mode);\n }\n\n prevParsed = parsed;\n }\n\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n }, {\n key: \"getMaxOverflow\",\n value: function getMaxOverflow() {\n var me = this;\n var meta = me._cachedMeta;\n var dataset = meta.dataset;\n var border = dataset.options && dataset.options.borderWidth || 0;\n var data = meta.data || [];\n\n if (!data.length) {\n return border;\n }\n\n var firstPoint = data[0].size(me.resolveDataElementOptions(0));\n var lastPoint = data[data.length - 1].size(me.resolveDataElementOptions(data.length - 1));\n return Math.max(border, firstPoint, lastPoint) / 2;\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var meta = this._cachedMeta;\n meta.dataset.updateControlPoints(this.chart.chartArea, meta.iScale.axis);\n\n _get(_getPrototypeOf(LineController.prototype), \"draw\", this).call(this);\n }\n }]);\n\n return LineController;\n}(DatasetController);\n\nLineController.id = 'line';\nLineController.defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n showLine: true,\n spanGaps: false\n};\nLineController.overrides = {\n scales: {\n _index_: {\n type: 'category'\n },\n _value_: {\n type: 'linear'\n }\n }\n};\n\nfunction getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {\n var pointCount = points.length;\n var start = 0;\n var count = pointCount;\n\n if (meta._sorted) {\n var iScale = meta.iScale,\n _parsed = meta._parsed;\n var axis = iScale.axis;\n\n var _iScale$getUserBounds = iScale.getUserBounds(),\n min = _iScale$getUserBounds.min,\n max = _iScale$getUserBounds.max,\n minDefined = _iScale$getUserBounds.minDefined,\n maxDefined = _iScale$getUserBounds.maxDefined;\n\n if (minDefined) {\n start = _limitValue(Math.min(_lookupByKey(_parsed, iScale.axis, min).lo, animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo), 0, pointCount - 1);\n }\n\n if (maxDefined) {\n count = _limitValue(Math.max(_lookupByKey(_parsed, iScale.axis, max).hi + 1, animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max)).hi + 1), start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n }\n\n return {\n start: start,\n count: count\n };\n}\n\nfunction scaleRangesChanged(meta) {\n var xScale = meta.xScale,\n yScale = meta.yScale,\n _scaleRanges = meta._scaleRanges;\n var newRanges = {\n xmin: xScale.min,\n xmax: xScale.max,\n ymin: yScale.min,\n ymax: yScale.max\n };\n\n if (!_scaleRanges) {\n meta._scaleRanges = newRanges;\n return true;\n }\n\n var changed = _scaleRanges.xmin !== xScale.min || _scaleRanges.xmax !== xScale.max || _scaleRanges.ymin !== yScale.min || _scaleRanges.ymax !== yScale.max;\n Object.assign(_scaleRanges, newRanges);\n return changed;\n}\n\nvar PolarAreaController = /*#__PURE__*/function (_DatasetController5) {\n _inherits(PolarAreaController, _DatasetController5);\n\n var _super5 = _createSuper(PolarAreaController);\n\n function PolarAreaController(chart, datasetIndex) {\n var _this2;\n\n _classCallCheck(this, PolarAreaController);\n\n _this2 = _super5.call(this, chart, datasetIndex);\n _this2.innerRadius = undefined;\n _this2.outerRadius = undefined;\n return _this2;\n }\n\n _createClass(PolarAreaController, [{\n key: \"getLabelAndValue\",\n value: function getLabelAndValue(index) {\n var me = this;\n var meta = me._cachedMeta;\n var chart = me.chart;\n var labels = chart.data.labels || [];\n var value = formatNumber(meta._parsed[index].r, chart.options.locale);\n return {\n label: labels[index] || '',\n value: value\n };\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var arcs = this._cachedMeta.data;\n\n this._updateRadius();\n\n this.updateElements(arcs, 0, arcs.length, mode);\n }\n }, {\n key: \"_updateRadius\",\n value: function _updateRadius() {\n var me = this;\n var chart = me.chart;\n var chartArea = chart.chartArea;\n var opts = chart.options;\n var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);\n var outerRadius = Math.max(minSize / 2, 0);\n var innerRadius = Math.max(opts.cutoutPercentage ? outerRadius / 100 * opts.cutoutPercentage : 1, 0);\n var radiusLength = (outerRadius - innerRadius) / chart.getVisibleDatasetCount();\n me.outerRadius = outerRadius - radiusLength * me.index;\n me.innerRadius = me.outerRadius - radiusLength;\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(arcs, start, count, mode) {\n var me = this;\n var reset = mode === 'reset';\n var chart = me.chart;\n var dataset = me.getDataset();\n var opts = chart.options;\n var animationOpts = opts.animation;\n var scale = me._cachedMeta.rScale;\n var centerX = scale.xCenter;\n var centerY = scale.yCenter;\n var datasetStartAngle = scale.getIndexAngle(0) - 0.5 * PI;\n var angle = datasetStartAngle;\n var i;\n var defaultAngle = 360 / me.countVisibleElements();\n\n for (i = 0; i < start; ++i) {\n angle += me._computeAngle(i, mode, defaultAngle);\n }\n\n for (i = start; i < start + count; i++) {\n var arc = arcs[i];\n var startAngle = angle;\n\n var endAngle = angle + me._computeAngle(i, mode, defaultAngle);\n\n var outerRadius = chart.getDataVisibility(i) ? scale.getDistanceFromCenterForValue(dataset.data[i]) : 0;\n angle = endAngle;\n\n if (reset) {\n if (animationOpts.animateScale) {\n outerRadius = 0;\n }\n\n if (animationOpts.animateRotate) {\n startAngle = endAngle = datasetStartAngle;\n }\n }\n\n var properties = {\n x: centerX,\n y: centerY,\n innerRadius: 0,\n outerRadius: outerRadius,\n startAngle: startAngle,\n endAngle: endAngle,\n options: me.resolveDataElementOptions(i, mode)\n };\n me.updateElement(arc, i, properties, mode);\n }\n }\n }, {\n key: \"countVisibleElements\",\n value: function countVisibleElements() {\n var _this3 = this;\n\n var dataset = this.getDataset();\n var meta = this._cachedMeta;\n var count = 0;\n meta.data.forEach(function (element, index) {\n if (!isNaN(dataset.data[index]) && _this3.chart.getDataVisibility(index)) {\n count++;\n }\n });\n return count;\n }\n }, {\n key: \"_computeAngle\",\n value: function _computeAngle(index, mode, defaultAngle) {\n return this.chart.getDataVisibility(index) ? toRadians(this.resolveDataElementOptions(index, mode).angle || defaultAngle) : 0;\n }\n }]);\n\n return PolarAreaController;\n}(DatasetController);\n\nPolarAreaController.id = 'polarArea';\nPolarAreaController.defaults = {\n dataElementType: 'arc',\n animation: {\n animateRotate: true,\n animateScale: true\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'startAngle', 'endAngle', 'innerRadius', 'outerRadius']\n }\n },\n indexAxis: 'r',\n startAngle: 0\n};\nPolarAreaController.overrides = {\n aspectRatio: 1,\n plugins: {\n legend: {\n labels: {\n generateLabels: function generateLabels(chart) {\n var data = chart.data;\n\n if (data.labels.length && data.datasets.length) {\n return data.labels.map(function (label, i) {\n var meta = chart.getDatasetMeta(0);\n var style = meta.controller.getStyle(i);\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n lineWidth: style.borderWidth,\n hidden: !chart.getDataVisibility(i),\n index: i\n };\n });\n }\n\n return [];\n }\n },\n onClick: function onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n },\n tooltip: {\n callbacks: {\n title: function title() {\n return '';\n },\n label: function label(context) {\n return context.chart.data.labels[context.dataIndex] + ': ' + context.formattedValue;\n }\n }\n }\n },\n scales: {\n r: {\n type: 'radialLinear',\n angleLines: {\n display: false\n },\n beginAtZero: true,\n grid: {\n circular: true\n },\n pointLabels: {\n display: false\n },\n startAngle: 0\n }\n }\n};\n\nvar PieController = /*#__PURE__*/function (_DoughnutController) {\n _inherits(PieController, _DoughnutController);\n\n var _super6 = _createSuper(PieController);\n\n function PieController() {\n _classCallCheck(this, PieController);\n\n return _super6.apply(this, arguments);\n }\n\n return _createClass(PieController);\n}(DoughnutController);\n\nPieController.id = 'pie';\nPieController.defaults = {\n cutout: 0,\n rotation: 0,\n circumference: 360,\n radius: '100%'\n};\n\nvar RadarController = /*#__PURE__*/function (_DatasetController6) {\n _inherits(RadarController, _DatasetController6);\n\n var _super7 = _createSuper(RadarController);\n\n function RadarController() {\n _classCallCheck(this, RadarController);\n\n return _super7.apply(this, arguments);\n }\n\n _createClass(RadarController, [{\n key: \"getLabelAndValue\",\n value: function getLabelAndValue(index) {\n var me = this;\n var vScale = me._cachedMeta.vScale;\n var parsed = me.getParsed(index);\n return {\n label: vScale.getLabels()[index],\n value: '' + vScale.getLabelForValue(parsed[vScale.axis])\n };\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var me = this;\n var meta = me._cachedMeta;\n var line = meta.dataset;\n var points = meta.data || [];\n var labels = meta.iScale.getLabels();\n line.points = points;\n\n if (mode !== 'resize') {\n var options = me.resolveDatasetElementOptions(mode);\n\n if (!me.options.showLine) {\n options.borderWidth = 0;\n }\n\n var properties = {\n _loop: true,\n _fullLoop: labels.length === points.length,\n options: options\n };\n me.updateElement(line, undefined, properties, mode);\n }\n\n me.updateElements(points, 0, points.length, mode);\n }\n }, {\n key: \"updateElements\",\n value: function updateElements(points, start, count, mode) {\n var me = this;\n var dataset = me.getDataset();\n var scale = me._cachedMeta.rScale;\n var reset = mode === 'reset';\n\n for (var i = start; i < start + count; i++) {\n var point = points[i];\n var options = me.resolveDataElementOptions(i, mode);\n var pointPosition = scale.getPointPositionForValue(i, dataset.data[i]);\n var x = reset ? scale.xCenter : pointPosition.x;\n var y = reset ? scale.yCenter : pointPosition.y;\n var properties = {\n x: x,\n y: y,\n angle: pointPosition.angle,\n skip: isNaN(x) || isNaN(y),\n options: options\n };\n me.updateElement(point, i, properties, mode);\n }\n }\n }]);\n\n return RadarController;\n}(DatasetController);\n\nRadarController.id = 'radar';\nRadarController.defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n indexAxis: 'r',\n showLine: true,\n elements: {\n line: {\n fill: 'start'\n }\n }\n};\nRadarController.overrides = {\n aspectRatio: 1,\n scales: {\n r: {\n type: 'radialLinear'\n }\n }\n};\n\nvar ScatterController = /*#__PURE__*/function (_LineController) {\n _inherits(ScatterController, _LineController);\n\n var _super8 = _createSuper(ScatterController);\n\n function ScatterController() {\n _classCallCheck(this, ScatterController);\n\n return _super8.apply(this, arguments);\n }\n\n return _createClass(ScatterController);\n}(LineController);\n\nScatterController.id = 'scatter';\nScatterController.defaults = {\n showLine: false,\n fill: false\n};\nScatterController.overrides = {\n interaction: {\n mode: 'point'\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: function title() {\n return '';\n },\n label: function label(item) {\n return '(' + item.label + ', ' + item.formattedValue + ')';\n }\n }\n }\n },\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n }\n};\nvar controllers = /*#__PURE__*/Object.freeze({\n __proto__: null,\n BarController: BarController,\n BubbleController: BubbleController,\n DoughnutController: DoughnutController,\n LineController: LineController,\n PolarAreaController: PolarAreaController,\n PieController: PieController,\n RadarController: RadarController,\n ScatterController: ScatterController\n});\n\nfunction abstract() {\n throw new Error('This method is not implemented: Check that a complete date adapter is provided.');\n}\n\nvar DateAdapter = /*#__PURE__*/function () {\n function DateAdapter(options) {\n _classCallCheck(this, DateAdapter);\n\n this.options = options || {};\n }\n\n _createClass(DateAdapter, [{\n key: \"formats\",\n value: function formats() {\n return abstract();\n }\n }, {\n key: \"parse\",\n value: function parse(value, format) {\n return abstract();\n }\n }, {\n key: \"format\",\n value: function format(timestamp, _format) {\n return abstract();\n }\n }, {\n key: \"add\",\n value: function add(timestamp, amount, unit) {\n return abstract();\n }\n }, {\n key: \"diff\",\n value: function diff(a, b, unit) {\n return abstract();\n }\n }, {\n key: \"startOf\",\n value: function startOf(timestamp, unit, weekday) {\n return abstract();\n }\n }, {\n key: \"endOf\",\n value: function endOf(timestamp, unit) {\n return abstract();\n }\n }]);\n\n return DateAdapter;\n}();\n\nDateAdapter.override = function (members) {\n Object.assign(DateAdapter.prototype, members);\n};\n\nvar adapters = {\n _date: DateAdapter\n};\n\nfunction getRelativePosition(e, chart) {\n if ('native' in e) {\n return {\n x: e.x,\n y: e.y\n };\n }\n\n return getRelativePosition$1(e, chart);\n}\n\nfunction evaluateAllVisibleItems(chart, handler) {\n var metasets = chart.getSortedVisibleDatasetMetas();\n var index, data, element;\n\n for (var i = 0, ilen = metasets.length; i < ilen; ++i) {\n var _metasets$i = metasets[i];\n index = _metasets$i.index;\n data = _metasets$i.data;\n\n for (var j = 0, jlen = data.length; j < jlen; ++j) {\n element = data[j];\n\n if (!element.skip) {\n handler(element, index, j);\n }\n }\n }\n}\n\nfunction binarySearch(metaset, axis, value, intersect) {\n var controller = metaset.controller,\n data = metaset.data,\n _sorted = metaset._sorted;\n var iScale = controller._cachedMeta.iScale;\n\n if (iScale && axis === iScale.axis && _sorted && data.length) {\n var lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;\n\n if (!intersect) {\n return lookupMethod(data, axis, value);\n } else if (controller._sharedOptions) {\n var el = data[0];\n var range = typeof el.getRange === 'function' && el.getRange(axis);\n\n if (range) {\n var start = lookupMethod(data, axis, value - range);\n var end = lookupMethod(data, axis, value + range);\n return {\n lo: start.lo,\n hi: end.hi\n };\n }\n }\n }\n\n return {\n lo: 0,\n hi: data.length - 1\n };\n}\n\nfunction optimizedEvaluateItems(chart, axis, position, handler, intersect) {\n var metasets = chart.getSortedVisibleDatasetMetas();\n var value = position[axis];\n\n for (var i = 0, ilen = metasets.length; i < ilen; ++i) {\n var _metasets$i2 = metasets[i],\n index = _metasets$i2.index,\n data = _metasets$i2.data;\n\n var _binarySearch = binarySearch(metasets[i], axis, value, intersect),\n lo = _binarySearch.lo,\n hi = _binarySearch.hi;\n\n for (var j = lo; j <= hi; ++j) {\n var element = data[j];\n\n if (!element.skip) {\n handler(element, index, j);\n }\n }\n }\n}\n\nfunction getDistanceMetricForAxis(axis) {\n var useX = axis.indexOf('x') !== -1;\n var useY = axis.indexOf('y') !== -1;\n return function (pt1, pt2) {\n var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;\n var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;\n return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\n };\n}\n\nfunction getIntersectItems(chart, position, axis, useFinalPosition) {\n var items = [];\n\n if (!_isPointInArea(position, chart.chartArea, chart._minPadding)) {\n return items;\n }\n\n var evaluationFunc = function evaluationFunc(element, datasetIndex, index) {\n if (element.inRange(position.x, position.y, useFinalPosition)) {\n items.push({\n element: element,\n datasetIndex: datasetIndex,\n index: index\n });\n }\n };\n\n optimizedEvaluateItems(chart, axis, position, evaluationFunc, true);\n return items;\n}\n\nfunction getNearestItems(chart, position, axis, intersect, useFinalPosition) {\n var distanceMetric = getDistanceMetricForAxis(axis);\n var minDistance = Number.POSITIVE_INFINITY;\n var items = [];\n\n if (!_isPointInArea(position, chart.chartArea, chart._minPadding)) {\n return items;\n }\n\n var evaluationFunc = function evaluationFunc(element, datasetIndex, index) {\n if (intersect && !element.inRange(position.x, position.y, useFinalPosition)) {\n return;\n }\n\n var center = element.getCenterPoint(useFinalPosition);\n\n if (!_isPointInArea(center, chart.chartArea, chart._minPadding)) {\n return;\n }\n\n var distance = distanceMetric(position, center);\n\n if (distance < minDistance) {\n items = [{\n element: element,\n datasetIndex: datasetIndex,\n index: index\n }];\n minDistance = distance;\n } else if (distance === minDistance) {\n items.push({\n element: element,\n datasetIndex: datasetIndex,\n index: index\n });\n }\n };\n\n optimizedEvaluateItems(chart, axis, position, evaluationFunc);\n return items;\n}\n\nfunction getAxisItems(chart, e, options, useFinalPosition) {\n var position = getRelativePosition(e, chart);\n var items = [];\n var axis = options.axis;\n var rangeMethod = axis === 'x' ? 'inXRange' : 'inYRange';\n var intersectsItem = false;\n evaluateAllVisibleItems(chart, function (element, datasetIndex, index) {\n if (element[rangeMethod](position[axis], useFinalPosition)) {\n items.push({\n element: element,\n datasetIndex: datasetIndex,\n index: index\n });\n }\n\n if (element.inRange(position.x, position.y, useFinalPosition)) {\n intersectsItem = true;\n }\n });\n\n if (options.intersect && !intersectsItem) {\n return [];\n }\n\n return items;\n}\n\nvar Interaction = {\n modes: {\n index: function index(chart, e, options, useFinalPosition) {\n var position = getRelativePosition(e, chart);\n var axis = options.axis || 'x';\n var items = options.intersect ? getIntersectItems(chart, position, axis, useFinalPosition) : getNearestItems(chart, position, axis, false, useFinalPosition);\n var elements = [];\n\n if (!items.length) {\n return [];\n }\n\n chart.getSortedVisibleDatasetMetas().forEach(function (meta) {\n var index = items[0].index;\n var element = meta.data[index];\n\n if (element && !element.skip) {\n elements.push({\n element: element,\n datasetIndex: meta.index,\n index: index\n });\n }\n });\n return elements;\n },\n dataset: function dataset(chart, e, options, useFinalPosition) {\n var position = getRelativePosition(e, chart);\n var axis = options.axis || 'xy';\n var items = options.intersect ? getIntersectItems(chart, position, axis, useFinalPosition) : getNearestItems(chart, position, axis, false, useFinalPosition);\n\n if (items.length > 0) {\n var datasetIndex = items[0].datasetIndex;\n var data = chart.getDatasetMeta(datasetIndex).data;\n items = [];\n\n for (var i = 0; i < data.length; ++i) {\n items.push({\n element: data[i],\n datasetIndex: datasetIndex,\n index: i\n });\n }\n }\n\n return items;\n },\n point: function point(chart, e, options, useFinalPosition) {\n var position = getRelativePosition(e, chart);\n var axis = options.axis || 'xy';\n return getIntersectItems(chart, position, axis, useFinalPosition);\n },\n nearest: function nearest(chart, e, options, useFinalPosition) {\n var position = getRelativePosition(e, chart);\n var axis = options.axis || 'xy';\n return getNearestItems(chart, position, axis, options.intersect, useFinalPosition);\n },\n x: function x(chart, e, options, useFinalPosition) {\n options.axis = 'x';\n return getAxisItems(chart, e, options, useFinalPosition);\n },\n y: function y(chart, e, options, useFinalPosition) {\n options.axis = 'y';\n return getAxisItems(chart, e, options, useFinalPosition);\n }\n }\n};\nvar STATIC_POSITIONS = ['left', 'top', 'right', 'bottom'];\n\nfunction filterByPosition(array, position) {\n return array.filter(function (v) {\n return v.pos === position;\n });\n}\n\nfunction filterDynamicPositionByAxis(array, axis) {\n return array.filter(function (v) {\n return STATIC_POSITIONS.indexOf(v.pos) === -1 && v.box.axis === axis;\n });\n}\n\nfunction sortByWeight(array, reverse) {\n return array.sort(function (a, b) {\n var v0 = reverse ? b : a;\n var v1 = reverse ? a : b;\n return v0.weight === v1.weight ? v0.index - v1.index : v0.weight - v1.weight;\n });\n}\n\nfunction wrapBoxes(boxes) {\n var layoutBoxes = [];\n var i, ilen, box;\n\n for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {\n box = boxes[i];\n layoutBoxes.push({\n index: i,\n box: box,\n pos: box.position,\n horizontal: box.isHorizontal(),\n weight: box.weight\n });\n }\n\n return layoutBoxes;\n}\n\nfunction setLayoutDims(layouts, params) {\n var i, ilen, layout;\n\n for (i = 0, ilen = layouts.length; i < ilen; ++i) {\n layout = layouts[i];\n\n if (layout.horizontal) {\n layout.width = layout.box.fullSize && params.availableWidth;\n layout.height = params.hBoxMaxHeight;\n } else {\n layout.width = params.vBoxMaxWidth;\n layout.height = layout.box.fullSize && params.availableHeight;\n }\n }\n}\n\nfunction buildLayoutBoxes(boxes) {\n var layoutBoxes = wrapBoxes(boxes);\n var fullSize = sortByWeight(layoutBoxes.filter(function (wrap) {\n return wrap.box.fullSize;\n }), true);\n var left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);\n var right = sortByWeight(filterByPosition(layoutBoxes, 'right'));\n var top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);\n var bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));\n var centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, 'x');\n var centerVertical = filterDynamicPositionByAxis(layoutBoxes, 'y');\n return {\n fullSize: fullSize,\n leftAndTop: left.concat(top),\n rightAndBottom: right.concat(centerVertical).concat(bottom).concat(centerHorizontal),\n chartArea: filterByPosition(layoutBoxes, 'chartArea'),\n vertical: left.concat(right).concat(centerVertical),\n horizontal: top.concat(bottom).concat(centerHorizontal)\n };\n}\n\nfunction getCombinedMax(maxPadding, chartArea, a, b) {\n return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);\n}\n\nfunction updateMaxPadding(maxPadding, boxPadding) {\n maxPadding.top = Math.max(maxPadding.top, boxPadding.top);\n maxPadding.left = Math.max(maxPadding.left, boxPadding.left);\n maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);\n maxPadding.right = Math.max(maxPadding.right, boxPadding.right);\n}\n\nfunction updateDims(chartArea, params, layout) {\n var box = layout.box;\n var maxPadding = chartArea.maxPadding;\n\n if (!isObject(layout.pos)) {\n if (layout.size) {\n chartArea[layout.pos] -= layout.size;\n }\n\n layout.size = layout.horizontal ? box.height : box.width;\n chartArea[layout.pos] += layout.size;\n }\n\n if (box.getPadding) {\n updateMaxPadding(maxPadding, box.getPadding());\n }\n\n var newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right'));\n var newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom'));\n var widthChanged = newWidth !== chartArea.w;\n var heightChanged = newHeight !== chartArea.h;\n chartArea.w = newWidth;\n chartArea.h = newHeight;\n return layout.horizontal ? {\n same: widthChanged,\n other: heightChanged\n } : {\n same: heightChanged,\n other: widthChanged\n };\n}\n\nfunction handleMaxPadding(chartArea) {\n var maxPadding = chartArea.maxPadding;\n\n function updatePos(pos) {\n var change = Math.max(maxPadding[pos] - chartArea[pos], 0);\n chartArea[pos] += change;\n return change;\n }\n\n chartArea.y += updatePos('top');\n chartArea.x += updatePos('left');\n updatePos('right');\n updatePos('bottom');\n}\n\nfunction getMargins(horizontal, chartArea) {\n var maxPadding = chartArea.maxPadding;\n\n function marginForPositions(positions) {\n var margin = {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n positions.forEach(function (pos) {\n margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);\n });\n return margin;\n }\n\n return horizontal ? marginForPositions(['left', 'right']) : marginForPositions(['top', 'bottom']);\n}\n\nfunction fitBoxes(boxes, chartArea, params) {\n var refitBoxes = [];\n var i, ilen, layout, box, refit, changed;\n\n for (i = 0, ilen = boxes.length, refit = 0; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n box.update(layout.width || chartArea.w, layout.height || chartArea.h, getMargins(layout.horizontal, chartArea));\n\n var _updateDims = updateDims(chartArea, params, layout),\n same = _updateDims.same,\n other = _updateDims.other;\n\n refit |= same && refitBoxes.length;\n changed = changed || other;\n\n if (!box.fullSize) {\n refitBoxes.push(layout);\n }\n }\n\n return refit && fitBoxes(refitBoxes, chartArea, params) || changed;\n}\n\nfunction placeBoxes(boxes, chartArea, params) {\n var userPadding = params.padding;\n var x = chartArea.x;\n var y = chartArea.y;\n var i, ilen, layout, box;\n\n for (i = 0, ilen = boxes.length; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n\n if (layout.horizontal) {\n box.left = box.fullSize ? userPadding.left : chartArea.left;\n box.right = box.fullSize ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;\n box.top = y;\n box.bottom = y + box.height;\n box.width = box.right - box.left;\n y = box.bottom;\n } else {\n box.left = x;\n box.right = x + box.width;\n box.top = box.fullSize ? userPadding.top : chartArea.top;\n box.bottom = box.fullSize ? params.outerHeight - userPadding.right : chartArea.top + chartArea.h;\n box.height = box.bottom - box.top;\n x = box.right;\n }\n }\n\n chartArea.x = x;\n chartArea.y = y;\n}\n\ndefaults.set('layout', {\n padding: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n }\n});\nvar layouts = {\n addBox: function addBox(chart, item) {\n if (!chart.boxes) {\n chart.boxes = [];\n }\n\n item.fullSize = item.fullSize || false;\n item.position = item.position || 'top';\n item.weight = item.weight || 0;\n\n item._layers = item._layers || function () {\n return [{\n z: 0,\n draw: function draw(chartArea) {\n item.draw(chartArea);\n }\n }];\n };\n\n chart.boxes.push(item);\n },\n removeBox: function removeBox(chart, layoutItem) {\n var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;\n\n if (index !== -1) {\n chart.boxes.splice(index, 1);\n }\n },\n configure: function configure(chart, item, options) {\n item.fullSize = options.fullSize;\n item.position = options.position;\n item.weight = options.weight;\n },\n update: function update(chart, width, height, minPadding) {\n if (!chart) {\n return;\n }\n\n var padding = toPadding(chart.options.layout.padding);\n var availableWidth = Math.max(width - padding.width, 0);\n var availableHeight = Math.max(height - padding.height, 0);\n var boxes = buildLayoutBoxes(chart.boxes);\n var verticalBoxes = boxes.vertical;\n var horizontalBoxes = boxes.horizontal;\n each(chart.boxes, function (box) {\n if (typeof box.beforeLayout === 'function') {\n box.beforeLayout();\n }\n });\n var visibleVerticalBoxCount = verticalBoxes.reduce(function (total, wrap) {\n return wrap.box.options && wrap.box.options.display === false ? total : total + 1;\n }, 0) || 1;\n var params = Object.freeze({\n outerWidth: width,\n outerHeight: height,\n padding: padding,\n availableWidth: availableWidth,\n availableHeight: availableHeight,\n vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,\n hBoxMaxHeight: availableHeight / 2\n });\n var maxPadding = Object.assign({}, padding);\n updateMaxPadding(maxPadding, toPadding(minPadding));\n var chartArea = Object.assign({\n maxPadding: maxPadding,\n w: availableWidth,\n h: availableHeight,\n x: padding.left,\n y: padding.top\n }, padding);\n setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);\n fitBoxes(boxes.fullSize, chartArea, params);\n fitBoxes(verticalBoxes, chartArea, params);\n\n if (fitBoxes(horizontalBoxes, chartArea, params)) {\n fitBoxes(verticalBoxes, chartArea, params);\n }\n\n handleMaxPadding(chartArea);\n placeBoxes(boxes.leftAndTop, chartArea, params);\n chartArea.x += chartArea.w;\n chartArea.y += chartArea.h;\n placeBoxes(boxes.rightAndBottom, chartArea, params);\n chart.chartArea = {\n left: chartArea.left,\n top: chartArea.top,\n right: chartArea.left + chartArea.w,\n bottom: chartArea.top + chartArea.h,\n height: chartArea.h,\n width: chartArea.w\n };\n each(boxes.chartArea, function (layout) {\n var box = layout.box;\n Object.assign(box, chart.chartArea);\n box.update(chartArea.w, chartArea.h);\n });\n }\n};\n\nvar BasePlatform = /*#__PURE__*/function () {\n function BasePlatform() {\n _classCallCheck(this, BasePlatform);\n }\n\n _createClass(BasePlatform, [{\n key: \"acquireContext\",\n value: function acquireContext(canvas, aspectRatio) {}\n }, {\n key: \"releaseContext\",\n value: function releaseContext(context) {\n return false;\n }\n }, {\n key: \"addEventListener\",\n value: function addEventListener(chart, type, listener) {}\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(chart, type, listener) {}\n }, {\n key: \"getDevicePixelRatio\",\n value: function getDevicePixelRatio() {\n return 1;\n }\n }, {\n key: \"getMaximumSize\",\n value: function getMaximumSize(element, width, height, aspectRatio) {\n width = Math.max(0, width || element.width);\n height = height || element.height;\n return {\n width: width,\n height: Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height)\n };\n }\n }, {\n key: \"isAttached\",\n value: function isAttached(canvas) {\n return true;\n }\n }]);\n\n return BasePlatform;\n}();\n\nvar BasicPlatform = /*#__PURE__*/function (_BasePlatform) {\n _inherits(BasicPlatform, _BasePlatform);\n\n var _super9 = _createSuper(BasicPlatform);\n\n function BasicPlatform() {\n _classCallCheck(this, BasicPlatform);\n\n return _super9.apply(this, arguments);\n }\n\n _createClass(BasicPlatform, [{\n key: \"acquireContext\",\n value: function acquireContext(item) {\n return item && item.getContext && item.getContext('2d') || null;\n }\n }]);\n\n return BasicPlatform;\n}(BasePlatform);\n\nvar EXPANDO_KEY = '$chartjs';\nvar EVENT_TYPES = {\n touchstart: 'mousedown',\n touchmove: 'mousemove',\n touchend: 'mouseup',\n pointerenter: 'mouseenter',\n pointerdown: 'mousedown',\n pointermove: 'mousemove',\n pointerup: 'mouseup',\n pointerleave: 'mouseout',\n pointerout: 'mouseout'\n};\n\nvar isNullOrEmpty = function isNullOrEmpty(value) {\n return value === null || value === '';\n};\n\nfunction initCanvas(canvas, aspectRatio) {\n var style = canvas.style;\n var renderHeight = canvas.getAttribute('height');\n var renderWidth = canvas.getAttribute('width');\n canvas[EXPANDO_KEY] = {\n initial: {\n height: renderHeight,\n width: renderWidth,\n style: {\n display: style.display,\n height: style.height,\n width: style.width\n }\n }\n };\n style.display = style.display || 'block';\n style.boxSizing = style.boxSizing || 'border-box';\n\n if (isNullOrEmpty(renderWidth)) {\n var displayWidth = readUsedSize(canvas, 'width');\n\n if (displayWidth !== undefined) {\n canvas.width = displayWidth;\n }\n }\n\n if (isNullOrEmpty(renderHeight)) {\n if (canvas.style.height === '') {\n canvas.height = canvas.width / (aspectRatio || 2);\n } else {\n var displayHeight = readUsedSize(canvas, 'height');\n\n if (displayHeight !== undefined) {\n canvas.height = displayHeight;\n }\n }\n }\n\n return canvas;\n}\n\nvar eventListenerOptions = supportsEventListenerOptions ? {\n passive: true\n} : false;\n\nfunction addListener(node, type, listener) {\n node.addEventListener(type, listener, eventListenerOptions);\n}\n\nfunction removeListener(chart, type, listener) {\n chart.canvas.removeEventListener(type, listener, eventListenerOptions);\n}\n\nfunction fromNativeEvent(event, chart) {\n var type = EVENT_TYPES[event.type] || event.type;\n\n var _getRelativePosition$ = getRelativePosition$1(event, chart),\n x = _getRelativePosition$.x,\n y = _getRelativePosition$.y;\n\n return {\n type: type,\n chart: chart,\n native: event,\n x: x !== undefined ? x : null,\n y: y !== undefined ? y : null\n };\n}\n\nfunction createAttachObserver(chart, type, listener) {\n var canvas = chart.canvas;\n\n var container = canvas && _getParentNode(canvas);\n\n var element = container || canvas;\n var observer = new MutationObserver(function (entries) {\n var parent = _getParentNode(element);\n\n entries.forEach(function (entry) {\n for (var i = 0; i < entry.addedNodes.length; i++) {\n var added = entry.addedNodes[i];\n\n if (added === element || added === parent) {\n listener(entry.target);\n }\n }\n });\n });\n observer.observe(document, {\n childList: true,\n subtree: true\n });\n return observer;\n}\n\nfunction createDetachObserver(chart, type, listener) {\n var canvas = chart.canvas;\n\n var container = canvas && _getParentNode(canvas);\n\n if (!container) {\n return;\n }\n\n var observer = new MutationObserver(function (entries) {\n entries.forEach(function (entry) {\n for (var i = 0; i < entry.removedNodes.length; i++) {\n if (entry.removedNodes[i] === canvas) {\n listener();\n break;\n }\n }\n });\n });\n observer.observe(container, {\n childList: true\n });\n return observer;\n}\n\nvar drpListeningCharts = new Map();\nvar oldDevicePixelRatio = 0;\n\nfunction onWindowResize() {\n var dpr = window.devicePixelRatio;\n\n if (dpr === oldDevicePixelRatio) {\n return;\n }\n\n oldDevicePixelRatio = dpr;\n drpListeningCharts.forEach(function (resize, chart) {\n if (chart.currentDevicePixelRatio !== dpr) {\n resize();\n }\n });\n}\n\nfunction listenDevicePixelRatioChanges(chart, resize) {\n if (!drpListeningCharts.size) {\n window.addEventListener('resize', onWindowResize);\n }\n\n drpListeningCharts.set(chart, resize);\n}\n\nfunction unlistenDevicePixelRatioChanges(chart) {\n drpListeningCharts.delete(chart);\n\n if (!drpListeningCharts.size) {\n window.removeEventListener('resize', onWindowResize);\n }\n}\n\nfunction createResizeObserver(chart, type, listener) {\n var canvas = chart.canvas;\n\n var container = canvas && _getParentNode(canvas);\n\n if (!container) {\n return;\n }\n\n var resize = throttled(function (width, height) {\n var w = container.clientWidth;\n listener(width, height);\n\n if (w < container.clientWidth) {\n listener();\n }\n }, window);\n var observer = new ResizeObserver(function (entries) {\n var entry = entries[0];\n var width = entry.contentRect.width;\n var height = entry.contentRect.height;\n\n if (width === 0 && height === 0) {\n return;\n }\n\n resize(width, height);\n });\n observer.observe(container);\n listenDevicePixelRatioChanges(chart, resize);\n return observer;\n}\n\nfunction releaseObserver(chart, type, observer) {\n if (observer) {\n observer.disconnect();\n }\n\n if (type === 'resize') {\n unlistenDevicePixelRatioChanges(chart);\n }\n}\n\nfunction createProxyAndListen(chart, type, listener) {\n var canvas = chart.canvas;\n var proxy = throttled(function (event) {\n if (chart.ctx !== null) {\n listener(fromNativeEvent(event, chart));\n }\n }, chart, function (args) {\n var event = args[0];\n return [event, event.offsetX, event.offsetY];\n });\n addListener(canvas, type, proxy);\n return proxy;\n}\n\nvar DomPlatform = /*#__PURE__*/function (_BasePlatform2) {\n _inherits(DomPlatform, _BasePlatform2);\n\n var _super10 = _createSuper(DomPlatform);\n\n function DomPlatform() {\n _classCallCheck(this, DomPlatform);\n\n return _super10.apply(this, arguments);\n }\n\n _createClass(DomPlatform, [{\n key: \"acquireContext\",\n value: function acquireContext(canvas, aspectRatio) {\n var context = canvas && canvas.getContext && canvas.getContext('2d');\n\n if (context && context.canvas === canvas) {\n initCanvas(canvas, aspectRatio);\n return context;\n }\n\n return null;\n }\n }, {\n key: \"releaseContext\",\n value: function releaseContext(context) {\n var canvas = context.canvas;\n\n if (!canvas[EXPANDO_KEY]) {\n return false;\n }\n\n var initial = canvas[EXPANDO_KEY].initial;\n ['height', 'width'].forEach(function (prop) {\n var value = initial[prop];\n\n if (isNullOrUndef(value)) {\n canvas.removeAttribute(prop);\n } else {\n canvas.setAttribute(prop, value);\n }\n });\n var style = initial.style || {};\n Object.keys(style).forEach(function (key) {\n canvas.style[key] = style[key];\n });\n canvas.width = canvas.width;\n delete canvas[EXPANDO_KEY];\n return true;\n }\n }, {\n key: \"addEventListener\",\n value: function addEventListener(chart, type, listener) {\n this.removeEventListener(chart, type);\n var proxies = chart.$proxies || (chart.$proxies = {});\n var handlers = {\n attach: createAttachObserver,\n detach: createDetachObserver,\n resize: createResizeObserver\n };\n var handler = handlers[type] || createProxyAndListen;\n proxies[type] = handler(chart, type, listener);\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(chart, type) {\n var proxies = chart.$proxies || (chart.$proxies = {});\n var proxy = proxies[type];\n\n if (!proxy) {\n return;\n }\n\n var handlers = {\n attach: releaseObserver,\n detach: releaseObserver,\n resize: releaseObserver\n };\n var handler = handlers[type] || removeListener;\n handler(chart, type, proxy);\n proxies[type] = undefined;\n }\n }, {\n key: \"getDevicePixelRatio\",\n value: function getDevicePixelRatio() {\n return window.devicePixelRatio;\n }\n }, {\n key: \"getMaximumSize\",\n value: function getMaximumSize(canvas, width, height, aspectRatio) {\n return _getMaximumSize(canvas, width, height, aspectRatio);\n }\n }, {\n key: \"isAttached\",\n value: function isAttached(canvas) {\n var container = _getParentNode(canvas);\n\n return !!(container && _getParentNode(container));\n }\n }]);\n\n return DomPlatform;\n}(BasePlatform);\n\nvar Element = /*#__PURE__*/function () {\n function Element() {\n _classCallCheck(this, Element);\n\n this.x = undefined;\n this.y = undefined;\n this.active = false;\n this.options = undefined;\n this.$animations = undefined;\n }\n\n _createClass(Element, [{\n key: \"tooltipPosition\",\n value: function tooltipPosition(useFinalPosition) {\n var _this$getProps = this.getProps(['x', 'y'], useFinalPosition),\n x = _this$getProps.x,\n y = _this$getProps.y;\n\n return {\n x: x,\n y: y\n };\n }\n }, {\n key: \"hasValue\",\n value: function hasValue() {\n return isNumber(this.x) && isNumber(this.y);\n }\n }, {\n key: \"getProps\",\n value: function getProps(props, final) {\n var me = this;\n var anims = this.$animations;\n\n if (!final || !anims) {\n return me;\n }\n\n var ret = {};\n props.forEach(function (prop) {\n ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : me[prop];\n });\n return ret;\n }\n }]);\n\n return Element;\n}();\n\nElement.defaults = {};\nElement.defaultRoutes = undefined;\nvar formatters = {\n values: function values(value) {\n return isArray(value) ? value : '' + value;\n },\n numeric: function numeric(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0';\n }\n\n var locale = this.chart.options.locale;\n var notation;\n var delta = tickValue;\n\n if (ticks.length > 1) {\n var maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));\n\n if (maxTick < 1e-4 || maxTick > 1e+15) {\n notation = 'scientific';\n }\n\n delta = calculateDelta(tickValue, ticks);\n }\n\n var logDelta = log10(Math.abs(delta));\n var numDecimal = Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);\n var options = {\n notation: notation,\n minimumFractionDigits: numDecimal,\n maximumFractionDigits: numDecimal\n };\n Object.assign(options, this.options.ticks.format);\n return formatNumber(tickValue, locale, options);\n },\n logarithmic: function logarithmic(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0';\n }\n\n var remain = tickValue / Math.pow(10, Math.floor(log10(tickValue)));\n\n if (remain === 1 || remain === 2 || remain === 5) {\n return formatters.numeric.call(this, tickValue, index, ticks);\n }\n\n return '';\n }\n};\n\nfunction calculateDelta(tickValue, ticks) {\n var delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;\n\n if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {\n delta = tickValue - Math.floor(tickValue);\n }\n\n return delta;\n}\n\nvar Ticks = {\n formatters: formatters\n};\ndefaults.set('scale', {\n display: true,\n offset: false,\n reverse: false,\n beginAtZero: false,\n bounds: 'ticks',\n grace: 0,\n grid: {\n display: true,\n lineWidth: 1,\n drawBorder: true,\n drawOnChartArea: true,\n drawTicks: true,\n tickLength: 8,\n tickWidth: function tickWidth(_ctx, options) {\n return options.lineWidth;\n },\n tickColor: function tickColor(_ctx, options) {\n return options.color;\n },\n offset: false,\n borderDash: [],\n borderDashOffset: 0.0,\n borderWidth: 1\n },\n title: {\n display: false,\n text: '',\n padding: {\n top: 4,\n bottom: 4\n }\n },\n ticks: {\n minRotation: 0,\n maxRotation: 50,\n mirror: false,\n textStrokeWidth: 0,\n textStrokeColor: '',\n padding: 3,\n display: true,\n autoSkip: true,\n autoSkipPadding: 3,\n labelOffset: 0,\n callback: Ticks.formatters.values,\n minor: {},\n major: {},\n align: 'center',\n crossAlign: 'near',\n showLabelBackdrop: false,\n backdropColor: 'rgba(255, 255, 255, 0.75)',\n backdropPadding: 2\n }\n});\ndefaults.route('scale.ticks', 'color', '', 'color');\ndefaults.route('scale.grid', 'color', '', 'borderColor');\ndefaults.route('scale.grid', 'borderColor', '', 'borderColor');\ndefaults.route('scale.title', 'color', '', 'color');\ndefaults.describe('scale', {\n _fallback: false,\n _scriptable: function _scriptable(name) {\n return !name.startsWith('before') && !name.startsWith('after') && name !== 'callback' && name !== 'parser';\n },\n _indexable: function _indexable(name) {\n return name !== 'borderDash' && name !== 'tickBorderDash';\n }\n});\ndefaults.describe('scales', {\n _fallback: 'scale'\n});\n\nfunction autoSkip(scale, ticks) {\n var tickOpts = scale.options.ticks;\n var ticksLimit = tickOpts.maxTicksLimit || determineMaxTicks(scale);\n var majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];\n var numMajorIndices = majorIndices.length;\n var first = majorIndices[0];\n var last = majorIndices[numMajorIndices - 1];\n var newTicks = [];\n\n if (numMajorIndices > ticksLimit) {\n skipMajors(ticks, newTicks, majorIndices, numMajorIndices / ticksLimit);\n return newTicks;\n }\n\n var spacing = calculateSpacing(majorIndices, ticks, ticksLimit);\n\n if (numMajorIndices > 0) {\n var i, ilen;\n var avgMajorSpacing = numMajorIndices > 1 ? Math.round((last - first) / (numMajorIndices - 1)) : null;\n skip(ticks, newTicks, spacing, isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);\n\n for (i = 0, ilen = numMajorIndices - 1; i < ilen; i++) {\n skip(ticks, newTicks, spacing, majorIndices[i], majorIndices[i + 1]);\n }\n\n skip(ticks, newTicks, spacing, last, isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);\n return newTicks;\n }\n\n skip(ticks, newTicks, spacing);\n return newTicks;\n}\n\nfunction determineMaxTicks(scale) {\n var offset = scale.options.offset;\n\n var tickLength = scale._tickSize();\n\n var maxScale = scale._length / tickLength + (offset ? 0 : 1);\n var maxChart = scale._maxLength / tickLength;\n return Math.floor(Math.min(maxScale, maxChart));\n}\n\nfunction calculateSpacing(majorIndices, ticks, ticksLimit) {\n var evenMajorSpacing = getEvenSpacing(majorIndices);\n var spacing = ticks.length / ticksLimit;\n\n if (!evenMajorSpacing) {\n return Math.max(spacing, 1);\n }\n\n var factors = _factorize(evenMajorSpacing);\n\n for (var i = 0, ilen = factors.length - 1; i < ilen; i++) {\n var factor = factors[i];\n\n if (factor > spacing) {\n return factor;\n }\n }\n\n return Math.max(spacing, 1);\n}\n\nfunction getMajorIndices(ticks) {\n var result = [];\n var i, ilen;\n\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n if (ticks[i].major) {\n result.push(i);\n }\n }\n\n return result;\n}\n\nfunction skipMajors(ticks, newTicks, majorIndices, spacing) {\n var count = 0;\n var next = majorIndices[0];\n var i;\n spacing = Math.ceil(spacing);\n\n for (i = 0; i < ticks.length; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = majorIndices[count * spacing];\n }\n }\n}\n\nfunction skip(ticks, newTicks, spacing, majorStart, majorEnd) {\n var start = valueOrDefault(majorStart, 0);\n var end = Math.min(valueOrDefault(majorEnd, ticks.length), ticks.length);\n var count = 0;\n var length, i, next;\n spacing = Math.ceil(spacing);\n\n if (majorEnd) {\n length = majorEnd - majorStart;\n spacing = length / Math.floor(length / spacing);\n }\n\n next = start;\n\n while (next < 0) {\n count++;\n next = Math.round(start + count * spacing);\n }\n\n for (i = Math.max(start, 0); i < end; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = Math.round(start + count * spacing);\n }\n }\n}\n\nfunction getEvenSpacing(arr) {\n var len = arr.length;\n var i, diff;\n\n if (len < 2) {\n return false;\n }\n\n for (diff = arr[0], i = 1; i < len; ++i) {\n if (arr[i] - arr[i - 1] !== diff) {\n return false;\n }\n }\n\n return diff;\n}\n\nvar reverseAlign = function reverseAlign(align) {\n return align === 'left' ? 'right' : align === 'right' ? 'left' : align;\n};\n\nvar offsetFromEdge = function offsetFromEdge(scale, edge, offset) {\n return edge === 'top' || edge === 'left' ? scale[edge] + offset : scale[edge] - offset;\n};\n\nfunction sample(arr, numItems) {\n var result = [];\n var increment = arr.length / numItems;\n var len = arr.length;\n var i = 0;\n\n for (; i < len; i += increment) {\n result.push(arr[Math.floor(i)]);\n }\n\n return result;\n}\n\nfunction getPixelForGridLine(scale, index, offsetGridLines) {\n var length = scale.ticks.length;\n var validIndex = Math.min(index, length - 1);\n var start = scale._startPixel;\n var end = scale._endPixel;\n var epsilon = 1e-6;\n var lineValue = scale.getPixelForTick(validIndex);\n var offset;\n\n if (offsetGridLines) {\n if (length === 1) {\n offset = Math.max(lineValue - start, end - lineValue);\n } else if (index === 0) {\n offset = (scale.getPixelForTick(1) - lineValue) / 2;\n } else {\n offset = (lineValue - scale.getPixelForTick(validIndex - 1)) / 2;\n }\n\n lineValue += validIndex < index ? offset : -offset;\n\n if (lineValue < start - epsilon || lineValue > end + epsilon) {\n return;\n }\n }\n\n return lineValue;\n}\n\nfunction garbageCollect(caches, length) {\n each(caches, function (cache) {\n var gc = cache.gc;\n var gcLen = gc.length / 2;\n var i;\n\n if (gcLen > length) {\n for (i = 0; i < gcLen; ++i) {\n delete cache.data[gc[i]];\n }\n\n gc.splice(0, gcLen);\n }\n });\n}\n\nfunction getTickMarkLength(options) {\n return options.drawTicks ? options.tickLength : 0;\n}\n\nfunction getTitleHeight(options, fallback) {\n if (!options.display) {\n return 0;\n }\n\n var font = toFont(options.font, fallback);\n var padding = toPadding(options.padding);\n var lines = isArray(options.text) ? options.text.length : 1;\n return lines * font.lineHeight + padding.height;\n}\n\nfunction createScaleContext(parent, scale) {\n return Object.assign(Object.create(parent), {\n scale: scale,\n type: 'scale'\n });\n}\n\nfunction createTickContext(parent, index, tick) {\n return Object.assign(Object.create(parent), {\n tick: tick,\n index: index,\n type: 'tick'\n });\n}\n\nfunction titleAlign(align, position, reverse) {\n var ret = _toLeftRightCenter(align);\n\n if (reverse && position !== 'right' || !reverse && position === 'right') {\n ret = reverseAlign(ret);\n }\n\n return ret;\n}\n\nfunction titleArgs(scale, offset, position, align) {\n var top = scale.top,\n left = scale.left,\n bottom = scale.bottom,\n right = scale.right;\n var rotation = 0;\n var maxWidth, titleX, titleY;\n\n if (scale.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n titleY = offsetFromEdge(scale, position, offset);\n maxWidth = right - left;\n } else {\n titleX = offsetFromEdge(scale, position, offset);\n titleY = _alignStartEnd(align, bottom, top);\n rotation = position === 'left' ? -HALF_PI : HALF_PI;\n }\n\n return {\n titleX: titleX,\n titleY: titleY,\n maxWidth: maxWidth,\n rotation: rotation\n };\n}\n\nvar Scale = /*#__PURE__*/function (_Element) {\n _inherits(Scale, _Element);\n\n var _super11 = _createSuper(Scale);\n\n function Scale(cfg) {\n var _this4;\n\n _classCallCheck(this, Scale);\n\n _this4 = _super11.call(this);\n _this4.id = cfg.id;\n _this4.type = cfg.type;\n _this4.options = undefined;\n _this4.ctx = cfg.ctx;\n _this4.chart = cfg.chart;\n _this4.top = undefined;\n _this4.bottom = undefined;\n _this4.left = undefined;\n _this4.right = undefined;\n _this4.width = undefined;\n _this4.height = undefined;\n _this4._margins = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n _this4.maxWidth = undefined;\n _this4.maxHeight = undefined;\n _this4.paddingTop = undefined;\n _this4.paddingBottom = undefined;\n _this4.paddingLeft = undefined;\n _this4.paddingRight = undefined;\n _this4.axis = undefined;\n _this4.labelRotation = undefined;\n _this4.min = undefined;\n _this4.max = undefined;\n _this4._range = undefined;\n _this4.ticks = [];\n _this4._gridLineItems = null;\n _this4._labelItems = null;\n _this4._labelSizes = null;\n _this4._length = 0;\n _this4._maxLength = 0;\n _this4._longestTextCache = {};\n _this4._startPixel = undefined;\n _this4._endPixel = undefined;\n _this4._reversePixels = false;\n _this4._userMax = undefined;\n _this4._userMin = undefined;\n _this4._suggestedMax = undefined;\n _this4._suggestedMin = undefined;\n _this4._ticksLength = 0;\n _this4._borderValue = 0;\n _this4._cache = {};\n _this4._dataLimitsCached = false;\n _this4.$context = undefined;\n return _this4;\n }\n\n _createClass(Scale, [{\n key: \"init\",\n value: function init(options) {\n var me = this;\n me.options = options.setContext(me.getContext());\n me.axis = options.axis;\n me._userMin = me.parse(options.min);\n me._userMax = me.parse(options.max);\n me._suggestedMin = me.parse(options.suggestedMin);\n me._suggestedMax = me.parse(options.suggestedMax);\n }\n }, {\n key: \"parse\",\n value: function parse(raw, index) {\n return raw;\n }\n }, {\n key: \"getUserBounds\",\n value: function getUserBounds() {\n var _userMin = this._userMin,\n _userMax = this._userMax,\n _suggestedMin = this._suggestedMin,\n _suggestedMax = this._suggestedMax;\n _userMin = finiteOrDefault(_userMin, Number.POSITIVE_INFINITY);\n _userMax = finiteOrDefault(_userMax, Number.NEGATIVE_INFINITY);\n _suggestedMin = finiteOrDefault(_suggestedMin, Number.POSITIVE_INFINITY);\n _suggestedMax = finiteOrDefault(_suggestedMax, Number.NEGATIVE_INFINITY);\n return {\n min: finiteOrDefault(_userMin, _suggestedMin),\n max: finiteOrDefault(_userMax, _suggestedMax),\n minDefined: isNumberFinite(_userMin),\n maxDefined: isNumberFinite(_userMax)\n };\n }\n }, {\n key: \"getMinMax\",\n value: function getMinMax(canStack) {\n var me = this;\n\n var _me$getUserBounds = me.getUserBounds(),\n min = _me$getUserBounds.min,\n max = _me$getUserBounds.max,\n minDefined = _me$getUserBounds.minDefined,\n maxDefined = _me$getUserBounds.maxDefined;\n\n var range;\n\n if (minDefined && maxDefined) {\n return {\n min: min,\n max: max\n };\n }\n\n var metas = me.getMatchingVisibleMetas();\n\n for (var i = 0, ilen = metas.length; i < ilen; ++i) {\n range = metas[i].controller.getMinMax(me, canStack);\n\n if (!minDefined) {\n min = Math.min(min, range.min);\n }\n\n if (!maxDefined) {\n max = Math.max(max, range.max);\n }\n }\n\n return {\n min: finiteOrDefault(min, finiteOrDefault(max, min)),\n max: finiteOrDefault(max, finiteOrDefault(min, max))\n };\n }\n }, {\n key: \"getPadding\",\n value: function getPadding() {\n var me = this;\n return {\n left: me.paddingLeft || 0,\n top: me.paddingTop || 0,\n right: me.paddingRight || 0,\n bottom: me.paddingBottom || 0\n };\n }\n }, {\n key: \"getTicks\",\n value: function getTicks() {\n return this.ticks;\n }\n }, {\n key: \"getLabels\",\n value: function getLabels() {\n var data = this.chart.data;\n return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];\n }\n }, {\n key: \"beforeLayout\",\n value: function beforeLayout() {\n this._cache = {};\n this._dataLimitsCached = false;\n }\n }, {\n key: \"beforeUpdate\",\n value: function beforeUpdate() {\n callback(this.options.beforeUpdate, [this]);\n }\n }, {\n key: \"update\",\n value: function update(maxWidth, maxHeight, margins) {\n var me = this;\n var tickOpts = me.options.ticks;\n var sampleSize = tickOpts.sampleSize;\n me.beforeUpdate();\n me.maxWidth = maxWidth;\n me.maxHeight = maxHeight;\n me._margins = margins = Object.assign({\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n }, margins);\n me.ticks = null;\n me._labelSizes = null;\n me._gridLineItems = null;\n me._labelItems = null;\n me.beforeSetDimensions();\n me.setDimensions();\n me.afterSetDimensions();\n me._maxLength = me.isHorizontal() ? me.width + margins.left + margins.right : me.height + margins.top + margins.bottom;\n\n if (!me._dataLimitsCached) {\n me.beforeDataLimits();\n me.determineDataLimits();\n me.afterDataLimits();\n me._range = _addGrace(me, me.options.grace);\n me._dataLimitsCached = true;\n }\n\n me.beforeBuildTicks();\n me.ticks = me.buildTicks() || [];\n me.afterBuildTicks();\n var samplingEnabled = sampleSize < me.ticks.length;\n\n me._convertTicksToLabels(samplingEnabled ? sample(me.ticks, sampleSize) : me.ticks);\n\n me.configure();\n me.beforeCalculateLabelRotation();\n me.calculateLabelRotation();\n me.afterCalculateLabelRotation();\n\n if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto')) {\n me.ticks = autoSkip(me, me.ticks);\n me._labelSizes = null;\n }\n\n if (samplingEnabled) {\n me._convertTicksToLabels(me.ticks);\n }\n\n me.beforeFit();\n me.fit();\n me.afterFit();\n me.afterUpdate();\n }\n }, {\n key: \"configure\",\n value: function configure() {\n var me = this;\n var reversePixels = me.options.reverse;\n var startPixel, endPixel;\n\n if (me.isHorizontal()) {\n startPixel = me.left;\n endPixel = me.right;\n } else {\n startPixel = me.top;\n endPixel = me.bottom;\n reversePixels = !reversePixels;\n }\n\n me._startPixel = startPixel;\n me._endPixel = endPixel;\n me._reversePixels = reversePixels;\n me._length = endPixel - startPixel;\n me._alignToPixels = me.options.alignToPixels;\n }\n }, {\n key: \"afterUpdate\",\n value: function afterUpdate() {\n callback(this.options.afterUpdate, [this]);\n }\n }, {\n key: \"beforeSetDimensions\",\n value: function beforeSetDimensions() {\n callback(this.options.beforeSetDimensions, [this]);\n }\n }, {\n key: \"setDimensions\",\n value: function setDimensions() {\n var me = this;\n\n if (me.isHorizontal()) {\n me.width = me.maxWidth;\n me.left = 0;\n me.right = me.width;\n } else {\n me.height = me.maxHeight;\n me.top = 0;\n me.bottom = me.height;\n }\n\n me.paddingLeft = 0;\n me.paddingTop = 0;\n me.paddingRight = 0;\n me.paddingBottom = 0;\n }\n }, {\n key: \"afterSetDimensions\",\n value: function afterSetDimensions() {\n callback(this.options.afterSetDimensions, [this]);\n }\n }, {\n key: \"_callHooks\",\n value: function _callHooks(name) {\n var me = this;\n me.chart.notifyPlugins(name, me.getContext());\n callback(me.options[name], [me]);\n }\n }, {\n key: \"beforeDataLimits\",\n value: function beforeDataLimits() {\n this._callHooks('beforeDataLimits');\n }\n }, {\n key: \"determineDataLimits\",\n value: function determineDataLimits() {}\n }, {\n key: \"afterDataLimits\",\n value: function afterDataLimits() {\n this._callHooks('afterDataLimits');\n }\n }, {\n key: \"beforeBuildTicks\",\n value: function beforeBuildTicks() {\n this._callHooks('beforeBuildTicks');\n }\n }, {\n key: \"buildTicks\",\n value: function buildTicks() {\n return [];\n }\n }, {\n key: \"afterBuildTicks\",\n value: function afterBuildTicks() {\n this._callHooks('afterBuildTicks');\n }\n }, {\n key: \"beforeTickToLabelConversion\",\n value: function beforeTickToLabelConversion() {\n callback(this.options.beforeTickToLabelConversion, [this]);\n }\n }, {\n key: \"generateTickLabels\",\n value: function generateTickLabels(ticks) {\n var me = this;\n var tickOpts = me.options.ticks;\n var i, ilen, tick;\n\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n tick = ticks[i];\n tick.label = callback(tickOpts.callback, [tick.value, i, ticks], me);\n }\n\n for (i = 0; i < ilen; i++) {\n if (isNullOrUndef(ticks[i].label)) {\n ticks.splice(i, 1);\n ilen--;\n i--;\n }\n }\n }\n }, {\n key: \"afterTickToLabelConversion\",\n value: function afterTickToLabelConversion() {\n callback(this.options.afterTickToLabelConversion, [this]);\n }\n }, {\n key: \"beforeCalculateLabelRotation\",\n value: function beforeCalculateLabelRotation() {\n callback(this.options.beforeCalculateLabelRotation, [this]);\n }\n }, {\n key: \"calculateLabelRotation\",\n value: function calculateLabelRotation() {\n var me = this;\n var options = me.options;\n var tickOpts = options.ticks;\n var numTicks = me.ticks.length;\n var minRotation = tickOpts.minRotation || 0;\n var maxRotation = tickOpts.maxRotation;\n var labelRotation = minRotation;\n var tickWidth, maxHeight, maxLabelDiagonal;\n\n if (!me._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !me.isHorizontal()) {\n me.labelRotation = minRotation;\n return;\n }\n\n var labelSizes = me._getLabelSizes();\n\n var maxLabelWidth = labelSizes.widest.width;\n var maxLabelHeight = labelSizes.highest.height;\n\n var maxWidth = _limitValue(me.chart.width - maxLabelWidth, 0, me.maxWidth);\n\n tickWidth = options.offset ? me.maxWidth / numTicks : maxWidth / (numTicks - 1);\n\n if (maxLabelWidth + 6 > tickWidth) {\n tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));\n maxHeight = me.maxHeight - getTickMarkLength(options.grid) - tickOpts.padding - getTitleHeight(options.title, me.chart.options.font);\n maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);\n labelRotation = toDegrees(Math.min(Math.asin(Math.min((labelSizes.highest.height + 6) / tickWidth, 1)), Math.asin(Math.min(maxHeight / maxLabelDiagonal, 1)) - Math.asin(maxLabelHeight / maxLabelDiagonal)));\n labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));\n }\n\n me.labelRotation = labelRotation;\n }\n }, {\n key: \"afterCalculateLabelRotation\",\n value: function afterCalculateLabelRotation() {\n callback(this.options.afterCalculateLabelRotation, [this]);\n }\n }, {\n key: \"beforeFit\",\n value: function beforeFit() {\n callback(this.options.beforeFit, [this]);\n }\n }, {\n key: \"fit\",\n value: function fit() {\n var me = this;\n var minSize = {\n width: 0,\n height: 0\n };\n var chart = me.chart,\n _me$options2 = me.options,\n tickOpts = _me$options2.ticks,\n titleOpts = _me$options2.title,\n gridOpts = _me$options2.grid;\n\n var display = me._isVisible();\n\n var isHorizontal = me.isHorizontal();\n\n if (display) {\n var titleHeight = getTitleHeight(titleOpts, chart.options.font);\n\n if (isHorizontal) {\n minSize.width = me.maxWidth;\n minSize.height = getTickMarkLength(gridOpts) + titleHeight;\n } else {\n minSize.height = me.maxHeight;\n minSize.width = getTickMarkLength(gridOpts) + titleHeight;\n }\n\n if (tickOpts.display && me.ticks.length) {\n var _me$_getLabelSizes = me._getLabelSizes(),\n first = _me$_getLabelSizes.first,\n last = _me$_getLabelSizes.last,\n widest = _me$_getLabelSizes.widest,\n highest = _me$_getLabelSizes.highest;\n\n var tickPadding = tickOpts.padding * 2;\n var angleRadians = toRadians(me.labelRotation);\n var cos = Math.cos(angleRadians);\n var sin = Math.sin(angleRadians);\n\n if (isHorizontal) {\n var labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;\n minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);\n } else {\n var labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;\n minSize.width = Math.min(me.maxWidth, minSize.width + labelWidth + tickPadding);\n }\n\n me._calculatePadding(first, last, sin, cos);\n }\n }\n\n me._handleMargins();\n\n if (isHorizontal) {\n me.width = me._length = chart.width - me._margins.left - me._margins.right;\n me.height = minSize.height;\n } else {\n me.width = minSize.width;\n me.height = me._length = chart.height - me._margins.top - me._margins.bottom;\n }\n }\n }, {\n key: \"_calculatePadding\",\n value: function _calculatePadding(first, last, sin, cos) {\n var me = this;\n var _me$options3 = me.options,\n _me$options3$ticks = _me$options3.ticks,\n align = _me$options3$ticks.align,\n padding = _me$options3$ticks.padding,\n position = _me$options3.position;\n var isRotated = me.labelRotation !== 0;\n var labelsBelowTicks = position !== 'top' && me.axis === 'x';\n\n if (me.isHorizontal()) {\n var offsetLeft = me.getPixelForTick(0) - me.left;\n var offsetRight = me.right - me.getPixelForTick(me.ticks.length - 1);\n var paddingLeft = 0;\n var paddingRight = 0;\n\n if (isRotated) {\n if (labelsBelowTicks) {\n paddingLeft = cos * first.width;\n paddingRight = sin * last.height;\n } else {\n paddingLeft = sin * first.height;\n paddingRight = cos * last.width;\n }\n } else if (align === 'start') {\n paddingRight = last.width;\n } else if (align === 'end') {\n paddingLeft = first.width;\n } else {\n paddingLeft = first.width / 2;\n paddingRight = last.width / 2;\n }\n\n me.paddingLeft = Math.max((paddingLeft - offsetLeft + padding) * me.width / (me.width - offsetLeft), 0);\n me.paddingRight = Math.max((paddingRight - offsetRight + padding) * me.width / (me.width - offsetRight), 0);\n } else {\n var paddingTop = last.height / 2;\n var paddingBottom = first.height / 2;\n\n if (align === 'start') {\n paddingTop = 0;\n paddingBottom = first.height;\n } else if (align === 'end') {\n paddingTop = last.height;\n paddingBottom = 0;\n }\n\n me.paddingTop = paddingTop + padding;\n me.paddingBottom = paddingBottom + padding;\n }\n }\n }, {\n key: \"_handleMargins\",\n value: function _handleMargins() {\n var me = this;\n\n if (me._margins) {\n me._margins.left = Math.max(me.paddingLeft, me._margins.left);\n me._margins.top = Math.max(me.paddingTop, me._margins.top);\n me._margins.right = Math.max(me.paddingRight, me._margins.right);\n me._margins.bottom = Math.max(me.paddingBottom, me._margins.bottom);\n }\n }\n }, {\n key: \"afterFit\",\n value: function afterFit() {\n callback(this.options.afterFit, [this]);\n }\n }, {\n key: \"isHorizontal\",\n value: function isHorizontal() {\n var _this$options = this.options,\n axis = _this$options.axis,\n position = _this$options.position;\n return position === 'top' || position === 'bottom' || axis === 'x';\n }\n }, {\n key: \"isFullSize\",\n value: function isFullSize() {\n return this.options.fullSize;\n }\n }, {\n key: \"_convertTicksToLabels\",\n value: function _convertTicksToLabels(ticks) {\n var me = this;\n me.beforeTickToLabelConversion();\n me.generateTickLabels(ticks);\n me.afterTickToLabelConversion();\n }\n }, {\n key: \"_getLabelSizes\",\n value: function _getLabelSizes() {\n var me = this;\n var labelSizes = me._labelSizes;\n\n if (!labelSizes) {\n var sampleSize = me.options.ticks.sampleSize;\n var ticks = me.ticks;\n\n if (sampleSize < ticks.length) {\n ticks = sample(ticks, sampleSize);\n }\n\n me._labelSizes = labelSizes = me._computeLabelSizes(ticks, ticks.length);\n }\n\n return labelSizes;\n }\n }, {\n key: \"_computeLabelSizes\",\n value: function _computeLabelSizes(ticks, length) {\n var ctx = this.ctx,\n caches = this._longestTextCache;\n var widths = [];\n var heights = [];\n var widestLabelSize = 0;\n var highestLabelSize = 0;\n var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel;\n\n for (i = 0; i < length; ++i) {\n label = ticks[i].label;\n tickFont = this._resolveTickFontOptions(i);\n ctx.font = fontString = tickFont.string;\n cache = caches[fontString] = caches[fontString] || {\n data: {},\n gc: []\n };\n lineHeight = tickFont.lineHeight;\n width = height = 0;\n\n if (!isNullOrUndef(label) && !isArray(label)) {\n width = _measureText(ctx, cache.data, cache.gc, width, label);\n height = lineHeight;\n } else if (isArray(label)) {\n for (j = 0, jlen = label.length; j < jlen; ++j) {\n nestedLabel = label[j];\n\n if (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {\n width = _measureText(ctx, cache.data, cache.gc, width, nestedLabel);\n height += lineHeight;\n }\n }\n }\n\n widths.push(width);\n heights.push(height);\n widestLabelSize = Math.max(width, widestLabelSize);\n highestLabelSize = Math.max(height, highestLabelSize);\n }\n\n garbageCollect(caches, length);\n var widest = widths.indexOf(widestLabelSize);\n var highest = heights.indexOf(highestLabelSize);\n\n var valueAt = function valueAt(idx) {\n return {\n width: widths[idx] || 0,\n height: heights[idx] || 0\n };\n };\n\n return {\n first: valueAt(0),\n last: valueAt(length - 1),\n widest: valueAt(widest),\n highest: valueAt(highest),\n widths: widths,\n heights: heights\n };\n }\n }, {\n key: \"getLabelForValue\",\n value: function getLabelForValue(value) {\n return value;\n }\n }, {\n key: \"getPixelForValue\",\n value: function getPixelForValue(value, index) {\n return NaN;\n }\n }, {\n key: \"getValueForPixel\",\n value: function getValueForPixel(pixel) {}\n }, {\n key: \"getPixelForTick\",\n value: function getPixelForTick(index) {\n var ticks = this.ticks;\n\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n\n return this.getPixelForValue(ticks[index].value);\n }\n }, {\n key: \"getPixelForDecimal\",\n value: function getPixelForDecimal(decimal) {\n var me = this;\n\n if (me._reversePixels) {\n decimal = 1 - decimal;\n }\n\n var pixel = me._startPixel + decimal * me._length;\n return _int16Range(me._alignToPixels ? _alignPixel(me.chart, pixel, 0) : pixel);\n }\n }, {\n key: \"getDecimalForPixel\",\n value: function getDecimalForPixel(pixel) {\n var decimal = (pixel - this._startPixel) / this._length;\n return this._reversePixels ? 1 - decimal : decimal;\n }\n }, {\n key: \"getBasePixel\",\n value: function getBasePixel() {\n return this.getPixelForValue(this.getBaseValue());\n }\n }, {\n key: \"getBaseValue\",\n value: function getBaseValue() {\n var min = this.min,\n max = this.max;\n return min < 0 && max < 0 ? max : min > 0 && max > 0 ? min : 0;\n }\n }, {\n key: \"getContext\",\n value: function getContext(index) {\n var me = this;\n var ticks = me.ticks || [];\n\n if (index >= 0 && index < ticks.length) {\n var tick = ticks[index];\n return tick.$context || (tick.$context = createTickContext(me.getContext(), index, tick));\n }\n\n return me.$context || (me.$context = createScaleContext(me.chart.getContext(), me));\n }\n }, {\n key: \"_tickSize\",\n value: function _tickSize() {\n var me = this;\n var optionTicks = me.options.ticks;\n var rot = toRadians(me.labelRotation);\n var cos = Math.abs(Math.cos(rot));\n var sin = Math.abs(Math.sin(rot));\n\n var labelSizes = me._getLabelSizes();\n\n var padding = optionTicks.autoSkipPadding || 0;\n var w = labelSizes ? labelSizes.widest.width + padding : 0;\n var h = labelSizes ? labelSizes.highest.height + padding : 0;\n return me.isHorizontal() ? h * cos > w * sin ? w / cos : h / sin : h * sin < w * cos ? h / cos : w / sin;\n }\n }, {\n key: \"_isVisible\",\n value: function _isVisible() {\n var display = this.options.display;\n\n if (display !== 'auto') {\n return !!display;\n }\n\n return this.getMatchingVisibleMetas().length > 0;\n }\n }, {\n key: \"_computeGridLineItems\",\n value: function _computeGridLineItems(chartArea) {\n var me = this;\n var axis = me.axis;\n var chart = me.chart;\n var options = me.options;\n var grid = options.grid,\n position = options.position;\n var offset = grid.offset;\n var isHorizontal = me.isHorizontal();\n var ticks = me.ticks;\n var ticksLength = ticks.length + (offset ? 1 : 0);\n var tl = getTickMarkLength(grid);\n var items = [];\n var borderOpts = grid.setContext(me.getContext());\n var axisWidth = borderOpts.drawBorder ? borderOpts.borderWidth : 0;\n var axisHalfWidth = axisWidth / 2;\n\n var alignBorderValue = function alignBorderValue(pixel) {\n return _alignPixel(chart, pixel, axisWidth);\n };\n\n var borderValue, i, lineValue, alignedLineValue;\n var tx1, ty1, tx2, ty2, x1, y1, x2, y2;\n\n if (position === 'top') {\n borderValue = alignBorderValue(me.bottom);\n ty1 = me.bottom - tl;\n ty2 = borderValue - axisHalfWidth;\n y1 = alignBorderValue(chartArea.top) + axisHalfWidth;\n y2 = chartArea.bottom;\n } else if (position === 'bottom') {\n borderValue = alignBorderValue(me.top);\n y1 = chartArea.top;\n y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;\n ty1 = borderValue + axisHalfWidth;\n ty2 = me.top + tl;\n } else if (position === 'left') {\n borderValue = alignBorderValue(me.right);\n tx1 = me.right - tl;\n tx2 = borderValue - axisHalfWidth;\n x1 = alignBorderValue(chartArea.left) + axisHalfWidth;\n x2 = chartArea.right;\n } else if (position === 'right') {\n borderValue = alignBorderValue(me.left);\n x1 = chartArea.left;\n x2 = alignBorderValue(chartArea.right) - axisHalfWidth;\n tx1 = borderValue + axisHalfWidth;\n tx2 = me.left + tl;\n } else if (axis === 'x') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.top + chartArea.bottom) / 2 + 0.5);\n } else if (isObject(position)) {\n var positionAxisID = Object.keys(position)[0];\n var value = position[positionAxisID];\n borderValue = alignBorderValue(me.chart.scales[positionAxisID].getPixelForValue(value));\n }\n\n y1 = chartArea.top;\n y2 = chartArea.bottom;\n ty1 = borderValue + axisHalfWidth;\n ty2 = ty1 + tl;\n } else if (axis === 'y') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.left + chartArea.right) / 2);\n } else if (isObject(position)) {\n var _positionAxisID = Object.keys(position)[0];\n var _value = position[_positionAxisID];\n borderValue = alignBorderValue(me.chart.scales[_positionAxisID].getPixelForValue(_value));\n }\n\n tx1 = borderValue - axisHalfWidth;\n tx2 = tx1 - tl;\n x1 = chartArea.left;\n x2 = chartArea.right;\n }\n\n for (i = 0; i < ticksLength; ++i) {\n var optsAtIndex = grid.setContext(me.getContext(i));\n var lineWidth = optsAtIndex.lineWidth;\n var lineColor = optsAtIndex.color;\n var borderDash = grid.borderDash || [];\n var borderDashOffset = optsAtIndex.borderDashOffset;\n var tickWidth = optsAtIndex.tickWidth;\n var tickColor = optsAtIndex.tickColor;\n var tickBorderDash = optsAtIndex.tickBorderDash || [];\n var tickBorderDashOffset = optsAtIndex.tickBorderDashOffset;\n lineValue = getPixelForGridLine(me, i, offset);\n\n if (lineValue === undefined) {\n continue;\n }\n\n alignedLineValue = _alignPixel(chart, lineValue, lineWidth);\n\n if (isHorizontal) {\n tx1 = tx2 = x1 = x2 = alignedLineValue;\n } else {\n ty1 = ty2 = y1 = y2 = alignedLineValue;\n }\n\n items.push({\n tx1: tx1,\n ty1: ty1,\n tx2: tx2,\n ty2: ty2,\n x1: x1,\n y1: y1,\n x2: x2,\n y2: y2,\n width: lineWidth,\n color: lineColor,\n borderDash: borderDash,\n borderDashOffset: borderDashOffset,\n tickWidth: tickWidth,\n tickColor: tickColor,\n tickBorderDash: tickBorderDash,\n tickBorderDashOffset: tickBorderDashOffset\n });\n }\n\n me._ticksLength = ticksLength;\n me._borderValue = borderValue;\n return items;\n }\n }, {\n key: \"_computeLabelItems\",\n value: function _computeLabelItems(chartArea) {\n var me = this;\n var axis = me.axis;\n var options = me.options;\n var position = options.position,\n optionTicks = options.ticks;\n var isHorizontal = me.isHorizontal();\n var ticks = me.ticks;\n var align = optionTicks.align,\n crossAlign = optionTicks.crossAlign,\n padding = optionTicks.padding,\n mirror = optionTicks.mirror;\n var tl = getTickMarkLength(options.grid);\n var tickAndPadding = tl + padding;\n var hTickAndPadding = mirror ? -padding : tickAndPadding;\n var rotation = -toRadians(me.labelRotation);\n var items = [];\n var i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;\n var textBaseline = 'middle';\n\n if (position === 'top') {\n y = me.bottom - hTickAndPadding;\n textAlign = me._getXAxisLabelAlignment();\n } else if (position === 'bottom') {\n y = me.top + hTickAndPadding;\n textAlign = me._getXAxisLabelAlignment();\n } else if (position === 'left') {\n var ret = me._getYAxisLabelAlignment(tl);\n\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (position === 'right') {\n var _ret = me._getYAxisLabelAlignment(tl);\n\n textAlign = _ret.textAlign;\n x = _ret.x;\n } else if (axis === 'x') {\n if (position === 'center') {\n y = (chartArea.top + chartArea.bottom) / 2 + tickAndPadding;\n } else if (isObject(position)) {\n var positionAxisID = Object.keys(position)[0];\n var value = position[positionAxisID];\n y = me.chart.scales[positionAxisID].getPixelForValue(value) + tickAndPadding;\n }\n\n textAlign = me._getXAxisLabelAlignment();\n } else if (axis === 'y') {\n if (position === 'center') {\n x = (chartArea.left + chartArea.right) / 2 - tickAndPadding;\n } else if (isObject(position)) {\n var _positionAxisID2 = Object.keys(position)[0];\n var _value2 = position[_positionAxisID2];\n x = me.chart.scales[_positionAxisID2].getPixelForValue(_value2);\n }\n\n textAlign = me._getYAxisLabelAlignment(tl).textAlign;\n }\n\n if (axis === 'y') {\n if (align === 'start') {\n textBaseline = 'top';\n } else if (align === 'end') {\n textBaseline = 'bottom';\n }\n }\n\n var labelSizes = me._getLabelSizes();\n\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n label = tick.label;\n var optsAtIndex = optionTicks.setContext(me.getContext(i));\n pixel = me.getPixelForTick(i) + optionTicks.labelOffset;\n font = me._resolveTickFontOptions(i);\n lineHeight = font.lineHeight;\n lineCount = isArray(label) ? label.length : 1;\n var halfCount = lineCount / 2;\n var color = optsAtIndex.color;\n var strokeColor = optsAtIndex.textStrokeColor;\n var strokeWidth = optsAtIndex.textStrokeWidth;\n\n if (isHorizontal) {\n x = pixel;\n\n if (position === 'top') {\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = -lineCount * lineHeight + lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight + lineHeight;\n } else {\n textOffset = -labelSizes.highest.height + lineHeight / 2;\n }\n } else {\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight;\n } else {\n textOffset = labelSizes.highest.height - lineCount * lineHeight;\n }\n }\n\n if (mirror) {\n textOffset *= -1;\n }\n } else {\n y = pixel;\n textOffset = (1 - lineCount) * lineHeight / 2;\n }\n\n var backdrop = void 0;\n\n if (optsAtIndex.showLabelBackdrop) {\n var labelPadding = toPadding(optsAtIndex.backdropPadding);\n var height = labelSizes.heights[i];\n var width = labelSizes.widths[i];\n var top = y + textOffset - labelPadding.top;\n var left = x - labelPadding.left;\n\n switch (textBaseline) {\n case 'middle':\n top -= height / 2;\n break;\n\n case 'bottom':\n top -= height;\n break;\n }\n\n switch (textAlign) {\n case 'center':\n left -= width / 2;\n break;\n\n case 'right':\n left -= width;\n break;\n }\n\n backdrop = {\n left: left,\n top: top,\n width: width + labelPadding.width,\n height: height + labelPadding.height,\n color: optsAtIndex.backdropColor\n };\n }\n\n items.push({\n rotation: rotation,\n label: label,\n font: font,\n color: color,\n strokeColor: strokeColor,\n strokeWidth: strokeWidth,\n textOffset: textOffset,\n textAlign: textAlign,\n textBaseline: textBaseline,\n translation: [x, y],\n backdrop: backdrop\n });\n }\n\n return items;\n }\n }, {\n key: \"_getXAxisLabelAlignment\",\n value: function _getXAxisLabelAlignment() {\n var me = this;\n var _me$options4 = me.options,\n position = _me$options4.position,\n ticks = _me$options4.ticks;\n var rotation = -toRadians(me.labelRotation);\n\n if (rotation) {\n return position === 'top' ? 'left' : 'right';\n }\n\n var align = 'center';\n\n if (ticks.align === 'start') {\n align = 'left';\n } else if (ticks.align === 'end') {\n align = 'right';\n }\n\n return align;\n }\n }, {\n key: \"_getYAxisLabelAlignment\",\n value: function _getYAxisLabelAlignment(tl) {\n var me = this;\n var _me$options5 = me.options,\n position = _me$options5.position,\n _me$options5$ticks = _me$options5.ticks,\n crossAlign = _me$options5$ticks.crossAlign,\n mirror = _me$options5$ticks.mirror,\n padding = _me$options5$ticks.padding;\n\n var labelSizes = me._getLabelSizes();\n\n var tickAndPadding = tl + padding;\n var widest = labelSizes.widest.width;\n var textAlign;\n var x;\n\n if (position === 'left') {\n if (mirror) {\n textAlign = 'left';\n x = me.right + padding;\n } else {\n x = me.right - tickAndPadding;\n\n if (crossAlign === 'near') {\n textAlign = 'right';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x -= widest / 2;\n } else {\n textAlign = 'left';\n x = me.left;\n }\n }\n } else if (position === 'right') {\n if (mirror) {\n textAlign = 'right';\n x = me.left + padding;\n } else {\n x = me.left + tickAndPadding;\n\n if (crossAlign === 'near') {\n textAlign = 'left';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x += widest / 2;\n } else {\n textAlign = 'right';\n x = me.right;\n }\n }\n } else {\n textAlign = 'right';\n }\n\n return {\n textAlign: textAlign,\n x: x\n };\n }\n }, {\n key: \"_computeLabelArea\",\n value: function _computeLabelArea() {\n var me = this;\n\n if (me.options.ticks.mirror) {\n return;\n }\n\n var chart = me.chart;\n var position = me.options.position;\n\n if (position === 'left' || position === 'right') {\n return {\n top: 0,\n left: me.left,\n bottom: chart.height,\n right: me.right\n };\n }\n\n if (position === 'top' || position === 'bottom') {\n return {\n top: me.top,\n left: 0,\n bottom: me.bottom,\n right: chart.width\n };\n }\n }\n }, {\n key: \"drawBackground\",\n value: function drawBackground() {\n var ctx = this.ctx,\n backgroundColor = this.options.backgroundColor,\n left = this.left,\n top = this.top,\n width = this.width,\n height = this.height;\n\n if (backgroundColor) {\n ctx.save();\n ctx.fillStyle = backgroundColor;\n ctx.fillRect(left, top, width, height);\n ctx.restore();\n }\n }\n }, {\n key: \"getLineWidthForValue\",\n value: function getLineWidthForValue(value) {\n var me = this;\n var grid = me.options.grid;\n\n if (!me._isVisible() || !grid.display) {\n return 0;\n }\n\n var ticks = me.ticks;\n var index = ticks.findIndex(function (t) {\n return t.value === value;\n });\n\n if (index >= 0) {\n var opts = grid.setContext(me.getContext(index));\n return opts.lineWidth;\n }\n\n return 0;\n }\n }, {\n key: \"drawGrid\",\n value: function drawGrid(chartArea) {\n var me = this;\n var grid = me.options.grid;\n var ctx = me.ctx;\n\n var items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));\n\n var i, ilen;\n\n var drawLine = function drawLine(p1, p2, style) {\n if (!style.width || !style.color) {\n return;\n }\n\n ctx.save();\n ctx.lineWidth = style.width;\n ctx.strokeStyle = style.color;\n ctx.setLineDash(style.borderDash || []);\n ctx.lineDashOffset = style.borderDashOffset;\n ctx.beginPath();\n ctx.moveTo(p1.x, p1.y);\n ctx.lineTo(p2.x, p2.y);\n ctx.stroke();\n ctx.restore();\n };\n\n if (grid.display) {\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n var item = items[i];\n\n if (grid.drawOnChartArea) {\n drawLine({\n x: item.x1,\n y: item.y1\n }, {\n x: item.x2,\n y: item.y2\n }, item);\n }\n\n if (grid.drawTicks) {\n drawLine({\n x: item.tx1,\n y: item.ty1\n }, {\n x: item.tx2,\n y: item.ty2\n }, {\n color: item.tickColor,\n width: item.tickWidth,\n borderDash: item.tickBorderDash,\n borderDashOffset: item.tickBorderDashOffset\n });\n }\n }\n }\n }\n }, {\n key: \"drawBorder\",\n value: function drawBorder() {\n var me = this;\n var chart = me.chart,\n ctx = me.ctx,\n grid = me.options.grid;\n var borderOpts = grid.setContext(me.getContext());\n var axisWidth = grid.drawBorder ? borderOpts.borderWidth : 0;\n\n if (!axisWidth) {\n return;\n }\n\n var lastLineWidth = grid.setContext(me.getContext(0)).lineWidth;\n var borderValue = me._borderValue;\n var x1, x2, y1, y2;\n\n if (me.isHorizontal()) {\n x1 = _alignPixel(chart, me.left, axisWidth) - axisWidth / 2;\n x2 = _alignPixel(chart, me.right, lastLineWidth) + lastLineWidth / 2;\n y1 = y2 = borderValue;\n } else {\n y1 = _alignPixel(chart, me.top, axisWidth) - axisWidth / 2;\n y2 = _alignPixel(chart, me.bottom, lastLineWidth) + lastLineWidth / 2;\n x1 = x2 = borderValue;\n }\n\n ctx.save();\n ctx.lineWidth = borderOpts.borderWidth;\n ctx.strokeStyle = borderOpts.borderColor;\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n ctx.restore();\n }\n }, {\n key: \"drawLabels\",\n value: function drawLabels(chartArea) {\n var me = this;\n var optionTicks = me.options.ticks;\n\n if (!optionTicks.display) {\n return;\n }\n\n var ctx = me.ctx;\n\n var area = me._computeLabelArea();\n\n if (area) {\n clipArea(ctx, area);\n }\n\n var items = me._labelItems || (me._labelItems = me._computeLabelItems(chartArea));\n\n var i, ilen;\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n var item = items[i];\n var tickFont = item.font;\n var label = item.label;\n\n if (item.backdrop) {\n ctx.fillStyle = item.backdrop.color;\n ctx.fillRect(item.backdrop.left, item.backdrop.top, item.backdrop.width, item.backdrop.height);\n }\n\n var y = item.textOffset;\n renderText(ctx, label, 0, y, tickFont, item);\n }\n\n if (area) {\n unclipArea(ctx);\n }\n }\n }, {\n key: \"drawTitle\",\n value: function drawTitle() {\n var ctx = this.ctx,\n _this$options2 = this.options,\n position = _this$options2.position,\n title = _this$options2.title,\n reverse = _this$options2.reverse;\n\n if (!title.display) {\n return;\n }\n\n var font = toFont(title.font);\n var padding = toPadding(title.padding);\n var align = title.align;\n var offset = font.lineHeight / 2;\n\n if (position === 'bottom') {\n offset += padding.bottom;\n\n if (isArray(title.text)) {\n offset += font.lineHeight * (title.text.length - 1);\n }\n } else {\n offset += padding.top;\n }\n\n var _titleArgs = titleArgs(this, offset, position, align),\n titleX = _titleArgs.titleX,\n titleY = _titleArgs.titleY,\n maxWidth = _titleArgs.maxWidth,\n rotation = _titleArgs.rotation;\n\n renderText(ctx, title.text, 0, 0, font, {\n color: title.color,\n maxWidth: maxWidth,\n rotation: rotation,\n textAlign: titleAlign(align, position, reverse),\n textBaseline: 'middle',\n translation: [titleX, titleY]\n });\n }\n }, {\n key: \"draw\",\n value: function draw(chartArea) {\n var me = this;\n\n if (!me._isVisible()) {\n return;\n }\n\n me.drawBackground();\n me.drawGrid(chartArea);\n me.drawBorder();\n me.drawTitle();\n me.drawLabels(chartArea);\n }\n }, {\n key: \"_layers\",\n value: function _layers() {\n var me = this;\n var opts = me.options;\n var tz = opts.ticks && opts.ticks.z || 0;\n var gz = opts.grid && opts.grid.z || 0;\n\n if (!me._isVisible() || me.draw !== Scale.prototype.draw) {\n return [{\n z: tz,\n draw: function draw(chartArea) {\n me.draw(chartArea);\n }\n }];\n }\n\n return [{\n z: gz,\n draw: function draw(chartArea) {\n me.drawBackground();\n me.drawGrid(chartArea);\n me.drawTitle();\n }\n }, {\n z: gz + 1,\n draw: function draw() {\n me.drawBorder();\n }\n }, {\n z: tz,\n draw: function draw(chartArea) {\n me.drawLabels(chartArea);\n }\n }];\n }\n }, {\n key: \"getMatchingVisibleMetas\",\n value: function getMatchingVisibleMetas(type) {\n var me = this;\n var metas = me.chart.getSortedVisibleDatasetMetas();\n var axisID = me.axis + 'AxisID';\n var result = [];\n var i, ilen;\n\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n var meta = metas[i];\n\n if (meta[axisID] === me.id && (!type || meta.type === type)) {\n result.push(meta);\n }\n }\n\n return result;\n }\n }, {\n key: \"_resolveTickFontOptions\",\n value: function _resolveTickFontOptions(index) {\n var opts = this.options.ticks.setContext(this.getContext(index));\n return toFont(opts.font);\n }\n }, {\n key: \"_maxDigits\",\n value: function _maxDigits() {\n var me = this;\n\n var fontSize = me._resolveTickFontOptions(0).lineHeight;\n\n return (me.isHorizontal() ? me.width : me.height) / fontSize;\n }\n }]);\n\n return Scale;\n}(Element);\n\nvar TypedRegistry = /*#__PURE__*/function () {\n function TypedRegistry(type, scope, override) {\n _classCallCheck(this, TypedRegistry);\n\n this.type = type;\n this.scope = scope;\n this.override = override;\n this.items = Object.create(null);\n }\n\n _createClass(TypedRegistry, [{\n key: \"isForType\",\n value: function isForType(type) {\n return Object.prototype.isPrototypeOf.call(this.type.prototype, type.prototype);\n }\n }, {\n key: \"register\",\n value: function register(item) {\n var me = this;\n var proto = Object.getPrototypeOf(item);\n var parentScope;\n\n if (isIChartComponent(proto)) {\n parentScope = me.register(proto);\n }\n\n var items = me.items;\n var id = item.id;\n var scope = me.scope + '.' + id;\n\n if (!id) {\n throw new Error('class does not have id: ' + item);\n }\n\n if (id in items) {\n return scope;\n }\n\n items[id] = item;\n registerDefaults(item, scope, parentScope);\n\n if (me.override) {\n defaults.override(item.id, item.overrides);\n }\n\n return scope;\n }\n }, {\n key: \"get\",\n value: function get(id) {\n return this.items[id];\n }\n }, {\n key: \"unregister\",\n value: function unregister(item) {\n var items = this.items;\n var id = item.id;\n var scope = this.scope;\n\n if (id in items) {\n delete items[id];\n }\n\n if (scope && id in defaults[scope]) {\n delete defaults[scope][id];\n\n if (this.override) {\n delete overrides[id];\n }\n }\n }\n }]);\n\n return TypedRegistry;\n}();\n\nfunction registerDefaults(item, scope, parentScope) {\n var itemDefaults = merge(Object.create(null), [parentScope ? defaults.get(parentScope) : {}, defaults.get(scope), item.defaults]);\n defaults.set(scope, itemDefaults);\n\n if (item.defaultRoutes) {\n routeDefaults(scope, item.defaultRoutes);\n }\n\n if (item.descriptors) {\n defaults.describe(scope, item.descriptors);\n }\n}\n\nfunction routeDefaults(scope, routes) {\n Object.keys(routes).forEach(function (property) {\n var propertyParts = property.split('.');\n var sourceName = propertyParts.pop();\n var sourceScope = [scope].concat(propertyParts).join('.');\n var parts = routes[property].split('.');\n var targetName = parts.pop();\n var targetScope = parts.join('.');\n defaults.route(sourceScope, sourceName, targetScope, targetName);\n });\n}\n\nfunction isIChartComponent(proto) {\n return 'id' in proto && 'defaults' in proto;\n}\n\nvar Registry = /*#__PURE__*/function () {\n function Registry() {\n _classCallCheck(this, Registry);\n\n this.controllers = new TypedRegistry(DatasetController, 'datasets', true);\n this.elements = new TypedRegistry(Element, 'elements');\n this.plugins = new TypedRegistry(Object, 'plugins');\n this.scales = new TypedRegistry(Scale, 'scales');\n this._typedRegistries = [this.controllers, this.scales, this.elements];\n }\n\n _createClass(Registry, [{\n key: \"add\",\n value: function add() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n this._each('register', args);\n }\n }, {\n key: \"remove\",\n value: function remove() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n this._each('unregister', args);\n }\n }, {\n key: \"addControllers\",\n value: function addControllers() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this._each('register', args, this.controllers);\n }\n }, {\n key: \"addElements\",\n value: function addElements() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n this._each('register', args, this.elements);\n }\n }, {\n key: \"addPlugins\",\n value: function addPlugins() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n this._each('register', args, this.plugins);\n }\n }, {\n key: \"addScales\",\n value: function addScales() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n this._each('register', args, this.scales);\n }\n }, {\n key: \"getController\",\n value: function getController(id) {\n return this._get(id, this.controllers, 'controller');\n }\n }, {\n key: \"getElement\",\n value: function getElement(id) {\n return this._get(id, this.elements, 'element');\n }\n }, {\n key: \"getPlugin\",\n value: function getPlugin(id) {\n return this._get(id, this.plugins, 'plugin');\n }\n }, {\n key: \"getScale\",\n value: function getScale(id) {\n return this._get(id, this.scales, 'scale');\n }\n }, {\n key: \"removeControllers\",\n value: function removeControllers() {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n\n this._each('unregister', args, this.controllers);\n }\n }, {\n key: \"removeElements\",\n value: function removeElements() {\n for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n args[_key8] = arguments[_key8];\n }\n\n this._each('unregister', args, this.elements);\n }\n }, {\n key: \"removePlugins\",\n value: function removePlugins() {\n for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n args[_key9] = arguments[_key9];\n }\n\n this._each('unregister', args, this.plugins);\n }\n }, {\n key: \"removeScales\",\n value: function removeScales() {\n for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n args[_key10] = arguments[_key10];\n }\n\n this._each('unregister', args, this.scales);\n }\n }, {\n key: \"_each\",\n value: function _each(method, args, typedRegistry) {\n var me = this;\n\n _toConsumableArray(args).forEach(function (arg) {\n var reg = typedRegistry || me._getRegistryForType(arg);\n\n if (typedRegistry || reg.isForType(arg) || reg === me.plugins && arg.id) {\n me._exec(method, reg, arg);\n } else {\n each(arg, function (item) {\n var itemReg = typedRegistry || me._getRegistryForType(item);\n\n me._exec(method, itemReg, item);\n });\n }\n });\n }\n }, {\n key: \"_exec\",\n value: function _exec(method, registry, component) {\n var camelMethod = _capitalize(method);\n\n callback(component['before' + camelMethod], [], component);\n registry[method](component);\n callback(component['after' + camelMethod], [], component);\n }\n }, {\n key: \"_getRegistryForType\",\n value: function _getRegistryForType(type) {\n for (var i = 0; i < this._typedRegistries.length; i++) {\n var reg = this._typedRegistries[i];\n\n if (reg.isForType(type)) {\n return reg;\n }\n }\n\n return this.plugins;\n }\n }, {\n key: \"_get\",\n value: function _get(id, typedRegistry, type) {\n var item = typedRegistry.get(id);\n\n if (item === undefined) {\n throw new Error('\"' + id + '\" is not a registered ' + type + '.');\n }\n\n return item;\n }\n }]);\n\n return Registry;\n}();\n\nvar registry = new Registry();\n\nvar PluginService = /*#__PURE__*/function () {\n function PluginService() {\n _classCallCheck(this, PluginService);\n\n this._init = [];\n }\n\n _createClass(PluginService, [{\n key: \"notify\",\n value: function notify(chart, hook, args, filter) {\n var me = this;\n\n if (hook === 'beforeInit') {\n me._init = me._createDescriptors(chart, true);\n\n me._notify(me._init, chart, 'install');\n }\n\n var descriptors = filter ? me._descriptors(chart).filter(filter) : me._descriptors(chart);\n\n var result = me._notify(descriptors, chart, hook, args);\n\n if (hook === 'destroy') {\n me._notify(descriptors, chart, 'stop');\n\n me._notify(me._init, chart, 'uninstall');\n }\n\n return result;\n }\n }, {\n key: \"_notify\",\n value: function _notify(descriptors, chart, hook, args) {\n args = args || {};\n\n var _iterator5 = _createForOfIteratorHelper(descriptors),\n _step5;\n\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var descriptor = _step5.value;\n var plugin = descriptor.plugin;\n var method = plugin[hook];\n var params = [chart, args, descriptor.options];\n\n if (callback(method, params, plugin) === false && args.cancelable) {\n return false;\n }\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n\n return true;\n }\n }, {\n key: \"invalidate\",\n value: function invalidate() {\n if (!isNullOrUndef(this._cache)) {\n this._oldCache = this._cache;\n this._cache = undefined;\n }\n }\n }, {\n key: \"_descriptors\",\n value: function _descriptors(chart) {\n if (this._cache) {\n return this._cache;\n }\n\n var descriptors = this._cache = this._createDescriptors(chart);\n\n this._notifyStateChanges(chart);\n\n return descriptors;\n }\n }, {\n key: \"_createDescriptors\",\n value: function _createDescriptors(chart, all) {\n var config = chart && chart.config;\n var options = valueOrDefault(config.options && config.options.plugins, {});\n var plugins = allPlugins(config);\n return options === false && !all ? [] : createDescriptors(chart, plugins, options, all);\n }\n }, {\n key: \"_notifyStateChanges\",\n value: function _notifyStateChanges(chart) {\n var previousDescriptors = this._oldCache || [];\n var descriptors = this._cache;\n\n var diff = function diff(a, b) {\n return a.filter(function (x) {\n return !b.some(function (y) {\n return x.plugin.id === y.plugin.id;\n });\n });\n };\n\n this._notify(diff(previousDescriptors, descriptors), chart, 'stop');\n\n this._notify(diff(descriptors, previousDescriptors), chart, 'start');\n }\n }]);\n\n return PluginService;\n}();\n\nfunction allPlugins(config) {\n var plugins = [];\n var keys = Object.keys(registry.plugins.items);\n\n for (var i = 0; i < keys.length; i++) {\n plugins.push(registry.getPlugin(keys[i]));\n }\n\n var local = config.plugins || [];\n\n for (var _i = 0; _i < local.length; _i++) {\n var plugin = local[_i];\n\n if (plugins.indexOf(plugin) === -1) {\n plugins.push(plugin);\n }\n }\n\n return plugins;\n}\n\nfunction getOpts(options, all) {\n if (!all && options === false) {\n return null;\n }\n\n if (options === true) {\n return {};\n }\n\n return options;\n}\n\nfunction createDescriptors(chart, plugins, options, all) {\n var result = [];\n var context = chart.getContext();\n\n for (var i = 0; i < plugins.length; i++) {\n var plugin = plugins[i];\n var id = plugin.id;\n var opts = getOpts(options[id], all);\n\n if (opts === null) {\n continue;\n }\n\n result.push({\n plugin: plugin,\n options: pluginOpts(chart.config, plugin, opts, context)\n });\n }\n\n return result;\n}\n\nfunction pluginOpts(config, plugin, opts, context) {\n var keys = config.pluginScopeKeys(plugin);\n var scopes = config.getOptionScopes(opts, keys);\n return config.createResolver(scopes, context, [''], {\n scriptable: false,\n indexable: false,\n allKeys: true\n });\n}\n\nfunction getIndexAxis(type, options) {\n var datasetDefaults = defaults.datasets[type] || {};\n var datasetOptions = (options.datasets || {})[type] || {};\n return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';\n}\n\nfunction getAxisFromDefaultScaleID(id, indexAxis) {\n var axis = id;\n\n if (id === '_index_') {\n axis = indexAxis;\n } else if (id === '_value_') {\n axis = indexAxis === 'x' ? 'y' : 'x';\n }\n\n return axis;\n}\n\nfunction getDefaultScaleIDFromAxis(axis, indexAxis) {\n return axis === indexAxis ? '_index_' : '_value_';\n}\n\nfunction axisFromPosition(position) {\n if (position === 'top' || position === 'bottom') {\n return 'x';\n }\n\n if (position === 'left' || position === 'right') {\n return 'y';\n }\n}\n\nfunction determineAxis(id, scaleOptions) {\n if (id === 'x' || id === 'y') {\n return id;\n }\n\n return scaleOptions.axis || axisFromPosition(scaleOptions.position) || id.charAt(0).toLowerCase();\n}\n\nfunction mergeScaleConfig(config, options) {\n var chartDefaults = overrides[config.type] || {\n scales: {}\n };\n var configScales = options.scales || {};\n var chartIndexAxis = getIndexAxis(config.type, options);\n var firstIDs = Object.create(null);\n var scales = Object.create(null);\n Object.keys(configScales).forEach(function (id) {\n var scaleConf = configScales[id];\n var axis = determineAxis(id, scaleConf);\n var defaultId = getDefaultScaleIDFromAxis(axis, chartIndexAxis);\n var defaultScaleOptions = chartDefaults.scales || {};\n firstIDs[axis] = firstIDs[axis] || id;\n scales[id] = mergeIf(Object.create(null), [{\n axis: axis\n }, scaleConf, defaultScaleOptions[axis], defaultScaleOptions[defaultId]]);\n });\n config.data.datasets.forEach(function (dataset) {\n var type = dataset.type || config.type;\n var indexAxis = dataset.indexAxis || getIndexAxis(type, options);\n var datasetDefaults = overrides[type] || {};\n var defaultScaleOptions = datasetDefaults.scales || {};\n Object.keys(defaultScaleOptions).forEach(function (defaultID) {\n var axis = getAxisFromDefaultScaleID(defaultID, indexAxis);\n var id = dataset[axis + 'AxisID'] || firstIDs[axis] || axis;\n scales[id] = scales[id] || Object.create(null);\n mergeIf(scales[id], [{\n axis: axis\n }, configScales[id], defaultScaleOptions[defaultID]]);\n });\n });\n Object.keys(scales).forEach(function (key) {\n var scale = scales[key];\n mergeIf(scale, [defaults.scales[scale.type], defaults.scale]);\n });\n return scales;\n}\n\nfunction initOptions(config) {\n var options = config.options || (config.options = {});\n options.plugins = valueOrDefault(options.plugins, {});\n options.scales = mergeScaleConfig(config, options);\n}\n\nfunction initData(data) {\n data = data || {};\n data.datasets = data.datasets || [];\n data.labels = data.labels || [];\n return data;\n}\n\nfunction initConfig(config) {\n config = config || {};\n config.data = initData(config.data);\n initOptions(config);\n return config;\n}\n\nvar keyCache = new Map();\nvar keysCached = new Set();\n\nfunction cachedKeys(cacheKey, generate) {\n var keys = keyCache.get(cacheKey);\n\n if (!keys) {\n keys = generate();\n keyCache.set(cacheKey, keys);\n keysCached.add(keys);\n }\n\n return keys;\n}\n\nvar addIfFound = function addIfFound(set, obj, key) {\n var opts = resolveObjectKey(obj, key);\n\n if (opts !== undefined) {\n set.add(opts);\n }\n};\n\nvar Config = /*#__PURE__*/function () {\n function Config(config) {\n _classCallCheck(this, Config);\n\n this._config = initConfig(config);\n this._scopeCache = new Map();\n this._resolverCache = new Map();\n }\n\n _createClass(Config, [{\n key: \"type\",\n get: function get() {\n return this._config.type;\n },\n set: function set(type) {\n this._config.type = type;\n }\n }, {\n key: \"data\",\n get: function get() {\n return this._config.data;\n },\n set: function set(data) {\n this._config.data = initData(data);\n }\n }, {\n key: \"options\",\n get: function get() {\n return this._config.options;\n },\n set: function set(options) {\n this._config.options = options;\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return this._config.plugins;\n }\n }, {\n key: \"update\",\n value: function update() {\n var config = this._config;\n this.clearCache();\n initOptions(config);\n }\n }, {\n key: \"clearCache\",\n value: function clearCache() {\n this._scopeCache.clear();\n\n this._resolverCache.clear();\n }\n }, {\n key: \"datasetScopeKeys\",\n value: function datasetScopeKeys(datasetType) {\n return cachedKeys(datasetType, function () {\n return [[\"datasets.\".concat(datasetType), '']];\n });\n }\n }, {\n key: \"datasetAnimationScopeKeys\",\n value: function datasetAnimationScopeKeys(datasetType, transition) {\n return cachedKeys(\"\".concat(datasetType, \".transition.\").concat(transition), function () {\n return [[\"datasets.\".concat(datasetType, \".transitions.\").concat(transition), \"transitions.\".concat(transition)], [\"datasets.\".concat(datasetType), '']];\n });\n }\n }, {\n key: \"datasetElementScopeKeys\",\n value: function datasetElementScopeKeys(datasetType, elementType) {\n return cachedKeys(\"\".concat(datasetType, \"-\").concat(elementType), function () {\n return [[\"datasets.\".concat(datasetType, \".elements.\").concat(elementType), \"datasets.\".concat(datasetType), \"elements.\".concat(elementType), '']];\n });\n }\n }, {\n key: \"pluginScopeKeys\",\n value: function pluginScopeKeys(plugin) {\n var id = plugin.id;\n var type = this.type;\n return cachedKeys(\"\".concat(type, \"-plugin-\").concat(id), function () {\n return [[\"plugins.\".concat(id)].concat(_toConsumableArray(plugin.additionalOptionScopes || []))];\n });\n }\n }, {\n key: \"_cachedScopes\",\n value: function _cachedScopes(mainScope, resetCache) {\n var _scopeCache = this._scopeCache;\n\n var cache = _scopeCache.get(mainScope);\n\n if (!cache || resetCache) {\n cache = new Map();\n\n _scopeCache.set(mainScope, cache);\n }\n\n return cache;\n }\n }, {\n key: \"getOptionScopes\",\n value: function getOptionScopes(mainScope, keyLists, resetCache) {\n var options = this.options,\n type = this.type;\n\n var cache = this._cachedScopes(mainScope, resetCache);\n\n var cached = cache.get(keyLists);\n\n if (cached) {\n return cached;\n }\n\n var scopes = new Set();\n keyLists.forEach(function (keys) {\n if (mainScope) {\n scopes.add(mainScope);\n keys.forEach(function (key) {\n return addIfFound(scopes, mainScope, key);\n });\n }\n\n keys.forEach(function (key) {\n return addIfFound(scopes, options, key);\n });\n keys.forEach(function (key) {\n return addIfFound(scopes, overrides[type] || {}, key);\n });\n keys.forEach(function (key) {\n return addIfFound(scopes, defaults, key);\n });\n keys.forEach(function (key) {\n return addIfFound(scopes, descriptors, key);\n });\n });\n\n var array = _toConsumableArray(scopes);\n\n if (keysCached.has(keyLists)) {\n cache.set(keyLists, array);\n }\n\n return array;\n }\n }, {\n key: \"chartOptionScopes\",\n value: function chartOptionScopes() {\n var options = this.options,\n type = this.type;\n return [options, overrides[type] || {}, defaults.datasets[type] || {}, {\n type: type\n }, defaults, descriptors];\n }\n }, {\n key: \"resolveNamedOptions\",\n value: function resolveNamedOptions(scopes, names, context) {\n var prefixes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [''];\n var result = {\n $shared: true\n };\n\n var _getResolver = getResolver(this._resolverCache, scopes, prefixes),\n resolver = _getResolver.resolver,\n subPrefixes = _getResolver.subPrefixes;\n\n var options = resolver;\n\n if (needContext(resolver, names)) {\n result.$shared = false;\n context = isFunction(context) ? context() : context;\n var subResolver = this.createResolver(scopes, context, subPrefixes);\n options = _attachContext(resolver, context, subResolver);\n }\n\n var _iterator6 = _createForOfIteratorHelper(names),\n _step6;\n\n try {\n for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n var prop = _step6.value;\n result[prop] = options[prop];\n }\n } catch (err) {\n _iterator6.e(err);\n } finally {\n _iterator6.f();\n }\n\n return result;\n }\n }, {\n key: \"createResolver\",\n value: function createResolver(scopes, context) {\n var prefixes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [''];\n var descriptorDefaults = arguments.length > 3 ? arguments[3] : undefined;\n\n var _getResolver2 = getResolver(this._resolverCache, scopes, prefixes),\n resolver = _getResolver2.resolver;\n\n return isObject(context) ? _attachContext(resolver, context, undefined, descriptorDefaults) : resolver;\n }\n }]);\n\n return Config;\n}();\n\nfunction getResolver(resolverCache, scopes, prefixes) {\n var cache = resolverCache.get(scopes);\n\n if (!cache) {\n cache = new Map();\n resolverCache.set(scopes, cache);\n }\n\n var cacheKey = prefixes.join();\n var cached = cache.get(cacheKey);\n\n if (!cached) {\n var resolver = _createResolver(scopes, prefixes);\n\n cached = {\n resolver: resolver,\n subPrefixes: prefixes.filter(function (p) {\n return !p.toLowerCase().includes('hover');\n })\n };\n cache.set(cacheKey, cached);\n }\n\n return cached;\n}\n\nfunction needContext(proxy, names) {\n var _descriptors2 = _descriptors(proxy),\n isScriptable = _descriptors2.isScriptable,\n isIndexable = _descriptors2.isIndexable;\n\n var _iterator7 = _createForOfIteratorHelper(names),\n _step7;\n\n try {\n for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {\n var prop = _step7.value;\n\n if (isScriptable(prop) && isFunction(proxy[prop]) || isIndexable(prop) && isArray(proxy[prop])) {\n return true;\n }\n }\n } catch (err) {\n _iterator7.e(err);\n } finally {\n _iterator7.f();\n }\n\n return false;\n}\n\nvar version = \"3.3.2\";\nvar KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];\n\nfunction positionIsHorizontal(position, axis) {\n return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';\n}\n\nfunction compare2Level(l1, l2) {\n return function (a, b) {\n return a[l1] === b[l1] ? a[l2] - b[l2] : a[l1] - b[l1];\n };\n}\n\nfunction onAnimationsComplete(context) {\n var chart = context.chart;\n var animationOptions = chart.options.animation;\n chart.notifyPlugins('afterRender');\n callback(animationOptions && animationOptions.onComplete, [context], chart);\n}\n\nfunction onAnimationProgress(context) {\n var chart = context.chart;\n var animationOptions = chart.options.animation;\n callback(animationOptions && animationOptions.onProgress, [context], chart);\n}\n\nfunction isDomSupported() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nfunction getCanvas(item) {\n if (isDomSupported() && typeof item === 'string') {\n item = document.getElementById(item);\n } else if (item && item.length) {\n item = item[0];\n }\n\n if (item && item.canvas) {\n item = item.canvas;\n }\n\n return item;\n}\n\nvar instances = {};\n\nvar getChart = function getChart(key) {\n var canvas = getCanvas(key);\n return Object.values(instances).filter(function (c) {\n return c.canvas === canvas;\n }).pop();\n};\n\nvar Chart = /*#__PURE__*/function () {\n function Chart(item, config) {\n var _this5 = this;\n\n _classCallCheck(this, Chart);\n\n var me = this;\n this.config = config = new Config(config);\n var initialCanvas = getCanvas(item);\n var existingChart = getChart(initialCanvas);\n\n if (existingChart) {\n throw new Error('Canvas is already in use. Chart with ID \\'' + existingChart.id + '\\'' + ' must be destroyed before the canvas can be reused.');\n }\n\n var options = config.createResolver(config.chartOptionScopes(), me.getContext());\n this.platform = me._initializePlatform(initialCanvas, config);\n var context = me.platform.acquireContext(initialCanvas, options.aspectRatio);\n var canvas = context && context.canvas;\n var height = canvas && canvas.height;\n var width = canvas && canvas.width;\n this.id = uid();\n this.ctx = context;\n this.canvas = canvas;\n this.width = width;\n this.height = height;\n this._options = options;\n this._aspectRatio = this.aspectRatio;\n this._layers = [];\n this._metasets = [];\n this._stacks = undefined;\n this.boxes = [];\n this.currentDevicePixelRatio = undefined;\n this.chartArea = undefined;\n this._active = [];\n this._lastEvent = undefined;\n this._listeners = {};\n this._responsiveListeners = undefined;\n this._sortedMetasets = [];\n this.scales = {};\n this.scale = undefined;\n this._plugins = new PluginService();\n this.$proxies = {};\n this._hiddenIndices = {};\n this.attached = false;\n this._animationsDisabled = undefined;\n this.$context = undefined;\n this._doResize = debounce(function () {\n return _this5.update('resize');\n }, options.resizeDelay || 0);\n instances[me.id] = me;\n\n if (!context || !canvas) {\n console.error(\"Failed to create chart: can't acquire context from the given item\");\n return;\n }\n\n animator.listen(me, 'complete', onAnimationsComplete);\n animator.listen(me, 'progress', onAnimationProgress);\n\n me._initialize();\n\n if (me.attached) {\n me.update();\n }\n }\n\n _createClass(Chart, [{\n key: \"aspectRatio\",\n get: function get() {\n var _this$options3 = this.options,\n aspectRatio = _this$options3.aspectRatio,\n maintainAspectRatio = _this$options3.maintainAspectRatio,\n width = this.width,\n height = this.height,\n _aspectRatio = this._aspectRatio;\n\n if (!isNullOrUndef(aspectRatio)) {\n return aspectRatio;\n }\n\n if (maintainAspectRatio && _aspectRatio) {\n return _aspectRatio;\n }\n\n return height ? width / height : null;\n }\n }, {\n key: \"data\",\n get: function get() {\n return this.config.data;\n },\n set: function set(data) {\n this.config.data = data;\n }\n }, {\n key: \"options\",\n get: function get() {\n return this._options;\n },\n set: function set(options) {\n this.config.options = options;\n }\n }, {\n key: \"_initialize\",\n value: function _initialize() {\n var me = this;\n me.notifyPlugins('beforeInit');\n\n if (me.options.responsive) {\n me.resize();\n } else {\n retinaScale(me, me.options.devicePixelRatio);\n }\n\n me.bindEvents();\n me.notifyPlugins('afterInit');\n return me;\n }\n }, {\n key: \"_initializePlatform\",\n value: function _initializePlatform(canvas, config) {\n if (config.platform) {\n return new config.platform();\n } else if (!isDomSupported() || typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {\n return new BasicPlatform();\n }\n\n return new DomPlatform();\n }\n }, {\n key: \"clear\",\n value: function clear() {\n clearCanvas(this.canvas, this.ctx);\n return this;\n }\n }, {\n key: \"stop\",\n value: function stop() {\n animator.stop(this);\n return this;\n }\n }, {\n key: \"resize\",\n value: function resize(width, height) {\n if (!animator.running(this)) {\n this._resize(width, height);\n } else {\n this._resizeBeforeDraw = {\n width: width,\n height: height\n };\n }\n }\n }, {\n key: \"_resize\",\n value: function _resize(width, height) {\n var me = this;\n var options = me.options;\n var canvas = me.canvas;\n var aspectRatio = options.maintainAspectRatio && me.aspectRatio;\n var newSize = me.platform.getMaximumSize(canvas, width, height, aspectRatio);\n var newRatio = options.devicePixelRatio || me.platform.getDevicePixelRatio();\n me.width = newSize.width;\n me.height = newSize.height;\n me._aspectRatio = me.aspectRatio;\n\n if (!retinaScale(me, newRatio, true)) {\n return;\n }\n\n me.notifyPlugins('resize', {\n size: newSize\n });\n callback(options.onResize, [me, newSize], me);\n\n if (me.attached) {\n if (me._doResize()) {\n me.render();\n }\n }\n }\n }, {\n key: \"ensureScalesHaveIDs\",\n value: function ensureScalesHaveIDs() {\n var options = this.options;\n var scalesOptions = options.scales || {};\n each(scalesOptions, function (axisOptions, axisID) {\n axisOptions.id = axisID;\n });\n }\n }, {\n key: \"buildOrUpdateScales\",\n value: function buildOrUpdateScales() {\n var me = this;\n var options = me.options;\n var scaleOpts = options.scales;\n var scales = me.scales;\n var updated = Object.keys(scales).reduce(function (obj, id) {\n obj[id] = false;\n return obj;\n }, {});\n var items = [];\n\n if (scaleOpts) {\n items = items.concat(Object.keys(scaleOpts).map(function (id) {\n var scaleOptions = scaleOpts[id];\n var axis = determineAxis(id, scaleOptions);\n var isRadial = axis === 'r';\n var isHorizontal = axis === 'x';\n return {\n options: scaleOptions,\n dposition: isRadial ? 'chartArea' : isHorizontal ? 'bottom' : 'left',\n dtype: isRadial ? 'radialLinear' : isHorizontal ? 'category' : 'linear'\n };\n }));\n }\n\n each(items, function (item) {\n var scaleOptions = item.options;\n var id = scaleOptions.id;\n var axis = determineAxis(id, scaleOptions);\n var scaleType = valueOrDefault(scaleOptions.type, item.dtype);\n\n if (scaleOptions.position === undefined || positionIsHorizontal(scaleOptions.position, axis) !== positionIsHorizontal(item.dposition)) {\n scaleOptions.position = item.dposition;\n }\n\n updated[id] = true;\n var scale = null;\n\n if (id in scales && scales[id].type === scaleType) {\n scale = scales[id];\n } else {\n var scaleClass = registry.getScale(scaleType);\n scale = new scaleClass({\n id: id,\n type: scaleType,\n ctx: me.ctx,\n chart: me\n });\n scales[scale.id] = scale;\n }\n\n scale.init(scaleOptions, options);\n });\n each(updated, function (hasUpdated, id) {\n if (!hasUpdated) {\n delete scales[id];\n }\n });\n each(scales, function (scale) {\n layouts.configure(me, scale, scale.options);\n layouts.addBox(me, scale);\n });\n }\n }, {\n key: \"_updateMetasets\",\n value: function _updateMetasets() {\n var me = this;\n var metasets = me._metasets;\n var numData = me.data.datasets.length;\n var numMeta = metasets.length;\n metasets.sort(function (a, b) {\n return a.index - b.index;\n });\n\n if (numMeta > numData) {\n for (var i = numData; i < numMeta; ++i) {\n me._destroyDatasetMeta(i);\n }\n\n metasets.splice(numData, numMeta - numData);\n }\n\n me._sortedMetasets = metasets.slice(0).sort(compare2Level('order', 'index'));\n }\n }, {\n key: \"_removeUnreferencedMetasets\",\n value: function _removeUnreferencedMetasets() {\n var me = this;\n var metasets = me._metasets,\n datasets = me.data.datasets;\n\n if (metasets.length > datasets.length) {\n delete me._stacks;\n }\n\n metasets.forEach(function (meta, index) {\n if (datasets.filter(function (x) {\n return x === meta._dataset;\n }).length === 0) {\n me._destroyDatasetMeta(index);\n }\n });\n }\n }, {\n key: \"buildOrUpdateControllers\",\n value: function buildOrUpdateControllers() {\n var me = this;\n var newControllers = [];\n var datasets = me.data.datasets;\n var i, ilen;\n\n me._removeUnreferencedMetasets();\n\n for (i = 0, ilen = datasets.length; i < ilen; i++) {\n var dataset = datasets[i];\n var meta = me.getDatasetMeta(i);\n var type = dataset.type || me.config.type;\n\n if (meta.type && meta.type !== type) {\n me._destroyDatasetMeta(i);\n\n meta = me.getDatasetMeta(i);\n }\n\n meta.type = type;\n meta.indexAxis = dataset.indexAxis || getIndexAxis(type, me.options);\n meta.order = dataset.order || 0;\n meta.index = i;\n meta.label = '' + dataset.label;\n meta.visible = me.isDatasetVisible(i);\n\n if (meta.controller) {\n meta.controller.updateIndex(i);\n meta.controller.linkScales();\n } else {\n var ControllerClass = registry.getController(type);\n var _defaults$datasets$ty = defaults.datasets[type],\n datasetElementType = _defaults$datasets$ty.datasetElementType,\n dataElementType = _defaults$datasets$ty.dataElementType;\n Object.assign(ControllerClass.prototype, {\n dataElementType: registry.getElement(dataElementType),\n datasetElementType: datasetElementType && registry.getElement(datasetElementType)\n });\n meta.controller = new ControllerClass(me, i);\n newControllers.push(meta.controller);\n }\n }\n\n me._updateMetasets();\n\n return newControllers;\n }\n }, {\n key: \"_resetElements\",\n value: function _resetElements() {\n var me = this;\n each(me.data.datasets, function (dataset, datasetIndex) {\n me.getDatasetMeta(datasetIndex).controller.reset();\n }, me);\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this._resetElements();\n\n this.notifyPlugins('reset');\n }\n }, {\n key: \"update\",\n value: function update(mode) {\n var me = this;\n var config = me.config;\n config.update();\n me._options = config.createResolver(config.chartOptionScopes(), me.getContext());\n each(me.scales, function (scale) {\n layouts.removeBox(me, scale);\n });\n var animsDisabled = me._animationsDisabled = !me.options.animation;\n me.ensureScalesHaveIDs();\n me.buildOrUpdateScales();\n var existingEvents = new Set(Object.keys(me._listeners));\n var newEvents = new Set(me.options.events);\n\n if (!setsEqual(existingEvents, newEvents) || !!this._responsiveListeners !== me.options.responsive) {\n me.unbindEvents();\n me.bindEvents();\n }\n\n me._plugins.invalidate();\n\n if (me.notifyPlugins('beforeUpdate', {\n mode: mode,\n cancelable: true\n }) === false) {\n return;\n }\n\n var newControllers = me.buildOrUpdateControllers();\n me.notifyPlugins('beforeElementsUpdate');\n var minPadding = 0;\n\n for (var i = 0, ilen = me.data.datasets.length; i < ilen; i++) {\n var _me$getDatasetMeta = me.getDatasetMeta(i),\n controller = _me$getDatasetMeta.controller;\n\n var reset = !animsDisabled && newControllers.indexOf(controller) === -1;\n controller.buildOrUpdateElements(reset);\n minPadding = Math.max(+controller.getMaxOverflow(), minPadding);\n }\n\n me._minPadding = minPadding;\n\n me._updateLayout(minPadding);\n\n if (!animsDisabled) {\n each(newControllers, function (controller) {\n controller.reset();\n });\n }\n\n me._updateDatasets(mode);\n\n me.notifyPlugins('afterUpdate', {\n mode: mode\n });\n\n me._layers.sort(compare2Level('z', '_idx'));\n\n if (me._lastEvent) {\n me._eventHandler(me._lastEvent, true);\n }\n\n me.render();\n }\n }, {\n key: \"_updateLayout\",\n value: function _updateLayout(minPadding) {\n var me = this;\n\n if (me.notifyPlugins('beforeLayout', {\n cancelable: true\n }) === false) {\n return;\n }\n\n layouts.update(me, me.width, me.height, minPadding);\n var area = me.chartArea;\n var noArea = area.width <= 0 || area.height <= 0;\n me._layers = [];\n each(me.boxes, function (box) {\n var _me$_layers;\n\n if (noArea && box.position === 'chartArea') {\n return;\n }\n\n if (box.configure) {\n box.configure();\n }\n\n (_me$_layers = me._layers).push.apply(_me$_layers, _toConsumableArray(box._layers()));\n }, me);\n\n me._layers.forEach(function (item, index) {\n item._idx = index;\n });\n\n me.notifyPlugins('afterLayout');\n }\n }, {\n key: \"_updateDatasets\",\n value: function _updateDatasets(mode) {\n var me = this;\n var isFunction = typeof mode === 'function';\n\n if (me.notifyPlugins('beforeDatasetsUpdate', {\n mode: mode,\n cancelable: true\n }) === false) {\n return;\n }\n\n for (var i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {\n me._updateDataset(i, isFunction ? mode({\n datasetIndex: i\n }) : mode);\n }\n\n me.notifyPlugins('afterDatasetsUpdate', {\n mode: mode\n });\n }\n }, {\n key: \"_updateDataset\",\n value: function _updateDataset(index, mode) {\n var me = this;\n var meta = me.getDatasetMeta(index);\n var args = {\n meta: meta,\n index: index,\n mode: mode,\n cancelable: true\n };\n\n if (me.notifyPlugins('beforeDatasetUpdate', args) === false) {\n return;\n }\n\n meta.controller._update(mode);\n\n args.cancelable = false;\n me.notifyPlugins('afterDatasetUpdate', args);\n }\n }, {\n key: \"render\",\n value: function render() {\n var me = this;\n\n if (me.notifyPlugins('beforeRender', {\n cancelable: true\n }) === false) {\n return;\n }\n\n if (animator.has(me)) {\n if (me.attached && !animator.running(me)) {\n animator.start(me);\n }\n } else {\n me.draw();\n onAnimationsComplete({\n chart: me\n });\n }\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var me = this;\n var i;\n\n if (me._resizeBeforeDraw) {\n var _me$_resizeBeforeDraw = me._resizeBeforeDraw,\n width = _me$_resizeBeforeDraw.width,\n height = _me$_resizeBeforeDraw.height;\n\n me._resize(width, height);\n\n me._resizeBeforeDraw = null;\n }\n\n me.clear();\n\n if (me.width <= 0 || me.height <= 0) {\n return;\n }\n\n if (me.notifyPlugins('beforeDraw', {\n cancelable: true\n }) === false) {\n return;\n }\n\n var layers = me._layers;\n\n for (i = 0; i < layers.length && layers[i].z <= 0; ++i) {\n layers[i].draw(me.chartArea);\n }\n\n me._drawDatasets();\n\n for (; i < layers.length; ++i) {\n layers[i].draw(me.chartArea);\n }\n\n me.notifyPlugins('afterDraw');\n }\n }, {\n key: \"_getSortedDatasetMetas\",\n value: function _getSortedDatasetMetas(filterVisible) {\n var me = this;\n var metasets = me._sortedMetasets;\n var result = [];\n var i, ilen;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n var meta = metasets[i];\n\n if (!filterVisible || meta.visible) {\n result.push(meta);\n }\n }\n\n return result;\n }\n }, {\n key: \"getSortedVisibleDatasetMetas\",\n value: function getSortedVisibleDatasetMetas() {\n return this._getSortedDatasetMetas(true);\n }\n }, {\n key: \"_drawDatasets\",\n value: function _drawDatasets() {\n var me = this;\n\n if (me.notifyPlugins('beforeDatasetsDraw', {\n cancelable: true\n }) === false) {\n return;\n }\n\n var metasets = me.getSortedVisibleDatasetMetas();\n\n for (var i = metasets.length - 1; i >= 0; --i) {\n me._drawDataset(metasets[i]);\n }\n\n me.notifyPlugins('afterDatasetsDraw');\n }\n }, {\n key: \"_drawDataset\",\n value: function _drawDataset(meta) {\n var me = this;\n var ctx = me.ctx;\n var clip = meta._clip;\n var area = me.chartArea;\n var args = {\n meta: meta,\n index: meta.index,\n cancelable: true\n };\n\n if (me.notifyPlugins('beforeDatasetDraw', args) === false) {\n return;\n }\n\n clipArea(ctx, {\n left: clip.left === false ? 0 : area.left - clip.left,\n right: clip.right === false ? me.width : area.right + clip.right,\n top: clip.top === false ? 0 : area.top - clip.top,\n bottom: clip.bottom === false ? me.height : area.bottom + clip.bottom\n });\n meta.controller.draw();\n unclipArea(ctx);\n args.cancelable = false;\n me.notifyPlugins('afterDatasetDraw', args);\n }\n }, {\n key: \"getElementsAtEventForMode\",\n value: function getElementsAtEventForMode(e, mode, options, useFinalPosition) {\n var method = Interaction.modes[mode];\n\n if (typeof method === 'function') {\n return method(this, e, options, useFinalPosition);\n }\n\n return [];\n }\n }, {\n key: \"getDatasetMeta\",\n value: function getDatasetMeta(datasetIndex) {\n var me = this;\n var dataset = me.data.datasets[datasetIndex];\n var metasets = me._metasets;\n var meta = metasets.filter(function (x) {\n return x && x._dataset === dataset;\n }).pop();\n\n if (!meta) {\n meta = {\n type: null,\n data: [],\n dataset: null,\n controller: null,\n hidden: null,\n xAxisID: null,\n yAxisID: null,\n order: dataset && dataset.order || 0,\n index: datasetIndex,\n _dataset: dataset,\n _parsed: [],\n _sorted: false\n };\n metasets.push(meta);\n }\n\n return meta;\n }\n }, {\n key: \"getContext\",\n value: function getContext() {\n return this.$context || (this.$context = {\n chart: this,\n type: 'chart'\n });\n }\n }, {\n key: \"getVisibleDatasetCount\",\n value: function getVisibleDatasetCount() {\n return this.getSortedVisibleDatasetMetas().length;\n }\n }, {\n key: \"isDatasetVisible\",\n value: function isDatasetVisible(datasetIndex) {\n var dataset = this.data.datasets[datasetIndex];\n\n if (!dataset) {\n return false;\n }\n\n var meta = this.getDatasetMeta(datasetIndex);\n return typeof meta.hidden === 'boolean' ? !meta.hidden : !dataset.hidden;\n }\n }, {\n key: \"setDatasetVisibility\",\n value: function setDatasetVisibility(datasetIndex, visible) {\n var meta = this.getDatasetMeta(datasetIndex);\n meta.hidden = !visible;\n }\n }, {\n key: \"toggleDataVisibility\",\n value: function toggleDataVisibility(index) {\n this._hiddenIndices[index] = !this._hiddenIndices[index];\n }\n }, {\n key: \"getDataVisibility\",\n value: function getDataVisibility(index) {\n return !this._hiddenIndices[index];\n }\n }, {\n key: \"_updateDatasetVisibility\",\n value: function _updateDatasetVisibility(datasetIndex, visible) {\n var me = this;\n var mode = visible ? 'show' : 'hide';\n var meta = me.getDatasetMeta(datasetIndex);\n\n var anims = meta.controller._resolveAnimations(undefined, mode);\n\n me.setDatasetVisibility(datasetIndex, visible);\n anims.update(meta, {\n visible: visible\n });\n me.update(function (ctx) {\n return ctx.datasetIndex === datasetIndex ? mode : undefined;\n });\n }\n }, {\n key: \"hide\",\n value: function hide(datasetIndex) {\n this._updateDatasetVisibility(datasetIndex, false);\n }\n }, {\n key: \"show\",\n value: function show(datasetIndex) {\n this._updateDatasetVisibility(datasetIndex, true);\n }\n }, {\n key: \"_destroyDatasetMeta\",\n value: function _destroyDatasetMeta(datasetIndex) {\n var me = this;\n var meta = me._metasets && me._metasets[datasetIndex];\n\n if (meta && meta.controller) {\n meta.controller._destroy();\n\n delete me._metasets[datasetIndex];\n }\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n var me = this;\n var canvas = me.canvas,\n ctx = me.ctx;\n var i, ilen;\n me.stop();\n animator.remove(me);\n\n for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {\n me._destroyDatasetMeta(i);\n }\n\n me.config.clearCache();\n\n if (canvas) {\n me.unbindEvents();\n clearCanvas(canvas, ctx);\n me.platform.releaseContext(ctx);\n me.canvas = null;\n me.ctx = null;\n }\n\n me.notifyPlugins('destroy');\n delete instances[me.id];\n }\n }, {\n key: \"toBase64Image\",\n value: function toBase64Image() {\n var _this$canvas;\n\n return (_this$canvas = this.canvas).toDataURL.apply(_this$canvas, arguments);\n }\n }, {\n key: \"bindEvents\",\n value: function bindEvents() {\n this.bindUserEvents();\n\n if (this.options.responsive) {\n this.bindResponsiveEvents();\n } else {\n this.attached = true;\n }\n }\n }, {\n key: \"bindUserEvents\",\n value: function bindUserEvents() {\n var me = this;\n var listeners = me._listeners;\n var platform = me.platform;\n\n var _add = function _add(type, listener) {\n platform.addEventListener(me, type, listener);\n listeners[type] = listener;\n };\n\n var listener = function listener(e, x, y) {\n e.offsetX = x;\n e.offsetY = y;\n\n me._eventHandler(e);\n };\n\n each(me.options.events, function (type) {\n return _add(type, listener);\n });\n }\n }, {\n key: \"bindResponsiveEvents\",\n value: function bindResponsiveEvents() {\n var me = this;\n\n if (!me._responsiveListeners) {\n me._responsiveListeners = {};\n }\n\n var listeners = me._responsiveListeners;\n var platform = me.platform;\n\n var _add = function _add(type, listener) {\n platform.addEventListener(me, type, listener);\n listeners[type] = listener;\n };\n\n var _remove = function _remove(type, listener) {\n if (listeners[type]) {\n platform.removeEventListener(me, type, listener);\n delete listeners[type];\n }\n };\n\n var listener = function listener(width, height) {\n if (me.canvas) {\n me.resize(width, height);\n }\n };\n\n var detached;\n\n var attached = function attached() {\n _remove('attach', attached);\n\n me.attached = true;\n me.resize();\n\n _add('resize', listener);\n\n _add('detach', detached);\n };\n\n detached = function detached() {\n me.attached = false;\n\n _remove('resize', listener);\n\n _add('attach', attached);\n };\n\n if (platform.isAttached(me.canvas)) {\n attached();\n } else {\n detached();\n }\n }\n }, {\n key: \"unbindEvents\",\n value: function unbindEvents() {\n var me = this;\n each(me._listeners, function (listener, type) {\n me.platform.removeEventListener(me, type, listener);\n });\n me._listeners = {};\n each(me._responsiveListeners, function (listener, type) {\n me.platform.removeEventListener(me, type, listener);\n });\n me._responsiveListeners = undefined;\n }\n }, {\n key: \"updateHoverStyle\",\n value: function updateHoverStyle(items, mode, enabled) {\n var prefix = enabled ? 'set' : 'remove';\n var meta, item, i, ilen;\n\n if (mode === 'dataset') {\n meta = this.getDatasetMeta(items[0].datasetIndex);\n meta.controller['_' + prefix + 'DatasetHoverStyle']();\n }\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n item = items[i];\n var controller = item && this.getDatasetMeta(item.datasetIndex).controller;\n\n if (controller) {\n controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);\n }\n }\n }\n }, {\n key: \"getActiveElements\",\n value: function getActiveElements() {\n return this._active || [];\n }\n }, {\n key: \"setActiveElements\",\n value: function setActiveElements(activeElements) {\n var me = this;\n var lastActive = me._active || [];\n var active = activeElements.map(function (_ref) {\n var datasetIndex = _ref.datasetIndex,\n index = _ref.index;\n var meta = me.getDatasetMeta(datasetIndex);\n\n if (!meta) {\n throw new Error('No dataset found at index ' + datasetIndex);\n }\n\n return {\n datasetIndex: datasetIndex,\n element: meta.data[index],\n index: index\n };\n });\n var changed = !_elementsEqual(active, lastActive);\n\n if (changed) {\n me._active = active;\n\n me._updateHoverStyles(active, lastActive);\n }\n }\n }, {\n key: \"notifyPlugins\",\n value: function notifyPlugins(hook, args, filter) {\n return this._plugins.notify(this, hook, args, filter);\n }\n }, {\n key: \"_updateHoverStyles\",\n value: function _updateHoverStyles(active, lastActive, replay) {\n var me = this;\n var hoverOptions = me.options.hover;\n\n var diff = function diff(a, b) {\n return a.filter(function (x) {\n return !b.some(function (y) {\n return x.datasetIndex === y.datasetIndex && x.index === y.index;\n });\n });\n };\n\n var deactivated = diff(lastActive, active);\n var activated = replay ? active : diff(active, lastActive);\n\n if (deactivated.length) {\n me.updateHoverStyle(deactivated, hoverOptions.mode, false);\n }\n\n if (activated.length && hoverOptions.mode) {\n me.updateHoverStyle(activated, hoverOptions.mode, true);\n }\n }\n }, {\n key: \"_eventHandler\",\n value: function _eventHandler(e, replay) {\n var _this6 = this;\n\n var me = this;\n var args = {\n event: e,\n replay: replay,\n cancelable: true\n };\n\n var eventFilter = function eventFilter(plugin) {\n return (plugin.options.events || _this6.options.events).includes(e.type);\n };\n\n if (me.notifyPlugins('beforeEvent', args, eventFilter) === false) {\n return;\n }\n\n var changed = me._handleEvent(e, replay);\n\n args.cancelable = false;\n me.notifyPlugins('afterEvent', args, eventFilter);\n\n if (changed || args.changed) {\n me.render();\n }\n\n return me;\n }\n }, {\n key: \"_handleEvent\",\n value: function _handleEvent(e, replay) {\n var me = this;\n var _me$_active = me._active,\n lastActive = _me$_active === void 0 ? [] : _me$_active,\n options = me.options;\n var hoverOptions = options.hover;\n var useFinalPosition = replay;\n var active = [];\n var changed = false;\n var lastEvent = null;\n\n if (e.type !== 'mouseout') {\n active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions, useFinalPosition);\n lastEvent = e.type === 'click' ? me._lastEvent : e;\n }\n\n me._lastEvent = null;\n\n if (_isPointInArea(e, me.chartArea, me._minPadding)) {\n callback(options.onHover, [e, active, me], me);\n\n if (e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu') {\n callback(options.onClick, [e, active, me], me);\n }\n }\n\n changed = !_elementsEqual(active, lastActive);\n\n if (changed || replay) {\n me._active = active;\n\n me._updateHoverStyles(active, lastActive, replay);\n }\n\n me._lastEvent = lastEvent;\n return changed;\n }\n }]);\n\n return Chart;\n}();\n\nvar invalidatePlugins = function invalidatePlugins() {\n return each(Chart.instances, function (chart) {\n return chart._plugins.invalidate();\n });\n};\n\nvar enumerable = true;\nObject.defineProperties(Chart, {\n defaults: {\n enumerable: enumerable,\n value: defaults\n },\n instances: {\n enumerable: enumerable,\n value: instances\n },\n overrides: {\n enumerable: enumerable,\n value: overrides\n },\n registry: {\n enumerable: enumerable,\n value: registry\n },\n version: {\n enumerable: enumerable,\n value: version\n },\n getChart: {\n enumerable: enumerable,\n value: getChart\n },\n register: {\n enumerable: enumerable,\n value: function value() {\n registry.add.apply(registry, arguments);\n invalidatePlugins();\n }\n },\n unregister: {\n enumerable: enumerable,\n value: function value() {\n registry.remove.apply(registry, arguments);\n invalidatePlugins();\n }\n }\n});\n\nfunction clipArc(ctx, element, endAngle) {\n var startAngle = element.startAngle,\n pixelMargin = element.pixelMargin,\n x = element.x,\n y = element.y,\n outerRadius = element.outerRadius,\n innerRadius = element.innerRadius;\n var angleMargin = pixelMargin / outerRadius;\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, startAngle - angleMargin, endAngle + angleMargin);\n\n if (innerRadius > pixelMargin) {\n angleMargin = pixelMargin / innerRadius;\n ctx.arc(x, y, innerRadius, endAngle + angleMargin, startAngle - angleMargin, true);\n } else {\n ctx.arc(x, y, pixelMargin, endAngle + HALF_PI, startAngle - HALF_PI);\n }\n\n ctx.closePath();\n ctx.clip();\n}\n\nfunction toRadiusCorners(value) {\n return _readValueToProps(value, ['outerStart', 'outerEnd', 'innerStart', 'innerEnd']);\n}\n\nfunction parseBorderRadius$1(arc, innerRadius, outerRadius, angleDelta) {\n var o = toRadiusCorners(arc.options.borderRadius);\n var halfThickness = (outerRadius - innerRadius) / 2;\n var innerLimit = Math.min(halfThickness, angleDelta * innerRadius / 2);\n\n var computeOuterLimit = function computeOuterLimit(val) {\n var outerArcLimit = (outerRadius - Math.min(halfThickness, val)) * angleDelta / 2;\n return _limitValue(val, 0, Math.min(halfThickness, outerArcLimit));\n };\n\n return {\n outerStart: computeOuterLimit(o.outerStart),\n outerEnd: computeOuterLimit(o.outerEnd),\n innerStart: _limitValue(o.innerStart, 0, innerLimit),\n innerEnd: _limitValue(o.innerEnd, 0, innerLimit)\n };\n}\n\nfunction rThetaToXY(r, theta, x, y) {\n return {\n x: x + r * Math.cos(theta),\n y: y + r * Math.sin(theta)\n };\n}\n\nfunction pathArc(ctx, element, offset, end) {\n var x = element.x,\n y = element.y,\n start = element.startAngle,\n pixelMargin = element.pixelMargin,\n innerR = element.innerRadius;\n var outerRadius = Math.max(element.outerRadius + offset - pixelMargin, 0);\n var innerRadius = innerR > 0 ? innerR + offset + pixelMargin : 0;\n var alpha = end - start;\n var beta = Math.max(0.001, alpha * outerRadius - offset / PI) / outerRadius;\n var angleOffset = (alpha - beta) / 2;\n var startAngle = start + angleOffset;\n var endAngle = end - angleOffset;\n\n var _parseBorderRadius$ = parseBorderRadius$1(element, innerRadius, outerRadius, endAngle - startAngle),\n outerStart = _parseBorderRadius$.outerStart,\n outerEnd = _parseBorderRadius$.outerEnd,\n innerStart = _parseBorderRadius$.innerStart,\n innerEnd = _parseBorderRadius$.innerEnd;\n\n var outerStartAdjustedRadius = outerRadius - outerStart;\n var outerEndAdjustedRadius = outerRadius - outerEnd;\n var outerStartAdjustedAngle = startAngle + outerStart / outerStartAdjustedRadius;\n var outerEndAdjustedAngle = endAngle - outerEnd / outerEndAdjustedRadius;\n var innerStartAdjustedRadius = innerRadius + innerStart;\n var innerEndAdjustedRadius = innerRadius + innerEnd;\n var innerStartAdjustedAngle = startAngle + innerStart / innerStartAdjustedRadius;\n var innerEndAdjustedAngle = endAngle - innerEnd / innerEndAdjustedRadius;\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, outerStartAdjustedAngle, outerEndAdjustedAngle);\n\n if (outerEnd > 0) {\n var pCenter = rThetaToXY(outerEndAdjustedRadius, outerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle, endAngle + HALF_PI);\n }\n\n var p4 = rThetaToXY(innerEndAdjustedRadius, endAngle, x, y);\n ctx.lineTo(p4.x, p4.y);\n\n if (innerEnd > 0) {\n var _pCenter = rThetaToXY(innerEndAdjustedRadius, innerEndAdjustedAngle, x, y);\n\n ctx.arc(_pCenter.x, _pCenter.y, innerEnd, endAngle + HALF_PI, innerEndAdjustedAngle + Math.PI);\n }\n\n ctx.arc(x, y, innerRadius, endAngle - innerEnd / innerRadius, startAngle + innerStart / innerRadius, true);\n\n if (innerStart > 0) {\n var _pCenter2 = rThetaToXY(innerStartAdjustedRadius, innerStartAdjustedAngle, x, y);\n\n ctx.arc(_pCenter2.x, _pCenter2.y, innerStart, innerStartAdjustedAngle + Math.PI, startAngle - HALF_PI);\n }\n\n var p8 = rThetaToXY(outerStartAdjustedRadius, startAngle, x, y);\n ctx.lineTo(p8.x, p8.y);\n\n if (outerStart > 0) {\n var _pCenter3 = rThetaToXY(outerStartAdjustedRadius, outerStartAdjustedAngle, x, y);\n\n ctx.arc(_pCenter3.x, _pCenter3.y, outerStart, startAngle - HALF_PI, outerStartAdjustedAngle);\n }\n\n ctx.closePath();\n}\n\nfunction drawArc(ctx, element, offset) {\n var fullCircles = element.fullCircles,\n startAngle = element.startAngle,\n circumference = element.circumference;\n var endAngle = element.endAngle;\n\n if (fullCircles) {\n pathArc(ctx, element, offset, startAngle + TAU);\n\n for (var i = 0; i < fullCircles; ++i) {\n ctx.fill();\n }\n\n if (!isNaN(circumference)) {\n endAngle = startAngle + circumference % TAU;\n\n if (circumference % TAU === 0) {\n endAngle += TAU;\n }\n }\n }\n\n pathArc(ctx, element, offset, endAngle);\n ctx.fill();\n return endAngle;\n}\n\nfunction drawFullCircleBorders(ctx, element, inner) {\n var x = element.x,\n y = element.y,\n startAngle = element.startAngle,\n pixelMargin = element.pixelMargin,\n fullCircles = element.fullCircles;\n var outerRadius = Math.max(element.outerRadius - pixelMargin, 0);\n var innerRadius = element.innerRadius + pixelMargin;\n var i;\n\n if (inner) {\n clipArc(ctx, element, startAngle + TAU);\n }\n\n ctx.beginPath();\n ctx.arc(x, y, innerRadius, startAngle + TAU, startAngle, true);\n\n for (i = 0; i < fullCircles; ++i) {\n ctx.stroke();\n }\n\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, startAngle, startAngle + TAU);\n\n for (i = 0; i < fullCircles; ++i) {\n ctx.stroke();\n }\n}\n\nfunction drawBorder(ctx, element, offset, endAngle) {\n var options = element.options;\n var inner = options.borderAlign === 'inner';\n\n if (!options.borderWidth) {\n return;\n }\n\n if (inner) {\n ctx.lineWidth = options.borderWidth * 2;\n ctx.lineJoin = 'round';\n } else {\n ctx.lineWidth = options.borderWidth;\n ctx.lineJoin = 'bevel';\n }\n\n if (element.fullCircles) {\n drawFullCircleBorders(ctx, element, inner);\n }\n\n if (inner) {\n clipArc(ctx, element, endAngle);\n }\n\n pathArc(ctx, element, offset, endAngle);\n ctx.stroke();\n}\n\nvar ArcElement = /*#__PURE__*/function (_Element2) {\n _inherits(ArcElement, _Element2);\n\n var _super12 = _createSuper(ArcElement);\n\n function ArcElement(cfg) {\n var _this7;\n\n _classCallCheck(this, ArcElement);\n\n _this7 = _super12.call(this);\n _this7.options = undefined;\n _this7.circumference = undefined;\n _this7.startAngle = undefined;\n _this7.endAngle = undefined;\n _this7.innerRadius = undefined;\n _this7.outerRadius = undefined;\n _this7.pixelMargin = 0;\n _this7.fullCircles = 0;\n\n if (cfg) {\n Object.assign(_assertThisInitialized(_this7), cfg);\n }\n\n return _this7;\n }\n\n _createClass(ArcElement, [{\n key: \"inRange\",\n value: function inRange(chartX, chartY, useFinalPosition) {\n var point = this.getProps(['x', 'y'], useFinalPosition);\n\n var _getAngleFromPoint = getAngleFromPoint(point, {\n x: chartX,\n y: chartY\n }),\n angle = _getAngleFromPoint.angle,\n distance = _getAngleFromPoint.distance;\n\n var _this$getProps2 = this.getProps(['startAngle', 'endAngle', 'innerRadius', 'outerRadius', 'circumference'], useFinalPosition),\n startAngle = _this$getProps2.startAngle,\n endAngle = _this$getProps2.endAngle,\n innerRadius = _this$getProps2.innerRadius,\n outerRadius = _this$getProps2.outerRadius,\n circumference = _this$getProps2.circumference;\n\n var betweenAngles = circumference >= TAU || _angleBetween(angle, startAngle, endAngle);\n\n var withinRadius = distance >= innerRadius && distance <= outerRadius;\n return betweenAngles && withinRadius;\n }\n }, {\n key: \"getCenterPoint\",\n value: function getCenterPoint(useFinalPosition) {\n var _this$getProps3 = this.getProps(['x', 'y', 'startAngle', 'endAngle', 'innerRadius', 'outerRadius', 'circumference'], useFinalPosition),\n x = _this$getProps3.x,\n y = _this$getProps3.y,\n startAngle = _this$getProps3.startAngle,\n endAngle = _this$getProps3.endAngle,\n innerRadius = _this$getProps3.innerRadius,\n outerRadius = _this$getProps3.outerRadius;\n\n var halfAngle = (startAngle + endAngle) / 2;\n var halfRadius = (innerRadius + outerRadius) / 2;\n return {\n x: x + Math.cos(halfAngle) * halfRadius,\n y: y + Math.sin(halfAngle) * halfRadius\n };\n }\n }, {\n key: \"tooltipPosition\",\n value: function tooltipPosition(useFinalPosition) {\n return this.getCenterPoint(useFinalPosition);\n }\n }, {\n key: \"draw\",\n value: function draw(ctx) {\n var me = this;\n var options = me.options,\n circumference = me.circumference;\n var offset = (options.offset || 0) / 2;\n me.pixelMargin = options.borderAlign === 'inner' ? 0.33 : 0;\n me.fullCircles = circumference > TAU ? Math.floor(circumference / TAU) : 0;\n\n if (circumference === 0 || me.innerRadius < 0 || me.outerRadius < 0) {\n return;\n }\n\n ctx.save();\n var radiusOffset = 0;\n\n if (offset) {\n radiusOffset = offset / 2;\n var halfAngle = (me.startAngle + me.endAngle) / 2;\n ctx.translate(Math.cos(halfAngle) * radiusOffset, Math.sin(halfAngle) * radiusOffset);\n\n if (me.circumference >= PI) {\n radiusOffset = offset;\n }\n }\n\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n var endAngle = drawArc(ctx, me, radiusOffset);\n drawBorder(ctx, me, radiusOffset, endAngle);\n ctx.restore();\n }\n }]);\n\n return ArcElement;\n}(Element);\n\nArcElement.id = 'arc';\nArcElement.defaults = {\n borderAlign: 'center',\n borderColor: '#fff',\n borderRadius: 0,\n borderWidth: 2,\n offset: 0,\n angle: undefined\n};\nArcElement.defaultRoutes = {\n backgroundColor: 'backgroundColor'\n};\n\nfunction setStyle(ctx, options) {\n var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : options;\n ctx.lineCap = valueOrDefault(style.borderCapStyle, options.borderCapStyle);\n ctx.setLineDash(valueOrDefault(style.borderDash, options.borderDash));\n ctx.lineDashOffset = valueOrDefault(style.borderDashOffset, options.borderDashOffset);\n ctx.lineJoin = valueOrDefault(style.borderJoinStyle, options.borderJoinStyle);\n ctx.lineWidth = valueOrDefault(style.borderWidth, options.borderWidth);\n ctx.strokeStyle = valueOrDefault(style.borderColor, options.borderColor);\n}\n\nfunction lineTo(ctx, previous, target) {\n ctx.lineTo(target.x, target.y);\n}\n\nfunction getLineMethod(options) {\n if (options.stepped) {\n return _steppedLineTo;\n }\n\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierCurveTo;\n }\n\n return lineTo;\n}\n\nfunction pathVars(points, segment) {\n var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var count = points.length;\n var _params$start = params.start,\n paramsStart = _params$start === void 0 ? 0 : _params$start,\n _params$end = params.end,\n paramsEnd = _params$end === void 0 ? count - 1 : _params$end;\n var segmentStart = segment.start,\n segmentEnd = segment.end;\n var start = Math.max(paramsStart, segmentStart);\n var end = Math.min(paramsEnd, segmentEnd);\n var outside = paramsStart < segmentStart && paramsEnd < segmentStart || paramsStart > segmentEnd && paramsEnd > segmentEnd;\n return {\n count: count,\n start: start,\n loop: segment.loop,\n ilen: end < start && !outside ? count + end - start : end - start\n };\n}\n\nfunction pathSegment(ctx, line, segment, params) {\n var points = line.points,\n options = line.options;\n\n var _pathVars = pathVars(points, segment, params),\n count = _pathVars.count,\n start = _pathVars.start,\n loop = _pathVars.loop,\n ilen = _pathVars.ilen;\n\n var lineMethod = getLineMethod(options);\n\n var _ref2 = params || {},\n _ref2$move = _ref2.move,\n move = _ref2$move === void 0 ? true : _ref2$move,\n reverse = _ref2.reverse;\n\n var i, point, prev;\n\n for (i = 0; i <= ilen; ++i) {\n point = points[(start + (reverse ? ilen - i : i)) % count];\n\n if (point.skip) {\n continue;\n } else if (move) {\n ctx.moveTo(point.x, point.y);\n move = false;\n } else {\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n\n prev = point;\n }\n\n if (loop) {\n point = points[(start + (reverse ? ilen : 0)) % count];\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n\n return !!loop;\n}\n\nfunction fastPathSegment(ctx, line, segment, params) {\n var points = line.points;\n\n var _pathVars2 = pathVars(points, segment, params),\n count = _pathVars2.count,\n start = _pathVars2.start,\n ilen = _pathVars2.ilen;\n\n var _ref3 = params || {},\n _ref3$move = _ref3.move,\n move = _ref3$move === void 0 ? true : _ref3$move,\n reverse = _ref3.reverse;\n\n var avgX = 0;\n var countX = 0;\n var i, point, prevX, minY, maxY, lastY;\n\n var pointIndex = function pointIndex(index) {\n return (start + (reverse ? ilen - index : index)) % count;\n };\n\n var drawX = function drawX() {\n if (minY !== maxY) {\n ctx.lineTo(avgX, maxY);\n ctx.lineTo(avgX, minY);\n ctx.lineTo(avgX, lastY);\n }\n };\n\n if (move) {\n point = points[pointIndex(0)];\n ctx.moveTo(point.x, point.y);\n }\n\n for (i = 0; i <= ilen; ++i) {\n point = points[pointIndex(i)];\n\n if (point.skip) {\n continue;\n }\n\n var x = point.x;\n var y = point.y;\n var truncX = x | 0;\n\n if (truncX === prevX) {\n if (y < minY) {\n minY = y;\n } else if (y > maxY) {\n maxY = y;\n }\n\n avgX = (countX * avgX + x) / ++countX;\n } else {\n drawX();\n ctx.lineTo(x, y);\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n }\n\n lastY = y;\n }\n\n drawX();\n}\n\nfunction _getSegmentMethod(line) {\n var opts = line.options;\n var borderDash = opts.borderDash && opts.borderDash.length;\n var useFastPath = !line._decimated && !line._loop && !opts.tension && opts.cubicInterpolationMode !== 'monotone' && !opts.stepped && !borderDash;\n return useFastPath ? fastPathSegment : pathSegment;\n}\n\nfunction _getInterpolationMethod(options) {\n if (options.stepped) {\n return _steppedInterpolation;\n }\n\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierInterpolation;\n }\n\n return _pointInLine;\n}\n\nfunction strokePathWithCache(ctx, line, start, count) {\n var path = line._path;\n\n if (!path) {\n path = line._path = new Path2D();\n\n if (line.path(path, start, count)) {\n path.closePath();\n }\n }\n\n setStyle(ctx, line.options);\n ctx.stroke(path);\n}\n\nfunction strokePathDirect(ctx, line, start, count) {\n var segments = line.segments,\n options = line.options;\n\n var segmentMethod = _getSegmentMethod(line);\n\n var _iterator8 = _createForOfIteratorHelper(segments),\n _step8;\n\n try {\n for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {\n var segment = _step8.value;\n setStyle(ctx, options, segment.style);\n ctx.beginPath();\n\n if (segmentMethod(ctx, line, segment, {\n start: start,\n end: start + count - 1\n })) {\n ctx.closePath();\n }\n\n ctx.stroke();\n }\n } catch (err) {\n _iterator8.e(err);\n } finally {\n _iterator8.f();\n }\n}\n\nvar usePath2D = typeof Path2D === 'function';\n\nfunction _draw(ctx, line, start, count) {\n if (usePath2D && line.segments.length === 1) {\n strokePathWithCache(ctx, line, start, count);\n } else {\n strokePathDirect(ctx, line, start, count);\n }\n}\n\nvar LineElement = /*#__PURE__*/function (_Element3) {\n _inherits(LineElement, _Element3);\n\n var _super13 = _createSuper(LineElement);\n\n function LineElement(cfg) {\n var _this8;\n\n _classCallCheck(this, LineElement);\n\n _this8 = _super13.call(this);\n _this8.animated = true;\n _this8.options = undefined;\n _this8._loop = undefined;\n _this8._fullLoop = undefined;\n _this8._path = undefined;\n _this8._points = undefined;\n _this8._segments = undefined;\n _this8._decimated = false;\n _this8._pointsUpdated = false;\n\n if (cfg) {\n Object.assign(_assertThisInitialized(_this8), cfg);\n }\n\n return _this8;\n }\n\n _createClass(LineElement, [{\n key: \"updateControlPoints\",\n value: function updateControlPoints(chartArea, indexAxis) {\n var me = this;\n var options = me.options;\n\n if ((options.tension || options.cubicInterpolationMode === 'monotone') && !options.stepped && !me._pointsUpdated) {\n var loop = options.spanGaps ? me._loop : me._fullLoop;\n\n _updateBezierControlPoints(me._points, options, chartArea, loop, indexAxis);\n\n me._pointsUpdated = true;\n }\n }\n }, {\n key: \"points\",\n get: function get() {\n return this._points;\n },\n set: function set(points) {\n var me = this;\n me._points = points;\n delete me._segments;\n delete me._path;\n me._pointsUpdated = false;\n }\n }, {\n key: \"segments\",\n get: function get() {\n return this._segments || (this._segments = _computeSegments(this, this.options.segment));\n }\n }, {\n key: \"first\",\n value: function first() {\n var segments = this.segments;\n var points = this.points;\n return segments.length && points[segments[0].start];\n }\n }, {\n key: \"last\",\n value: function last() {\n var segments = this.segments;\n var points = this.points;\n var count = segments.length;\n return count && points[segments[count - 1].end];\n }\n }, {\n key: \"interpolate\",\n value: function interpolate(point, property) {\n var me = this;\n var options = me.options;\n var value = point[property];\n var points = me.points;\n\n var segments = _boundSegments(me, {\n property: property,\n start: value,\n end: value\n });\n\n if (!segments.length) {\n return;\n }\n\n var result = [];\n\n var _interpolate = _getInterpolationMethod(options);\n\n var i, ilen;\n\n for (i = 0, ilen = segments.length; i < ilen; ++i) {\n var _segments$i = segments[i],\n start = _segments$i.start,\n end = _segments$i.end;\n var p1 = points[start];\n var p2 = points[end];\n\n if (p1 === p2) {\n result.push(p1);\n continue;\n }\n\n var t = Math.abs((value - p1[property]) / (p2[property] - p1[property]));\n\n var interpolated = _interpolate(p1, p2, t, options.stepped);\n\n interpolated[property] = point[property];\n result.push(interpolated);\n }\n\n return result.length === 1 ? result[0] : result;\n }\n }, {\n key: \"pathSegment\",\n value: function pathSegment(ctx, segment, params) {\n var segmentMethod = _getSegmentMethod(this);\n\n return segmentMethod(ctx, this, segment, params);\n }\n }, {\n key: \"path\",\n value: function path(ctx, start, count) {\n var me = this;\n var segments = me.segments;\n\n var segmentMethod = _getSegmentMethod(me);\n\n var loop = me._loop;\n start = start || 0;\n count = count || me.points.length - start;\n\n var _iterator9 = _createForOfIteratorHelper(segments),\n _step9;\n\n try {\n for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {\n var segment = _step9.value;\n loop &= segmentMethod(ctx, me, segment, {\n start: start,\n end: start + count - 1\n });\n }\n } catch (err) {\n _iterator9.e(err);\n } finally {\n _iterator9.f();\n }\n\n return !!loop;\n }\n }, {\n key: \"draw\",\n value: function draw(ctx, chartArea, start, count) {\n var me = this;\n var options = me.options || {};\n var points = me.points || [];\n\n if (!points.length || !options.borderWidth) {\n return;\n }\n\n ctx.save();\n\n _draw(ctx, me, start, count);\n\n ctx.restore();\n\n if (me.animated) {\n me._pointsUpdated = false;\n me._path = undefined;\n }\n }\n }]);\n\n return LineElement;\n}(Element);\n\nLineElement.id = 'line';\nLineElement.defaults = {\n borderCapStyle: 'butt',\n borderDash: [],\n borderDashOffset: 0,\n borderJoinStyle: 'miter',\n borderWidth: 3,\n capBezierPoints: true,\n cubicInterpolationMode: 'default',\n fill: false,\n spanGaps: false,\n stepped: false,\n tension: 0\n};\nLineElement.defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n};\nLineElement.descriptors = {\n _scriptable: true,\n _indexable: function _indexable(name) {\n return name !== 'borderDash' && name !== 'fill';\n }\n};\n\nfunction inRange$1(el, pos, axis, useFinalPosition) {\n var options = el.options;\n\n var _el$getProps = el.getProps([axis], useFinalPosition),\n value = _el$getProps[axis];\n\n return Math.abs(pos - value) < options.radius + options.hitRadius;\n}\n\nvar PointElement = /*#__PURE__*/function (_Element4) {\n _inherits(PointElement, _Element4);\n\n var _super14 = _createSuper(PointElement);\n\n function PointElement(cfg) {\n var _this9;\n\n _classCallCheck(this, PointElement);\n\n _this9 = _super14.call(this);\n _this9.options = undefined;\n _this9.parsed = undefined;\n _this9.skip = undefined;\n _this9.stop = undefined;\n\n if (cfg) {\n Object.assign(_assertThisInitialized(_this9), cfg);\n }\n\n return _this9;\n }\n\n _createClass(PointElement, [{\n key: \"inRange\",\n value: function inRange(mouseX, mouseY, useFinalPosition) {\n var options = this.options;\n\n var _this$getProps4 = this.getProps(['x', 'y'], useFinalPosition),\n x = _this$getProps4.x,\n y = _this$getProps4.y;\n\n return Math.pow(mouseX - x, 2) + Math.pow(mouseY - y, 2) < Math.pow(options.hitRadius + options.radius, 2);\n }\n }, {\n key: \"inXRange\",\n value: function inXRange(mouseX, useFinalPosition) {\n return inRange$1(this, mouseX, 'x', useFinalPosition);\n }\n }, {\n key: \"inYRange\",\n value: function inYRange(mouseY, useFinalPosition) {\n return inRange$1(this, mouseY, 'y', useFinalPosition);\n }\n }, {\n key: \"getCenterPoint\",\n value: function getCenterPoint(useFinalPosition) {\n var _this$getProps5 = this.getProps(['x', 'y'], useFinalPosition),\n x = _this$getProps5.x,\n y = _this$getProps5.y;\n\n return {\n x: x,\n y: y\n };\n }\n }, {\n key: \"size\",\n value: function size(options) {\n options = options || this.options || {};\n var radius = options.radius || 0;\n radius = Math.max(radius, radius && options.hoverRadius || 0);\n var borderWidth = radius && options.borderWidth || 0;\n return (radius + borderWidth) * 2;\n }\n }, {\n key: \"draw\",\n value: function draw(ctx) {\n var me = this;\n var options = me.options;\n\n if (me.skip || options.radius < 0.1) {\n return;\n }\n\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n ctx.fillStyle = options.backgroundColor;\n drawPoint(ctx, options, me.x, me.y);\n }\n }, {\n key: \"getRange\",\n value: function getRange() {\n var options = this.options || {};\n return options.radius + options.hitRadius;\n }\n }]);\n\n return PointElement;\n}(Element);\n\nPointElement.id = 'point';\nPointElement.defaults = {\n borderWidth: 1,\n hitRadius: 1,\n hoverBorderWidth: 1,\n hoverRadius: 4,\n pointStyle: 'circle',\n radius: 3,\n rotation: 0\n};\nPointElement.defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n};\n\nfunction getBarBounds(bar, useFinalPosition) {\n var _bar$getProps = bar.getProps(['x', 'y', 'base', 'width', 'height'], useFinalPosition),\n x = _bar$getProps.x,\n y = _bar$getProps.y,\n base = _bar$getProps.base,\n width = _bar$getProps.width,\n height = _bar$getProps.height;\n\n var left, right, top, bottom, half;\n\n if (bar.horizontal) {\n half = height / 2;\n left = Math.min(x, base);\n right = Math.max(x, base);\n top = y - half;\n bottom = y + half;\n } else {\n half = width / 2;\n left = x - half;\n right = x + half;\n top = Math.min(y, base);\n bottom = Math.max(y, base);\n }\n\n return {\n left: left,\n top: top,\n right: right,\n bottom: bottom\n };\n}\n\nfunction parseBorderSkipped(bar) {\n var edge = bar.options.borderSkipped;\n var res = {};\n\n if (!edge) {\n return res;\n }\n\n edge = bar.horizontal ? parseEdge(edge, 'left', 'right', bar.base > bar.x) : parseEdge(edge, 'bottom', 'top', bar.base < bar.y);\n res[edge] = true;\n return res;\n}\n\nfunction parseEdge(edge, a, b, reverse) {\n if (reverse) {\n edge = swap(edge, a, b);\n edge = startEnd(edge, b, a);\n } else {\n edge = startEnd(edge, a, b);\n }\n\n return edge;\n}\n\nfunction swap(orig, v1, v2) {\n return orig === v1 ? v2 : orig === v2 ? v1 : orig;\n}\n\nfunction startEnd(v, start, end) {\n return v === 'start' ? start : v === 'end' ? end : v;\n}\n\nfunction skipOrLimit(skip, value, min, max) {\n return skip ? 0 : Math.max(Math.min(value, max), min);\n}\n\nfunction parseBorderWidth(bar, maxW, maxH) {\n var value = bar.options.borderWidth;\n var skip = parseBorderSkipped(bar);\n var o = toTRBL(value);\n return {\n t: skipOrLimit(skip.top, o.top, 0, maxH),\n r: skipOrLimit(skip.right, o.right, 0, maxW),\n b: skipOrLimit(skip.bottom, o.bottom, 0, maxH),\n l: skipOrLimit(skip.left, o.left, 0, maxW)\n };\n}\n\nfunction parseBorderRadius(bar, maxW, maxH) {\n var _bar$getProps2 = bar.getProps(['enableBorderRadius']),\n enableBorderRadius = _bar$getProps2.enableBorderRadius;\n\n var value = bar.options.borderRadius;\n var o = toTRBLCorners(value);\n var maxR = Math.min(maxW, maxH);\n var skip = parseBorderSkipped(bar);\n var enableBorder = enableBorderRadius || isObject(value);\n return {\n topLeft: skipOrLimit(!enableBorder || skip.top || skip.left, o.topLeft, 0, maxR),\n topRight: skipOrLimit(!enableBorder || skip.top || skip.right, o.topRight, 0, maxR),\n bottomLeft: skipOrLimit(!enableBorder || skip.bottom || skip.left, o.bottomLeft, 0, maxR),\n bottomRight: skipOrLimit(!enableBorder || skip.bottom || skip.right, o.bottomRight, 0, maxR)\n };\n}\n\nfunction boundingRects(bar) {\n var bounds = getBarBounds(bar);\n var width = bounds.right - bounds.left;\n var height = bounds.bottom - bounds.top;\n var border = parseBorderWidth(bar, width / 2, height / 2);\n var radius = parseBorderRadius(bar, width / 2, height / 2);\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height,\n radius: radius\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b,\n radius: {\n topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),\n topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),\n bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),\n bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r))\n }\n }\n };\n}\n\nfunction _inRange(bar, x, y, useFinalPosition) {\n var skipX = x === null;\n var skipY = y === null;\n var skipBoth = skipX && skipY;\n var bounds = bar && !skipBoth && getBarBounds(bar, useFinalPosition);\n return bounds && (skipX || x >= bounds.left && x <= bounds.right) && (skipY || y >= bounds.top && y <= bounds.bottom);\n}\n\nfunction hasRadius(radius) {\n return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;\n}\n\nfunction addNormalRectPath(ctx, rect) {\n ctx.rect(rect.x, rect.y, rect.w, rect.h);\n}\n\nvar BarElement = /*#__PURE__*/function (_Element5) {\n _inherits(BarElement, _Element5);\n\n var _super15 = _createSuper(BarElement);\n\n function BarElement(cfg) {\n var _this10;\n\n _classCallCheck(this, BarElement);\n\n _this10 = _super15.call(this);\n _this10.options = undefined;\n _this10.horizontal = undefined;\n _this10.base = undefined;\n _this10.width = undefined;\n _this10.height = undefined;\n\n if (cfg) {\n Object.assign(_assertThisInitialized(_this10), cfg);\n }\n\n return _this10;\n }\n\n _createClass(BarElement, [{\n key: \"draw\",\n value: function draw(ctx) {\n var options = this.options;\n\n var _boundingRects = boundingRects(this),\n inner = _boundingRects.inner,\n outer = _boundingRects.outer;\n\n var addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;\n ctx.save();\n\n if (outer.w !== inner.w || outer.h !== inner.h) {\n ctx.beginPath();\n addRectPath(ctx, outer);\n ctx.clip();\n addRectPath(ctx, inner);\n ctx.fillStyle = options.borderColor;\n ctx.fill('evenodd');\n }\n\n ctx.beginPath();\n addRectPath(ctx, inner);\n ctx.fillStyle = options.backgroundColor;\n ctx.fill();\n ctx.restore();\n }\n }, {\n key: \"inRange\",\n value: function inRange(mouseX, mouseY, useFinalPosition) {\n return _inRange(this, mouseX, mouseY, useFinalPosition);\n }\n }, {\n key: \"inXRange\",\n value: function inXRange(mouseX, useFinalPosition) {\n return _inRange(this, mouseX, null, useFinalPosition);\n }\n }, {\n key: \"inYRange\",\n value: function inYRange(mouseY, useFinalPosition) {\n return _inRange(this, null, mouseY, useFinalPosition);\n }\n }, {\n key: \"getCenterPoint\",\n value: function getCenterPoint(useFinalPosition) {\n var _this$getProps6 = this.getProps(['x', 'y', 'base', 'horizontal'], useFinalPosition),\n x = _this$getProps6.x,\n y = _this$getProps6.y,\n base = _this$getProps6.base,\n horizontal = _this$getProps6.horizontal;\n\n return {\n x: horizontal ? (x + base) / 2 : x,\n y: horizontal ? y : (y + base) / 2\n };\n }\n }, {\n key: \"getRange\",\n value: function getRange(axis) {\n return axis === 'x' ? this.width / 2 : this.height / 2;\n }\n }]);\n\n return BarElement;\n}(Element);\n\nBarElement.id = 'bar';\nBarElement.defaults = {\n borderSkipped: 'start',\n borderWidth: 0,\n borderRadius: 0,\n enableBorderRadius: true,\n pointStyle: undefined\n};\nBarElement.defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n};\nvar elements = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ArcElement: ArcElement,\n LineElement: LineElement,\n PointElement: PointElement,\n BarElement: BarElement\n});\n\nfunction lttbDecimation(data, start, count, availableWidth, options) {\n var samples = options.samples || availableWidth;\n\n if (samples >= count) {\n return data.slice(start, start + count);\n }\n\n var decimated = [];\n var bucketWidth = (count - 2) / (samples - 2);\n var sampledIndex = 0;\n var endIndex = start + count - 1;\n var a = start;\n var i, maxAreaPoint, maxArea, area, nextA;\n decimated[sampledIndex++] = data[a];\n\n for (i = 0; i < samples - 2; i++) {\n var avgX = 0;\n var avgY = 0;\n var j = void 0;\n var avgRangeStart = Math.floor((i + 1) * bucketWidth) + 1 + start;\n var avgRangeEnd = Math.min(Math.floor((i + 2) * bucketWidth) + 1, count) + start;\n var avgRangeLength = avgRangeEnd - avgRangeStart;\n\n for (j = avgRangeStart; j < avgRangeEnd; j++) {\n avgX += data[j].x;\n avgY += data[j].y;\n }\n\n avgX /= avgRangeLength;\n avgY /= avgRangeLength;\n var rangeOffs = Math.floor(i * bucketWidth) + 1 + start;\n var rangeTo = Math.floor((i + 1) * bucketWidth) + 1 + start;\n var _data$a = data[a],\n pointAx = _data$a.x,\n pointAy = _data$a.y;\n maxArea = area = -1;\n\n for (j = rangeOffs; j < rangeTo; j++) {\n area = 0.5 * Math.abs((pointAx - avgX) * (data[j].y - pointAy) - (pointAx - data[j].x) * (avgY - pointAy));\n\n if (area > maxArea) {\n maxArea = area;\n maxAreaPoint = data[j];\n nextA = j;\n }\n }\n\n decimated[sampledIndex++] = maxAreaPoint;\n a = nextA;\n }\n\n decimated[sampledIndex++] = data[endIndex];\n return decimated;\n}\n\nfunction minMaxDecimation(data, start, count, availableWidth) {\n var avgX = 0;\n var countX = 0;\n var i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;\n var decimated = [];\n var endIndex = start + count - 1;\n var xMin = data[start].x;\n var xMax = data[endIndex].x;\n var dx = xMax - xMin;\n\n for (i = start; i < start + count; ++i) {\n point = data[i];\n x = (point.x - xMin) / dx * availableWidth;\n y = point.y;\n var truncX = x | 0;\n\n if (truncX === prevX) {\n if (y < minY) {\n minY = y;\n minIndex = i;\n } else if (y > maxY) {\n maxY = y;\n maxIndex = i;\n }\n\n avgX = (countX * avgX + point.x) / ++countX;\n } else {\n var lastIndex = i - 1;\n\n if (!isNullOrUndef(minIndex) && !isNullOrUndef(maxIndex)) {\n var intermediateIndex1 = Math.min(minIndex, maxIndex);\n var intermediateIndex2 = Math.max(minIndex, maxIndex);\n\n if (intermediateIndex1 !== startIndex && intermediateIndex1 !== lastIndex) {\n decimated.push(_objectSpread(_objectSpread({}, data[intermediateIndex1]), {}, {\n x: avgX\n }));\n }\n\n if (intermediateIndex2 !== startIndex && intermediateIndex2 !== lastIndex) {\n decimated.push(_objectSpread(_objectSpread({}, data[intermediateIndex2]), {}, {\n x: avgX\n }));\n }\n }\n\n if (i > 0 && lastIndex !== startIndex) {\n decimated.push(data[lastIndex]);\n }\n\n decimated.push(point);\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n minIndex = maxIndex = startIndex = i;\n }\n }\n\n return decimated;\n}\n\nfunction cleanDecimatedDataset(dataset) {\n if (dataset._decimated) {\n var data = dataset._data;\n delete dataset._decimated;\n delete dataset._data;\n Object.defineProperty(dataset, 'data', {\n value: data\n });\n }\n}\n\nfunction cleanDecimatedData(chart) {\n chart.data.datasets.forEach(function (dataset) {\n cleanDecimatedDataset(dataset);\n });\n}\n\nfunction getStartAndCountOfVisiblePointsSimplified(meta, points) {\n var pointCount = points.length;\n var start = 0;\n var count;\n var iScale = meta.iScale;\n\n var _iScale$getUserBounds2 = iScale.getUserBounds(),\n min = _iScale$getUserBounds2.min,\n max = _iScale$getUserBounds2.max,\n minDefined = _iScale$getUserBounds2.minDefined,\n maxDefined = _iScale$getUserBounds2.maxDefined;\n\n if (minDefined) {\n start = _limitValue(_lookupByKey(points, iScale.axis, min).lo, 0, pointCount - 1);\n }\n\n if (maxDefined) {\n count = _limitValue(_lookupByKey(points, iScale.axis, max).hi + 1, start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n\n return {\n start: start,\n count: count\n };\n}\n\nvar plugin_decimation = {\n id: 'decimation',\n defaults: {\n algorithm: 'min-max',\n enabled: false\n },\n beforeElementsUpdate: function beforeElementsUpdate(chart, args, options) {\n if (!options.enabled) {\n cleanDecimatedData(chart);\n return;\n }\n\n var availableWidth = chart.width;\n chart.data.datasets.forEach(function (dataset, datasetIndex) {\n var _data = dataset._data,\n indexAxis = dataset.indexAxis;\n var meta = chart.getDatasetMeta(datasetIndex);\n var data = _data || dataset.data;\n\n if (resolve([indexAxis, chart.options.indexAxis]) === 'y') {\n return;\n }\n\n if (meta.type !== 'line') {\n return;\n }\n\n var xAxis = chart.scales[meta.xAxisID];\n\n if (xAxis.type !== 'linear' && xAxis.type !== 'time') {\n return;\n }\n\n if (chart.options.parsing) {\n return;\n }\n\n var _getStartAndCountOfVi2 = getStartAndCountOfVisiblePointsSimplified(meta, data),\n start = _getStartAndCountOfVi2.start,\n count = _getStartAndCountOfVi2.count;\n\n if (count <= 4 * availableWidth) {\n cleanDecimatedDataset(dataset);\n return;\n }\n\n if (isNullOrUndef(_data)) {\n dataset._data = data;\n delete dataset.data;\n Object.defineProperty(dataset, 'data', {\n configurable: true,\n enumerable: true,\n get: function get() {\n return this._decimated;\n },\n set: function set(d) {\n this._data = d;\n }\n });\n }\n\n var decimated;\n\n switch (options.algorithm) {\n case 'lttb':\n decimated = lttbDecimation(data, start, count, availableWidth, options);\n break;\n\n case 'min-max':\n decimated = minMaxDecimation(data, start, count, availableWidth);\n break;\n\n default:\n throw new Error(\"Unsupported decimation algorithm '\".concat(options.algorithm, \"'\"));\n }\n\n dataset._decimated = decimated;\n });\n },\n destroy: function destroy(chart) {\n cleanDecimatedData(chart);\n }\n};\n\nfunction getLineByIndex(chart, index) {\n var meta = chart.getDatasetMeta(index);\n var visible = meta && chart.isDatasetVisible(index);\n return visible ? meta.dataset : null;\n}\n\nfunction parseFillOption(line) {\n var options = line.options;\n var fillOption = options.fill;\n var fill = valueOrDefault(fillOption && fillOption.target, fillOption);\n\n if (fill === undefined) {\n fill = !!options.backgroundColor;\n }\n\n if (fill === false || fill === null) {\n return false;\n }\n\n if (fill === true) {\n return 'origin';\n }\n\n return fill;\n}\n\nfunction decodeFill(line, index, count) {\n var fill = parseFillOption(line);\n\n if (isObject(fill)) {\n return isNaN(fill.value) ? false : fill;\n }\n\n var target = parseFloat(fill);\n\n if (isNumberFinite(target) && Math.floor(target) === target) {\n if (fill[0] === '-' || fill[0] === '+') {\n target = index + target;\n }\n\n if (target === index || target < 0 || target >= count) {\n return false;\n }\n\n return target;\n }\n\n return ['origin', 'start', 'end', 'stack'].indexOf(fill) >= 0 && fill;\n}\n\nfunction computeLinearBoundary(source) {\n var _source$scale = source.scale,\n scale = _source$scale === void 0 ? {} : _source$scale,\n fill = source.fill;\n var target = null;\n var horizontal;\n\n if (fill === 'start') {\n target = scale.bottom;\n } else if (fill === 'end') {\n target = scale.top;\n } else if (isObject(fill)) {\n target = scale.getPixelForValue(fill.value);\n } else if (scale.getBasePixel) {\n target = scale.getBasePixel();\n }\n\n if (isNumberFinite(target)) {\n horizontal = scale.isHorizontal();\n return {\n x: horizontal ? target : null,\n y: horizontal ? null : target\n };\n }\n\n return null;\n}\n\nvar simpleArc = /*#__PURE__*/function () {\n function simpleArc(opts) {\n _classCallCheck(this, simpleArc);\n\n this.x = opts.x;\n this.y = opts.y;\n this.radius = opts.radius;\n }\n\n _createClass(simpleArc, [{\n key: \"pathSegment\",\n value: function pathSegment(ctx, bounds, opts) {\n var x = this.x,\n y = this.y,\n radius = this.radius;\n bounds = bounds || {\n start: 0,\n end: TAU\n };\n ctx.arc(x, y, radius, bounds.end, bounds.start, true);\n return !opts.bounds;\n }\n }, {\n key: \"interpolate\",\n value: function interpolate(point) {\n var x = this.x,\n y = this.y,\n radius = this.radius;\n var angle = point.angle;\n return {\n x: x + Math.cos(angle) * radius,\n y: y + Math.sin(angle) * radius,\n angle: angle\n };\n }\n }]);\n\n return simpleArc;\n}();\n\nfunction computeCircularBoundary(source) {\n var scale = source.scale,\n fill = source.fill;\n var options = scale.options;\n var length = scale.getLabels().length;\n var target = [];\n var start = options.reverse ? scale.max : scale.min;\n var end = options.reverse ? scale.min : scale.max;\n var i, center, value;\n\n if (fill === 'start') {\n value = start;\n } else if (fill === 'end') {\n value = end;\n } else if (isObject(fill)) {\n value = fill.value;\n } else {\n value = scale.getBaseValue();\n }\n\n if (options.grid.circular) {\n center = scale.getPointPositionForValue(0, start);\n return new simpleArc({\n x: center.x,\n y: center.y,\n radius: scale.getDistanceFromCenterForValue(value)\n });\n }\n\n for (i = 0; i < length; ++i) {\n target.push(scale.getPointPositionForValue(i, value));\n }\n\n return target;\n}\n\nfunction computeBoundary(source) {\n var scale = source.scale || {};\n\n if (scale.getPointPositionForValue) {\n return computeCircularBoundary(source);\n }\n\n return computeLinearBoundary(source);\n}\n\nfunction pointsFromSegments(boundary, line) {\n var _ref4 = boundary || {},\n _ref4$x = _ref4.x,\n x = _ref4$x === void 0 ? null : _ref4$x,\n _ref4$y = _ref4.y,\n y = _ref4$y === void 0 ? null : _ref4$y;\n\n var linePoints = line.points;\n var points = [];\n line.segments.forEach(function (segment) {\n var first = linePoints[segment.start];\n var last = linePoints[segment.end];\n\n if (y !== null) {\n points.push({\n x: first.x,\n y: y\n });\n points.push({\n x: last.x,\n y: y\n });\n } else if (x !== null) {\n points.push({\n x: x,\n y: first.y\n });\n points.push({\n x: x,\n y: last.y\n });\n }\n });\n return points;\n}\n\nfunction buildStackLine(source) {\n var chart = source.chart,\n scale = source.scale,\n index = source.index,\n line = source.line;\n var points = [];\n var segments = line.segments;\n var sourcePoints = line.points;\n var linesBelow = getLinesBelow(chart, index);\n linesBelow.push(createBoundaryLine({\n x: null,\n y: scale.bottom\n }, line));\n\n for (var i = 0; i < segments.length; i++) {\n var segment = segments[i];\n\n for (var j = segment.start; j <= segment.end; j++) {\n addPointsBelow(points, sourcePoints[j], linesBelow);\n }\n }\n\n return new LineElement({\n points: points,\n options: {}\n });\n}\n\nvar isLineAndNotInHideAnimation = function isLineAndNotInHideAnimation(meta) {\n return meta.type === 'line' && !meta.hidden;\n};\n\nfunction getLinesBelow(chart, index) {\n var below = [];\n var metas = chart.getSortedVisibleDatasetMetas();\n\n for (var i = 0; i < metas.length; i++) {\n var meta = metas[i];\n\n if (meta.index === index) {\n break;\n }\n\n if (isLineAndNotInHideAnimation(meta)) {\n below.unshift(meta.dataset);\n }\n }\n\n return below;\n}\n\nfunction addPointsBelow(points, sourcePoint, linesBelow) {\n var postponed = [];\n\n for (var j = 0; j < linesBelow.length; j++) {\n var line = linesBelow[j];\n\n var _findPoint = findPoint(line, sourcePoint, 'x'),\n first = _findPoint.first,\n last = _findPoint.last,\n point = _findPoint.point;\n\n if (!point || first && last) {\n continue;\n }\n\n if (first) {\n postponed.unshift(point);\n } else {\n points.push(point);\n\n if (!last) {\n break;\n }\n }\n }\n\n points.push.apply(points, postponed);\n}\n\nfunction findPoint(line, sourcePoint, property) {\n var point = line.interpolate(sourcePoint, property);\n\n if (!point) {\n return {};\n }\n\n var pointValue = point[property];\n var segments = line.segments;\n var linePoints = line.points;\n var first = false;\n var last = false;\n\n for (var i = 0; i < segments.length; i++) {\n var segment = segments[i];\n var firstValue = linePoints[segment.start][property];\n var lastValue = linePoints[segment.end][property];\n\n if (pointValue >= firstValue && pointValue <= lastValue) {\n first = pointValue === firstValue;\n last = pointValue === lastValue;\n break;\n }\n }\n\n return {\n first: first,\n last: last,\n point: point\n };\n}\n\nfunction getTarget(source) {\n var chart = source.chart,\n fill = source.fill,\n line = source.line;\n\n if (isNumberFinite(fill)) {\n return getLineByIndex(chart, fill);\n }\n\n if (fill === 'stack') {\n return buildStackLine(source);\n }\n\n var boundary = computeBoundary(source);\n\n if (boundary instanceof simpleArc) {\n return boundary;\n }\n\n return createBoundaryLine(boundary, line);\n}\n\nfunction createBoundaryLine(boundary, line) {\n var points = [];\n var _loop = false;\n\n if (isArray(boundary)) {\n _loop = true;\n points = boundary;\n } else {\n points = pointsFromSegments(boundary, line);\n }\n\n return points.length ? new LineElement({\n points: points,\n options: {\n tension: 0\n },\n _loop: _loop,\n _fullLoop: _loop\n }) : null;\n}\n\nfunction resolveTarget(sources, index, propagate) {\n var source = sources[index];\n var fill = source.fill;\n var visited = [index];\n var target;\n\n if (!propagate) {\n return fill;\n }\n\n while (fill !== false && visited.indexOf(fill) === -1) {\n if (!isNumberFinite(fill)) {\n return fill;\n }\n\n target = sources[fill];\n\n if (!target) {\n return false;\n }\n\n if (target.visible) {\n return fill;\n }\n\n visited.push(fill);\n fill = target.fill;\n }\n\n return false;\n}\n\nfunction _clip(ctx, target, clipY) {\n ctx.beginPath();\n target.path(ctx);\n ctx.lineTo(target.last().x, clipY);\n ctx.lineTo(target.first().x, clipY);\n ctx.closePath();\n ctx.clip();\n}\n\nfunction getBounds(property, first, last, loop) {\n if (loop) {\n return;\n }\n\n var start = first[property];\n var end = last[property];\n\n if (property === 'angle') {\n start = _normalizeAngle(start);\n end = _normalizeAngle(end);\n }\n\n return {\n property: property,\n start: start,\n end: end\n };\n}\n\nfunction _getEdge(a, b, prop, fn) {\n if (a && b) {\n return fn(a[prop], b[prop]);\n }\n\n return a ? a[prop] : b ? b[prop] : 0;\n}\n\nfunction _segments(line, target, property) {\n var segments = line.segments;\n var points = line.points;\n var tpoints = target.points;\n var parts = [];\n\n var _iterator10 = _createForOfIteratorHelper(segments),\n _step10;\n\n try {\n for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {\n var segment = _step10.value;\n var bounds = getBounds(property, points[segment.start], points[segment.end], segment.loop);\n\n if (!target.segments) {\n parts.push({\n source: segment,\n target: bounds,\n start: points[segment.start],\n end: points[segment.end]\n });\n continue;\n }\n\n var targetSegments = _boundSegments(target, bounds);\n\n var _iterator11 = _createForOfIteratorHelper(targetSegments),\n _step11;\n\n try {\n for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {\n var tgt = _step11.value;\n var subBounds = getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);\n\n var fillSources = _boundSegment(segment, points, subBounds);\n\n var _iterator12 = _createForOfIteratorHelper(fillSources),\n _step12;\n\n try {\n for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {\n var fillSource = _step12.value;\n parts.push({\n source: fillSource,\n target: tgt,\n start: _defineProperty({}, property, _getEdge(bounds, subBounds, 'start', Math.max)),\n end: _defineProperty({}, property, _getEdge(bounds, subBounds, 'end', Math.min))\n });\n }\n } catch (err) {\n _iterator12.e(err);\n } finally {\n _iterator12.f();\n }\n }\n } catch (err) {\n _iterator11.e(err);\n } finally {\n _iterator11.f();\n }\n }\n } catch (err) {\n _iterator10.e(err);\n } finally {\n _iterator10.f();\n }\n\n return parts;\n}\n\nfunction clipBounds(ctx, scale, bounds) {\n var _scale$chart$chartAre = scale.chart.chartArea,\n top = _scale$chart$chartAre.top,\n bottom = _scale$chart$chartAre.bottom;\n\n var _ref5 = bounds || {},\n property = _ref5.property,\n start = _ref5.start,\n end = _ref5.end;\n\n if (property === 'x') {\n ctx.beginPath();\n ctx.rect(start, top, end - start, bottom - top);\n ctx.clip();\n }\n}\n\nfunction interpolatedLineTo(ctx, target, point, property) {\n var interpolatedPoint = target.interpolate(point, property);\n\n if (interpolatedPoint) {\n ctx.lineTo(interpolatedPoint.x, interpolatedPoint.y);\n }\n}\n\nfunction _fill(ctx, cfg) {\n var line = cfg.line,\n target = cfg.target,\n property = cfg.property,\n color = cfg.color,\n scale = cfg.scale;\n\n var segments = _segments(line, target, property);\n\n var _iterator13 = _createForOfIteratorHelper(segments),\n _step13;\n\n try {\n for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {\n var _step13$value = _step13.value,\n src = _step13$value.source,\n tgt = _step13$value.target,\n start = _step13$value.start,\n end = _step13$value.end;\n var _src$style = src.style;\n _src$style = _src$style === void 0 ? {} : _src$style;\n var _src$style$background = _src$style.backgroundColor,\n backgroundColor = _src$style$background === void 0 ? color : _src$style$background;\n ctx.save();\n ctx.fillStyle = backgroundColor;\n clipBounds(ctx, scale, getBounds(property, start, end));\n ctx.beginPath();\n var lineLoop = !!line.pathSegment(ctx, src);\n\n if (lineLoop) {\n ctx.closePath();\n } else {\n interpolatedLineTo(ctx, target, end, property);\n }\n\n var targetLoop = !!target.pathSegment(ctx, tgt, {\n move: lineLoop,\n reverse: true\n });\n var loop = lineLoop && targetLoop;\n\n if (!loop) {\n interpolatedLineTo(ctx, target, start, property);\n }\n\n ctx.closePath();\n ctx.fill(loop ? 'evenodd' : 'nonzero');\n ctx.restore();\n }\n } catch (err) {\n _iterator13.e(err);\n } finally {\n _iterator13.f();\n }\n}\n\nfunction doFill(ctx, cfg) {\n var line = cfg.line,\n target = cfg.target,\n above = cfg.above,\n below = cfg.below,\n area = cfg.area,\n scale = cfg.scale;\n var property = line._loop ? 'angle' : cfg.axis;\n ctx.save();\n\n if (property === 'x' && below !== above) {\n _clip(ctx, target, area.top);\n\n _fill(ctx, {\n line: line,\n target: target,\n color: above,\n scale: scale,\n property: property\n });\n\n ctx.restore();\n ctx.save();\n\n _clip(ctx, target, area.bottom);\n }\n\n _fill(ctx, {\n line: line,\n target: target,\n color: below,\n scale: scale,\n property: property\n });\n\n ctx.restore();\n}\n\nfunction drawfill(ctx, source, area) {\n var target = getTarget(source);\n var line = source.line,\n scale = source.scale,\n axis = source.axis;\n var lineOpts = line.options;\n var fillOption = lineOpts.fill;\n var color = lineOpts.backgroundColor;\n\n var _ref6 = fillOption || {},\n _ref6$above = _ref6.above,\n above = _ref6$above === void 0 ? color : _ref6$above,\n _ref6$below = _ref6.below,\n below = _ref6$below === void 0 ? color : _ref6$below;\n\n if (target && line.points.length) {\n clipArea(ctx, area);\n doFill(ctx, {\n line: line,\n target: target,\n above: above,\n below: below,\n area: area,\n scale: scale,\n axis: axis\n });\n unclipArea(ctx);\n }\n}\n\nvar plugin_filler = {\n id: 'filler',\n afterDatasetsUpdate: function afterDatasetsUpdate(chart, _args, options) {\n var count = (chart.data.datasets || []).length;\n var sources = [];\n var meta, i, line, source;\n\n for (i = 0; i < count; ++i) {\n meta = chart.getDatasetMeta(i);\n line = meta.dataset;\n source = null;\n\n if (line && line.options && line instanceof LineElement) {\n source = {\n visible: chart.isDatasetVisible(i),\n index: i,\n fill: decodeFill(line, i, count),\n chart: chart,\n axis: meta.controller.options.indexAxis,\n scale: meta.vScale,\n line: line\n };\n }\n\n meta.$filler = source;\n sources.push(source);\n }\n\n for (i = 0; i < count; ++i) {\n source = sources[i];\n\n if (!source || source.fill === false) {\n continue;\n }\n\n source.fill = resolveTarget(sources, i, options.propagate);\n }\n },\n beforeDraw: function beforeDraw(chart, _args, options) {\n var draw = options.drawTime === 'beforeDraw';\n var metasets = chart.getSortedVisibleDatasetMetas();\n var area = chart.chartArea;\n\n for (var i = metasets.length - 1; i >= 0; --i) {\n var source = metasets[i].$filler;\n\n if (!source) {\n continue;\n }\n\n source.line.updateControlPoints(area, source.axis);\n\n if (draw) {\n drawfill(chart.ctx, source, area);\n }\n }\n },\n beforeDatasetsDraw: function beforeDatasetsDraw(chart, _args, options) {\n if (options.drawTime !== 'beforeDatasetsDraw') {\n return;\n }\n\n var metasets = chart.getSortedVisibleDatasetMetas();\n\n for (var i = metasets.length - 1; i >= 0; --i) {\n var source = metasets[i].$filler;\n\n if (source) {\n drawfill(chart.ctx, source, chart.chartArea);\n }\n }\n },\n beforeDatasetDraw: function beforeDatasetDraw(chart, args, options) {\n var source = args.meta.$filler;\n\n if (!source || source.fill === false || options.drawTime !== 'beforeDatasetDraw') {\n return;\n }\n\n drawfill(chart.ctx, source, chart.chartArea);\n },\n defaults: {\n propagate: true,\n drawTime: 'beforeDatasetDraw'\n }\n};\n\nvar getBoxSize = function getBoxSize(labelOpts, fontSize) {\n var _labelOpts$boxHeight = labelOpts.boxHeight,\n boxHeight = _labelOpts$boxHeight === void 0 ? fontSize : _labelOpts$boxHeight,\n _labelOpts$boxWidth = labelOpts.boxWidth,\n boxWidth = _labelOpts$boxWidth === void 0 ? fontSize : _labelOpts$boxWidth;\n\n if (labelOpts.usePointStyle) {\n boxHeight = Math.min(boxHeight, fontSize);\n boxWidth = Math.min(boxWidth, fontSize);\n }\n\n return {\n boxWidth: boxWidth,\n boxHeight: boxHeight,\n itemHeight: Math.max(fontSize, boxHeight)\n };\n};\n\nvar itemsEqual = function itemsEqual(a, b) {\n return a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index;\n};\n\nvar Legend = /*#__PURE__*/function (_Element6) {\n _inherits(Legend, _Element6);\n\n var _super16 = _createSuper(Legend);\n\n function Legend(config) {\n var _this11;\n\n _classCallCheck(this, Legend);\n\n _this11 = _super16.call(this);\n _this11._added = false;\n _this11.legendHitBoxes = [];\n _this11._hoveredItem = null;\n _this11.doughnutMode = false;\n _this11.chart = config.chart;\n _this11.options = config.options;\n _this11.ctx = config.ctx;\n _this11.legendItems = undefined;\n _this11.columnSizes = undefined;\n _this11.lineWidths = undefined;\n _this11.maxHeight = undefined;\n _this11.maxWidth = undefined;\n _this11.top = undefined;\n _this11.bottom = undefined;\n _this11.left = undefined;\n _this11.right = undefined;\n _this11.height = undefined;\n _this11.width = undefined;\n _this11._margins = undefined;\n _this11.position = undefined;\n _this11.weight = undefined;\n _this11.fullSize = undefined;\n return _this11;\n }\n\n _createClass(Legend, [{\n key: \"update\",\n value: function update(maxWidth, maxHeight, margins) {\n var me = this;\n me.maxWidth = maxWidth;\n me.maxHeight = maxHeight;\n me._margins = margins;\n me.setDimensions();\n me.buildLabels();\n me.fit();\n }\n }, {\n key: \"setDimensions\",\n value: function setDimensions() {\n var me = this;\n\n if (me.isHorizontal()) {\n me.width = me.maxWidth;\n me.left = 0;\n me.right = me.width;\n } else {\n me.height = me.maxHeight;\n me.top = 0;\n me.bottom = me.height;\n }\n }\n }, {\n key: \"buildLabels\",\n value: function buildLabels() {\n var me = this;\n var labelOpts = me.options.labels || {};\n var legendItems = callback(labelOpts.generateLabels, [me.chart], me) || [];\n\n if (labelOpts.filter) {\n legendItems = legendItems.filter(function (item) {\n return labelOpts.filter(item, me.chart.data);\n });\n }\n\n if (labelOpts.sort) {\n legendItems = legendItems.sort(function (a, b) {\n return labelOpts.sort(a, b, me.chart.data);\n });\n }\n\n if (me.options.reverse) {\n legendItems.reverse();\n }\n\n me.legendItems = legendItems;\n }\n }, {\n key: \"fit\",\n value: function fit() {\n var me = this;\n var options = me.options,\n ctx = me.ctx;\n\n if (!options.display) {\n me.width = me.height = 0;\n return;\n }\n\n var labelOpts = options.labels;\n var labelFont = toFont(labelOpts.font);\n var fontSize = labelFont.size;\n\n var titleHeight = me._computeTitleHeight();\n\n var _getBoxSize = getBoxSize(labelOpts, fontSize),\n boxWidth = _getBoxSize.boxWidth,\n itemHeight = _getBoxSize.itemHeight;\n\n var width, height;\n ctx.font = labelFont.string;\n\n if (me.isHorizontal()) {\n width = me.maxWidth;\n height = me._fitRows(titleHeight, fontSize, boxWidth, itemHeight) + 10;\n } else {\n height = me.maxHeight;\n width = me._fitCols(titleHeight, fontSize, boxWidth, itemHeight) + 10;\n }\n\n me.width = Math.min(width, options.maxWidth || me.maxWidth);\n me.height = Math.min(height, options.maxHeight || me.maxHeight);\n }\n }, {\n key: \"_fitRows\",\n value: function _fitRows(titleHeight, fontSize, boxWidth, itemHeight) {\n var me = this;\n var ctx = me.ctx,\n maxWidth = me.maxWidth,\n padding = me.options.labels.padding;\n var hitboxes = me.legendHitBoxes = [];\n var lineWidths = me.lineWidths = [0];\n var lineHeight = itemHeight + padding;\n var totalHeight = titleHeight;\n ctx.textAlign = 'left';\n ctx.textBaseline = 'middle';\n var row = -1;\n var top = -lineHeight;\n me.legendItems.forEach(function (legendItem, i) {\n var itemWidth = boxWidth + fontSize / 2 + ctx.measureText(legendItem.text).width;\n\n if (i === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) {\n totalHeight += lineHeight;\n lineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0;\n top += lineHeight;\n row++;\n }\n\n hitboxes[i] = {\n left: 0,\n top: top,\n row: row,\n width: itemWidth,\n height: itemHeight\n };\n lineWidths[lineWidths.length - 1] += itemWidth + padding;\n });\n return totalHeight;\n }\n }, {\n key: \"_fitCols\",\n value: function _fitCols(titleHeight, fontSize, boxWidth, itemHeight) {\n var me = this;\n var ctx = me.ctx,\n maxHeight = me.maxHeight,\n padding = me.options.labels.padding;\n var hitboxes = me.legendHitBoxes = [];\n var columnSizes = me.columnSizes = [];\n var heightLimit = maxHeight - titleHeight;\n var totalWidth = padding;\n var currentColWidth = 0;\n var currentColHeight = 0;\n var left = 0;\n var top = 0;\n var col = 0;\n me.legendItems.forEach(function (legendItem, i) {\n var itemWidth = boxWidth + fontSize / 2 + ctx.measureText(legendItem.text).width;\n\n if (i > 0 && currentColHeight + fontSize + 2 * padding > heightLimit) {\n totalWidth += currentColWidth + padding;\n columnSizes.push({\n width: currentColWidth,\n height: currentColHeight\n });\n left += currentColWidth + padding;\n col++;\n top = 0;\n currentColWidth = currentColHeight = 0;\n }\n\n currentColWidth = Math.max(currentColWidth, itemWidth);\n currentColHeight += fontSize + padding;\n hitboxes[i] = {\n left: left,\n top: top,\n col: col,\n width: itemWidth,\n height: itemHeight\n };\n top += itemHeight + padding;\n });\n totalWidth += currentColWidth;\n columnSizes.push({\n width: currentColWidth,\n height: currentColHeight\n });\n return totalWidth;\n }\n }, {\n key: \"adjustHitBoxes\",\n value: function adjustHitBoxes() {\n var me = this;\n\n if (!me.options.display) {\n return;\n }\n\n var titleHeight = me._computeTitleHeight();\n\n var hitboxes = me.legendHitBoxes,\n _me$options6 = me.options,\n align = _me$options6.align,\n padding = _me$options6.labels.padding;\n\n if (this.isHorizontal()) {\n var row = 0;\n\n var left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]);\n\n var _iterator14 = _createForOfIteratorHelper(hitboxes),\n _step14;\n\n try {\n for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {\n var hitbox = _step14.value;\n\n if (row !== hitbox.row) {\n row = hitbox.row;\n left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]);\n }\n\n hitbox.top += me.top + titleHeight + padding;\n hitbox.left = left;\n left += hitbox.width + padding;\n }\n } catch (err) {\n _iterator14.e(err);\n } finally {\n _iterator14.f();\n }\n } else {\n var col = 0;\n\n var top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height);\n\n var _iterator15 = _createForOfIteratorHelper(hitboxes),\n _step15;\n\n try {\n for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {\n var _hitbox = _step15.value;\n\n if (_hitbox.col !== col) {\n col = _hitbox.col;\n top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height);\n }\n\n _hitbox.top = top;\n _hitbox.left += me.left + padding;\n top += _hitbox.height + padding;\n }\n } catch (err) {\n _iterator15.e(err);\n } finally {\n _iterator15.f();\n }\n }\n }\n }, {\n key: \"isHorizontal\",\n value: function isHorizontal() {\n return this.options.position === 'top' || this.options.position === 'bottom';\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var me = this;\n\n if (me.options.display) {\n var ctx = me.ctx;\n clipArea(ctx, me);\n\n me._draw();\n\n unclipArea(ctx);\n }\n }\n }, {\n key: \"_draw\",\n value: function _draw() {\n var me = this;\n var opts = me.options,\n columnSizes = me.columnSizes,\n lineWidths = me.lineWidths,\n ctx = me.ctx;\n var align = opts.align,\n labelOpts = opts.labels;\n var defaultColor = defaults.color;\n var rtlHelper = getRtlAdapter(opts.rtl, me.left, me.width);\n var labelFont = toFont(labelOpts.font);\n var fontColor = labelOpts.color,\n padding = labelOpts.padding;\n var fontSize = labelFont.size;\n var halfFontSize = fontSize / 2;\n var cursor;\n me.drawTitle();\n ctx.textAlign = rtlHelper.textAlign('left');\n ctx.textBaseline = 'middle';\n ctx.lineWidth = 0.5;\n ctx.font = labelFont.string;\n\n var _getBoxSize2 = getBoxSize(labelOpts, fontSize),\n boxWidth = _getBoxSize2.boxWidth,\n boxHeight = _getBoxSize2.boxHeight,\n itemHeight = _getBoxSize2.itemHeight;\n\n var drawLegendBox = function drawLegendBox(x, y, legendItem) {\n if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {\n return;\n }\n\n ctx.save();\n var lineWidth = valueOrDefault(legendItem.lineWidth, 1);\n ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);\n ctx.lineCap = valueOrDefault(legendItem.lineCap, 'butt');\n ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);\n ctx.lineJoin = valueOrDefault(legendItem.lineJoin, 'miter');\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);\n ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));\n\n if (labelOpts.usePointStyle) {\n var drawOptions = {\n radius: boxWidth * Math.SQRT2 / 2,\n pointStyle: legendItem.pointStyle,\n rotation: legendItem.rotation,\n borderWidth: lineWidth\n };\n var centerX = rtlHelper.xPlus(x, boxWidth / 2);\n var centerY = y + halfFontSize;\n drawPoint(ctx, drawOptions, centerX, centerY);\n } else {\n var yBoxTop = y + Math.max((fontSize - boxHeight) / 2, 0);\n var xBoxLeft = rtlHelper.leftForLtr(x, boxWidth);\n var borderRadius = toTRBLCorners(legendItem.borderRadius);\n ctx.beginPath();\n\n if (Object.values(borderRadius).some(function (v) {\n return v !== 0;\n })) {\n addRoundedRectPath(ctx, {\n x: xBoxLeft,\n y: yBoxTop,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius\n });\n } else {\n ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);\n }\n\n ctx.fill();\n\n if (lineWidth !== 0) {\n ctx.stroke();\n }\n }\n\n ctx.restore();\n };\n\n var fillText = function fillText(x, y, legendItem) {\n renderText(ctx, legendItem.text, x, y + itemHeight / 2, labelFont, {\n strikethrough: legendItem.hidden,\n textAlign: legendItem.textAlign\n });\n };\n\n var isHorizontal = me.isHorizontal();\n\n var titleHeight = this._computeTitleHeight();\n\n if (isHorizontal) {\n cursor = {\n x: _alignStartEnd(align, me.left + padding, me.right - lineWidths[0]),\n y: me.top + padding + titleHeight,\n line: 0\n };\n } else {\n cursor = {\n x: me.left + padding,\n y: _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - columnSizes[0].height),\n line: 0\n };\n }\n\n overrideTextDirection(me.ctx, opts.textDirection);\n var lineHeight = itemHeight + padding;\n me.legendItems.forEach(function (legendItem, i) {\n ctx.strokeStyle = legendItem.fontColor || fontColor;\n ctx.fillStyle = legendItem.fontColor || fontColor;\n var textWidth = ctx.measureText(legendItem.text).width;\n var textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));\n var width = boxWidth + fontSize / 2 + textWidth;\n var x = cursor.x;\n var y = cursor.y;\n rtlHelper.setWidth(me.width);\n\n if (isHorizontal) {\n if (i > 0 && x + width + padding > me.right) {\n y = cursor.y += lineHeight;\n cursor.line++;\n x = cursor.x = _alignStartEnd(align, me.left + padding, me.right - lineWidths[cursor.line]);\n }\n } else if (i > 0 && y + lineHeight > me.bottom) {\n x = cursor.x = x + columnSizes[cursor.line].width + padding;\n cursor.line++;\n y = cursor.y = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - columnSizes[cursor.line].height);\n }\n\n var realX = rtlHelper.x(x);\n drawLegendBox(realX, y, legendItem);\n x = _textX(textAlign, x + boxWidth + halfFontSize, me.right);\n fillText(rtlHelper.x(x), y, legendItem);\n\n if (isHorizontal) {\n cursor.x += width + padding;\n } else {\n cursor.y += lineHeight;\n }\n });\n restoreTextDirection(me.ctx, opts.textDirection);\n }\n }, {\n key: \"drawTitle\",\n value: function drawTitle() {\n var me = this;\n var opts = me.options;\n var titleOpts = opts.title;\n var titleFont = toFont(titleOpts.font);\n var titlePadding = toPadding(titleOpts.padding);\n\n if (!titleOpts.display) {\n return;\n }\n\n var rtlHelper = getRtlAdapter(opts.rtl, me.left, me.width);\n var ctx = me.ctx;\n var position = titleOpts.position;\n var halfFontSize = titleFont.size / 2;\n var topPaddingPlusHalfFontSize = titlePadding.top + halfFontSize;\n var y;\n var left = me.left;\n var maxWidth = me.width;\n\n if (this.isHorizontal()) {\n maxWidth = Math.max.apply(Math, _toConsumableArray(me.lineWidths));\n y = me.top + topPaddingPlusHalfFontSize;\n left = _alignStartEnd(opts.align, left, me.right - maxWidth);\n } else {\n var maxHeight = me.columnSizes.reduce(function (acc, size) {\n return Math.max(acc, size.height);\n }, 0);\n y = topPaddingPlusHalfFontSize + _alignStartEnd(opts.align, me.top, me.bottom - maxHeight - opts.labels.padding - me._computeTitleHeight());\n }\n\n var x = _alignStartEnd(position, left, left + maxWidth);\n\n ctx.textAlign = rtlHelper.textAlign(_toLeftRightCenter(position));\n ctx.textBaseline = 'middle';\n ctx.strokeStyle = titleOpts.color;\n ctx.fillStyle = titleOpts.color;\n ctx.font = titleFont.string;\n renderText(ctx, titleOpts.text, x, y, titleFont);\n }\n }, {\n key: \"_computeTitleHeight\",\n value: function _computeTitleHeight() {\n var titleOpts = this.options.title;\n var titleFont = toFont(titleOpts.font);\n var titlePadding = toPadding(titleOpts.padding);\n return titleOpts.display ? titleFont.lineHeight + titlePadding.height : 0;\n }\n }, {\n key: \"_getLegendItemAt\",\n value: function _getLegendItemAt(x, y) {\n var me = this;\n var i, hitBox, lh;\n\n if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {\n lh = me.legendHitBoxes;\n\n for (i = 0; i < lh.length; ++i) {\n hitBox = lh[i];\n\n if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {\n return me.legendItems[i];\n }\n }\n }\n\n return null;\n }\n }, {\n key: \"handleEvent\",\n value: function handleEvent(e) {\n var me = this;\n var opts = me.options;\n\n if (!isListened(e.type, opts)) {\n return;\n }\n\n var hoveredItem = me._getLegendItemAt(e.x, e.y);\n\n if (e.type === 'mousemove') {\n var previous = me._hoveredItem;\n var sameItem = itemsEqual(previous, hoveredItem);\n\n if (previous && !sameItem) {\n callback(opts.onLeave, [e, previous, me], me);\n }\n\n me._hoveredItem = hoveredItem;\n\n if (hoveredItem && !sameItem) {\n callback(opts.onHover, [e, hoveredItem, me], me);\n }\n } else if (hoveredItem) {\n callback(opts.onClick, [e, hoveredItem, me], me);\n }\n }\n }]);\n\n return Legend;\n}(Element);\n\nfunction isListened(type, opts) {\n if (type === 'mousemove' && (opts.onHover || opts.onLeave)) {\n return true;\n }\n\n if (opts.onClick && (type === 'click' || type === 'mouseup')) {\n return true;\n }\n\n return false;\n}\n\nvar plugin_legend = {\n id: 'legend',\n _element: Legend,\n start: function start(chart, _args, options) {\n var legend = chart.legend = new Legend({\n ctx: chart.ctx,\n options: options,\n chart: chart\n });\n layouts.configure(chart, legend, options);\n layouts.addBox(chart, legend);\n },\n stop: function stop(chart) {\n layouts.removeBox(chart, chart.legend);\n delete chart.legend;\n },\n beforeUpdate: function beforeUpdate(chart, _args, options) {\n var legend = chart.legend;\n layouts.configure(chart, legend, options);\n legend.options = options;\n },\n afterUpdate: function afterUpdate(chart) {\n var legend = chart.legend;\n legend.buildLabels();\n legend.adjustHitBoxes();\n },\n afterEvent: function afterEvent(chart, args) {\n if (!args.replay) {\n chart.legend.handleEvent(args.event);\n }\n },\n defaults: {\n display: true,\n position: 'top',\n align: 'center',\n fullSize: true,\n reverse: false,\n weight: 1000,\n onClick: function onClick(e, legendItem, legend) {\n var index = legendItem.datasetIndex;\n var ci = legend.chart;\n\n if (ci.isDatasetVisible(index)) {\n ci.hide(index);\n legendItem.hidden = true;\n } else {\n ci.show(index);\n legendItem.hidden = false;\n }\n },\n onHover: null,\n onLeave: null,\n labels: {\n color: function color(ctx) {\n return ctx.chart.options.color;\n },\n boxWidth: 40,\n padding: 10,\n generateLabels: function generateLabels(chart) {\n var datasets = chart.data.datasets;\n var _chart$legend$options = chart.legend.options.labels,\n usePointStyle = _chart$legend$options.usePointStyle,\n pointStyle = _chart$legend$options.pointStyle,\n textAlign = _chart$legend$options.textAlign,\n color = _chart$legend$options.color;\n return chart._getSortedDatasetMetas().map(function (meta) {\n var style = meta.controller.getStyle(usePointStyle ? 0 : undefined);\n var borderWidth = toPadding(style.borderWidth);\n return {\n text: datasets[meta.index].label,\n fillStyle: style.backgroundColor,\n fontColor: color,\n hidden: !meta.visible,\n lineCap: style.borderCapStyle,\n lineDash: style.borderDash,\n lineDashOffset: style.borderDashOffset,\n lineJoin: style.borderJoinStyle,\n lineWidth: (borderWidth.width + borderWidth.height) / 4,\n strokeStyle: style.borderColor,\n pointStyle: pointStyle || style.pointStyle,\n rotation: style.rotation,\n textAlign: textAlign || style.textAlign,\n borderRadius: 0,\n datasetIndex: meta.index\n };\n }, this);\n }\n },\n title: {\n color: function color(ctx) {\n return ctx.chart.options.color;\n },\n display: false,\n position: 'center',\n text: ''\n }\n },\n descriptors: {\n _scriptable: function _scriptable(name) {\n return !name.startsWith('on');\n },\n labels: {\n _scriptable: function _scriptable(name) {\n return !['generateLabels', 'filter', 'sort'].includes(name);\n }\n }\n }\n};\n\nvar Title = /*#__PURE__*/function (_Element7) {\n _inherits(Title, _Element7);\n\n var _super17 = _createSuper(Title);\n\n function Title(config) {\n var _this12;\n\n _classCallCheck(this, Title);\n\n _this12 = _super17.call(this);\n _this12.chart = config.chart;\n _this12.options = config.options;\n _this12.ctx = config.ctx;\n _this12._padding = undefined;\n _this12.top = undefined;\n _this12.bottom = undefined;\n _this12.left = undefined;\n _this12.right = undefined;\n _this12.width = undefined;\n _this12.height = undefined;\n _this12.position = undefined;\n _this12.weight = undefined;\n _this12.fullSize = undefined;\n return _this12;\n }\n\n _createClass(Title, [{\n key: \"update\",\n value: function update(maxWidth, maxHeight) {\n var me = this;\n var opts = me.options;\n me.left = 0;\n me.top = 0;\n\n if (!opts.display) {\n me.width = me.height = me.right = me.bottom = 0;\n return;\n }\n\n me.width = me.right = maxWidth;\n me.height = me.bottom = maxHeight;\n var lineCount = isArray(opts.text) ? opts.text.length : 1;\n me._padding = toPadding(opts.padding);\n\n var textSize = lineCount * toFont(opts.font).lineHeight + me._padding.height;\n\n if (me.isHorizontal()) {\n me.height = textSize;\n } else {\n me.width = textSize;\n }\n }\n }, {\n key: \"isHorizontal\",\n value: function isHorizontal() {\n var pos = this.options.position;\n return pos === 'top' || pos === 'bottom';\n }\n }, {\n key: \"_drawArgs\",\n value: function _drawArgs(offset) {\n var top = this.top,\n left = this.left,\n bottom = this.bottom,\n right = this.right,\n options = this.options;\n var align = options.align;\n var rotation = 0;\n var maxWidth, titleX, titleY;\n\n if (this.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n titleY = top + offset;\n maxWidth = right - left;\n } else {\n if (options.position === 'left') {\n titleX = left + offset;\n titleY = _alignStartEnd(align, bottom, top);\n rotation = PI * -0.5;\n } else {\n titleX = right - offset;\n titleY = _alignStartEnd(align, top, bottom);\n rotation = PI * 0.5;\n }\n\n maxWidth = bottom - top;\n }\n\n return {\n titleX: titleX,\n titleY: titleY,\n maxWidth: maxWidth,\n rotation: rotation\n };\n }\n }, {\n key: \"draw\",\n value: function draw() {\n var me = this;\n var ctx = me.ctx;\n var opts = me.options;\n\n if (!opts.display) {\n return;\n }\n\n var fontOpts = toFont(opts.font);\n var lineHeight = fontOpts.lineHeight;\n var offset = lineHeight / 2 + me._padding.top;\n\n var _me$_drawArgs = me._drawArgs(offset),\n titleX = _me$_drawArgs.titleX,\n titleY = _me$_drawArgs.titleY,\n maxWidth = _me$_drawArgs.maxWidth,\n rotation = _me$_drawArgs.rotation;\n\n renderText(ctx, opts.text, 0, 0, fontOpts, {\n color: opts.color,\n maxWidth: maxWidth,\n rotation: rotation,\n textAlign: _toLeftRightCenter(opts.align),\n textBaseline: 'middle',\n translation: [titleX, titleY]\n });\n }\n }]);\n\n return Title;\n}(Element);\n\nfunction createTitle(chart, titleOpts) {\n var title = new Title({\n ctx: chart.ctx,\n options: titleOpts,\n chart: chart\n });\n layouts.configure(chart, title, titleOpts);\n layouts.addBox(chart, title);\n chart.titleBlock = title;\n}\n\nvar plugin_title = {\n id: 'title',\n _element: Title,\n start: function start(chart, _args, options) {\n createTitle(chart, options);\n },\n stop: function stop(chart) {\n var titleBlock = chart.titleBlock;\n layouts.removeBox(chart, titleBlock);\n delete chart.titleBlock;\n },\n beforeUpdate: function beforeUpdate(chart, _args, options) {\n var title = chart.titleBlock;\n layouts.configure(chart, title, options);\n title.options = options;\n },\n defaults: {\n align: 'center',\n display: false,\n font: {\n weight: 'bold'\n },\n fullSize: true,\n padding: 10,\n position: 'top',\n text: '',\n weight: 2000\n },\n defaultRoutes: {\n color: 'color'\n },\n descriptors: {\n _scriptable: true,\n _indexable: false\n }\n};\nvar positioners = {\n average: function average(items) {\n if (!items.length) {\n return false;\n }\n\n var i, len;\n var x = 0;\n var y = 0;\n var count = 0;\n\n for (i = 0, len = items.length; i < len; ++i) {\n var el = items[i].element;\n\n if (el && el.hasValue()) {\n var pos = el.tooltipPosition();\n x += pos.x;\n y += pos.y;\n ++count;\n }\n }\n\n return {\n x: x / count,\n y: y / count\n };\n },\n nearest: function nearest(items, eventPosition) {\n if (!items.length) {\n return false;\n }\n\n var x = eventPosition.x;\n var y = eventPosition.y;\n var minDistance = Number.POSITIVE_INFINITY;\n var i, len, nearestElement;\n\n for (i = 0, len = items.length; i < len; ++i) {\n var el = items[i].element;\n\n if (el && el.hasValue()) {\n var center = el.getCenterPoint();\n var d = distanceBetweenPoints(eventPosition, center);\n\n if (d < minDistance) {\n minDistance = d;\n nearestElement = el;\n }\n }\n }\n\n if (nearestElement) {\n var tp = nearestElement.tooltipPosition();\n x = tp.x;\n y = tp.y;\n }\n\n return {\n x: x,\n y: y\n };\n }\n};\n\nfunction pushOrConcat(base, toPush) {\n if (toPush) {\n if (isArray(toPush)) {\n Array.prototype.push.apply(base, toPush);\n } else {\n base.push(toPush);\n }\n }\n\n return base;\n}\n\nfunction splitNewlines(str) {\n if ((typeof str === 'string' || str instanceof String) && str.indexOf('\\n') > -1) {\n return str.split('\\n');\n }\n\n return str;\n}\n\nfunction createTooltipItem(chart, item) {\n var element = item.element,\n datasetIndex = item.datasetIndex,\n index = item.index;\n var controller = chart.getDatasetMeta(datasetIndex).controller;\n\n var _controller$getLabelA = controller.getLabelAndValue(index),\n label = _controller$getLabelA.label,\n value = _controller$getLabelA.value;\n\n return {\n chart: chart,\n label: label,\n parsed: controller.getParsed(index),\n raw: chart.data.datasets[datasetIndex].data[index],\n formattedValue: value,\n dataset: controller.getDataset(),\n dataIndex: index,\n datasetIndex: datasetIndex,\n element: element\n };\n}\n\nfunction getTooltipSize(tooltip, options) {\n var ctx = tooltip._chart.ctx;\n var body = tooltip.body,\n footer = tooltip.footer,\n title = tooltip.title;\n var boxWidth = options.boxWidth,\n boxHeight = options.boxHeight;\n var bodyFont = toFont(options.bodyFont);\n var titleFont = toFont(options.titleFont);\n var footerFont = toFont(options.footerFont);\n var titleLineCount = title.length;\n var footerLineCount = footer.length;\n var bodyLineItemCount = body.length;\n var padding = toPadding(options.padding);\n var height = padding.height;\n var width = 0;\n var combinedBodyLength = body.reduce(function (count, bodyItem) {\n return count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length;\n }, 0);\n combinedBodyLength += tooltip.beforeBody.length + tooltip.afterBody.length;\n\n if (titleLineCount) {\n height += titleLineCount * titleFont.lineHeight + (titleLineCount - 1) * options.titleSpacing + options.titleMarginBottom;\n }\n\n if (combinedBodyLength) {\n var bodyLineHeight = options.displayColors ? Math.max(boxHeight, bodyFont.lineHeight) : bodyFont.lineHeight;\n height += bodyLineItemCount * bodyLineHeight + (combinedBodyLength - bodyLineItemCount) * bodyFont.lineHeight + (combinedBodyLength - 1) * options.bodySpacing;\n }\n\n if (footerLineCount) {\n height += options.footerMarginTop + footerLineCount * footerFont.lineHeight + (footerLineCount - 1) * options.footerSpacing;\n }\n\n var widthPadding = 0;\n\n var maxLineWidth = function maxLineWidth(line) {\n width = Math.max(width, ctx.measureText(line).width + widthPadding);\n };\n\n ctx.save();\n ctx.font = titleFont.string;\n each(tooltip.title, maxLineWidth);\n ctx.font = bodyFont.string;\n each(tooltip.beforeBody.concat(tooltip.afterBody), maxLineWidth);\n widthPadding = options.displayColors ? boxWidth + 2 : 0;\n each(body, function (bodyItem) {\n each(bodyItem.before, maxLineWidth);\n each(bodyItem.lines, maxLineWidth);\n each(bodyItem.after, maxLineWidth);\n });\n widthPadding = 0;\n ctx.font = footerFont.string;\n each(tooltip.footer, maxLineWidth);\n ctx.restore();\n width += padding.width;\n return {\n width: width,\n height: height\n };\n}\n\nfunction determineYAlign(chart, size) {\n var y = size.y,\n height = size.height;\n\n if (y < height / 2) {\n return 'top';\n } else if (y > chart.height - height / 2) {\n return 'bottom';\n }\n\n return 'center';\n}\n\nfunction doesNotFitWithAlign(xAlign, chart, options, size) {\n var x = size.x,\n width = size.width;\n var caret = options.caretSize + options.caretPadding;\n\n if (xAlign === 'left' && x + width + caret > chart.width) {\n return true;\n }\n\n if (xAlign === 'right' && x - width - caret < 0) {\n return true;\n }\n}\n\nfunction determineXAlign(chart, options, size, yAlign) {\n var x = size.x,\n width = size.width;\n var chartWidth = chart.width,\n _chart$chartArea = chart.chartArea,\n left = _chart$chartArea.left,\n right = _chart$chartArea.right;\n var xAlign = 'center';\n\n if (yAlign === 'center') {\n xAlign = x <= (left + right) / 2 ? 'left' : 'right';\n } else if (x <= width / 2) {\n xAlign = 'left';\n } else if (x >= chartWidth - width / 2) {\n xAlign = 'right';\n }\n\n if (doesNotFitWithAlign(xAlign, chart, options, size)) {\n xAlign = 'center';\n }\n\n return xAlign;\n}\n\nfunction determineAlignment(chart, options, size) {\n var yAlign = options.yAlign || determineYAlign(chart, size);\n return {\n xAlign: options.xAlign || determineXAlign(chart, options, size, yAlign),\n yAlign: yAlign\n };\n}\n\nfunction alignX(size, xAlign) {\n var x = size.x,\n width = size.width;\n\n if (xAlign === 'right') {\n x -= width;\n } else if (xAlign === 'center') {\n x -= width / 2;\n }\n\n return x;\n}\n\nfunction alignY(size, yAlign, paddingAndSize) {\n var y = size.y,\n height = size.height;\n\n if (yAlign === 'top') {\n y += paddingAndSize;\n } else if (yAlign === 'bottom') {\n y -= height + paddingAndSize;\n } else {\n y -= height / 2;\n }\n\n return y;\n}\n\nfunction getBackgroundPoint(options, size, alignment, chart) {\n var caretSize = options.caretSize,\n caretPadding = options.caretPadding,\n cornerRadius = options.cornerRadius;\n var xAlign = alignment.xAlign,\n yAlign = alignment.yAlign;\n var paddingAndSize = caretSize + caretPadding;\n var radiusAndPadding = cornerRadius + caretPadding;\n var x = alignX(size, xAlign);\n var y = alignY(size, yAlign, paddingAndSize);\n\n if (yAlign === 'center') {\n if (xAlign === 'left') {\n x += paddingAndSize;\n } else if (xAlign === 'right') {\n x -= paddingAndSize;\n }\n } else if (xAlign === 'left') {\n x -= radiusAndPadding;\n } else if (xAlign === 'right') {\n x += radiusAndPadding;\n }\n\n return {\n x: _limitValue(x, 0, chart.width - size.width),\n y: _limitValue(y, 0, chart.height - size.height)\n };\n}\n\nfunction getAlignedX(tooltip, align, options) {\n var padding = toPadding(options.padding);\n return align === 'center' ? tooltip.x + tooltip.width / 2 : align === 'right' ? tooltip.x + tooltip.width - padding.right : tooltip.x + padding.left;\n}\n\nfunction getBeforeAfterBodyLines(callback) {\n return pushOrConcat([], splitNewlines(callback));\n}\n\nfunction createTooltipContext(parent, tooltip, tooltipItems) {\n return Object.assign(Object.create(parent), {\n tooltip: tooltip,\n tooltipItems: tooltipItems,\n type: 'tooltip'\n });\n}\n\nfunction overrideCallbacks(callbacks, context) {\n var override = context && context.dataset && context.dataset.tooltip && context.dataset.tooltip.callbacks;\n return override ? callbacks.override(override) : callbacks;\n}\n\nvar Tooltip = /*#__PURE__*/function (_Element8) {\n _inherits(Tooltip, _Element8);\n\n var _super18 = _createSuper(Tooltip);\n\n function Tooltip(config) {\n var _this13;\n\n _classCallCheck(this, Tooltip);\n\n _this13 = _super18.call(this);\n _this13.opacity = 0;\n _this13._active = [];\n _this13._chart = config._chart;\n _this13._eventPosition = undefined;\n _this13._size = undefined;\n _this13._cachedAnimations = undefined;\n _this13._tooltipItems = [];\n _this13.$animations = undefined;\n _this13.$context = undefined;\n _this13.options = config.options;\n _this13.dataPoints = undefined;\n _this13.title = undefined;\n _this13.beforeBody = undefined;\n _this13.body = undefined;\n _this13.afterBody = undefined;\n _this13.footer = undefined;\n _this13.xAlign = undefined;\n _this13.yAlign = undefined;\n _this13.x = undefined;\n _this13.y = undefined;\n _this13.height = undefined;\n _this13.width = undefined;\n _this13.caretX = undefined;\n _this13.caretY = undefined;\n _this13.labelColors = undefined;\n _this13.labelPointStyles = undefined;\n _this13.labelTextColors = undefined;\n return _this13;\n }\n\n _createClass(Tooltip, [{\n key: \"initialize\",\n value: function initialize(options) {\n this.options = options;\n this._cachedAnimations = undefined;\n this.$context = undefined;\n }\n }, {\n key: \"_resolveAnimations\",\n value: function _resolveAnimations() {\n var me = this;\n var cached = me._cachedAnimations;\n\n if (cached) {\n return cached;\n }\n\n var chart = me._chart;\n var options = me.options.setContext(me.getContext());\n var opts = options.enabled && chart.options.animation && options.animations;\n var animations = new Animations(me._chart, opts);\n\n if (opts._cacheable) {\n me._cachedAnimations = Object.freeze(animations);\n }\n\n return animations;\n }\n }, {\n key: \"getContext\",\n value: function getContext() {\n var me = this;\n return me.$context || (me.$context = createTooltipContext(me._chart.getContext(), me, me._tooltipItems));\n }\n }, {\n key: \"getTitle\",\n value: function getTitle(context, options) {\n var me = this;\n var callbacks = options.callbacks;\n var beforeTitle = callbacks.beforeTitle.apply(me, [context]);\n var title = callbacks.title.apply(me, [context]);\n var afterTitle = callbacks.afterTitle.apply(me, [context]);\n var lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeTitle));\n lines = pushOrConcat(lines, splitNewlines(title));\n lines = pushOrConcat(lines, splitNewlines(afterTitle));\n return lines;\n }\n }, {\n key: \"getBeforeBody\",\n value: function getBeforeBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(options.callbacks.beforeBody.apply(this, [tooltipItems]));\n }\n }, {\n key: \"getBody\",\n value: function getBody(tooltipItems, options) {\n var me = this;\n var callbacks = options.callbacks;\n var bodyItems = [];\n each(tooltipItems, function (context) {\n var bodyItem = {\n before: [],\n lines: [],\n after: []\n };\n var scoped = overrideCallbacks(callbacks, context);\n pushOrConcat(bodyItem.before, splitNewlines(scoped.beforeLabel.call(me, context)));\n pushOrConcat(bodyItem.lines, scoped.label.call(me, context));\n pushOrConcat(bodyItem.after, splitNewlines(scoped.afterLabel.call(me, context)));\n bodyItems.push(bodyItem);\n });\n return bodyItems;\n }\n }, {\n key: \"getAfterBody\",\n value: function getAfterBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(options.callbacks.afterBody.apply(this, [tooltipItems]));\n }\n }, {\n key: \"getFooter\",\n value: function getFooter(tooltipItems, options) {\n var me = this;\n var callbacks = options.callbacks;\n var beforeFooter = callbacks.beforeFooter.apply(me, [tooltipItems]);\n var footer = callbacks.footer.apply(me, [tooltipItems]);\n var afterFooter = callbacks.afterFooter.apply(me, [tooltipItems]);\n var lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeFooter));\n lines = pushOrConcat(lines, splitNewlines(footer));\n lines = pushOrConcat(lines, splitNewlines(afterFooter));\n return lines;\n }\n }, {\n key: \"_createItems\",\n value: function _createItems(options) {\n var me = this;\n var active = me._active;\n var data = me._chart.data;\n var labelColors = [];\n var labelPointStyles = [];\n var labelTextColors = [];\n var tooltipItems = [];\n var i, len;\n\n for (i = 0, len = active.length; i < len; ++i) {\n tooltipItems.push(createTooltipItem(me._chart, active[i]));\n }\n\n if (options.filter) {\n tooltipItems = tooltipItems.filter(function (element, index, array) {\n return options.filter(element, index, array, data);\n });\n }\n\n if (options.itemSort) {\n tooltipItems = tooltipItems.sort(function (a, b) {\n return options.itemSort(a, b, data);\n });\n }\n\n each(tooltipItems, function (context) {\n var scoped = overrideCallbacks(options.callbacks, context);\n labelColors.push(scoped.labelColor.call(me, context));\n labelPointStyles.push(scoped.labelPointStyle.call(me, context));\n labelTextColors.push(scoped.labelTextColor.call(me, context));\n });\n me.labelColors = labelColors;\n me.labelPointStyles = labelPointStyles;\n me.labelTextColors = labelTextColors;\n me.dataPoints = tooltipItems;\n return tooltipItems;\n }\n }, {\n key: \"update\",\n value: function update(changed, replay) {\n var me = this;\n var options = me.options.setContext(me.getContext());\n var active = me._active;\n var properties;\n var tooltipItems = [];\n\n if (!active.length) {\n if (me.opacity !== 0) {\n properties = {\n opacity: 0\n };\n }\n } else {\n var position = positioners[options.position].call(me, active, me._eventPosition);\n tooltipItems = me._createItems(options);\n me.title = me.getTitle(tooltipItems, options);\n me.beforeBody = me.getBeforeBody(tooltipItems, options);\n me.body = me.getBody(tooltipItems, options);\n me.afterBody = me.getAfterBody(tooltipItems, options);\n me.footer = me.getFooter(tooltipItems, options);\n var size = me._size = getTooltipSize(me, options);\n var positionAndSize = Object.assign({}, position, size);\n var alignment = determineAlignment(me._chart, options, positionAndSize);\n var backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, me._chart);\n me.xAlign = alignment.xAlign;\n me.yAlign = alignment.yAlign;\n properties = {\n opacity: 1,\n x: backgroundPoint.x,\n y: backgroundPoint.y,\n width: size.width,\n height: size.height,\n caretX: position.x,\n caretY: position.y\n };\n }\n\n me._tooltipItems = tooltipItems;\n me.$context = undefined;\n\n if (properties) {\n me._resolveAnimations().update(me, properties);\n }\n\n if (changed && options.external) {\n options.external.call(me, {\n chart: me._chart,\n tooltip: me,\n replay: replay\n });\n }\n }\n }, {\n key: \"drawCaret\",\n value: function drawCaret(tooltipPoint, ctx, size, options) {\n var caretPosition = this.getCaretPosition(tooltipPoint, size, options);\n ctx.lineTo(caretPosition.x1, caretPosition.y1);\n ctx.lineTo(caretPosition.x2, caretPosition.y2);\n ctx.lineTo(caretPosition.x3, caretPosition.y3);\n }\n }, {\n key: \"getCaretPosition\",\n value: function getCaretPosition(tooltipPoint, size, options) {\n var xAlign = this.xAlign,\n yAlign = this.yAlign;\n var cornerRadius = options.cornerRadius,\n caretSize = options.caretSize;\n var ptX = tooltipPoint.x,\n ptY = tooltipPoint.y;\n var width = size.width,\n height = size.height;\n var x1, x2, x3, y1, y2, y3;\n\n if (yAlign === 'center') {\n y2 = ptY + height / 2;\n\n if (xAlign === 'left') {\n x1 = ptX;\n x2 = x1 - caretSize;\n y1 = y2 + caretSize;\n y3 = y2 - caretSize;\n } else {\n x1 = ptX + width;\n x2 = x1 + caretSize;\n y1 = y2 - caretSize;\n y3 = y2 + caretSize;\n }\n\n x3 = x1;\n } else {\n if (xAlign === 'left') {\n x2 = ptX + cornerRadius + caretSize;\n } else if (xAlign === 'right') {\n x2 = ptX + width - cornerRadius - caretSize;\n } else {\n x2 = this.caretX;\n }\n\n if (yAlign === 'top') {\n y1 = ptY;\n y2 = y1 - caretSize;\n x1 = x2 - caretSize;\n x3 = x2 + caretSize;\n } else {\n y1 = ptY + height;\n y2 = y1 + caretSize;\n x1 = x2 + caretSize;\n x3 = x2 - caretSize;\n }\n\n y3 = y1;\n }\n\n return {\n x1: x1,\n x2: x2,\n x3: x3,\n y1: y1,\n y2: y2,\n y3: y3\n };\n }\n }, {\n key: \"drawTitle\",\n value: function drawTitle(pt, ctx, options) {\n var me = this;\n var title = me.title;\n var length = title.length;\n var titleFont, titleSpacing, i;\n\n if (length) {\n var rtlHelper = getRtlAdapter(options.rtl, me.x, me.width);\n pt.x = getAlignedX(me, options.titleAlign, options);\n ctx.textAlign = rtlHelper.textAlign(options.titleAlign);\n ctx.textBaseline = 'middle';\n titleFont = toFont(options.titleFont);\n titleSpacing = options.titleSpacing;\n ctx.fillStyle = options.titleColor;\n ctx.font = titleFont.string;\n\n for (i = 0; i < length; ++i) {\n ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2);\n pt.y += titleFont.lineHeight + titleSpacing;\n\n if (i + 1 === length) {\n pt.y += options.titleMarginBottom - titleSpacing;\n }\n }\n }\n }\n }, {\n key: \"_drawColorBox\",\n value: function _drawColorBox(ctx, pt, i, rtlHelper, options) {\n var me = this;\n var labelColors = me.labelColors[i];\n var labelPointStyle = me.labelPointStyles[i];\n var boxHeight = options.boxHeight,\n boxWidth = options.boxWidth;\n var bodyFont = toFont(options.bodyFont);\n var colorX = getAlignedX(me, 'left', options);\n var rtlColorX = rtlHelper.x(colorX);\n var yOffSet = boxHeight < bodyFont.lineHeight ? (bodyFont.lineHeight - boxHeight) / 2 : 0;\n var colorY = pt.y + yOffSet;\n\n if (options.usePointStyle) {\n var drawOptions = {\n radius: Math.min(boxWidth, boxHeight) / 2,\n pointStyle: labelPointStyle.pointStyle,\n rotation: labelPointStyle.rotation,\n borderWidth: 1\n };\n var centerX = rtlHelper.leftForLtr(rtlColorX, boxWidth) + boxWidth / 2;\n var centerY = colorY + boxHeight / 2;\n ctx.strokeStyle = options.multiKeyBackground;\n ctx.fillStyle = options.multiKeyBackground;\n drawPoint(ctx, drawOptions, centerX, centerY);\n ctx.strokeStyle = labelColors.borderColor;\n ctx.fillStyle = labelColors.backgroundColor;\n drawPoint(ctx, drawOptions, centerX, centerY);\n } else {\n ctx.lineWidth = labelColors.borderWidth || 1;\n ctx.strokeStyle = labelColors.borderColor;\n ctx.setLineDash(labelColors.borderDash || []);\n ctx.lineDashOffset = labelColors.borderDashOffset || 0;\n var outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth);\n var innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - 2);\n var borderRadius = toTRBLCorners(labelColors.borderRadius);\n\n if (Object.values(borderRadius).some(function (v) {\n return v !== 0;\n })) {\n ctx.beginPath();\n ctx.fillStyle = options.multiKeyBackground;\n addRoundedRectPath(ctx, {\n x: outerX,\n y: colorY,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius\n });\n ctx.fill();\n ctx.stroke();\n ctx.fillStyle = labelColors.backgroundColor;\n ctx.beginPath();\n addRoundedRectPath(ctx, {\n x: innerX,\n y: colorY + 1,\n w: boxWidth - 2,\n h: boxHeight - 2,\n radius: borderRadius\n });\n ctx.fill();\n } else {\n ctx.fillStyle = options.multiKeyBackground;\n ctx.fillRect(outerX, colorY, boxWidth, boxHeight);\n ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);\n ctx.fillStyle = labelColors.backgroundColor;\n ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);\n }\n }\n\n ctx.fillStyle = me.labelTextColors[i];\n }\n }, {\n key: \"drawBody\",\n value: function drawBody(pt, ctx, options) {\n var me = this;\n var body = me.body;\n var bodySpacing = options.bodySpacing,\n bodyAlign = options.bodyAlign,\n displayColors = options.displayColors,\n boxHeight = options.boxHeight,\n boxWidth = options.boxWidth;\n var bodyFont = toFont(options.bodyFont);\n var bodyLineHeight = bodyFont.lineHeight;\n var xLinePadding = 0;\n var rtlHelper = getRtlAdapter(options.rtl, me.x, me.width);\n\n var fillLineOfText = function fillLineOfText(line) {\n ctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyLineHeight / 2);\n pt.y += bodyLineHeight + bodySpacing;\n };\n\n var bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);\n var bodyItem, textColor, lines, i, j, ilen, jlen;\n ctx.textAlign = bodyAlign;\n ctx.textBaseline = 'middle';\n ctx.font = bodyFont.string;\n pt.x = getAlignedX(me, bodyAlignForCalculation, options);\n ctx.fillStyle = options.bodyColor;\n each(me.beforeBody, fillLineOfText);\n xLinePadding = displayColors && bodyAlignForCalculation !== 'right' ? bodyAlign === 'center' ? boxWidth / 2 + 1 : boxWidth + 2 : 0;\n\n for (i = 0, ilen = body.length; i < ilen; ++i) {\n bodyItem = body[i];\n textColor = me.labelTextColors[i];\n ctx.fillStyle = textColor;\n each(bodyItem.before, fillLineOfText);\n lines = bodyItem.lines;\n\n if (displayColors && lines.length) {\n me._drawColorBox(ctx, pt, i, rtlHelper, options);\n\n bodyLineHeight = Math.max(bodyFont.lineHeight, boxHeight);\n }\n\n for (j = 0, jlen = lines.length; j < jlen; ++j) {\n fillLineOfText(lines[j]);\n bodyLineHeight = bodyFont.lineHeight;\n }\n\n each(bodyItem.after, fillLineOfText);\n }\n\n xLinePadding = 0;\n bodyLineHeight = bodyFont.lineHeight;\n each(me.afterBody, fillLineOfText);\n pt.y -= bodySpacing;\n }\n }, {\n key: \"drawFooter\",\n value: function drawFooter(pt, ctx, options) {\n var me = this;\n var footer = me.footer;\n var length = footer.length;\n var footerFont, i;\n\n if (length) {\n var rtlHelper = getRtlAdapter(options.rtl, me.x, me.width);\n pt.x = getAlignedX(me, options.footerAlign, options);\n pt.y += options.footerMarginTop;\n ctx.textAlign = rtlHelper.textAlign(options.footerAlign);\n ctx.textBaseline = 'middle';\n footerFont = toFont(options.footerFont);\n ctx.fillStyle = options.footerColor;\n ctx.font = footerFont.string;\n\n for (i = 0; i < length; ++i) {\n ctx.fillText(footer[i], rtlHelper.x(pt.x), pt.y + footerFont.lineHeight / 2);\n pt.y += footerFont.lineHeight + options.footerSpacing;\n }\n }\n }\n }, {\n key: \"drawBackground\",\n value: function drawBackground(pt, ctx, tooltipSize, options) {\n var xAlign = this.xAlign,\n yAlign = this.yAlign;\n var x = pt.x,\n y = pt.y;\n var width = tooltipSize.width,\n height = tooltipSize.height;\n var radius = options.cornerRadius;\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n ctx.beginPath();\n ctx.moveTo(x + radius, y);\n\n if (yAlign === 'top') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n\n ctx.lineTo(x + width - radius, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + radius);\n\n if (yAlign === 'center' && xAlign === 'right') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n\n ctx.lineTo(x + width, y + height - radius);\n ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\n\n if (yAlign === 'bottom') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n\n ctx.lineTo(x + radius, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - radius);\n\n if (yAlign === 'center' && xAlign === 'left') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n\n ctx.lineTo(x, y + radius);\n ctx.quadraticCurveTo(x, y, x + radius, y);\n ctx.closePath();\n ctx.fill();\n\n if (options.borderWidth > 0) {\n ctx.stroke();\n }\n }\n }, {\n key: \"_updateAnimationTarget\",\n value: function _updateAnimationTarget(options) {\n var me = this;\n var chart = me._chart;\n var anims = me.$animations;\n var animX = anims && anims.x;\n var animY = anims && anims.y;\n\n if (animX || animY) {\n var position = positioners[options.position].call(me, me._active, me._eventPosition);\n\n if (!position) {\n return;\n }\n\n var size = me._size = getTooltipSize(me, options);\n var positionAndSize = Object.assign({}, position, me._size);\n var alignment = determineAlignment(chart, options, positionAndSize);\n var point = getBackgroundPoint(options, positionAndSize, alignment, chart);\n\n if (animX._to !== point.x || animY._to !== point.y) {\n me.xAlign = alignment.xAlign;\n me.yAlign = alignment.yAlign;\n me.width = size.width;\n me.height = size.height;\n me.caretX = position.x;\n me.caretY = position.y;\n\n me._resolveAnimations().update(me, point);\n }\n }\n }\n }, {\n key: \"draw\",\n value: function draw(ctx) {\n var me = this;\n var options = me.options.setContext(me.getContext());\n var opacity = me.opacity;\n\n if (!opacity) {\n return;\n }\n\n me._updateAnimationTarget(options);\n\n var tooltipSize = {\n width: me.width,\n height: me.height\n };\n var pt = {\n x: me.x,\n y: me.y\n };\n opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;\n var padding = toPadding(options.padding);\n var hasTooltipContent = me.title.length || me.beforeBody.length || me.body.length || me.afterBody.length || me.footer.length;\n\n if (options.enabled && hasTooltipContent) {\n ctx.save();\n ctx.globalAlpha = opacity;\n me.drawBackground(pt, ctx, tooltipSize, options);\n overrideTextDirection(ctx, options.textDirection);\n pt.y += padding.top;\n me.drawTitle(pt, ctx, options);\n me.drawBody(pt, ctx, options);\n me.drawFooter(pt, ctx, options);\n restoreTextDirection(ctx, options.textDirection);\n ctx.restore();\n }\n }\n }, {\n key: \"getActiveElements\",\n value: function getActiveElements() {\n return this._active || [];\n }\n }, {\n key: \"setActiveElements\",\n value: function setActiveElements(activeElements, eventPosition) {\n var me = this;\n var lastActive = me._active;\n var active = activeElements.map(function (_ref7) {\n var datasetIndex = _ref7.datasetIndex,\n index = _ref7.index;\n\n var meta = me._chart.getDatasetMeta(datasetIndex);\n\n if (!meta) {\n throw new Error('Cannot find a dataset at index ' + datasetIndex);\n }\n\n return {\n datasetIndex: datasetIndex,\n element: meta.data[index],\n index: index\n };\n });\n var changed = !_elementsEqual(lastActive, active);\n\n var positionChanged = me._positionChanged(active, eventPosition);\n\n if (changed || positionChanged) {\n me._active = active;\n me._eventPosition = eventPosition;\n me.update(true);\n }\n }\n }, {\n key: \"handleEvent\",\n value: function handleEvent(e, replay) {\n var me = this;\n var options = me.options;\n var lastActive = me._active || [];\n var changed = false;\n var active = [];\n\n if (e.type !== 'mouseout') {\n active = me._chart.getElementsAtEventForMode(e, options.mode, options, replay);\n\n if (options.reverse) {\n active.reverse();\n }\n }\n\n var positionChanged = me._positionChanged(active, e);\n\n changed = replay || !_elementsEqual(active, lastActive) || positionChanged;\n\n if (changed) {\n me._active = active;\n\n if (options.enabled || options.external) {\n me._eventPosition = {\n x: e.x,\n y: e.y\n };\n me.update(true, replay);\n }\n }\n\n return changed;\n }\n }, {\n key: \"_positionChanged\",\n value: function _positionChanged(active, e) {\n var caretX = this.caretX,\n caretY = this.caretY,\n options = this.options;\n var position = positioners[options.position].call(this, active, e);\n return position !== false && (caretX !== position.x || caretY !== position.y);\n }\n }]);\n\n return Tooltip;\n}(Element);\n\nTooltip.positioners = positioners;\nvar plugin_tooltip = {\n id: 'tooltip',\n _element: Tooltip,\n positioners: positioners,\n afterInit: function afterInit(chart, _args, options) {\n if (options) {\n chart.tooltip = new Tooltip({\n _chart: chart,\n options: options\n });\n }\n },\n beforeUpdate: function beforeUpdate(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n reset: function reset(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n afterDraw: function afterDraw(chart) {\n var tooltip = chart.tooltip;\n var args = {\n tooltip: tooltip\n };\n\n if (chart.notifyPlugins('beforeTooltipDraw', args) === false) {\n return;\n }\n\n if (tooltip) {\n tooltip.draw(chart.ctx);\n }\n\n chart.notifyPlugins('afterTooltipDraw', args);\n },\n afterEvent: function afterEvent(chart, args) {\n if (chart.tooltip) {\n var useFinalPosition = args.replay;\n\n if (chart.tooltip.handleEvent(args.event, useFinalPosition)) {\n args.changed = true;\n }\n }\n },\n defaults: {\n enabled: true,\n external: null,\n position: 'average',\n backgroundColor: 'rgba(0,0,0,0.8)',\n titleColor: '#fff',\n titleFont: {\n weight: 'bold'\n },\n titleSpacing: 2,\n titleMarginBottom: 6,\n titleAlign: 'left',\n bodyColor: '#fff',\n bodySpacing: 2,\n bodyFont: {},\n bodyAlign: 'left',\n footerColor: '#fff',\n footerSpacing: 2,\n footerMarginTop: 6,\n footerFont: {\n weight: 'bold'\n },\n footerAlign: 'left',\n padding: 6,\n caretPadding: 2,\n caretSize: 5,\n cornerRadius: 6,\n boxHeight: function boxHeight(ctx, opts) {\n return opts.bodyFont.size;\n },\n boxWidth: function boxWidth(ctx, opts) {\n return opts.bodyFont.size;\n },\n multiKeyBackground: '#fff',\n displayColors: true,\n borderColor: 'rgba(0,0,0,0)',\n borderWidth: 0,\n animation: {\n duration: 400,\n easing: 'easeOutQuart'\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'width', 'height', 'caretX', 'caretY']\n },\n opacity: {\n easing: 'linear',\n duration: 200\n }\n },\n callbacks: {\n beforeTitle: noop,\n title: function title(tooltipItems) {\n if (tooltipItems.length > 0) {\n var item = tooltipItems[0];\n var labels = item.chart.data.labels;\n var labelCount = labels ? labels.length : 0;\n\n if (this && this.options && this.options.mode === 'dataset') {\n return item.dataset.label || '';\n } else if (item.label) {\n return item.label;\n } else if (labelCount > 0 && item.dataIndex < labelCount) {\n return labels[item.dataIndex];\n }\n }\n\n return '';\n },\n afterTitle: noop,\n beforeBody: noop,\n beforeLabel: noop,\n label: function label(tooltipItem) {\n if (this && this.options && this.options.mode === 'dataset') {\n return tooltipItem.label + ': ' + tooltipItem.formattedValue || tooltipItem.formattedValue;\n }\n\n var label = tooltipItem.dataset.label || '';\n\n if (label) {\n label += ': ';\n }\n\n var value = tooltipItem.formattedValue;\n\n if (!isNullOrUndef(value)) {\n label += value;\n }\n\n return label;\n },\n labelColor: function labelColor(tooltipItem) {\n var meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n var options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n borderColor: options.borderColor,\n backgroundColor: options.backgroundColor,\n borderWidth: options.borderWidth,\n borderDash: options.borderDash,\n borderDashOffset: options.borderDashOffset,\n borderRadius: 0\n };\n },\n labelTextColor: function labelTextColor() {\n return this.options.bodyColor;\n },\n labelPointStyle: function labelPointStyle(tooltipItem) {\n var meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n var options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n pointStyle: options.pointStyle,\n rotation: options.rotation\n };\n },\n afterLabel: noop,\n afterBody: noop,\n beforeFooter: noop,\n footer: noop,\n afterFooter: noop\n }\n },\n defaultRoutes: {\n bodyFont: 'font',\n footerFont: 'font',\n titleFont: 'font'\n },\n descriptors: {\n _scriptable: function _scriptable(name) {\n return name !== 'filter' && name !== 'itemSort' && name !== 'external';\n },\n _indexable: false,\n callbacks: {\n _scriptable: false,\n _indexable: false\n },\n animation: {\n _fallback: false\n },\n animations: {\n _fallback: 'animation'\n }\n },\n additionalOptionScopes: ['interaction']\n};\nvar plugins = /*#__PURE__*/Object.freeze({\n __proto__: null,\n Decimation: plugin_decimation,\n Filler: plugin_filler,\n Legend: plugin_legend,\n Title: plugin_title,\n Tooltip: plugin_tooltip\n});\n\nvar addIfString = function addIfString(labels, raw, index) {\n return typeof raw === 'string' ? labels.push(raw) - 1 : isNaN(raw) ? null : index;\n};\n\nfunction findOrAddLabel(labels, raw, index) {\n var first = labels.indexOf(raw);\n\n if (first === -1) {\n return addIfString(labels, raw, index);\n }\n\n var last = labels.lastIndexOf(raw);\n return first !== last ? index : first;\n}\n\nvar validIndex = function validIndex(index, max) {\n return index === null ? null : _limitValue(Math.round(index), 0, max);\n};\n\nvar CategoryScale = /*#__PURE__*/function (_Scale) {\n _inherits(CategoryScale, _Scale);\n\n var _super19 = _createSuper(CategoryScale);\n\n function CategoryScale(cfg) {\n var _this14;\n\n _classCallCheck(this, CategoryScale);\n\n _this14 = _super19.call(this, cfg);\n _this14._startValue = undefined;\n _this14._valueRange = 0;\n return _this14;\n }\n\n _createClass(CategoryScale, [{\n key: \"parse\",\n value: function parse(raw, index) {\n if (isNullOrUndef(raw)) {\n return null;\n }\n\n var labels = this.getLabels();\n index = isFinite(index) && labels[index] === raw ? index : findOrAddLabel(labels, raw, valueOrDefault(index, raw));\n return validIndex(index, labels.length - 1);\n }\n }, {\n key: \"determineDataLimits\",\n value: function determineDataLimits() {\n var me = this;\n\n var _me$getUserBounds2 = me.getUserBounds(),\n minDefined = _me$getUserBounds2.minDefined,\n maxDefined = _me$getUserBounds2.maxDefined;\n\n var _me$getMinMax = me.getMinMax(true),\n min = _me$getMinMax.min,\n max = _me$getMinMax.max;\n\n if (me.options.bounds === 'ticks') {\n if (!minDefined) {\n min = 0;\n }\n\n if (!maxDefined) {\n max = me.getLabels().length - 1;\n }\n }\n\n me.min = min;\n me.max = max;\n }\n }, {\n key: \"buildTicks\",\n value: function buildTicks() {\n var me = this;\n var min = me.min;\n var max = me.max;\n var offset = me.options.offset;\n var ticks = [];\n var labels = me.getLabels();\n labels = min === 0 && max === labels.length - 1 ? labels : labels.slice(min, max + 1);\n me._valueRange = Math.max(labels.length - (offset ? 0 : 1), 1);\n me._startValue = me.min - (offset ? 0.5 : 0);\n\n for (var value = min; value <= max; value++) {\n ticks.push({\n value: value\n });\n }\n\n return ticks;\n }\n }, {\n key: \"getLabelForValue\",\n value: function getLabelForValue(value) {\n var me = this;\n var labels = me.getLabels();\n\n if (value >= 0 && value < labels.length) {\n return labels[value];\n }\n\n return value;\n }\n }, {\n key: \"configure\",\n value: function configure() {\n var me = this;\n\n _get(_getPrototypeOf(CategoryScale.prototype), \"configure\", this).call(this);\n\n if (!me.isHorizontal()) {\n me._reversePixels = !me._reversePixels;\n }\n }\n }, {\n key: \"getPixelForValue\",\n value: function getPixelForValue(value) {\n var me = this;\n\n if (typeof value !== 'number') {\n value = me.parse(value);\n }\n\n return value === null ? NaN : me.getPixelForDecimal((value - me._startValue) / me._valueRange);\n }\n }, {\n key: \"getPixelForTick\",\n value: function getPixelForTick(index) {\n var me = this;\n var ticks = me.ticks;\n\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n\n return me.getPixelForValue(ticks[index].value);\n }\n }, {\n key: \"getValueForPixel\",\n value: function getValueForPixel(pixel) {\n var me = this;\n return Math.round(me._startValue + me.getDecimalForPixel(pixel) * me._valueRange);\n }\n }, {\n key: \"getBasePixel\",\n value: function getBasePixel() {\n return this.bottom;\n }\n }]);\n\n return CategoryScale;\n}(Scale);\n\nCategoryScale.id = 'category';\nCategoryScale.defaults = {\n ticks: {\n callback: CategoryScale.prototype.getLabelForValue\n }\n};\n\nfunction generateTicks$1(generationOptions, dataRange) {\n var ticks = [];\n var MIN_SPACING = 1e-14;\n var bounds = generationOptions.bounds,\n step = generationOptions.step,\n min = generationOptions.min,\n max = generationOptions.max,\n precision = generationOptions.precision,\n count = generationOptions.count,\n maxTicks = generationOptions.maxTicks,\n maxDigits = generationOptions.maxDigits,\n includeBounds = generationOptions.includeBounds;\n var unit = step || 1;\n var maxSpaces = maxTicks - 1;\n var rmin = dataRange.min,\n rmax = dataRange.max;\n var minDefined = !isNullOrUndef(min);\n var maxDefined = !isNullOrUndef(max);\n var countDefined = !isNullOrUndef(count);\n var minSpacing = (rmax - rmin) / (maxDigits + 1);\n var spacing = niceNum((rmax - rmin) / maxSpaces / unit) * unit;\n var factor, niceMin, niceMax, numSpaces;\n\n if (spacing < MIN_SPACING && !minDefined && !maxDefined) {\n return [{\n value: rmin\n }, {\n value: rmax\n }];\n }\n\n numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing);\n\n if (numSpaces > maxSpaces) {\n spacing = niceNum(numSpaces * spacing / maxSpaces / unit) * unit;\n }\n\n if (!isNullOrUndef(precision)) {\n factor = Math.pow(10, precision);\n spacing = Math.ceil(spacing * factor) / factor;\n }\n\n if (bounds === 'ticks') {\n niceMin = Math.floor(rmin / spacing) * spacing;\n niceMax = Math.ceil(rmax / spacing) * spacing;\n } else {\n niceMin = rmin;\n niceMax = rmax;\n }\n\n if (minDefined && maxDefined && step && almostWhole((max - min) / step, spacing / 1000)) {\n numSpaces = Math.min((max - min) / spacing, maxTicks);\n spacing = (max - min) / numSpaces;\n niceMin = min;\n niceMax = max;\n } else if (countDefined) {\n niceMin = minDefined ? min : niceMin;\n niceMax = maxDefined ? max : niceMax;\n numSpaces = count - 1;\n spacing = (niceMax - niceMin) / numSpaces;\n } else {\n numSpaces = (niceMax - niceMin) / spacing;\n\n if (almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {\n numSpaces = Math.round(numSpaces);\n } else {\n numSpaces = Math.ceil(numSpaces);\n }\n }\n\n var decimalPlaces = Math.max(_decimalPlaces(spacing), _decimalPlaces(niceMin));\n factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);\n niceMin = Math.round(niceMin * factor) / factor;\n niceMax = Math.round(niceMax * factor) / factor;\n var j = 0;\n\n if (minDefined) {\n if (includeBounds && niceMin !== min) {\n ticks.push({\n value: min\n });\n\n if (niceMin < min) {\n j++;\n }\n\n if (almostEquals(Math.round((niceMin + j * spacing) * factor) / factor, min, relativeLabelSize(min, minSpacing, generationOptions))) {\n j++;\n }\n } else if (niceMin < min) {\n j++;\n }\n }\n\n for (; j < numSpaces; ++j) {\n ticks.push({\n value: Math.round((niceMin + j * spacing) * factor) / factor\n });\n }\n\n if (maxDefined && includeBounds && niceMax !== max) {\n if (almostEquals(ticks[ticks.length - 1].value, max, relativeLabelSize(max, minSpacing, generationOptions))) {\n ticks[ticks.length - 1].value = max;\n } else {\n ticks.push({\n value: max\n });\n }\n } else if (!maxDefined || niceMax === max) {\n ticks.push({\n value: niceMax\n });\n }\n\n return ticks;\n}\n\nfunction relativeLabelSize(value, minSpacing, _ref8) {\n var horizontal = _ref8.horizontal,\n minRotation = _ref8.minRotation;\n var rad = toRadians(minRotation);\n var ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;\n var length = 0.75 * minSpacing * ('' + value).length;\n return Math.min(minSpacing / ratio, length);\n}\n\nvar LinearScaleBase = /*#__PURE__*/function (_Scale2) {\n _inherits(LinearScaleBase, _Scale2);\n\n var _super20 = _createSuper(LinearScaleBase);\n\n function LinearScaleBase(cfg) {\n var _this15;\n\n _classCallCheck(this, LinearScaleBase);\n\n _this15 = _super20.call(this, cfg);\n _this15.start = undefined;\n _this15.end = undefined;\n _this15._startValue = undefined;\n _this15._endValue = undefined;\n _this15._valueRange = 0;\n return _this15;\n }\n\n _createClass(LinearScaleBase, [{\n key: \"parse\",\n value: function parse(raw, index) {\n if (isNullOrUndef(raw)) {\n return null;\n }\n\n if ((typeof raw === 'number' || raw instanceof Number) && !isFinite(+raw)) {\n return null;\n }\n\n return +raw;\n }\n }, {\n key: \"handleTickRangeOptions\",\n value: function handleTickRangeOptions() {\n var me = this;\n var beginAtZero = me.options.beginAtZero;\n\n var _me$getUserBounds3 = me.getUserBounds(),\n minDefined = _me$getUserBounds3.minDefined,\n maxDefined = _me$getUserBounds3.maxDefined;\n\n var min = me.min,\n max = me.max;\n\n var setMin = function setMin(v) {\n return min = minDefined ? min : v;\n };\n\n var setMax = function setMax(v) {\n return max = maxDefined ? max : v;\n };\n\n if (beginAtZero) {\n var minSign = sign(min);\n var maxSign = sign(max);\n\n if (minSign < 0 && maxSign < 0) {\n setMax(0);\n } else if (minSign > 0 && maxSign > 0) {\n setMin(0);\n }\n }\n\n if (min === max) {\n setMax(max + 1);\n\n if (!beginAtZero) {\n setMin(min - 1);\n }\n }\n\n me.min = min;\n me.max = max;\n }\n }, {\n key: \"getTickLimit\",\n value: function getTickLimit() {\n var me = this;\n var tickOpts = me.options.ticks;\n var maxTicksLimit = tickOpts.maxTicksLimit,\n stepSize = tickOpts.stepSize;\n var maxTicks;\n\n if (stepSize) {\n maxTicks = Math.ceil(me.max / stepSize) - Math.floor(me.min / stepSize) + 1;\n } else {\n maxTicks = me.computeTickLimit();\n maxTicksLimit = maxTicksLimit || 11;\n }\n\n if (maxTicksLimit) {\n maxTicks = Math.min(maxTicksLimit, maxTicks);\n }\n\n return maxTicks;\n }\n }, {\n key: \"computeTickLimit\",\n value: function computeTickLimit() {\n return Number.POSITIVE_INFINITY;\n }\n }, {\n key: \"buildTicks\",\n value: function buildTicks() {\n var me = this;\n var opts = me.options;\n var tickOpts = opts.ticks;\n var maxTicks = me.getTickLimit();\n maxTicks = Math.max(2, maxTicks);\n var numericGeneratorOptions = {\n maxTicks: maxTicks,\n bounds: opts.bounds,\n min: opts.min,\n max: opts.max,\n precision: tickOpts.precision,\n step: tickOpts.stepSize,\n count: tickOpts.count,\n maxDigits: me._maxDigits(),\n horizontal: me.isHorizontal(),\n minRotation: tickOpts.minRotation || 0,\n includeBounds: tickOpts.includeBounds !== false\n };\n var dataRange = me._range || me;\n var ticks = generateTicks$1(numericGeneratorOptions, dataRange);\n\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, me, 'value');\n }\n\n if (opts.reverse) {\n ticks.reverse();\n me.start = me.max;\n me.end = me.min;\n } else {\n me.start = me.min;\n me.end = me.max;\n }\n\n return ticks;\n }\n }, {\n key: \"configure\",\n value: function configure() {\n var me = this;\n var ticks = me.ticks;\n var start = me.min;\n var end = me.max;\n\n _get(_getPrototypeOf(LinearScaleBase.prototype), \"configure\", this).call(this);\n\n if (me.options.offset && ticks.length) {\n var offset = (end - start) / Math.max(ticks.length - 1, 1) / 2;\n start -= offset;\n end += offset;\n }\n\n me._startValue = start;\n me._endValue = end;\n me._valueRange = end - start;\n }\n }, {\n key: \"getLabelForValue\",\n value: function getLabelForValue(value) {\n return formatNumber(value, this.chart.options.locale);\n }\n }]);\n\n return LinearScaleBase;\n}(Scale);\n\nvar LinearScale = /*#__PURE__*/function (_LinearScaleBase) {\n _inherits(LinearScale, _LinearScaleBase);\n\n var _super21 = _createSuper(LinearScale);\n\n function LinearScale() {\n _classCallCheck(this, LinearScale);\n\n return _super21.apply(this, arguments);\n }\n\n _createClass(LinearScale, [{\n key: \"determineDataLimits\",\n value: function determineDataLimits() {\n var me = this;\n\n var _me$getMinMax2 = me.getMinMax(true),\n min = _me$getMinMax2.min,\n max = _me$getMinMax2.max;\n\n me.min = isNumberFinite(min) ? min : 0;\n me.max = isNumberFinite(max) ? max : 1;\n me.handleTickRangeOptions();\n }\n }, {\n key: \"computeTickLimit\",\n value: function computeTickLimit() {\n var me = this;\n var horizontal = me.isHorizontal();\n var length = horizontal ? me.width : me.height;\n var minRotation = toRadians(me.options.ticks.minRotation);\n var ratio = (horizontal ? Math.sin(minRotation) : Math.cos(minRotation)) || 0.001;\n\n var tickFont = me._resolveTickFontOptions(0);\n\n return Math.ceil(length / Math.min(40, tickFont.lineHeight / ratio));\n }\n }, {\n key: \"getPixelForValue\",\n value: function getPixelForValue(value) {\n return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);\n }\n }, {\n key: \"getValueForPixel\",\n value: function getValueForPixel(pixel) {\n return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;\n }\n }]);\n\n return LinearScale;\n}(LinearScaleBase);\n\nLinearScale.id = 'linear';\nLinearScale.defaults = {\n ticks: {\n callback: Ticks.formatters.numeric\n }\n};\n\nfunction isMajor(tickVal) {\n var remain = tickVal / Math.pow(10, Math.floor(log10(tickVal)));\n return remain === 1;\n}\n\nfunction generateTicks(generationOptions, dataRange) {\n var endExp = Math.floor(log10(dataRange.max));\n var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));\n var ticks = [];\n var tickVal = finiteOrDefault(generationOptions.min, Math.pow(10, Math.floor(log10(dataRange.min))));\n var exp = Math.floor(log10(tickVal));\n var significand = Math.floor(tickVal / Math.pow(10, exp));\n var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;\n\n do {\n ticks.push({\n value: tickVal,\n major: isMajor(tickVal)\n });\n ++significand;\n\n if (significand === 10) {\n significand = 1;\n ++exp;\n precision = exp >= 0 ? 1 : precision;\n }\n\n tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;\n } while (exp < endExp || exp === endExp && significand < endSignificand);\n\n var lastTick = finiteOrDefault(generationOptions.max, tickVal);\n ticks.push({\n value: lastTick,\n major: isMajor(tickVal)\n });\n return ticks;\n}\n\nvar LogarithmicScale = /*#__PURE__*/function (_Scale3) {\n _inherits(LogarithmicScale, _Scale3);\n\n var _super22 = _createSuper(LogarithmicScale);\n\n function LogarithmicScale(cfg) {\n var _this16;\n\n _classCallCheck(this, LogarithmicScale);\n\n _this16 = _super22.call(this, cfg);\n _this16.start = undefined;\n _this16.end = undefined;\n _this16._startValue = undefined;\n _this16._valueRange = 0;\n return _this16;\n }\n\n _createClass(LogarithmicScale, [{\n key: \"parse\",\n value: function parse(raw, index) {\n var value = LinearScaleBase.prototype.parse.apply(this, [raw, index]);\n\n if (value === 0) {\n this._zero = true;\n return undefined;\n }\n\n return isNumberFinite(value) && value > 0 ? value : null;\n }\n }, {\n key: \"determineDataLimits\",\n value: function determineDataLimits() {\n var me = this;\n\n var _me$getMinMax3 = me.getMinMax(true),\n min = _me$getMinMax3.min,\n max = _me$getMinMax3.max;\n\n me.min = isNumberFinite(min) ? Math.max(0, min) : null;\n me.max = isNumberFinite(max) ? Math.max(0, max) : null;\n\n if (me.options.beginAtZero) {\n me._zero = true;\n }\n\n me.handleTickRangeOptions();\n }\n }, {\n key: \"handleTickRangeOptions\",\n value: function handleTickRangeOptions() {\n var me = this;\n\n var _me$getUserBounds4 = me.getUserBounds(),\n minDefined = _me$getUserBounds4.minDefined,\n maxDefined = _me$getUserBounds4.maxDefined;\n\n var min = me.min;\n var max = me.max;\n\n var setMin = function setMin(v) {\n return min = minDefined ? min : v;\n };\n\n var setMax = function setMax(v) {\n return max = maxDefined ? max : v;\n };\n\n var exp = function exp(v, m) {\n return Math.pow(10, Math.floor(log10(v)) + m);\n };\n\n if (min === max) {\n if (min <= 0) {\n setMin(1);\n setMax(10);\n } else {\n setMin(exp(min, -1));\n setMax(exp(max, +1));\n }\n }\n\n if (min <= 0) {\n setMin(exp(max, -1));\n }\n\n if (max <= 0) {\n setMax(exp(min, +1));\n }\n\n if (me._zero && me.min !== me._suggestedMin && min === exp(me.min, 0)) {\n setMin(exp(min, -1));\n }\n\n me.min = min;\n me.max = max;\n }\n }, {\n key: \"buildTicks\",\n value: function buildTicks() {\n var me = this;\n var opts = me.options;\n var generationOptions = {\n min: me._userMin,\n max: me._userMax\n };\n var ticks = generateTicks(generationOptions, me);\n\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, me, 'value');\n }\n\n if (opts.reverse) {\n ticks.reverse();\n me.start = me.max;\n me.end = me.min;\n } else {\n me.start = me.min;\n me.end = me.max;\n }\n\n return ticks;\n }\n }, {\n key: \"getLabelForValue\",\n value: function getLabelForValue(value) {\n return value === undefined ? '0' : formatNumber(value, this.chart.options.locale);\n }\n }, {\n key: \"configure\",\n value: function configure() {\n var me = this;\n var start = me.min;\n\n _get(_getPrototypeOf(LogarithmicScale.prototype), \"configure\", this).call(this);\n\n me._startValue = log10(start);\n me._valueRange = log10(me.max) - log10(start);\n }\n }, {\n key: \"getPixelForValue\",\n value: function getPixelForValue(value) {\n var me = this;\n\n if (value === undefined || value === 0) {\n value = me.min;\n }\n\n if (value === null || isNaN(value)) {\n return NaN;\n }\n\n return me.getPixelForDecimal(value === me.min ? 0 : (log10(value) - me._startValue) / me._valueRange);\n }\n }, {\n key: \"getValueForPixel\",\n value: function getValueForPixel(pixel) {\n var me = this;\n var decimal = me.getDecimalForPixel(pixel);\n return Math.pow(10, me._startValue + decimal * me._valueRange);\n }\n }]);\n\n return LogarithmicScale;\n}(Scale);\n\nLogarithmicScale.id = 'logarithmic';\nLogarithmicScale.defaults = {\n ticks: {\n callback: Ticks.formatters.logarithmic,\n major: {\n enabled: true\n }\n }\n};\n\nfunction getTickBackdropHeight(opts) {\n var tickOpts = opts.ticks;\n\n if (tickOpts.display && opts.display) {\n var padding = toPadding(tickOpts.backdropPadding);\n return valueOrDefault(tickOpts.font && tickOpts.font.size, defaults.font.size) + padding.height;\n }\n\n return 0;\n}\n\nfunction measureLabelSize(ctx, lineHeight, label) {\n if (isArray(label)) {\n return {\n w: _longestText(ctx, ctx.font, label),\n h: label.length * lineHeight\n };\n }\n\n return {\n w: ctx.measureText(label).width,\n h: lineHeight\n };\n}\n\nfunction determineLimits(angle, pos, size, min, max) {\n if (angle === min || angle === max) {\n return {\n start: pos - size / 2,\n end: pos + size / 2\n };\n } else if (angle < min || angle > max) {\n return {\n start: pos - size,\n end: pos\n };\n }\n\n return {\n start: pos,\n end: pos + size\n };\n}\n\nfunction fitWithPointLabels(scale) {\n var furthestLimits = {\n l: 0,\n r: scale.width,\n t: 0,\n b: scale.height - scale.paddingTop\n };\n var furthestAngles = {};\n var i, textSize, pointPosition;\n var labelSizes = [];\n var padding = [];\n var valueCount = scale.getLabels().length;\n\n for (i = 0; i < valueCount; i++) {\n var _opts = scale.options.pointLabels.setContext(scale.getContext(i));\n\n padding[i] = _opts.padding;\n pointPosition = scale.getPointPosition(i, scale.drawingArea + padding[i]);\n var plFont = toFont(_opts.font);\n scale.ctx.font = plFont.string;\n textSize = measureLabelSize(scale.ctx, plFont.lineHeight, scale._pointLabels[i]);\n labelSizes[i] = textSize;\n var angleRadians = scale.getIndexAngle(i);\n var angle = toDegrees(angleRadians);\n var hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);\n var vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);\n\n if (hLimits.start < furthestLimits.l) {\n furthestLimits.l = hLimits.start;\n furthestAngles.l = angleRadians;\n }\n\n if (hLimits.end > furthestLimits.r) {\n furthestLimits.r = hLimits.end;\n furthestAngles.r = angleRadians;\n }\n\n if (vLimits.start < furthestLimits.t) {\n furthestLimits.t = vLimits.start;\n furthestAngles.t = angleRadians;\n }\n\n if (vLimits.end > furthestLimits.b) {\n furthestLimits.b = vLimits.end;\n furthestAngles.b = angleRadians;\n }\n }\n\n scale._setReductions(scale.drawingArea, furthestLimits, furthestAngles);\n\n scale._pointLabelItems = [];\n var opts = scale.options;\n var tickBackdropHeight = getTickBackdropHeight(opts);\n var outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);\n\n for (i = 0; i < valueCount; i++) {\n var extra = i === 0 ? tickBackdropHeight / 2 : 0;\n var pointLabelPosition = scale.getPointPosition(i, outerDistance + extra + padding[i]);\n\n var _angle = toDegrees(scale.getIndexAngle(i));\n\n var size = labelSizes[i];\n adjustPointPositionForLabelHeight(_angle, size, pointLabelPosition);\n var textAlign = getTextAlignForAngle(_angle);\n var left = void 0;\n\n if (textAlign === 'left') {\n left = pointLabelPosition.x;\n } else if (textAlign === 'center') {\n left = pointLabelPosition.x - size.w / 2;\n } else {\n left = pointLabelPosition.x - size.w;\n }\n\n var right = left + size.w;\n scale._pointLabelItems[i] = {\n x: pointLabelPosition.x,\n y: pointLabelPosition.y,\n textAlign: textAlign,\n left: left,\n top: pointLabelPosition.y,\n right: right,\n bottom: pointLabelPosition.y + size.h\n };\n }\n}\n\nfunction getTextAlignForAngle(angle) {\n if (angle === 0 || angle === 180) {\n return 'center';\n } else if (angle < 180) {\n return 'left';\n }\n\n return 'right';\n}\n\nfunction adjustPointPositionForLabelHeight(angle, textSize, position) {\n if (angle === 90 || angle === 270) {\n position.y -= textSize.h / 2;\n } else if (angle > 270 || angle < 90) {\n position.y -= textSize.h;\n }\n}\n\nfunction drawPointLabels(scale, labelCount) {\n var ctx = scale.ctx,\n pointLabels = scale.options.pointLabels;\n\n for (var i = labelCount - 1; i >= 0; i--) {\n var optsAtIndex = pointLabels.setContext(scale.getContext(i));\n var plFont = toFont(optsAtIndex.font);\n var _scale$_pointLabelIte = scale._pointLabelItems[i],\n x = _scale$_pointLabelIte.x,\n y = _scale$_pointLabelIte.y,\n textAlign = _scale$_pointLabelIte.textAlign,\n left = _scale$_pointLabelIte.left,\n top = _scale$_pointLabelIte.top,\n right = _scale$_pointLabelIte.right,\n bottom = _scale$_pointLabelIte.bottom;\n var backdropColor = optsAtIndex.backdropColor;\n\n if (!isNullOrUndef(backdropColor)) {\n var padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillStyle = backdropColor;\n ctx.fillRect(left - padding.left, top - padding.top, right - left + padding.width, bottom - top + padding.height);\n }\n\n renderText(ctx, scale._pointLabels[i], x, y + plFont.lineHeight / 2, plFont, {\n color: optsAtIndex.color,\n textAlign: textAlign,\n textBaseline: 'middle'\n });\n }\n}\n\nfunction pathRadiusLine(scale, radius, circular, labelCount) {\n var ctx = scale.ctx;\n\n if (circular) {\n ctx.arc(scale.xCenter, scale.yCenter, radius, 0, TAU);\n } else {\n var pointPosition = scale.getPointPosition(0, radius);\n ctx.moveTo(pointPosition.x, pointPosition.y);\n\n for (var i = 1; i < labelCount; i++) {\n pointPosition = scale.getPointPosition(i, radius);\n ctx.lineTo(pointPosition.x, pointPosition.y);\n }\n }\n}\n\nfunction drawRadiusLine(scale, gridLineOpts, radius, labelCount) {\n var ctx = scale.ctx;\n var circular = gridLineOpts.circular;\n var color = gridLineOpts.color,\n lineWidth = gridLineOpts.lineWidth;\n\n if (!circular && !labelCount || !color || !lineWidth || radius < 0) {\n return;\n }\n\n ctx.save();\n ctx.strokeStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash(gridLineOpts.borderDash);\n ctx.lineDashOffset = gridLineOpts.borderDashOffset;\n ctx.beginPath();\n pathRadiusLine(scale, radius, circular, labelCount);\n ctx.closePath();\n ctx.stroke();\n ctx.restore();\n}\n\nfunction numberOrZero(param) {\n return isNumber(param) ? param : 0;\n}\n\nvar RadialLinearScale = /*#__PURE__*/function (_LinearScaleBase2) {\n _inherits(RadialLinearScale, _LinearScaleBase2);\n\n var _super23 = _createSuper(RadialLinearScale);\n\n function RadialLinearScale(cfg) {\n var _this17;\n\n _classCallCheck(this, RadialLinearScale);\n\n _this17 = _super23.call(this, cfg);\n _this17.xCenter = undefined;\n _this17.yCenter = undefined;\n _this17.drawingArea = undefined;\n _this17._pointLabels = [];\n _this17._pointLabelItems = [];\n return _this17;\n }\n\n _createClass(RadialLinearScale, [{\n key: \"setDimensions\",\n value: function setDimensions() {\n var me = this;\n me.width = me.maxWidth;\n me.height = me.maxHeight;\n me.paddingTop = getTickBackdropHeight(me.options) / 2;\n me.xCenter = Math.floor(me.width / 2);\n me.yCenter = Math.floor((me.height - me.paddingTop) / 2);\n me.drawingArea = Math.min(me.height - me.paddingTop, me.width) / 2;\n }\n }, {\n key: \"determineDataLimits\",\n value: function determineDataLimits() {\n var me = this;\n\n var _me$getMinMax4 = me.getMinMax(false),\n min = _me$getMinMax4.min,\n max = _me$getMinMax4.max;\n\n me.min = isNumberFinite(min) && !isNaN(min) ? min : 0;\n me.max = isNumberFinite(max) && !isNaN(max) ? max : 0;\n me.handleTickRangeOptions();\n }\n }, {\n key: \"computeTickLimit\",\n value: function computeTickLimit() {\n return Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));\n }\n }, {\n key: \"generateTickLabels\",\n value: function generateTickLabels(ticks) {\n var me = this;\n LinearScaleBase.prototype.generateTickLabels.call(me, ticks);\n me._pointLabels = me.getLabels().map(function (value, index) {\n var label = callback(me.options.pointLabels.callback, [value, index], me);\n return label || label === 0 ? label : '';\n });\n }\n }, {\n key: \"fit\",\n value: function fit() {\n var me = this;\n var opts = me.options;\n\n if (opts.display && opts.pointLabels.display) {\n fitWithPointLabels(me);\n } else {\n me.setCenterPoint(0, 0, 0, 0);\n }\n }\n }, {\n key: \"_setReductions\",\n value: function _setReductions(largestPossibleRadius, furthestLimits, furthestAngles) {\n var me = this;\n var radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l);\n var radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r);\n var radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t);\n var radiusReductionBottom = -Math.max(furthestLimits.b - (me.height - me.paddingTop), 0) / Math.cos(furthestAngles.b);\n radiusReductionLeft = numberOrZero(radiusReductionLeft);\n radiusReductionRight = numberOrZero(radiusReductionRight);\n radiusReductionTop = numberOrZero(radiusReductionTop);\n radiusReductionBottom = numberOrZero(radiusReductionBottom);\n me.drawingArea = Math.max(largestPossibleRadius / 2, Math.min(Math.floor(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2), Math.floor(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2)));\n me.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom);\n }\n }, {\n key: \"setCenterPoint\",\n value: function setCenterPoint(leftMovement, rightMovement, topMovement, bottomMovement) {\n var me = this;\n var maxRight = me.width - rightMovement - me.drawingArea;\n var maxLeft = leftMovement + me.drawingArea;\n var maxTop = topMovement + me.drawingArea;\n var maxBottom = me.height - me.paddingTop - bottomMovement - me.drawingArea;\n me.xCenter = Math.floor((maxLeft + maxRight) / 2 + me.left);\n me.yCenter = Math.floor((maxTop + maxBottom) / 2 + me.top + me.paddingTop);\n }\n }, {\n key: \"getIndexAngle\",\n value: function getIndexAngle(index) {\n var angleMultiplier = TAU / this.getLabels().length;\n var startAngle = this.options.startAngle || 0;\n return _normalizeAngle(index * angleMultiplier + toRadians(startAngle));\n }\n }, {\n key: \"getDistanceFromCenterForValue\",\n value: function getDistanceFromCenterForValue(value) {\n var me = this;\n\n if (isNullOrUndef(value)) {\n return NaN;\n }\n\n var scalingFactor = me.drawingArea / (me.max - me.min);\n\n if (me.options.reverse) {\n return (me.max - value) * scalingFactor;\n }\n\n return (value - me.min) * scalingFactor;\n }\n }, {\n key: \"getValueForDistanceFromCenter\",\n value: function getValueForDistanceFromCenter(distance) {\n if (isNullOrUndef(distance)) {\n return NaN;\n }\n\n var me = this;\n var scaledDistance = distance / (me.drawingArea / (me.max - me.min));\n return me.options.reverse ? me.max - scaledDistance : me.min + scaledDistance;\n }\n }, {\n key: \"getPointPosition\",\n value: function getPointPosition(index, distanceFromCenter) {\n var me = this;\n var angle = me.getIndexAngle(index) - HALF_PI;\n return {\n x: Math.cos(angle) * distanceFromCenter + me.xCenter,\n y: Math.sin(angle) * distanceFromCenter + me.yCenter,\n angle: angle\n };\n }\n }, {\n key: \"getPointPositionForValue\",\n value: function getPointPositionForValue(index, value) {\n return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));\n }\n }, {\n key: \"getBasePosition\",\n value: function getBasePosition(index) {\n return this.getPointPositionForValue(index || 0, this.getBaseValue());\n }\n }, {\n key: \"getPointLabelPosition\",\n value: function getPointLabelPosition(index) {\n var _this$_pointLabelItem = this._pointLabelItems[index],\n left = _this$_pointLabelItem.left,\n top = _this$_pointLabelItem.top,\n right = _this$_pointLabelItem.right,\n bottom = _this$_pointLabelItem.bottom;\n return {\n left: left,\n top: top,\n right: right,\n bottom: bottom\n };\n }\n }, {\n key: \"drawBackground\",\n value: function drawBackground() {\n var me = this;\n var _me$options7 = me.options,\n backgroundColor = _me$options7.backgroundColor,\n circular = _me$options7.grid.circular;\n\n if (backgroundColor) {\n var ctx = me.ctx;\n ctx.save();\n ctx.beginPath();\n pathRadiusLine(me, me.getDistanceFromCenterForValue(me._endValue), circular, me.getLabels().length);\n ctx.closePath();\n ctx.fillStyle = backgroundColor;\n ctx.fill();\n ctx.restore();\n }\n }\n }, {\n key: \"drawGrid\",\n value: function drawGrid() {\n var me = this;\n var ctx = me.ctx;\n var opts = me.options;\n var angleLines = opts.angleLines,\n grid = opts.grid;\n var labelCount = me.getLabels().length;\n var i, offset, position;\n\n if (opts.pointLabels.display) {\n drawPointLabels(me, labelCount);\n }\n\n if (grid.display) {\n me.ticks.forEach(function (tick, index) {\n if (index !== 0) {\n offset = me.getDistanceFromCenterForValue(tick.value);\n var optsAtIndex = grid.setContext(me.getContext(index - 1));\n drawRadiusLine(me, optsAtIndex, offset, labelCount);\n }\n });\n }\n\n if (angleLines.display) {\n ctx.save();\n\n for (i = me.getLabels().length - 1; i >= 0; i--) {\n var optsAtIndex = angleLines.setContext(me.getContext(i));\n var color = optsAtIndex.color,\n lineWidth = optsAtIndex.lineWidth;\n\n if (!lineWidth || !color) {\n continue;\n }\n\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = color;\n ctx.setLineDash(optsAtIndex.borderDash);\n ctx.lineDashOffset = optsAtIndex.borderDashOffset;\n offset = me.getDistanceFromCenterForValue(opts.ticks.reverse ? me.min : me.max);\n position = me.getPointPosition(i, offset);\n ctx.beginPath();\n ctx.moveTo(me.xCenter, me.yCenter);\n ctx.lineTo(position.x, position.y);\n ctx.stroke();\n }\n\n ctx.restore();\n }\n }\n }, {\n key: \"drawBorder\",\n value: function drawBorder() {}\n }, {\n key: \"drawLabels\",\n value: function drawLabels() {\n var me = this;\n var ctx = me.ctx;\n var opts = me.options;\n var tickOpts = opts.ticks;\n\n if (!tickOpts.display) {\n return;\n }\n\n var startAngle = me.getIndexAngle(0);\n var offset, width;\n ctx.save();\n ctx.translate(me.xCenter, me.yCenter);\n ctx.rotate(startAngle);\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n me.ticks.forEach(function (tick, index) {\n if (index === 0 && !opts.reverse) {\n return;\n }\n\n var optsAtIndex = tickOpts.setContext(me.getContext(index));\n var tickFont = toFont(optsAtIndex.font);\n offset = me.getDistanceFromCenterForValue(me.ticks[index].value);\n\n if (optsAtIndex.showLabelBackdrop) {\n width = ctx.measureText(tick.label).width;\n ctx.fillStyle = optsAtIndex.backdropColor;\n var padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillRect(-width / 2 - padding.left, -offset - tickFont.size / 2 - padding.top, width + padding.width, tickFont.size + padding.height);\n }\n\n renderText(ctx, tick.label, 0, -offset, tickFont, {\n color: optsAtIndex.color\n });\n });\n ctx.restore();\n }\n }, {\n key: \"drawTitle\",\n value: function drawTitle() {}\n }]);\n\n return RadialLinearScale;\n}(LinearScaleBase);\n\nRadialLinearScale.id = 'radialLinear';\nRadialLinearScale.defaults = {\n display: true,\n animate: true,\n position: 'chartArea',\n angleLines: {\n display: true,\n lineWidth: 1,\n borderDash: [],\n borderDashOffset: 0.0\n },\n grid: {\n circular: false\n },\n startAngle: 0,\n ticks: {\n showLabelBackdrop: true,\n callback: Ticks.formatters.numeric\n },\n pointLabels: {\n backdropColor: undefined,\n backdropPadding: 2,\n display: true,\n font: {\n size: 10\n },\n callback: function callback(label) {\n return label;\n },\n padding: 5\n }\n};\nRadialLinearScale.defaultRoutes = {\n 'angleLines.color': 'borderColor',\n 'pointLabels.color': 'color',\n 'ticks.color': 'color'\n};\nRadialLinearScale.descriptors = {\n angleLines: {\n _fallback: 'grid'\n }\n};\nvar INTERVALS = {\n millisecond: {\n common: true,\n size: 1,\n steps: 1000\n },\n second: {\n common: true,\n size: 1000,\n steps: 60\n },\n minute: {\n common: true,\n size: 60000,\n steps: 60\n },\n hour: {\n common: true,\n size: 3600000,\n steps: 24\n },\n day: {\n common: true,\n size: 86400000,\n steps: 30\n },\n week: {\n common: false,\n size: 604800000,\n steps: 4\n },\n month: {\n common: true,\n size: 2.628e9,\n steps: 12\n },\n quarter: {\n common: false,\n size: 7.884e9,\n steps: 4\n },\n year: {\n common: true,\n size: 3.154e10\n }\n};\nvar UNITS = Object.keys(INTERVALS);\n\nfunction sorter(a, b) {\n return a - b;\n}\n\nfunction _parse(scale, input) {\n if (isNullOrUndef(input)) {\n return null;\n }\n\n var adapter = scale._adapter;\n var _scale$_parseOpts = scale._parseOpts,\n parser = _scale$_parseOpts.parser,\n round = _scale$_parseOpts.round,\n isoWeekday = _scale$_parseOpts.isoWeekday;\n var value = input;\n\n if (typeof parser === 'function') {\n value = parser(value);\n }\n\n if (!isNumberFinite(value)) {\n value = typeof parser === 'string' ? adapter.parse(value, parser) : adapter.parse(value);\n }\n\n if (value === null) {\n return null;\n }\n\n if (round) {\n value = round === 'week' && (isNumber(isoWeekday) || isoWeekday === true) ? adapter.startOf(value, 'isoWeek', isoWeekday) : adapter.startOf(value, round);\n }\n\n return +value;\n}\n\nfunction determineUnitForAutoTicks(minUnit, min, max, capacity) {\n var ilen = UNITS.length;\n\n for (var i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {\n var interval = INTERVALS[UNITS[i]];\n var factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER;\n\n if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {\n return UNITS[i];\n }\n }\n\n return UNITS[ilen - 1];\n}\n\nfunction determineUnitForFormatting(scale, numTicks, minUnit, min, max) {\n for (var i = UNITS.length - 1; i >= UNITS.indexOf(minUnit); i--) {\n var unit = UNITS[i];\n\n if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= numTicks - 1) {\n return unit;\n }\n }\n\n return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];\n}\n\nfunction determineMajorUnit(unit) {\n for (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {\n if (INTERVALS[UNITS[i]].common) {\n return UNITS[i];\n }\n }\n}\n\nfunction addTick(ticks, time, timestamps) {\n if (!timestamps) {\n ticks[time] = true;\n } else if (timestamps.length) {\n var _lookup2 = _lookup(timestamps, time),\n lo = _lookup2.lo,\n hi = _lookup2.hi;\n\n var timestamp = timestamps[lo] >= time ? timestamps[lo] : timestamps[hi];\n ticks[timestamp] = true;\n }\n}\n\nfunction setMajorTicks(scale, ticks, map, majorUnit) {\n var adapter = scale._adapter;\n var first = +adapter.startOf(ticks[0].value, majorUnit);\n var last = ticks[ticks.length - 1].value;\n var major, index;\n\n for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {\n index = map[major];\n\n if (index >= 0) {\n ticks[index].major = true;\n }\n }\n\n return ticks;\n}\n\nfunction ticksFromTimestamps(scale, values, majorUnit) {\n var ticks = [];\n var map = {};\n var ilen = values.length;\n var i, value;\n\n for (i = 0; i < ilen; ++i) {\n value = values[i];\n map[value] = i;\n ticks.push({\n value: value,\n major: false\n });\n }\n\n return ilen === 0 || !majorUnit ? ticks : setMajorTicks(scale, ticks, map, majorUnit);\n}\n\nvar TimeScale = /*#__PURE__*/function (_Scale4) {\n _inherits(TimeScale, _Scale4);\n\n var _super24 = _createSuper(TimeScale);\n\n function TimeScale(props) {\n var _this18;\n\n _classCallCheck(this, TimeScale);\n\n _this18 = _super24.call(this, props);\n _this18._cache = {\n data: [],\n labels: [],\n all: []\n };\n _this18._unit = 'day';\n _this18._majorUnit = undefined;\n _this18._offsets = {};\n _this18._normalized = false;\n _this18._parseOpts = undefined;\n return _this18;\n }\n\n _createClass(TimeScale, [{\n key: \"init\",\n value: function init(scaleOpts, opts) {\n var time = scaleOpts.time || (scaleOpts.time = {});\n var adapter = this._adapter = new adapters._date(scaleOpts.adapters.date);\n mergeIf(time.displayFormats, adapter.formats());\n this._parseOpts = {\n parser: time.parser,\n round: time.round,\n isoWeekday: time.isoWeekday\n };\n\n _get(_getPrototypeOf(TimeScale.prototype), \"init\", this).call(this, scaleOpts);\n\n this._normalized = opts.normalized;\n }\n }, {\n key: \"parse\",\n value: function parse(raw, index) {\n if (raw === undefined) {\n return null;\n }\n\n return _parse(this, raw);\n }\n }, {\n key: \"beforeLayout\",\n value: function beforeLayout() {\n _get(_getPrototypeOf(TimeScale.prototype), \"beforeLayout\", this).call(this);\n\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n }\n }, {\n key: \"determineDataLimits\",\n value: function determineDataLimits() {\n var me = this;\n var options = me.options;\n var adapter = me._adapter;\n var unit = options.time.unit || 'day';\n\n var _me$getUserBounds5 = me.getUserBounds(),\n min = _me$getUserBounds5.min,\n max = _me$getUserBounds5.max,\n minDefined = _me$getUserBounds5.minDefined,\n maxDefined = _me$getUserBounds5.maxDefined;\n\n function _applyBounds(bounds) {\n if (!minDefined && !isNaN(bounds.min)) {\n min = Math.min(min, bounds.min);\n }\n\n if (!maxDefined && !isNaN(bounds.max)) {\n max = Math.max(max, bounds.max);\n }\n }\n\n if (!minDefined || !maxDefined) {\n _applyBounds(me._getLabelBounds());\n\n if (options.bounds !== 'ticks' || options.ticks.source !== 'labels') {\n _applyBounds(me.getMinMax(false));\n }\n }\n\n min = isNumberFinite(min) && !isNaN(min) ? min : +adapter.startOf(Date.now(), unit);\n max = isNumberFinite(max) && !isNaN(max) ? max : +adapter.endOf(Date.now(), unit) + 1;\n me.min = Math.min(min, max - 1);\n me.max = Math.max(min + 1, max);\n }\n }, {\n key: \"_getLabelBounds\",\n value: function _getLabelBounds() {\n var arr = this.getLabelTimestamps();\n var min = Number.POSITIVE_INFINITY;\n var max = Number.NEGATIVE_INFINITY;\n\n if (arr.length) {\n min = arr[0];\n max = arr[arr.length - 1];\n }\n\n return {\n min: min,\n max: max\n };\n }\n }, {\n key: \"buildTicks\",\n value: function buildTicks() {\n var me = this;\n var options = me.options;\n var timeOpts = options.time;\n var tickOpts = options.ticks;\n var timestamps = tickOpts.source === 'labels' ? me.getLabelTimestamps() : me._generate();\n\n if (options.bounds === 'ticks' && timestamps.length) {\n me.min = me._userMin || timestamps[0];\n me.max = me._userMax || timestamps[timestamps.length - 1];\n }\n\n var min = me.min;\n var max = me.max;\n\n var ticks = _filterBetween(timestamps, min, max);\n\n me._unit = timeOpts.unit || (tickOpts.autoSkip ? determineUnitForAutoTicks(timeOpts.minUnit, me.min, me.max, me._getLabelCapacity(min)) : determineUnitForFormatting(me, ticks.length, timeOpts.minUnit, me.min, me.max));\n me._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined : determineMajorUnit(me._unit);\n me.initOffsets(timestamps);\n\n if (options.reverse) {\n ticks.reverse();\n }\n\n return ticksFromTimestamps(me, ticks, me._majorUnit);\n }\n }, {\n key: \"initOffsets\",\n value: function initOffsets(timestamps) {\n var me = this;\n var start = 0;\n var end = 0;\n var first, last;\n\n if (me.options.offset && timestamps.length) {\n first = me.getDecimalForValue(timestamps[0]);\n\n if (timestamps.length === 1) {\n start = 1 - first;\n } else {\n start = (me.getDecimalForValue(timestamps[1]) - first) / 2;\n }\n\n last = me.getDecimalForValue(timestamps[timestamps.length - 1]);\n\n if (timestamps.length === 1) {\n end = last;\n } else {\n end = (last - me.getDecimalForValue(timestamps[timestamps.length - 2])) / 2;\n }\n }\n\n var limit = timestamps.length < 3 ? 0.5 : 0.25;\n start = _limitValue(start, 0, limit);\n end = _limitValue(end, 0, limit);\n me._offsets = {\n start: start,\n end: end,\n factor: 1 / (start + 1 + end)\n };\n }\n }, {\n key: \"_generate\",\n value: function _generate() {\n var me = this;\n var adapter = me._adapter;\n var min = me.min;\n var max = me.max;\n var options = me.options;\n var timeOpts = options.time;\n var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, me._getLabelCapacity(min));\n var stepSize = valueOrDefault(timeOpts.stepSize, 1);\n var weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n var hasWeekday = isNumber(weekday) || weekday === true;\n var ticks = {};\n var first = min;\n var time, count;\n\n if (hasWeekday) {\n first = +adapter.startOf(first, 'isoWeek', weekday);\n }\n\n first = +adapter.startOf(first, hasWeekday ? 'day' : minor);\n\n if (adapter.diff(max, min, minor) > 100000 * stepSize) {\n throw new Error(min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor);\n }\n\n var timestamps = options.ticks.source === 'data' && me.getDataTimestamps();\n\n for (time = first, count = 0; time < max; time = +adapter.add(time, stepSize, minor), count++) {\n addTick(ticks, time, timestamps);\n }\n\n if (time === max || options.bounds === 'ticks' || count === 1) {\n addTick(ticks, time, timestamps);\n }\n\n return Object.keys(ticks).sort(function (a, b) {\n return a - b;\n }).map(function (x) {\n return +x;\n });\n }\n }, {\n key: \"getLabelForValue\",\n value: function getLabelForValue(value) {\n var me = this;\n var adapter = me._adapter;\n var timeOpts = me.options.time;\n\n if (timeOpts.tooltipFormat) {\n return adapter.format(value, timeOpts.tooltipFormat);\n }\n\n return adapter.format(value, timeOpts.displayFormats.datetime);\n }\n }, {\n key: \"_tickFormatFunction\",\n value: function _tickFormatFunction(time, index, ticks, format) {\n var me = this;\n var options = me.options;\n var formats = options.time.displayFormats;\n var unit = me._unit;\n var majorUnit = me._majorUnit;\n var minorFormat = unit && formats[unit];\n var majorFormat = majorUnit && formats[majorUnit];\n var tick = ticks[index];\n var major = majorUnit && majorFormat && tick && tick.major;\n\n var label = me._adapter.format(time, format || (major ? majorFormat : minorFormat));\n\n var formatter = options.ticks.callback;\n return formatter ? callback(formatter, [label, index, ticks], me) : label;\n }\n }, {\n key: \"generateTickLabels\",\n value: function generateTickLabels(ticks) {\n var i, ilen, tick;\n\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n tick.label = this._tickFormatFunction(tick.value, i, ticks);\n }\n }\n }, {\n key: \"getDecimalForValue\",\n value: function getDecimalForValue(value) {\n var me = this;\n return value === null ? NaN : (value - me.min) / (me.max - me.min);\n }\n }, {\n key: \"getPixelForValue\",\n value: function getPixelForValue(value) {\n var me = this;\n var offsets = me._offsets;\n var pos = me.getDecimalForValue(value);\n return me.getPixelForDecimal((offsets.start + pos) * offsets.factor);\n }\n }, {\n key: \"getValueForPixel\",\n value: function getValueForPixel(pixel) {\n var me = this;\n var offsets = me._offsets;\n var pos = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return me.min + pos * (me.max - me.min);\n }\n }, {\n key: \"_getLabelSize\",\n value: function _getLabelSize(label) {\n var me = this;\n var ticksOpts = me.options.ticks;\n var tickLabelWidth = me.ctx.measureText(label).width;\n var angle = toRadians(me.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);\n var cosRotation = Math.cos(angle);\n var sinRotation = Math.sin(angle);\n\n var tickFontSize = me._resolveTickFontOptions(0).size;\n\n return {\n w: tickLabelWidth * cosRotation + tickFontSize * sinRotation,\n h: tickLabelWidth * sinRotation + tickFontSize * cosRotation\n };\n }\n }, {\n key: \"_getLabelCapacity\",\n value: function _getLabelCapacity(exampleTime) {\n var me = this;\n var timeOpts = me.options.time;\n var displayFormats = timeOpts.displayFormats;\n var format = displayFormats[timeOpts.unit] || displayFormats.millisecond;\n\n var exampleLabel = me._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(me, [exampleTime], me._majorUnit), format);\n\n var size = me._getLabelSize(exampleLabel);\n\n var capacity = Math.floor(me.isHorizontal() ? me.width / size.w : me.height / size.h) - 1;\n return capacity > 0 ? capacity : 1;\n }\n }, {\n key: \"getDataTimestamps\",\n value: function getDataTimestamps() {\n var me = this;\n var timestamps = me._cache.data || [];\n var i, ilen;\n\n if (timestamps.length) {\n return timestamps;\n }\n\n var metas = me.getMatchingVisibleMetas();\n\n if (me._normalized && metas.length) {\n return me._cache.data = metas[0].controller.getAllParsedValues(me);\n }\n\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n timestamps = timestamps.concat(metas[i].controller.getAllParsedValues(me));\n }\n\n return me._cache.data = me.normalize(timestamps);\n }\n }, {\n key: \"getLabelTimestamps\",\n value: function getLabelTimestamps() {\n var me = this;\n var timestamps = me._cache.labels || [];\n var i, ilen;\n\n if (timestamps.length) {\n return timestamps;\n }\n\n var labels = me.getLabels();\n\n for (i = 0, ilen = labels.length; i < ilen; ++i) {\n timestamps.push(_parse(me, labels[i]));\n }\n\n return me._cache.labels = me._normalized ? timestamps : me.normalize(timestamps);\n }\n }, {\n key: \"normalize\",\n value: function normalize(values) {\n return _arrayUnique(values.sort(sorter));\n }\n }]);\n\n return TimeScale;\n}(Scale);\n\nTimeScale.id = 'time';\nTimeScale.defaults = {\n bounds: 'data',\n adapters: {},\n time: {\n parser: false,\n unit: false,\n round: false,\n isoWeekday: false,\n minUnit: 'millisecond',\n displayFormats: {}\n },\n ticks: {\n source: 'auto',\n major: {\n enabled: false\n }\n }\n};\n\nfunction interpolate(table, val, reverse) {\n var prevSource, nextSource, prevTarget, nextTarget;\n\n if (reverse) {\n prevSource = Math.floor(val);\n nextSource = Math.ceil(val);\n prevTarget = table[prevSource];\n nextTarget = table[nextSource];\n } else {\n var result = _lookup(table, val);\n\n prevTarget = result.lo;\n nextTarget = result.hi;\n prevSource = table[prevTarget];\n nextSource = table[nextTarget];\n }\n\n var span = nextSource - prevSource;\n return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;\n}\n\nvar TimeSeriesScale = /*#__PURE__*/function (_TimeScale) {\n _inherits(TimeSeriesScale, _TimeScale);\n\n var _super25 = _createSuper(TimeSeriesScale);\n\n function TimeSeriesScale(props) {\n var _this19;\n\n _classCallCheck(this, TimeSeriesScale);\n\n _this19 = _super25.call(this, props);\n _this19._table = [];\n _this19._maxIndex = undefined;\n return _this19;\n }\n\n _createClass(TimeSeriesScale, [{\n key: \"initOffsets\",\n value: function initOffsets() {\n var me = this;\n\n var timestamps = me._getTimestampsForTable();\n\n me._table = me.buildLookupTable(timestamps);\n me._maxIndex = me._table.length - 1;\n\n _get(_getPrototypeOf(TimeSeriesScale.prototype), \"initOffsets\", this).call(this, timestamps);\n }\n }, {\n key: \"buildLookupTable\",\n value: function buildLookupTable(timestamps) {\n var me = this;\n var min = me.min,\n max = me.max;\n\n if (!timestamps.length) {\n return [{\n time: min,\n pos: 0\n }, {\n time: max,\n pos: 1\n }];\n }\n\n var items = [min];\n var i, ilen, curr;\n\n for (i = 0, ilen = timestamps.length; i < ilen; ++i) {\n curr = timestamps[i];\n\n if (curr > min && curr < max) {\n items.push(curr);\n }\n }\n\n items.push(max);\n return items;\n }\n }, {\n key: \"_getTimestampsForTable\",\n value: function _getTimestampsForTable() {\n var me = this;\n var timestamps = me._cache.all || [];\n\n if (timestamps.length) {\n return timestamps;\n }\n\n var data = me.getDataTimestamps();\n var label = me.getLabelTimestamps();\n\n if (data.length && label.length) {\n timestamps = me.normalize(data.concat(label));\n } else {\n timestamps = data.length ? data : label;\n }\n\n timestamps = me._cache.all = timestamps;\n return timestamps;\n }\n }, {\n key: \"getPixelForValue\",\n value: function getPixelForValue(value, index) {\n var me = this;\n var offsets = me._offsets;\n var pos = me._normalized && me._maxIndex > 0 && !isNullOrUndef(index) ? index / me._maxIndex : me.getDecimalForValue(value);\n return me.getPixelForDecimal((offsets.start + pos) * offsets.factor);\n }\n }, {\n key: \"getDecimalForValue\",\n value: function getDecimalForValue(value) {\n return interpolate(this._table, value) / this._maxIndex;\n }\n }, {\n key: \"getValueForPixel\",\n value: function getValueForPixel(pixel) {\n var me = this;\n var offsets = me._offsets;\n var decimal = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return interpolate(me._table, decimal * this._maxIndex, true);\n }\n }]);\n\n return TimeSeriesScale;\n}(TimeScale);\n\nTimeSeriesScale.id = 'timeseries';\nTimeSeriesScale.defaults = TimeScale.defaults;\nvar scales = /*#__PURE__*/Object.freeze({\n __proto__: null,\n CategoryScale: CategoryScale,\n LinearScale: LinearScale,\n LogarithmicScale: LogarithmicScale,\n RadialLinearScale: RadialLinearScale,\n TimeScale: TimeScale,\n TimeSeriesScale: TimeSeriesScale\n});\nvar registerables = [controllers, elements, plugins, scales];\nexport { Animation, Animations, ArcElement, BarController, BarElement, BasePlatform, BasicPlatform, BubbleController, CategoryScale, Chart, DatasetController, plugin_decimation as Decimation, DomPlatform, DoughnutController, Element, plugin_filler as Filler, Interaction, plugin_legend as Legend, LineController, LineElement, LinearScale, LogarithmicScale, PieController, PointElement, PolarAreaController, RadarController, RadialLinearScale, Scale, ScatterController, Ticks, TimeScale, TimeSeriesScale, plugin_title as Title, plugin_tooltip as Tooltip, adapters as _adapters, animator, controllers, elements, layouts, plugins, registerables, registry, scales };","map":{"version":3,"names":["r","requestAnimFrame","a","resolve","e","effects","c","color","i","isObject","b","isArray","d","defaults","v","valueOrDefault","u","unlistenArrayEvents","l","listenArrayEvents","f","resolveObjectKey","g","isNumberFinite","h","defined","s","sign","j","isNullOrUndef","k","clipArea","m","unclipArea","_","_arrayUnique","t","toRadians","n","toPercentage","o","toDimension","T","TAU","p","formatNumber","q","_angleBetween","H","HALF_PI","P","PI","w","isNumber","x","_limitValue","y","_lookupByKey","z","getRelativePosition$1","A","_isPointInArea","B","_rlookupByKey","C","toPadding","D","each","E","getMaximumSize","F","_getParentNode","G","readUsedSize","I","throttled","J","supportsEventListenerOptions","K","log10","L","_factorize","M","finiteOrDefault","N","callback","O","_addGrace","Q","toDegrees","R","_measureText","S","_int16Range","U","_alignPixel","V","renderText","W","toFont","X","_toLeftRightCenter","Y","_alignStartEnd","Z","overrides","$","merge","a0","_capitalize","a1","descriptors","a2","isFunction","a3","_attachContext","a4","_createResolver","a5","_descriptors","a6","mergeIf","a7","uid","a8","debounce","a9","retinaScale","aa","clearCanvas","ab","setsEqual","ac","_elementsEqual","ad","getAngleFromPoint","ae","_readValueToProps","af","_updateBezierControlPoints","ag","_computeSegments","ah","_boundSegments","ai","_steppedInterpolation","aj","_bezierInterpolation","ak","_pointInLine","al","_steppedLineTo","am","_bezierCurveTo","an","drawPoint","ao","addRoundedRectPath","ap","toTRBL","aq","toTRBLCorners","ar","_boundSegment","as","_normalizeAngle","at","getRtlAdapter","au","overrideTextDirection","av","_textX","aw","restoreTextDirection","ax","noop","ay","distanceBetweenPoints","az","_setMinAndMaxByKey","aA","niceNum","aB","almostWhole","aC","almostEquals","aD","_decimalPlaces","aE","_longestText","aF","_filterBetween","aG","_lookup","Animator","_request","_charts","Map","_running","_lastDate","undefined","chart","anims","date","type","callbacks","listeners","numSteps","duration","forEach","fn","initial","currentStep","Math","min","start","me","call","window","_update","_refresh","Date","now","remaining","running","items","length","draw","item","_active","_total","tick","pop","_notify","charts","get","complete","progress","set","event","cb","_getAnims","push","reduce","acc","cur","max","_duration","cancel","delete","animator","transparent","interpolators","boolean","from","to","factor","c0","c1","valid","mix","hexString","number","Animation","cfg","target","prop","currentValue","_fn","_easing","easing","linear","_start","floor","delay","_loop","loop","_target","_prop","_from","_to","_promises","elapsed","remain","promises","Promise","res","rej","resolved","method","numbers","colors","animationOptions","Object","keys","animation","describe","_fallback","_indexable","_scriptable","name","properties","active","resize","show","animations","visible","hide","Animations","config","_chart","_properties","configure","animatedProps","getOwnPropertyNames","key","option","has","values","newOptions","options","resolveTargetOptions","_createAnimations","$shared","awaitAll","$animations","then","props","charAt","_animateOptions","value","update","size","assign","add","anim","wait","all","scaleClip","scale","allowedOverflow","opts","reverse","end","defaultClip","xScale","yScale","top","right","bottom","left","toClip","getSortedDatasetIndices","filterVisible","metasets","_getSortedDatasetMetas","ilen","index","applyStack","stack","dsIndex","singleMode","mode","datasetIndex","otherValue","convertObjectDataToArray","data","adata","Array","isStacked","meta","stacked","getStackKey","indexScale","valueScale","id","getUserBounds","minDefined","maxDefined","Number","NEGATIVE_INFINITY","POSITIVE_INFINITY","getOrCreateStack","stacks","stackKey","indexValue","subStack","getLastIndexInStack","vScale","positive","getMatchingVisibleMetas","updateStacks","controller","parsed","_cachedMeta","_stacks","iScale","iAxis","axis","vAxis","itemStacks","_top","_bottom","getFirstScaleId","scales","filter","shift","createDatasetContext","parent","create","dataset","createDataContext","element","dataIndex","raw","clearStacks","_parsed","isDirectUpdateMode","cloneIfNotShared","cached","shared","DatasetController","_ctx","ctx","_cachedDataOpts","getMeta","_type","_parsing","_data","_objectData","_sharedOptions","_drawStart","_drawCount","enableOptionSharing","$context","_syncList","initialize","linkScales","_stacked","addElements","getDataset","chooseId","xid","xAxisID","yid","yAxisID","rid","rAxisID","indexAxis","iid","iAxisID","vid","vAxisID","getScaleForId","rScale","datasets","getDatasetMeta","scaleID","isExtensible","_dataCheck","datasetElementType","resetNewElements","stackChanged","oldStacked","_resyncElements","scopeKeys","datasetScopeKeys","scopes","getOptionScopes","createResolver","getContext","parsing","count","sorted","_sorted","prev","parseArrayData","parseObjectData","parsePrimitiveData","isNotInOrderComparedToPrev","labels","getLabels","singleScale","parse","xAxisKey","yAxisKey","range","parsedValue","NaN","canStack","otherScale","_getOtherScale","otherMin","otherMax","_skip","updateRangeFromParsed","getParsed","label","getLabelForValue","_clip","clip","getMaxOverflow","elements","area","chartArea","resolveDatasetElementOptions","resolveDataElementOptions","context","_resolveElementOptions","dataElementType","elementType","cache","cacheKey","sharing","datasetElementScopeKeys","prefixes","names","resolveNamedOptions","freeze","transition","datasetAnimationScopeKeys","_cacheable","sharedOptions","_animationsDisabled","_resolveAnimations","getStyle","getSharedOptions","_setStyle","arg1","arg2","numMeta","numData","_insertElements","_removeElements","move","arr","updateElements","removed","splice","arguments","prototype","getAllScaleValues","_cache","$bar","metas","concat","getAllParsedValues","sort","computeMinSampleSize","_length","curr","updateMinAndPrev","abs","getPixelForValue","ticks","getPixelForTick","computeFitCategoryTraits","ruler","stackCount","thickness","barThickness","ratio","categoryPercentage","barPercentage","chunk","pixels","computeFlexCategoryTraits","next","percent","parseFloatBar","entry","startValue","endValue","barStart","barEnd","_custom","parseValue","parseArrayOrPrimitive","isFloatBar","custom","BarController","iAxisKey","vAxisKey","obj","bars","reset","base","getBasePixel","horizontal","isHorizontal","_getRuler","firstOpts","includeOptions","updateSharedOptions","vpixels","head","_calculateBarValuePixels","ipixels","_calculateBarIndexPixels","enableBorderRadius","center","height","width","updateElement","last","val","isNaN","indexOf","_getStacks","_startPixel","_endPixel","_getStackCount","grouped","baseValue","minBarLength","floating","getDataVisibility","actualBase","halfGrid","getLineWidthForValue","skipNull","maxBarThickness","Infinity","stackIndex","_getStackIndex","rects","interaction","_index_","offset","grid","_value_","beginAtZero","BubbleController","points","point","iPixel","getPixelForDecimal","vPixel","skip","radius","plugins","tooltip","title","getRatioAndOffset","rotation","circumference","cutout","ratioX","ratioY","offsetX","offsetY","startAngle","endAngle","startX","cos","startY","sin","endX","endY","calcMax","angle","calcMin","maxX","maxY","minX","minY","DoughnutController","innerRadius","outerRadius","isDatasetVisible","_getRotation","_getCircumference","arcs","spacing","getMaxBorderWidth","getMaxOffset","maxSize","chartWeight","_getRingWeight","_getRotationExtents","maxWidth","maxHeight","maxRadius","radiusLength","_getVisibleDatasetWeightTotal","total","calculateTotal","_getRingWeightOffset","animateRotate","calculateCircumference","animationOpts","centerX","centerY","animateScale","_circumference","arc","metaData","locale","borderAlign","borderWidth","hoverBorderWidth","hoverOffset","ringWeightOffset","weight","aspectRatio","legend","generateLabels","map","style","text","fillStyle","backgroundColor","strokeStyle","borderColor","lineWidth","hidden","onClick","legendItem","toggleDataVisibility","tooltipItem","dataLabel","formattedValue","slice","LineController","line","_dataset","animationsDisabled","getStartAndCountOfVisiblePoints","scaleRangesChanged","_decimated","showLine","segment","animated","spanGaps","maxGapLength","directUpdate","prevParsed","nullData","stop","border","firstPoint","lastPoint","updateControlPoints","pointCount","lo","hi","_scaleRanges","newRanges","xmin","xmax","ymin","ymax","changed","PolarAreaController","_updateRadius","minSize","cutoutPercentage","getVisibleDatasetCount","xCenter","yCenter","datasetStartAngle","getIndexAngle","defaultAngle","countVisibleElements","_computeAngle","getDistanceFromCenterForValue","angleLines","display","circular","pointLabels","PieController","RadarController","_fullLoop","pointPosition","getPointPositionForValue","fill","ScatterController","controllers","__proto__","abstract","Error","DateAdapter","format","timestamp","amount","unit","weekday","override","members","adapters","_date","getRelativePosition","evaluateAllVisibleItems","handler","getSortedVisibleDatasetMetas","jlen","binarySearch","metaset","intersect","lookupMethod","_reversePixels","el","getRange","optimizedEvaluateItems","position","getDistanceMetricForAxis","useX","useY","pt1","pt2","deltaX","deltaY","sqrt","pow","getIntersectItems","useFinalPosition","_minPadding","evaluationFunc","inRange","getNearestItems","distanceMetric","minDistance","getCenterPoint","distance","getAxisItems","rangeMethod","intersectsItem","Interaction","modes","nearest","STATIC_POSITIONS","filterByPosition","array","pos","filterDynamicPositionByAxis","box","sortByWeight","v0","v1","wrapBoxes","boxes","layoutBoxes","setLayoutDims","layouts","params","layout","fullSize","availableWidth","hBoxMaxHeight","vBoxMaxWidth","availableHeight","buildLayoutBoxes","wrap","centerHorizontal","centerVertical","leftAndTop","rightAndBottom","vertical","getCombinedMax","maxPadding","updateMaxPadding","boxPadding","updateDims","getPadding","newWidth","outerWidth","newHeight","outerHeight","widthChanged","heightChanged","same","other","handleMaxPadding","updatePos","change","getMargins","marginForPositions","positions","margin","fitBoxes","refitBoxes","refit","placeBoxes","userPadding","padding","addBox","_layers","removeBox","layoutItem","minPadding","verticalBoxes","horizontalBoxes","beforeLayout","visibleVerticalBoxCount","BasePlatform","canvas","listener","BasicPlatform","EXPANDO_KEY","EVENT_TYPES","touchstart","touchmove","touchend","pointerenter","pointerdown","pointermove","pointerup","pointerleave","pointerout","isNullOrEmpty","initCanvas","renderHeight","getAttribute","renderWidth","boxSizing","displayWidth","displayHeight","eventListenerOptions","passive","addListener","node","addEventListener","removeListener","removeEventListener","fromNativeEvent","native","createAttachObserver","container","observer","MutationObserver","entries","addedNodes","added","observe","document","childList","subtree","createDetachObserver","removedNodes","drpListeningCharts","oldDevicePixelRatio","onWindowResize","dpr","devicePixelRatio","currentDevicePixelRatio","listenDevicePixelRatioChanges","unlistenDevicePixelRatioChanges","createResizeObserver","clientWidth","ResizeObserver","contentRect","releaseObserver","disconnect","createProxyAndListen","proxy","args","DomPlatform","removeAttribute","setAttribute","proxies","$proxies","handlers","attach","detach","Element","getProps","final","ret","defaultRoutes","formatters","numeric","tickValue","notation","delta","maxTick","calculateDelta","logDelta","numDecimal","minimumFractionDigits","maximumFractionDigits","logarithmic","Ticks","bounds","grace","drawBorder","drawOnChartArea","drawTicks","tickLength","tickWidth","tickColor","borderDash","borderDashOffset","minRotation","maxRotation","mirror","textStrokeWidth","textStrokeColor","autoSkip","autoSkipPadding","labelOffset","minor","major","align","crossAlign","showLabelBackdrop","backdropColor","backdropPadding","route","startsWith","tickOpts","ticksLimit","maxTicksLimit","determineMaxTicks","majorIndices","enabled","getMajorIndices","numMajorIndices","first","newTicks","skipMajors","calculateSpacing","avgMajorSpacing","round","_tickSize","maxScale","maxChart","_maxLength","evenMajorSpacing","getEvenSpacing","factors","result","ceil","majorStart","majorEnd","len","diff","reverseAlign","offsetFromEdge","edge","sample","numItems","increment","getPixelForGridLine","offsetGridLines","validIndex","epsilon","lineValue","garbageCollect","caches","gc","gcLen","getTickMarkLength","getTitleHeight","fallback","font","lines","lineHeight","createScaleContext","createTickContext","titleAlign","titleArgs","titleX","titleY","Scale","_margins","paddingTop","paddingBottom","paddingLeft","paddingRight","labelRotation","_range","_gridLineItems","_labelItems","_labelSizes","_longestTextCache","_userMax","_userMin","_suggestedMax","_suggestedMin","_ticksLength","_borderValue","_dataLimitsCached","setContext","suggestedMin","suggestedMax","getMinMax","xLabels","yLabels","beforeUpdate","margins","sampleSize","beforeSetDimensions","setDimensions","afterSetDimensions","beforeDataLimits","determineDataLimits","afterDataLimits","beforeBuildTicks","buildTicks","afterBuildTicks","samplingEnabled","_convertTicksToLabels","beforeCalculateLabelRotation","calculateLabelRotation","afterCalculateLabelRotation","source","beforeFit","fit","afterFit","afterUpdate","reversePixels","startPixel","endPixel","_alignToPixels","alignToPixels","notifyPlugins","_callHooks","beforeTickToLabelConversion","afterTickToLabelConversion","numTicks","maxLabelDiagonal","_isVisible","labelSizes","_getLabelSizes","maxLabelWidth","widest","maxLabelHeight","highest","asin","titleOpts","gridOpts","titleHeight","tickPadding","angleRadians","labelHeight","labelWidth","_calculatePadding","_handleMargins","isRotated","labelsBelowTicks","offsetLeft","offsetRight","generateTickLabels","_computeLabelSizes","widths","heights","widestLabelSize","highestLabelSize","tickFont","fontString","nestedLabel","_resolveTickFontOptions","string","valueAt","idx","pixel","decimal","getBaseValue","optionTicks","rot","ticksLength","tl","borderOpts","axisWidth","axisHalfWidth","alignBorderValue","borderValue","alignedLineValue","tx1","ty1","tx2","ty2","x1","y1","x2","y2","positionAxisID","optsAtIndex","lineColor","tickBorderDash","tickBorderDashOffset","tickAndPadding","hTickAndPadding","textAlign","lineCount","textOffset","textBaseline","_getXAxisLabelAlignment","_getYAxisLabelAlignment","halfCount","strokeColor","strokeWidth","backdrop","labelPadding","translation","save","fillRect","restore","findIndex","_computeGridLineItems","drawLine","p1","p2","setLineDash","lineDashOffset","beginPath","moveTo","lineTo","stroke","lastLineWidth","_computeLabelArea","_computeLabelItems","drawBackground","drawGrid","drawTitle","drawLabels","tz","gz","axisID","fontSize","TypedRegistry","scope","isPrototypeOf","proto","getPrototypeOf","parentScope","isIChartComponent","register","registerDefaults","itemDefaults","routeDefaults","routes","property","propertyParts","split","sourceName","sourceScope","join","parts","targetName","targetScope","Registry","_typedRegistries","_each","_get","typedRegistry","arg","reg","_getRegistryForType","isForType","_exec","itemReg","registry","component","camelMethod","PluginService","_init","hook","_createDescriptors","descriptor","plugin","cancelable","_oldCache","_notifyStateChanges","allPlugins","createDescriptors","previousDescriptors","some","getPlugin","local","getOpts","pluginOpts","pluginScopeKeys","scriptable","indexable","allKeys","getIndexAxis","datasetDefaults","datasetOptions","getAxisFromDefaultScaleID","getDefaultScaleIDFromAxis","axisFromPosition","determineAxis","scaleOptions","toLowerCase","mergeScaleConfig","chartDefaults","configScales","chartIndexAxis","firstIDs","scaleConf","defaultId","defaultScaleOptions","defaultID","initOptions","initData","initConfig","keyCache","keysCached","Set","cachedKeys","generate","addIfFound","Config","_config","_scopeCache","_resolverCache","clearCache","clear","datasetType","additionalOptionScopes","mainScope","resetCache","keyLists","_cachedScopes","getResolver","resolver","subPrefixes","needContext","subResolver","descriptorDefaults","resolverCache","includes","isScriptable","isIndexable","version","KNOWN_POSITIONS","positionIsHorizontal","compare2Level","l1","l2","onAnimationsComplete","onComplete","onAnimationProgress","onProgress","isDomSupported","getCanvas","getElementById","instances","getChart","Chart","initialCanvas","existingChart","chartOptionScopes","platform","_initializePlatform","acquireContext","_options","_aspectRatio","_metasets","_lastEvent","_listeners","_responsiveListeners","_sortedMetasets","_plugins","_hiddenIndices","attached","_doResize","resizeDelay","console","error","listen","_initialize","maintainAspectRatio","responsive","bindEvents","OffscreenCanvas","_resize","_resizeBeforeDraw","newSize","newRatio","getDevicePixelRatio","onResize","render","scalesOptions","axisOptions","scaleOpts","updated","isRadial","dposition","dtype","scaleType","scaleClass","getScale","init","hasUpdated","_destroyDatasetMeta","newControllers","_removeUnreferencedMetasets","order","updateIndex","ControllerClass","getController","getElement","_updateMetasets","_resetElements","animsDisabled","ensureScalesHaveIDs","buildOrUpdateScales","existingEvents","newEvents","events","unbindEvents","invalidate","buildOrUpdateControllers","buildOrUpdateElements","_updateLayout","_updateDatasets","_eventHandler","noArea","_idx","_updateDataset","layers","_drawDatasets","_drawDataset","setDatasetVisibility","_updateDatasetVisibility","_destroy","remove","releaseContext","toDataURL","bindUserEvents","bindResponsiveEvents","_add","_remove","detached","isAttached","prefix","activeElements","lastActive","_updateHoverStyles","notify","replay","hoverOptions","hover","deactivated","activated","updateHoverStyle","eventFilter","_handleEvent","lastEvent","getElementsAtEventForMode","onHover","invalidatePlugins","enumerable","defineProperties","unregister","clipArc","pixelMargin","angleMargin","closePath","toRadiusCorners","parseBorderRadius$1","angleDelta","borderRadius","halfThickness","innerLimit","computeOuterLimit","outerArcLimit","outerStart","outerEnd","innerStart","innerEnd","rThetaToXY","theta","pathArc","innerR","alpha","beta","angleOffset","outerStartAdjustedRadius","outerEndAdjustedRadius","outerStartAdjustedAngle","outerEndAdjustedAngle","innerStartAdjustedRadius","innerEndAdjustedRadius","innerStartAdjustedAngle","innerEndAdjustedAngle","pCenter","p4","p8","drawArc","fullCircles","drawFullCircleBorders","inner","lineJoin","ArcElement","chartX","chartY","betweenAngles","withinRadius","halfAngle","halfRadius","radiusOffset","translate","setStyle","lineCap","borderCapStyle","borderJoinStyle","previous","getLineMethod","stepped","tension","cubicInterpolationMode","pathVars","paramsStart","paramsEnd","segmentStart","segmentEnd","outside","pathSegment","lineMethod","fastPathSegment","avgX","countX","prevX","lastY","pointIndex","drawX","truncX","_getSegmentMethod","useFastPath","_getInterpolationMethod","strokePathWithCache","path","_path","Path2D","strokePathDirect","segments","segmentMethod","usePath2D","LineElement","_points","_segments","_pointsUpdated","_interpolate","interpolated","capBezierPoints","inRange$1","hitRadius","PointElement","mouseX","mouseY","hoverRadius","pointStyle","getBarBounds","bar","half","parseBorderSkipped","borderSkipped","parseEdge","swap","startEnd","orig","v2","skipOrLimit","parseBorderWidth","maxW","maxH","parseBorderRadius","maxR","enableBorder","topLeft","topRight","bottomLeft","bottomRight","boundingRects","outer","skipX","skipY","skipBoth","hasRadius","addNormalRectPath","rect","BarElement","addRectPath","lttbDecimation","samples","decimated","bucketWidth","sampledIndex","endIndex","maxAreaPoint","maxArea","nextA","avgY","avgRangeStart","avgRangeEnd","avgRangeLength","rangeOffs","rangeTo","pointAx","pointAy","minMaxDecimation","minIndex","maxIndex","startIndex","xMin","xMax","dx","lastIndex","intermediateIndex1","intermediateIndex2","cleanDecimatedDataset","defineProperty","cleanDecimatedData","getStartAndCountOfVisiblePointsSimplified","plugin_decimation","algorithm","beforeElementsUpdate","xAxis","configurable","destroy","getLineByIndex","parseFillOption","fillOption","decodeFill","parseFloat","computeLinearBoundary","simpleArc","computeCircularBoundary","computeBoundary","pointsFromSegments","boundary","linePoints","buildStackLine","sourcePoints","linesBelow","getLinesBelow","createBoundaryLine","addPointsBelow","isLineAndNotInHideAnimation","below","unshift","sourcePoint","postponed","findPoint","interpolate","pointValue","firstValue","lastValue","getTarget","resolveTarget","sources","propagate","visited","clipY","getBounds","_getEdge","tpoints","targetSegments","tgt","subBounds","fillSources","fillSource","clipBounds","interpolatedLineTo","interpolatedPoint","_fill","src","lineLoop","targetLoop","doFill","above","drawfill","lineOpts","plugin_filler","afterDatasetsUpdate","_args","$filler","beforeDraw","drawTime","beforeDatasetsDraw","beforeDatasetDraw","getBoxSize","labelOpts","boxHeight","boxWidth","usePointStyle","itemHeight","itemsEqual","Legend","_added","legendHitBoxes","_hoveredItem","doughnutMode","legendItems","columnSizes","lineWidths","buildLabels","labelFont","_computeTitleHeight","_fitRows","_fitCols","hitboxes","totalHeight","row","itemWidth","measureText","heightLimit","totalWidth","currentColWidth","currentColHeight","col","hitbox","_draw","defaultColor","rtlHelper","rtl","fontColor","halfFontSize","cursor","drawLegendBox","lineDash","drawOptions","SQRT2","xPlus","yBoxTop","xBoxLeft","leftForLtr","fillText","strikethrough","textDirection","textWidth","setWidth","realX","titleFont","titlePadding","topPaddingPlusHalfFontSize","hitBox","lh","isListened","hoveredItem","_getLegendItemAt","sameItem","onLeave","plugin_legend","_element","adjustHitBoxes","afterEvent","handleEvent","ci","Title","_padding","textSize","fontOpts","_drawArgs","createTitle","titleBlock","plugin_title","positioners","average","hasValue","tooltipPosition","eventPosition","nearestElement","tp","pushOrConcat","toPush","apply","splitNewlines","str","String","createTooltipItem","getLabelAndValue","getTooltipSize","body","footer","bodyFont","footerFont","titleLineCount","footerLineCount","bodyLineItemCount","combinedBodyLength","bodyItem","before","after","beforeBody","afterBody","titleSpacing","titleMarginBottom","bodyLineHeight","displayColors","bodySpacing","footerMarginTop","footerSpacing","widthPadding","maxLineWidth","determineYAlign","doesNotFitWithAlign","xAlign","caret","caretSize","caretPadding","determineXAlign","yAlign","chartWidth","determineAlignment","alignX","alignY","paddingAndSize","getBackgroundPoint","alignment","cornerRadius","radiusAndPadding","getAlignedX","getBeforeAfterBodyLines","createTooltipContext","tooltipItems","overrideCallbacks","Tooltip","opacity","_eventPosition","_size","_cachedAnimations","_tooltipItems","dataPoints","caretX","caretY","labelColors","labelPointStyles","labelTextColors","beforeTitle","afterTitle","bodyItems","scoped","beforeLabel","afterLabel","beforeFooter","afterFooter","itemSort","labelColor","labelPointStyle","labelTextColor","_createItems","getTitle","getBeforeBody","getBody","getAfterBody","getFooter","positionAndSize","backgroundPoint","external","tooltipPoint","caretPosition","getCaretPosition","x3","y3","ptX","ptY","pt","titleColor","colorX","rtlColorX","yOffSet","colorY","multiKeyBackground","outerX","innerX","strokeRect","bodyAlign","xLinePadding","fillLineOfText","bodyAlignForCalculation","textColor","bodyColor","_drawColorBox","footerAlign","footerColor","tooltipSize","drawCaret","quadraticCurveTo","animX","animY","_updateAnimationTarget","hasTooltipContent","globalAlpha","drawBody","drawFooter","positionChanged","_positionChanged","plugin_tooltip","afterInit","afterDraw","labelCount","Decimation","Filler","addIfString","findOrAddLabel","lastIndexOf","CategoryScale","_startValue","_valueRange","isFinite","getDecimalForPixel","generateTicks$1","generationOptions","dataRange","MIN_SPACING","step","precision","maxTicks","maxDigits","includeBounds","maxSpaces","rmin","rmax","countDefined","minSpacing","niceMin","niceMax","numSpaces","decimalPlaces","relativeLabelSize","rad","LinearScaleBase","_endValue","setMin","setMax","minSign","maxSign","stepSize","computeTickLimit","getTickLimit","numericGeneratorOptions","_maxDigits","LinearScale","handleTickRangeOptions","isMajor","tickVal","generateTicks","endExp","endSignificand","exp","significand","lastTick","LogarithmicScale","_zero","getTickBackdropHeight","measureLabelSize","determineLimits","fitWithPointLabels","furthestLimits","furthestAngles","valueCount","getPointPosition","drawingArea","plFont","_pointLabels","hLimits","vLimits","_setReductions","_pointLabelItems","tickBackdropHeight","outerDistance","extra","pointLabelPosition","adjustPointPositionForLabelHeight","getTextAlignForAngle","drawPointLabels","pathRadiusLine","drawRadiusLine","gridLineOpts","numberOrZero","param","RadialLinearScale","setCenterPoint","largestPossibleRadius","radiusReductionLeft","radiusReductionRight","radiusReductionTop","radiusReductionBottom","leftMovement","rightMovement","topMovement","bottomMovement","maxRight","maxLeft","maxTop","maxBottom","angleMultiplier","scalingFactor","scaledDistance","distanceFromCenter","rotate","animate","INTERVALS","millisecond","common","steps","second","minute","hour","day","week","month","quarter","year","UNITS","sorter","input","adapter","_adapter","_parseOpts","parser","isoWeekday","startOf","determineUnitForAutoTicks","minUnit","capacity","interval","MAX_SAFE_INTEGER","determineUnitForFormatting","determineMajorUnit","addTick","time","timestamps","setMajorTicks","majorUnit","ticksFromTimestamps","TimeScale","_unit","_majorUnit","_offsets","_normalized","displayFormats","formats","normalized","_applyBounds","_getLabelBounds","endOf","getLabelTimestamps","timeOpts","_generate","_getLabelCapacity","initOffsets","getDecimalForValue","limit","hasWeekday","getDataTimestamps","tooltipFormat","datetime","minorFormat","majorFormat","formatter","_tickFormatFunction","offsets","ticksOpts","tickLabelWidth","cosRotation","sinRotation","tickFontSize","exampleTime","exampleLabel","_getLabelSize","normalize","table","prevSource","nextSource","prevTarget","nextTarget","span","TimeSeriesScale","_table","_maxIndex","_getTimestampsForTable","buildLookupTable","registerables","_adapters"],"sources":["/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/chart.js/dist/chart.esm.js"],"sourcesContent":["/*!\n * Chart.js v3.3.2\n * https://www.chartjs.org\n * (c) 2021 Chart.js Contributors\n * Released under the MIT License\n */\nimport { r as requestAnimFrame, a as resolve, e as effects, c as color, i as isObject, b as isArray, d as defaults, v as valueOrDefault, u as unlistenArrayEvents, l as listenArrayEvents, f as resolveObjectKey, g as isNumberFinite, h as defined, s as sign, j as isNullOrUndef, k as clipArea, m as unclipArea, _ as _arrayUnique, t as toRadians, n as toPercentage, o as toDimension, T as TAU, p as formatNumber, q as _angleBetween, H as HALF_PI, P as PI, w as isNumber, x as _limitValue, y as _lookupByKey, z as getRelativePosition$1, A as _isPointInArea, B as _rlookupByKey, C as toPadding, D as each, E as getMaximumSize, F as _getParentNode, G as readUsedSize, I as throttled, J as supportsEventListenerOptions, K as log10, L as _factorize, M as finiteOrDefault, N as callback, O as _addGrace, Q as toDegrees, R as _measureText, S as _int16Range, U as _alignPixel, V as renderText, W as toFont, X as _toLeftRightCenter, Y as _alignStartEnd, Z as overrides, $ as merge, a0 as _capitalize, a1 as descriptors, a2 as isFunction, a3 as _attachContext, a4 as _createResolver, a5 as _descriptors, a6 as mergeIf, a7 as uid, a8 as debounce, a9 as retinaScale, aa as clearCanvas, ab as setsEqual, ac as _elementsEqual, ad as getAngleFromPoint, ae as _readValueToProps, af as _updateBezierControlPoints, ag as _computeSegments, ah as _boundSegments, ai as _steppedInterpolation, aj as _bezierInterpolation, ak as _pointInLine, al as _steppedLineTo, am as _bezierCurveTo, an as drawPoint, ao as addRoundedRectPath, ap as toTRBL, aq as toTRBLCorners, ar as _boundSegment, as as _normalizeAngle, at as getRtlAdapter, au as overrideTextDirection, av as _textX, aw as restoreTextDirection, ax as noop, ay as distanceBetweenPoints, az as _setMinAndMaxByKey, aA as niceNum, aB as almostWhole, aC as almostEquals, aD as _decimalPlaces, aE as _longestText, aF as _filterBetween, aG as _lookup } from './chunks/helpers.segment.js';\nexport { d as defaults } from './chunks/helpers.segment.js';\n\nclass Animator {\n constructor() {\n this._request = null;\n this._charts = new Map();\n this._running = false;\n this._lastDate = undefined;\n }\n _notify(chart, anims, date, type) {\n const callbacks = anims.listeners[type];\n const numSteps = anims.duration;\n callbacks.forEach(fn => fn({\n chart,\n initial: anims.initial,\n numSteps,\n currentStep: Math.min(date - anims.start, numSteps)\n }));\n }\n _refresh() {\n const me = this;\n if (me._request) {\n return;\n }\n me._running = true;\n me._request = requestAnimFrame.call(window, () => {\n me._update();\n me._request = null;\n if (me._running) {\n me._refresh();\n }\n });\n }\n _update(date = Date.now()) {\n const me = this;\n let remaining = 0;\n me._charts.forEach((anims, chart) => {\n if (!anims.running || !anims.items.length) {\n return;\n }\n const items = anims.items;\n let i = items.length - 1;\n let draw = false;\n let item;\n for (; i >= 0; --i) {\n item = items[i];\n if (item._active) {\n if (item._total > anims.duration) {\n anims.duration = item._total;\n }\n item.tick(date);\n draw = true;\n } else {\n items[i] = items[items.length - 1];\n items.pop();\n }\n }\n if (draw) {\n chart.draw();\n me._notify(chart, anims, date, 'progress');\n }\n if (!items.length) {\n anims.running = false;\n me._notify(chart, anims, date, 'complete');\n anims.initial = false;\n }\n remaining += items.length;\n });\n me._lastDate = date;\n if (remaining === 0) {\n me._running = false;\n }\n }\n _getAnims(chart) {\n const charts = this._charts;\n let anims = charts.get(chart);\n if (!anims) {\n anims = {\n running: false,\n initial: true,\n items: [],\n listeners: {\n complete: [],\n progress: []\n }\n };\n charts.set(chart, anims);\n }\n return anims;\n }\n listen(chart, event, cb) {\n this._getAnims(chart).listeners[event].push(cb);\n }\n add(chart, items) {\n if (!items || !items.length) {\n return;\n }\n this._getAnims(chart).items.push(...items);\n }\n has(chart) {\n return this._getAnims(chart).items.length > 0;\n }\n start(chart) {\n const anims = this._charts.get(chart);\n if (!anims) {\n return;\n }\n anims.running = true;\n anims.start = Date.now();\n anims.duration = anims.items.reduce((acc, cur) => Math.max(acc, cur._duration), 0);\n this._refresh();\n }\n running(chart) {\n if (!this._running) {\n return false;\n }\n const anims = this._charts.get(chart);\n if (!anims || !anims.running || !anims.items.length) {\n return false;\n }\n return true;\n }\n stop(chart) {\n const anims = this._charts.get(chart);\n if (!anims || !anims.items.length) {\n return;\n }\n const items = anims.items;\n let i = items.length - 1;\n for (; i >= 0; --i) {\n items[i].cancel();\n }\n anims.items = [];\n this._notify(chart, anims, Date.now(), 'complete');\n }\n remove(chart) {\n return this._charts.delete(chart);\n }\n}\nvar animator = new Animator();\n\nconst transparent = 'transparent';\nconst interpolators = {\n boolean(from, to, factor) {\n return factor > 0.5 ? to : from;\n },\n color(from, to, factor) {\n const c0 = color(from || transparent);\n const c1 = c0.valid && color(to || transparent);\n return c1 && c1.valid\n ? c1.mix(c0, factor).hexString()\n : to;\n },\n number(from, to, factor) {\n return from + (to - from) * factor;\n }\n};\nclass Animation {\n constructor(cfg, target, prop, to) {\n const currentValue = target[prop];\n to = resolve([cfg.to, to, currentValue, cfg.from]);\n const from = resolve([cfg.from, currentValue, to]);\n this._active = true;\n this._fn = cfg.fn || interpolators[cfg.type || typeof from];\n this._easing = effects[cfg.easing] || effects.linear;\n this._start = Math.floor(Date.now() + (cfg.delay || 0));\n this._duration = this._total = Math.floor(cfg.duration);\n this._loop = !!cfg.loop;\n this._target = target;\n this._prop = prop;\n this._from = from;\n this._to = to;\n this._promises = undefined;\n }\n active() {\n return this._active;\n }\n update(cfg, to, date) {\n const me = this;\n if (me._active) {\n me._notify(false);\n const currentValue = me._target[me._prop];\n const elapsed = date - me._start;\n const remain = me._duration - elapsed;\n me._start = date;\n me._duration = Math.floor(Math.max(remain, cfg.duration));\n me._total += elapsed;\n me._loop = !!cfg.loop;\n me._to = resolve([cfg.to, to, currentValue, cfg.from]);\n me._from = resolve([cfg.from, currentValue, to]);\n }\n }\n cancel() {\n const me = this;\n if (me._active) {\n me.tick(Date.now());\n me._active = false;\n me._notify(false);\n }\n }\n tick(date) {\n const me = this;\n const elapsed = date - me._start;\n const duration = me._duration;\n const prop = me._prop;\n const from = me._from;\n const loop = me._loop;\n const to = me._to;\n let factor;\n me._active = from !== to && (loop || (elapsed < duration));\n if (!me._active) {\n me._target[prop] = to;\n me._notify(true);\n return;\n }\n if (elapsed < 0) {\n me._target[prop] = from;\n return;\n }\n factor = (elapsed / duration) % 2;\n factor = loop && factor > 1 ? 2 - factor : factor;\n factor = me._easing(Math.min(1, Math.max(0, factor)));\n me._target[prop] = me._fn(from, to, factor);\n }\n wait() {\n const promises = this._promises || (this._promises = []);\n return new Promise((res, rej) => {\n promises.push({res, rej});\n });\n }\n _notify(resolved) {\n const method = resolved ? 'res' : 'rej';\n const promises = this._promises || [];\n for (let i = 0; i < promises.length; i++) {\n promises[i][method]();\n }\n }\n}\n\nconst numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];\nconst colors = ['color', 'borderColor', 'backgroundColor'];\ndefaults.set('animation', {\n delay: undefined,\n duration: 1000,\n easing: 'easeOutQuart',\n fn: undefined,\n from: undefined,\n loop: undefined,\n to: undefined,\n type: undefined,\n});\nconst animationOptions = Object.keys(defaults.animation);\ndefaults.describe('animation', {\n _fallback: false,\n _indexable: false,\n _scriptable: (name) => name !== 'onProgress' && name !== 'onComplete' && name !== 'fn',\n});\ndefaults.set('animations', {\n colors: {\n type: 'color',\n properties: colors\n },\n numbers: {\n type: 'number',\n properties: numbers\n },\n});\ndefaults.describe('animations', {\n _fallback: 'animation',\n});\ndefaults.set('transitions', {\n active: {\n animation: {\n duration: 400\n }\n },\n resize: {\n animation: {\n duration: 0\n }\n },\n show: {\n animations: {\n colors: {\n from: 'transparent'\n },\n visible: {\n type: 'boolean',\n duration: 0\n },\n }\n },\n hide: {\n animations: {\n colors: {\n to: 'transparent'\n },\n visible: {\n type: 'boolean',\n easing: 'linear',\n fn: v => v | 0\n },\n }\n }\n});\nclass Animations {\n constructor(chart, config) {\n this._chart = chart;\n this._properties = new Map();\n this.configure(config);\n }\n configure(config) {\n if (!isObject(config)) {\n return;\n }\n const animatedProps = this._properties;\n Object.getOwnPropertyNames(config).forEach(key => {\n const cfg = config[key];\n if (!isObject(cfg)) {\n return;\n }\n const resolved = {};\n for (const option of animationOptions) {\n resolved[option] = cfg[option];\n }\n (isArray(cfg.properties) && cfg.properties || [key]).forEach((prop) => {\n if (prop === key || !animatedProps.has(prop)) {\n animatedProps.set(prop, resolved);\n }\n });\n });\n }\n _animateOptions(target, values) {\n const newOptions = values.options;\n const options = resolveTargetOptions(target, newOptions);\n if (!options) {\n return [];\n }\n const animations = this._createAnimations(options, newOptions);\n if (newOptions.$shared) {\n awaitAll(target.options.$animations, newOptions).then(() => {\n target.options = newOptions;\n }, () => {\n });\n }\n return animations;\n }\n _createAnimations(target, values) {\n const animatedProps = this._properties;\n const animations = [];\n const running = target.$animations || (target.$animations = {});\n const props = Object.keys(values);\n const date = Date.now();\n let i;\n for (i = props.length - 1; i >= 0; --i) {\n const prop = props[i];\n if (prop.charAt(0) === '$') {\n continue;\n }\n if (prop === 'options') {\n animations.push(...this._animateOptions(target, values));\n continue;\n }\n const value = values[prop];\n let animation = running[prop];\n const cfg = animatedProps.get(prop);\n if (animation) {\n if (cfg && animation.active()) {\n animation.update(cfg, value, date);\n continue;\n } else {\n animation.cancel();\n }\n }\n if (!cfg || !cfg.duration) {\n target[prop] = value;\n continue;\n }\n running[prop] = animation = new Animation(cfg, target, prop, value);\n animations.push(animation);\n }\n return animations;\n }\n update(target, values) {\n if (this._properties.size === 0) {\n Object.assign(target, values);\n return;\n }\n const animations = this._createAnimations(target, values);\n if (animations.length) {\n animator.add(this._chart, animations);\n return true;\n }\n }\n}\nfunction awaitAll(animations, properties) {\n const running = [];\n const keys = Object.keys(properties);\n for (let i = 0; i < keys.length; i++) {\n const anim = animations[keys[i]];\n if (anim && anim.active()) {\n running.push(anim.wait());\n }\n }\n return Promise.all(running);\n}\nfunction resolveTargetOptions(target, newOptions) {\n if (!newOptions) {\n return;\n }\n let options = target.options;\n if (!options) {\n target.options = newOptions;\n return;\n }\n if (options.$shared) {\n target.options = options = Object.assign({}, options, {$shared: false, $animations: {}});\n }\n return options;\n}\n\nfunction scaleClip(scale, allowedOverflow) {\n const opts = scale && scale.options || {};\n const reverse = opts.reverse;\n const min = opts.min === undefined ? allowedOverflow : 0;\n const max = opts.max === undefined ? allowedOverflow : 0;\n return {\n start: reverse ? max : min,\n end: reverse ? min : max\n };\n}\nfunction defaultClip(xScale, yScale, allowedOverflow) {\n if (allowedOverflow === false) {\n return false;\n }\n const x = scaleClip(xScale, allowedOverflow);\n const y = scaleClip(yScale, allowedOverflow);\n return {\n top: y.end,\n right: x.end,\n bottom: y.start,\n left: x.start\n };\n}\nfunction toClip(value) {\n let t, r, b, l;\n if (isObject(value)) {\n t = value.top;\n r = value.right;\n b = value.bottom;\n l = value.left;\n } else {\n t = r = b = l = value;\n }\n return {\n top: t,\n right: r,\n bottom: b,\n left: l\n };\n}\nfunction getSortedDatasetIndices(chart, filterVisible) {\n const keys = [];\n const metasets = chart._getSortedDatasetMetas(filterVisible);\n let i, ilen;\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n keys.push(metasets[i].index);\n }\n return keys;\n}\nfunction applyStack(stack, value, dsIndex, options) {\n const keys = stack.keys;\n const singleMode = options.mode === 'single';\n let i, ilen, datasetIndex, otherValue;\n if (value === null) {\n return;\n }\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n datasetIndex = +keys[i];\n if (datasetIndex === dsIndex) {\n if (options.all) {\n continue;\n }\n break;\n }\n otherValue = stack.values[datasetIndex];\n if (isNumberFinite(otherValue) && (singleMode || (value === 0 || sign(value) === sign(otherValue)))) {\n value += otherValue;\n }\n }\n return value;\n}\nfunction convertObjectDataToArray(data) {\n const keys = Object.keys(data);\n const adata = new Array(keys.length);\n let i, ilen, key;\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n adata[i] = {\n x: key,\n y: data[key]\n };\n }\n return adata;\n}\nfunction isStacked(scale, meta) {\n const stacked = scale && scale.options.stacked;\n return stacked || (stacked === undefined && meta.stack !== undefined);\n}\nfunction getStackKey(indexScale, valueScale, meta) {\n return `${indexScale.id}.${valueScale.id}.${meta.stack || meta.type}`;\n}\nfunction getUserBounds(scale) {\n const {min, max, minDefined, maxDefined} = scale.getUserBounds();\n return {\n min: minDefined ? min : Number.NEGATIVE_INFINITY,\n max: maxDefined ? max : Number.POSITIVE_INFINITY\n };\n}\nfunction getOrCreateStack(stacks, stackKey, indexValue) {\n const subStack = stacks[stackKey] || (stacks[stackKey] = {});\n return subStack[indexValue] || (subStack[indexValue] = {});\n}\nfunction getLastIndexInStack(stack, vScale, positive) {\n for (const meta of vScale.getMatchingVisibleMetas('bar').reverse()) {\n const value = stack[meta.index];\n if ((positive && value > 0) || (!positive && value < 0)) {\n return meta.index;\n }\n }\n return null;\n}\nfunction updateStacks(controller, parsed) {\n const {chart, _cachedMeta: meta} = controller;\n const stacks = chart._stacks || (chart._stacks = {});\n const {iScale, vScale, index: datasetIndex} = meta;\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const key = getStackKey(iScale, vScale, meta);\n const ilen = parsed.length;\n let stack;\n for (let i = 0; i < ilen; ++i) {\n const item = parsed[i];\n const {[iAxis]: index, [vAxis]: value} = item;\n const itemStacks = item._stacks || (item._stacks = {});\n stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index);\n stack[datasetIndex] = value;\n stack._top = getLastIndexInStack(stack, vScale, true);\n stack._bottom = getLastIndexInStack(stack, vScale, false);\n }\n}\nfunction getFirstScaleId(chart, axis) {\n const scales = chart.scales;\n return Object.keys(scales).filter(key => scales[key].axis === axis).shift();\n}\nfunction createDatasetContext(parent, index) {\n return Object.assign(Object.create(parent),\n {\n active: false,\n dataset: undefined,\n datasetIndex: index,\n index,\n mode: 'default',\n type: 'dataset'\n }\n );\n}\nfunction createDataContext(parent, index, element) {\n return Object.assign(Object.create(parent), {\n active: false,\n dataIndex: index,\n parsed: undefined,\n raw: undefined,\n element,\n index,\n mode: 'default',\n type: 'data'\n });\n}\nfunction clearStacks(meta, items) {\n const axis = meta.vScale && meta.vScale.axis;\n if (!axis) {\n return;\n }\n items = items || meta._parsed;\n for (const parsed of items) {\n const stacks = parsed._stacks;\n if (!stacks || stacks[axis] === undefined || stacks[axis][meta.index] === undefined) {\n return;\n }\n delete stacks[axis][meta.index];\n }\n}\nconst isDirectUpdateMode = (mode) => mode === 'reset' || mode === 'none';\nconst cloneIfNotShared = (cached, shared) => shared ? cached : Object.assign({}, cached);\nclass DatasetController {\n constructor(chart, datasetIndex) {\n this.chart = chart;\n this._ctx = chart.ctx;\n this.index = datasetIndex;\n this._cachedDataOpts = {};\n this._cachedMeta = this.getMeta();\n this._type = this._cachedMeta.type;\n this.options = undefined;\n this._parsing = false;\n this._data = undefined;\n this._objectData = undefined;\n this._sharedOptions = undefined;\n this._drawStart = undefined;\n this._drawCount = undefined;\n this.enableOptionSharing = false;\n this.$context = undefined;\n this._syncList = [];\n this.initialize();\n }\n initialize() {\n const me = this;\n const meta = me._cachedMeta;\n me.configure();\n me.linkScales();\n meta._stacked = isStacked(meta.vScale, meta);\n me.addElements();\n }\n updateIndex(datasetIndex) {\n if (this.index !== datasetIndex) {\n clearStacks(this._cachedMeta);\n }\n this.index = datasetIndex;\n }\n linkScales() {\n const me = this;\n const chart = me.chart;\n const meta = me._cachedMeta;\n const dataset = me.getDataset();\n const chooseId = (axis, x, y, r) => axis === 'x' ? x : axis === 'r' ? r : y;\n const xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, 'x'));\n const yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, 'y'));\n const rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, 'r'));\n const indexAxis = meta.indexAxis;\n const iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);\n const vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);\n meta.xScale = me.getScaleForId(xid);\n meta.yScale = me.getScaleForId(yid);\n meta.rScale = me.getScaleForId(rid);\n meta.iScale = me.getScaleForId(iid);\n meta.vScale = me.getScaleForId(vid);\n }\n getDataset() {\n return this.chart.data.datasets[this.index];\n }\n getMeta() {\n return this.chart.getDatasetMeta(this.index);\n }\n getScaleForId(scaleID) {\n return this.chart.scales[scaleID];\n }\n _getOtherScale(scale) {\n const meta = this._cachedMeta;\n return scale === meta.iScale\n ? meta.vScale\n : meta.iScale;\n }\n reset() {\n this._update('reset');\n }\n _destroy() {\n const meta = this._cachedMeta;\n if (this._data) {\n unlistenArrayEvents(this._data, this);\n }\n if (meta._stacked) {\n clearStacks(meta);\n }\n }\n _dataCheck() {\n const me = this;\n const dataset = me.getDataset();\n const data = dataset.data || (dataset.data = []);\n const _data = me._data;\n if (isObject(data)) {\n me._data = convertObjectDataToArray(data);\n } else if (_data !== data) {\n if (_data) {\n unlistenArrayEvents(_data, me);\n const meta = me._cachedMeta;\n clearStacks(meta);\n meta._parsed = [];\n }\n if (data && Object.isExtensible(data)) {\n listenArrayEvents(data, me);\n }\n me._syncList = [];\n me._data = data;\n }\n }\n addElements() {\n const me = this;\n const meta = me._cachedMeta;\n me._dataCheck();\n if (me.datasetElementType) {\n meta.dataset = new me.datasetElementType();\n }\n }\n buildOrUpdateElements(resetNewElements) {\n const me = this;\n const meta = me._cachedMeta;\n const dataset = me.getDataset();\n let stackChanged = false;\n me._dataCheck();\n const oldStacked = meta._stacked;\n meta._stacked = isStacked(meta.vScale, meta);\n if (meta.stack !== dataset.stack) {\n stackChanged = true;\n clearStacks(meta);\n meta.stack = dataset.stack;\n }\n me._resyncElements(resetNewElements);\n if (stackChanged || oldStacked !== meta._stacked) {\n updateStacks(me, meta._parsed);\n }\n }\n configure() {\n const me = this;\n const config = me.chart.config;\n const scopeKeys = config.datasetScopeKeys(me._type);\n const scopes = config.getOptionScopes(me.getDataset(), scopeKeys, true);\n me.options = config.createResolver(scopes, me.getContext());\n me._parsing = me.options.parsing;\n }\n parse(start, count) {\n const me = this;\n const {_cachedMeta: meta, _data: data} = me;\n const {iScale, _stacked} = meta;\n const iAxis = iScale.axis;\n let sorted = start === 0 && count === data.length ? true : meta._sorted;\n let prev = start > 0 && meta._parsed[start - 1];\n let i, cur, parsed;\n if (me._parsing === false) {\n meta._parsed = data;\n meta._sorted = true;\n parsed = data;\n } else {\n if (isArray(data[start])) {\n parsed = me.parseArrayData(meta, data, start, count);\n } else if (isObject(data[start])) {\n parsed = me.parseObjectData(meta, data, start, count);\n } else {\n parsed = me.parsePrimitiveData(meta, data, start, count);\n }\n const isNotInOrderComparedToPrev = () => cur[iAxis] === null || (prev && cur[iAxis] < prev[iAxis]);\n for (i = 0; i < count; ++i) {\n meta._parsed[i + start] = cur = parsed[i];\n if (sorted) {\n if (isNotInOrderComparedToPrev()) {\n sorted = false;\n }\n prev = cur;\n }\n }\n meta._sorted = sorted;\n }\n if (_stacked) {\n updateStacks(me, parsed);\n }\n }\n parsePrimitiveData(meta, data, start, count) {\n const {iScale, vScale} = meta;\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const labels = iScale.getLabels();\n const singleScale = iScale === vScale;\n const parsed = new Array(count);\n let i, ilen, index;\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n parsed[i] = {\n [iAxis]: singleScale || iScale.parse(labels[index], index),\n [vAxis]: vScale.parse(data[index], index)\n };\n }\n return parsed;\n }\n parseArrayData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const parsed = new Array(count);\n let i, ilen, index, item;\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(item[0], index),\n y: yScale.parse(item[1], index)\n };\n }\n return parsed;\n }\n parseObjectData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const parsed = new Array(count);\n let i, ilen, index, item;\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(resolveObjectKey(item, xAxisKey), index),\n y: yScale.parse(resolveObjectKey(item, yAxisKey), index)\n };\n }\n return parsed;\n }\n getParsed(index) {\n return this._cachedMeta._parsed[index];\n }\n getDataElement(index) {\n return this._cachedMeta.data[index];\n }\n applyStack(scale, parsed, mode) {\n const chart = this.chart;\n const meta = this._cachedMeta;\n const value = parsed[scale.axis];\n const stack = {\n keys: getSortedDatasetIndices(chart, true),\n values: parsed._stacks[scale.axis]\n };\n return applyStack(stack, value, meta.index, {mode});\n }\n updateRangeFromParsed(range, scale, parsed, stack) {\n const parsedValue = parsed[scale.axis];\n let value = parsedValue === null ? NaN : parsedValue;\n const values = stack && parsed._stacks[scale.axis];\n if (stack && values) {\n stack.values = values;\n range.min = Math.min(range.min, value);\n range.max = Math.max(range.max, value);\n value = applyStack(stack, parsedValue, this._cachedMeta.index, {all: true});\n }\n range.min = Math.min(range.min, value);\n range.max = Math.max(range.max, value);\n }\n getMinMax(scale, canStack) {\n const me = this;\n const meta = me._cachedMeta;\n const _parsed = meta._parsed;\n const sorted = meta._sorted && scale === meta.iScale;\n const ilen = _parsed.length;\n const otherScale = me._getOtherScale(scale);\n const stack = canStack && meta._stacked && {keys: getSortedDatasetIndices(me.chart, true), values: null};\n const range = {min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY};\n const {min: otherMin, max: otherMax} = getUserBounds(otherScale);\n let i, value, parsed, otherValue;\n function _skip() {\n parsed = _parsed[i];\n value = parsed[scale.axis];\n otherValue = parsed[otherScale.axis];\n return !isNumberFinite(value) || otherMin > otherValue || otherMax < otherValue;\n }\n for (i = 0; i < ilen; ++i) {\n if (_skip()) {\n continue;\n }\n me.updateRangeFromParsed(range, scale, parsed, stack);\n if (sorted) {\n break;\n }\n }\n if (sorted) {\n for (i = ilen - 1; i >= 0; --i) {\n if (_skip()) {\n continue;\n }\n me.updateRangeFromParsed(range, scale, parsed, stack);\n break;\n }\n }\n return range;\n }\n getAllParsedValues(scale) {\n const parsed = this._cachedMeta._parsed;\n const values = [];\n let i, ilen, value;\n for (i = 0, ilen = parsed.length; i < ilen; ++i) {\n value = parsed[i][scale.axis];\n if (isNumberFinite(value)) {\n values.push(value);\n }\n }\n return values;\n }\n getMaxOverflow() {\n return false;\n }\n getLabelAndValue(index) {\n const me = this;\n const meta = me._cachedMeta;\n const iScale = meta.iScale;\n const vScale = meta.vScale;\n const parsed = me.getParsed(index);\n return {\n label: iScale ? '' + iScale.getLabelForValue(parsed[iScale.axis]) : '',\n value: vScale ? '' + vScale.getLabelForValue(parsed[vScale.axis]) : ''\n };\n }\n _update(mode) {\n const me = this;\n const meta = me._cachedMeta;\n me.configure();\n me._cachedDataOpts = {};\n me.update(mode || 'default');\n meta._clip = toClip(valueOrDefault(me.options.clip, defaultClip(meta.xScale, meta.yScale, me.getMaxOverflow())));\n }\n update(mode) {}\n draw() {\n const me = this;\n const ctx = me._ctx;\n const chart = me.chart;\n const meta = me._cachedMeta;\n const elements = meta.data || [];\n const area = chart.chartArea;\n const active = [];\n const start = me._drawStart || 0;\n const count = me._drawCount || (elements.length - start);\n let i;\n if (meta.dataset) {\n meta.dataset.draw(ctx, area, start, count);\n }\n for (i = start; i < start + count; ++i) {\n const element = elements[i];\n if (element.active) {\n active.push(element);\n } else {\n element.draw(ctx, area);\n }\n }\n for (i = 0; i < active.length; ++i) {\n active[i].draw(ctx, area);\n }\n }\n getStyle(index, active) {\n const mode = active ? 'active' : 'default';\n return index === undefined && this._cachedMeta.dataset\n ? this.resolveDatasetElementOptions(mode)\n : this.resolveDataElementOptions(index || 0, mode);\n }\n getContext(index, active, mode) {\n const me = this;\n const dataset = me.getDataset();\n let context;\n if (index >= 0 && index < me._cachedMeta.data.length) {\n const element = me._cachedMeta.data[index];\n context = element.$context ||\n (element.$context = createDataContext(me.getContext(), index, element));\n context.parsed = me.getParsed(index);\n context.raw = dataset.data[index];\n context.index = context.dataIndex = index;\n } else {\n context = me.$context ||\n (me.$context = createDatasetContext(me.chart.getContext(), me.index));\n context.dataset = dataset;\n context.index = context.datasetIndex = me.index;\n }\n context.active = !!active;\n context.mode = mode;\n return context;\n }\n resolveDatasetElementOptions(mode) {\n return this._resolveElementOptions(this.datasetElementType.id, mode);\n }\n resolveDataElementOptions(index, mode) {\n return this._resolveElementOptions(this.dataElementType.id, mode, index);\n }\n _resolveElementOptions(elementType, mode = 'default', index) {\n const me = this;\n const active = mode === 'active';\n const cache = me._cachedDataOpts;\n const cacheKey = elementType + '-' + mode;\n const cached = cache[cacheKey];\n const sharing = me.enableOptionSharing && defined(index);\n if (cached) {\n return cloneIfNotShared(cached, sharing);\n }\n const config = me.chart.config;\n const scopeKeys = config.datasetElementScopeKeys(me._type, elementType);\n const prefixes = active ? [`${elementType}Hover`, 'hover', elementType, ''] : [elementType, ''];\n const scopes = config.getOptionScopes(me.getDataset(), scopeKeys);\n const names = Object.keys(defaults.elements[elementType]);\n const context = () => me.getContext(index, active);\n const values = config.resolveNamedOptions(scopes, names, context, prefixes);\n if (values.$shared) {\n values.$shared = sharing;\n cache[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));\n }\n return values;\n }\n _resolveAnimations(index, transition, active) {\n const me = this;\n const chart = me.chart;\n const cache = me._cachedDataOpts;\n const cacheKey = `animation-${transition}`;\n const cached = cache[cacheKey];\n if (cached) {\n return cached;\n }\n let options;\n if (chart.options.animation !== false) {\n const config = me.chart.config;\n const scopeKeys = config.datasetAnimationScopeKeys(me._type, transition);\n const scopes = config.getOptionScopes(me.getDataset(), scopeKeys);\n options = config.createResolver(scopes, me.getContext(index, active, transition));\n }\n const animations = new Animations(chart, options && options.animations);\n if (options && options._cacheable) {\n cache[cacheKey] = Object.freeze(animations);\n }\n return animations;\n }\n getSharedOptions(options) {\n if (!options.$shared) {\n return;\n }\n return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));\n }\n includeOptions(mode, sharedOptions) {\n return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;\n }\n updateElement(element, index, properties, mode) {\n if (isDirectUpdateMode(mode)) {\n Object.assign(element, properties);\n } else {\n this._resolveAnimations(index, mode).update(element, properties);\n }\n }\n updateSharedOptions(sharedOptions, mode, newOptions) {\n if (sharedOptions && !isDirectUpdateMode(mode)) {\n this._resolveAnimations(undefined, mode).update(sharedOptions, newOptions);\n }\n }\n _setStyle(element, index, mode, active) {\n element.active = active;\n const options = this.getStyle(index, active);\n this._resolveAnimations(index, mode, active).update(element, {\n options: (!active && this.getSharedOptions(options)) || options\n });\n }\n removeHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', false);\n }\n setHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', true);\n }\n _removeDatasetHoverStyle() {\n const element = this._cachedMeta.dataset;\n if (element) {\n this._setStyle(element, undefined, 'active', false);\n }\n }\n _setDatasetHoverStyle() {\n const element = this._cachedMeta.dataset;\n if (element) {\n this._setStyle(element, undefined, 'active', true);\n }\n }\n _resyncElements(resetNewElements) {\n const me = this;\n const data = me._data;\n const elements = me._cachedMeta.data;\n for (const [method, arg1, arg2] of me._syncList) {\n me[method](arg1, arg2);\n }\n me._syncList = [];\n const numMeta = elements.length;\n const numData = data.length;\n const count = Math.min(numData, numMeta);\n if (count) {\n me.parse(0, count);\n }\n if (numData > numMeta) {\n me._insertElements(numMeta, numData - numMeta, resetNewElements);\n } else if (numData < numMeta) {\n me._removeElements(numData, numMeta - numData);\n }\n }\n _insertElements(start, count, resetNewElements = true) {\n const me = this;\n const meta = me._cachedMeta;\n const data = meta.data;\n const end = start + count;\n let i;\n const move = (arr) => {\n arr.length += count;\n for (i = arr.length - 1; i >= end; i--) {\n arr[i] = arr[i - count];\n }\n };\n move(data);\n for (i = start; i < end; ++i) {\n data[i] = new me.dataElementType();\n }\n if (me._parsing) {\n move(meta._parsed);\n }\n me.parse(start, count);\n if (resetNewElements) {\n me.updateElements(data, start, count, 'reset');\n }\n }\n updateElements(element, start, count, mode) {}\n _removeElements(start, count) {\n const me = this;\n const meta = me._cachedMeta;\n if (me._parsing) {\n const removed = meta._parsed.splice(start, count);\n if (meta._stacked) {\n clearStacks(meta, removed);\n }\n }\n meta.data.splice(start, count);\n }\n _onDataPush() {\n const count = arguments.length;\n this._syncList.push(['_insertElements', this.getDataset().data.length - count, count]);\n }\n _onDataPop() {\n this._syncList.push(['_removeElements', this._cachedMeta.data.length - 1, 1]);\n }\n _onDataShift() {\n this._syncList.push(['_removeElements', 0, 1]);\n }\n _onDataSplice(start, count) {\n this._syncList.push(['_removeElements', start, count]);\n this._syncList.push(['_insertElements', start, arguments.length - 2]);\n }\n _onDataUnshift() {\n this._syncList.push(['_insertElements', 0, arguments.length]);\n }\n}\nDatasetController.defaults = {};\nDatasetController.prototype.datasetElementType = null;\nDatasetController.prototype.dataElementType = null;\n\nfunction getAllScaleValues(scale) {\n if (!scale._cache.$bar) {\n const metas = scale.getMatchingVisibleMetas('bar');\n let values = [];\n for (let i = 0, ilen = metas.length; i < ilen; i++) {\n values = values.concat(metas[i].controller.getAllParsedValues(scale));\n }\n scale._cache.$bar = _arrayUnique(values.sort((a, b) => a - b));\n }\n return scale._cache.$bar;\n}\nfunction computeMinSampleSize(scale) {\n const values = getAllScaleValues(scale);\n let min = scale._length;\n let i, ilen, curr, prev;\n const updateMinAndPrev = () => {\n if (curr === 32767 || curr === -32768) {\n return;\n }\n if (defined(prev)) {\n min = Math.min(min, Math.abs(curr - prev) || min);\n }\n prev = curr;\n };\n for (i = 0, ilen = values.length; i < ilen; ++i) {\n curr = scale.getPixelForValue(values[i]);\n updateMinAndPrev();\n }\n prev = undefined;\n for (i = 0, ilen = scale.ticks.length; i < ilen; ++i) {\n curr = scale.getPixelForTick(i);\n updateMinAndPrev();\n }\n return min;\n}\nfunction computeFitCategoryTraits(index, ruler, options, stackCount) {\n const thickness = options.barThickness;\n let size, ratio;\n if (isNullOrUndef(thickness)) {\n size = ruler.min * options.categoryPercentage;\n ratio = options.barPercentage;\n } else {\n size = thickness * stackCount;\n ratio = 1;\n }\n return {\n chunk: size / stackCount,\n ratio,\n start: ruler.pixels[index] - (size / 2)\n };\n}\nfunction computeFlexCategoryTraits(index, ruler, options, stackCount) {\n const pixels = ruler.pixels;\n const curr = pixels[index];\n let prev = index > 0 ? pixels[index - 1] : null;\n let next = index < pixels.length - 1 ? pixels[index + 1] : null;\n const percent = options.categoryPercentage;\n if (prev === null) {\n prev = curr - (next === null ? ruler.end - ruler.start : next - curr);\n }\n if (next === null) {\n next = curr + curr - prev;\n }\n const start = curr - (curr - Math.min(prev, next)) / 2 * percent;\n const size = Math.abs(next - prev) / 2 * percent;\n return {\n chunk: size / stackCount,\n ratio: options.barPercentage,\n start\n };\n}\nfunction parseFloatBar(entry, item, vScale, i) {\n const startValue = vScale.parse(entry[0], i);\n const endValue = vScale.parse(entry[1], i);\n const min = Math.min(startValue, endValue);\n const max = Math.max(startValue, endValue);\n let barStart = min;\n let barEnd = max;\n if (Math.abs(min) > Math.abs(max)) {\n barStart = max;\n barEnd = min;\n }\n item[vScale.axis] = barEnd;\n item._custom = {\n barStart,\n barEnd,\n start: startValue,\n end: endValue,\n min,\n max\n };\n}\nfunction parseValue(entry, item, vScale, i) {\n if (isArray(entry)) {\n parseFloatBar(entry, item, vScale, i);\n } else {\n item[vScale.axis] = vScale.parse(entry, i);\n }\n return item;\n}\nfunction parseArrayOrPrimitive(meta, data, start, count) {\n const iScale = meta.iScale;\n const vScale = meta.vScale;\n const labels = iScale.getLabels();\n const singleScale = iScale === vScale;\n const parsed = [];\n let i, ilen, item, entry;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n entry = data[i];\n item = {};\n item[iScale.axis] = singleScale || iScale.parse(labels[i], i);\n parsed.push(parseValue(entry, item, vScale, i));\n }\n return parsed;\n}\nfunction isFloatBar(custom) {\n return custom && custom.barStart !== undefined && custom.barEnd !== undefined;\n}\nclass BarController extends DatasetController {\n parsePrimitiveData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n parseArrayData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n parseObjectData(meta, data, start, count) {\n const {iScale, vScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const iAxisKey = iScale.axis === 'x' ? xAxisKey : yAxisKey;\n const vAxisKey = vScale.axis === 'x' ? xAxisKey : yAxisKey;\n const parsed = [];\n let i, ilen, item, obj;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n obj = data[i];\n item = {};\n item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i);\n parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i));\n }\n return parsed;\n }\n updateRangeFromParsed(range, scale, parsed, stack) {\n super.updateRangeFromParsed(range, scale, parsed, stack);\n const custom = parsed._custom;\n if (custom && scale === this._cachedMeta.vScale) {\n range.min = Math.min(range.min, custom.min);\n range.max = Math.max(range.max, custom.max);\n }\n }\n getLabelAndValue(index) {\n const me = this;\n const meta = me._cachedMeta;\n const {iScale, vScale} = meta;\n const parsed = me.getParsed(index);\n const custom = parsed._custom;\n const value = isFloatBar(custom)\n ? '[' + custom.start + ', ' + custom.end + ']'\n : '' + vScale.getLabelForValue(parsed[vScale.axis]);\n return {\n label: '' + iScale.getLabelForValue(parsed[iScale.axis]),\n value\n };\n }\n initialize() {\n const me = this;\n me.enableOptionSharing = true;\n super.initialize();\n const meta = me._cachedMeta;\n meta.stack = me.getDataset().stack;\n }\n update(mode) {\n const me = this;\n const meta = me._cachedMeta;\n me.updateElements(meta.data, 0, meta.data.length, mode);\n }\n updateElements(bars, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const vScale = me._cachedMeta.vScale;\n const base = vScale.getBasePixel();\n const horizontal = vScale.isHorizontal();\n const ruler = me._getRuler();\n const firstOpts = me.resolveDataElementOptions(start, mode);\n const sharedOptions = me.getSharedOptions(firstOpts);\n const includeOptions = me.includeOptions(mode, sharedOptions);\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n for (let i = start; i < start + count; i++) {\n const parsed = me.getParsed(i);\n const vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {base, head: base} : me._calculateBarValuePixels(i);\n const ipixels = me._calculateBarIndexPixels(i, ruler);\n const stack = (parsed._stacks || {})[vScale.axis];\n const properties = {\n horizontal,\n base: vpixels.base,\n enableBorderRadius: !stack || isFloatBar(parsed._custom) || (me.index === stack._top || me.index === stack._bottom),\n x: horizontal ? vpixels.head : ipixels.center,\n y: horizontal ? ipixels.center : vpixels.head,\n height: horizontal ? ipixels.size : undefined,\n width: horizontal ? undefined : ipixels.size\n };\n if (includeOptions) {\n properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);\n }\n me.updateElement(bars[i], i, properties, mode);\n }\n }\n _getStacks(last, dataIndex) {\n const me = this;\n const meta = me._cachedMeta;\n const iScale = meta.iScale;\n const metasets = iScale.getMatchingVisibleMetas(me._type);\n const stacked = iScale.options.stacked;\n const ilen = metasets.length;\n const stacks = [];\n let i, item;\n for (i = 0; i < ilen; ++i) {\n item = metasets[i];\n if (typeof dataIndex !== 'undefined') {\n const val = item.controller.getParsed(dataIndex)[\n item.controller._cachedMeta.vScale.axis\n ];\n if (isNullOrUndef(val) || isNaN(val)) {\n continue;\n }\n }\n if (stacked === false || stacks.indexOf(item.stack) === -1 ||\n\t\t\t\t(stacked === undefined && item.stack === undefined)) {\n stacks.push(item.stack);\n }\n if (item.index === last) {\n break;\n }\n }\n if (!stacks.length) {\n stacks.push(undefined);\n }\n return stacks;\n }\n _getStackCount(index) {\n return this._getStacks(undefined, index).length;\n }\n _getStackIndex(datasetIndex, name, dataIndex) {\n const stacks = this._getStacks(datasetIndex, dataIndex);\n const index = (name !== undefined)\n ? stacks.indexOf(name)\n : -1;\n return (index === -1)\n ? stacks.length - 1\n : index;\n }\n _getRuler() {\n const me = this;\n const opts = me.options;\n const meta = me._cachedMeta;\n const iScale = meta.iScale;\n const pixels = [];\n let i, ilen;\n for (i = 0, ilen = meta.data.length; i < ilen; ++i) {\n pixels.push(iScale.getPixelForValue(me.getParsed(i)[iScale.axis], i));\n }\n const barThickness = opts.barThickness;\n const min = barThickness || computeMinSampleSize(iScale);\n return {\n min,\n pixels,\n start: iScale._startPixel,\n end: iScale._endPixel,\n stackCount: me._getStackCount(),\n scale: iScale,\n grouped: opts.grouped,\n ratio: barThickness ? 1 : opts.categoryPercentage * opts.barPercentage\n };\n }\n _calculateBarValuePixels(index) {\n const me = this;\n const {vScale, _stacked} = me._cachedMeta;\n const {base: baseValue, minBarLength} = me.options;\n const parsed = me.getParsed(index);\n const custom = parsed._custom;\n const floating = isFloatBar(custom);\n let value = parsed[vScale.axis];\n let start = 0;\n let length = _stacked ? me.applyStack(vScale, parsed, _stacked) : value;\n let head, size;\n if (length !== value) {\n start = length - value;\n length = value;\n }\n if (floating) {\n value = custom.barStart;\n length = custom.barEnd - custom.barStart;\n if (value !== 0 && sign(value) !== sign(custom.barEnd)) {\n start = 0;\n }\n start += value;\n }\n const startValue = !isNullOrUndef(baseValue) && !floating ? baseValue : start;\n let base = vScale.getPixelForValue(startValue);\n if (this.chart.getDataVisibility(index)) {\n head = vScale.getPixelForValue(start + length);\n } else {\n head = base;\n }\n size = head - base;\n if (minBarLength !== undefined && Math.abs(size) < minBarLength) {\n size = size < 0 ? -minBarLength : minBarLength;\n if (value === 0) {\n base -= size / 2;\n }\n head = base + size;\n }\n const actualBase = baseValue || 0;\n if (base === vScale.getPixelForValue(actualBase)) {\n const halfGrid = vScale.getLineWidthForValue(actualBase) / 2;\n if (size > 0) {\n base += halfGrid;\n size -= halfGrid;\n } else if (size < 0) {\n base -= halfGrid;\n size += halfGrid;\n }\n }\n return {\n size,\n base,\n head,\n center: head + size / 2\n };\n }\n _calculateBarIndexPixels(index, ruler) {\n const me = this;\n const scale = ruler.scale;\n const options = me.options;\n const skipNull = options.skipNull;\n const maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);\n let center, size;\n if (ruler.grouped) {\n const stackCount = skipNull ? me._getStackCount(index) : ruler.stackCount;\n const range = options.barThickness === 'flex'\n ? computeFlexCategoryTraits(index, ruler, options, stackCount)\n : computeFitCategoryTraits(index, ruler, options, stackCount);\n const stackIndex = me._getStackIndex(me.index, me._cachedMeta.stack, skipNull ? index : undefined);\n center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);\n size = Math.min(maxBarThickness, range.chunk * range.ratio);\n } else {\n center = scale.getPixelForValue(me.getParsed(index)[scale.axis], index);\n size = Math.min(maxBarThickness, ruler.min * ruler.ratio);\n }\n return {\n base: center - size / 2,\n head: center + size / 2,\n center,\n size\n };\n }\n draw() {\n const me = this;\n const chart = me.chart;\n const meta = me._cachedMeta;\n const vScale = meta.vScale;\n const rects = meta.data;\n const ilen = rects.length;\n let i = 0;\n clipArea(chart.ctx, chart.chartArea);\n for (; i < ilen; ++i) {\n if (me.getParsed(i)[vScale.axis] !== null) {\n rects[i].draw(me._ctx);\n }\n }\n unclipArea(chart.ctx);\n }\n}\nBarController.id = 'bar';\nBarController.defaults = {\n datasetElementType: false,\n dataElementType: 'bar',\n categoryPercentage: 0.8,\n barPercentage: 0.9,\n grouped: true,\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'base', 'width', 'height']\n }\n }\n};\nBarController.overrides = {\n interaction: {\n mode: 'index'\n },\n scales: {\n _index_: {\n type: 'category',\n offset: true,\n grid: {\n offset: true\n }\n },\n _value_: {\n type: 'linear',\n beginAtZero: true,\n }\n }\n};\n\nclass BubbleController extends DatasetController {\n initialize() {\n this.enableOptionSharing = true;\n super.initialize();\n }\n parseObjectData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const parsed = [];\n let i, ilen, item;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n item = data[i];\n parsed.push({\n x: xScale.parse(resolveObjectKey(item, xAxisKey), i),\n y: yScale.parse(resolveObjectKey(item, yAxisKey), i),\n _custom: item && item.r && +item.r\n });\n }\n return parsed;\n }\n getMaxOverflow() {\n const {data, _parsed} = this._cachedMeta;\n let max = 0;\n for (let i = data.length - 1; i >= 0; --i) {\n max = Math.max(max, data[i].size() / 2, _parsed[i]._custom);\n }\n return max > 0 && max;\n }\n getLabelAndValue(index) {\n const me = this;\n const meta = me._cachedMeta;\n const {xScale, yScale} = meta;\n const parsed = me.getParsed(index);\n const x = xScale.getLabelForValue(parsed.x);\n const y = yScale.getLabelForValue(parsed.y);\n const r = parsed._custom;\n return {\n label: meta.label,\n value: '(' + x + ', ' + y + (r ? ', ' + r : '') + ')'\n };\n }\n update(mode) {\n const me = this;\n const points = me._cachedMeta.data;\n me.updateElements(points, 0, points.length, mode);\n }\n updateElements(points, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const {iScale, vScale} = me._cachedMeta;\n const firstOpts = me.resolveDataElementOptions(start, mode);\n const sharedOptions = me.getSharedOptions(firstOpts);\n const includeOptions = me.includeOptions(mode, sharedOptions);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n for (let i = start; i < start + count; i++) {\n const point = points[i];\n const parsed = !reset && me.getParsed(i);\n const properties = {};\n const iPixel = properties[iAxis] = reset ? iScale.getPixelForDecimal(0.5) : iScale.getPixelForValue(parsed[iAxis]);\n const vPixel = properties[vAxis] = reset ? vScale.getBasePixel() : vScale.getPixelForValue(parsed[vAxis]);\n properties.skip = isNaN(iPixel) || isNaN(vPixel);\n if (includeOptions) {\n properties.options = me.resolveDataElementOptions(i, mode);\n if (reset) {\n properties.options.radius = 0;\n }\n }\n me.updateElement(point, i, properties, mode);\n }\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n resolveDataElementOptions(index, mode) {\n const parsed = this.getParsed(index);\n let values = super.resolveDataElementOptions(index, mode);\n if (values.$shared) {\n values = Object.assign({}, values, {$shared: false});\n }\n const radius = values.radius;\n if (mode !== 'active') {\n values.radius = 0;\n }\n values.radius += valueOrDefault(parsed && parsed._custom, radius);\n return values;\n }\n}\nBubbleController.id = 'bubble';\nBubbleController.defaults = {\n datasetElementType: false,\n dataElementType: 'point',\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'borderWidth', 'radius']\n }\n }\n};\nBubbleController.overrides = {\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n },\n plugins: {\n tooltip: {\n callbacks: {\n title() {\n return '';\n }\n }\n }\n }\n};\n\nfunction getRatioAndOffset(rotation, circumference, cutout) {\n let ratioX = 1;\n let ratioY = 1;\n let offsetX = 0;\n let offsetY = 0;\n if (circumference < TAU) {\n const startAngle = rotation;\n const endAngle = startAngle + circumference;\n const startX = Math.cos(startAngle);\n const startY = Math.sin(startAngle);\n const endX = Math.cos(endAngle);\n const endY = Math.sin(endAngle);\n const calcMax = (angle, a, b) => _angleBetween(angle, startAngle, endAngle, true) ? 1 : Math.max(a, a * cutout, b, b * cutout);\n const calcMin = (angle, a, b) => _angleBetween(angle, startAngle, endAngle, true) ? -1 : Math.min(a, a * cutout, b, b * cutout);\n const maxX = calcMax(0, startX, endX);\n const maxY = calcMax(HALF_PI, startY, endY);\n const minX = calcMin(PI, startX, endX);\n const minY = calcMin(PI + HALF_PI, startY, endY);\n ratioX = (maxX - minX) / 2;\n ratioY = (maxY - minY) / 2;\n offsetX = -(maxX + minX) / 2;\n offsetY = -(maxY + minY) / 2;\n }\n return {ratioX, ratioY, offsetX, offsetY};\n}\nclass DoughnutController extends DatasetController {\n constructor(chart, datasetIndex) {\n super(chart, datasetIndex);\n this.enableOptionSharing = true;\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n this.offsetX = undefined;\n this.offsetY = undefined;\n }\n linkScales() {}\n parse(start, count) {\n const data = this.getDataset().data;\n const meta = this._cachedMeta;\n let i, ilen;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n meta._parsed[i] = +data[i];\n }\n }\n _getRotation() {\n return toRadians(this.options.rotation - 90);\n }\n _getCircumference() {\n return toRadians(this.options.circumference);\n }\n _getRotationExtents() {\n let min = TAU;\n let max = -TAU;\n const me = this;\n for (let i = 0; i < me.chart.data.datasets.length; ++i) {\n if (me.chart.isDatasetVisible(i)) {\n const controller = me.chart.getDatasetMeta(i).controller;\n const rotation = controller._getRotation();\n const circumference = controller._getCircumference();\n min = Math.min(min, rotation);\n max = Math.max(max, rotation + circumference);\n }\n }\n return {\n rotation: min,\n circumference: max - min,\n };\n }\n update(mode) {\n const me = this;\n const chart = me.chart;\n const {chartArea} = chart;\n const meta = me._cachedMeta;\n const arcs = meta.data;\n const spacing = me.getMaxBorderWidth() + me.getMaxOffset(arcs);\n const maxSize = Math.max((Math.min(chartArea.width, chartArea.height) - spacing) / 2, 0);\n const cutout = Math.min(toPercentage(me.options.cutout, maxSize), 1);\n const chartWeight = me._getRingWeight(me.index);\n const {circumference, rotation} = me._getRotationExtents();\n const {ratioX, ratioY, offsetX, offsetY} = getRatioAndOffset(rotation, circumference, cutout);\n const maxWidth = (chartArea.width - spacing) / ratioX;\n const maxHeight = (chartArea.height - spacing) / ratioY;\n const maxRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);\n const outerRadius = toDimension(me.options.radius, maxRadius);\n const innerRadius = Math.max(outerRadius * cutout, 0);\n const radiusLength = (outerRadius - innerRadius) / me._getVisibleDatasetWeightTotal();\n me.offsetX = offsetX * outerRadius;\n me.offsetY = offsetY * outerRadius;\n meta.total = me.calculateTotal();\n me.outerRadius = outerRadius - radiusLength * me._getRingWeightOffset(me.index);\n me.innerRadius = Math.max(me.outerRadius - radiusLength * chartWeight, 0);\n me.updateElements(arcs, 0, arcs.length, mode);\n }\n _circumference(i, reset) {\n const me = this;\n const opts = me.options;\n const meta = me._cachedMeta;\n const circumference = me._getCircumference();\n if ((reset && opts.animation.animateRotate) || !this.chart.getDataVisibility(i) || meta._parsed[i] === null) {\n return 0;\n }\n return me.calculateCircumference(meta._parsed[i] * circumference / TAU);\n }\n updateElements(arcs, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const chart = me.chart;\n const chartArea = chart.chartArea;\n const opts = chart.options;\n const animationOpts = opts.animation;\n const centerX = (chartArea.left + chartArea.right) / 2;\n const centerY = (chartArea.top + chartArea.bottom) / 2;\n const animateScale = reset && animationOpts.animateScale;\n const innerRadius = animateScale ? 0 : me.innerRadius;\n const outerRadius = animateScale ? 0 : me.outerRadius;\n const firstOpts = me.resolveDataElementOptions(start, mode);\n const sharedOptions = me.getSharedOptions(firstOpts);\n const includeOptions = me.includeOptions(mode, sharedOptions);\n let startAngle = me._getRotation();\n let i;\n for (i = 0; i < start; ++i) {\n startAngle += me._circumference(i, reset);\n }\n for (i = start; i < start + count; ++i) {\n const circumference = me._circumference(i, reset);\n const arc = arcs[i];\n const properties = {\n x: centerX + me.offsetX,\n y: centerY + me.offsetY,\n startAngle,\n endAngle: startAngle + circumference,\n circumference,\n outerRadius,\n innerRadius\n };\n if (includeOptions) {\n properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);\n }\n startAngle += circumference;\n me.updateElement(arc, i, properties, mode);\n }\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n calculateTotal() {\n const meta = this._cachedMeta;\n const metaData = meta.data;\n let total = 0;\n let i;\n for (i = 0; i < metaData.length; i++) {\n const value = meta._parsed[i];\n if (value !== null && !isNaN(value) && this.chart.getDataVisibility(i)) {\n total += Math.abs(value);\n }\n }\n return total;\n }\n calculateCircumference(value) {\n const total = this._cachedMeta.total;\n if (total > 0 && !isNaN(value)) {\n return TAU * (Math.abs(value) / total);\n }\n return 0;\n }\n getLabelAndValue(index) {\n const me = this;\n const meta = me._cachedMeta;\n const chart = me.chart;\n const labels = chart.data.labels || [];\n const value = formatNumber(meta._parsed[index], chart.options.locale);\n return {\n label: labels[index] || '',\n value,\n };\n }\n getMaxBorderWidth(arcs) {\n const me = this;\n let max = 0;\n const chart = me.chart;\n let i, ilen, meta, controller, options;\n if (!arcs) {\n for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\n if (chart.isDatasetVisible(i)) {\n meta = chart.getDatasetMeta(i);\n arcs = meta.data;\n controller = meta.controller;\n if (controller !== me) {\n controller.configure();\n }\n break;\n }\n }\n }\n if (!arcs) {\n return 0;\n }\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n options = controller.resolveDataElementOptions(i);\n if (options.borderAlign !== 'inner') {\n max = Math.max(max, options.borderWidth || 0, options.hoverBorderWidth || 0);\n }\n }\n return max;\n }\n getMaxOffset(arcs) {\n let max = 0;\n for (let i = 0, ilen = arcs.length; i < ilen; ++i) {\n const options = this.resolveDataElementOptions(i);\n max = Math.max(max, options.offset || 0, options.hoverOffset || 0);\n }\n return max;\n }\n _getRingWeightOffset(datasetIndex) {\n let ringWeightOffset = 0;\n for (let i = 0; i < datasetIndex; ++i) {\n if (this.chart.isDatasetVisible(i)) {\n ringWeightOffset += this._getRingWeight(i);\n }\n }\n return ringWeightOffset;\n }\n _getRingWeight(datasetIndex) {\n return Math.max(valueOrDefault(this.chart.data.datasets[datasetIndex].weight, 1), 0);\n }\n _getVisibleDatasetWeightTotal() {\n return this._getRingWeightOffset(this.chart.data.datasets.length) || 1;\n }\n}\nDoughnutController.id = 'doughnut';\nDoughnutController.defaults = {\n datasetElementType: false,\n dataElementType: 'arc',\n animation: {\n animateRotate: true,\n animateScale: false\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['circumference', 'endAngle', 'innerRadius', 'outerRadius', 'startAngle', 'x', 'y', 'offset', 'borderWidth']\n },\n },\n cutout: '50%',\n rotation: 0,\n circumference: 360,\n radius: '100%',\n indexAxis: 'r',\n};\nDoughnutController.overrides = {\n aspectRatio: 1,\n plugins: {\n legend: {\n labels: {\n generateLabels(chart) {\n const data = chart.data;\n if (data.labels.length && data.datasets.length) {\n return data.labels.map((label, i) => {\n const meta = chart.getDatasetMeta(0);\n const style = meta.controller.getStyle(i);\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n lineWidth: style.borderWidth,\n hidden: !chart.getDataVisibility(i),\n index: i\n };\n });\n }\n return [];\n }\n },\n onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n },\n tooltip: {\n callbacks: {\n title() {\n return '';\n },\n label(tooltipItem) {\n let dataLabel = tooltipItem.label;\n const value = ': ' + tooltipItem.formattedValue;\n if (isArray(dataLabel)) {\n dataLabel = dataLabel.slice();\n dataLabel[0] += value;\n } else {\n dataLabel += value;\n }\n return dataLabel;\n }\n }\n }\n }\n};\n\nclass LineController extends DatasetController {\n initialize() {\n this.enableOptionSharing = true;\n super.initialize();\n }\n update(mode) {\n const me = this;\n const meta = me._cachedMeta;\n const {dataset: line, data: points = [], _dataset} = meta;\n const animationsDisabled = me.chart._animationsDisabled;\n let {start, count} = getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);\n me._drawStart = start;\n me._drawCount = count;\n if (scaleRangesChanged(meta)) {\n start = 0;\n count = points.length;\n }\n line._decimated = !!_dataset._decimated;\n line.points = points;\n const options = me.resolveDatasetElementOptions(mode);\n if (!me.options.showLine) {\n options.borderWidth = 0;\n }\n options.segment = me.options.segment;\n me.updateElement(line, undefined, {\n animated: !animationsDisabled,\n options\n }, mode);\n me.updateElements(points, start, count, mode);\n }\n updateElements(points, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const {iScale, vScale, _stacked} = me._cachedMeta;\n const firstOpts = me.resolveDataElementOptions(start, mode);\n const sharedOptions = me.getSharedOptions(firstOpts);\n const includeOptions = me.includeOptions(mode, sharedOptions);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const spanGaps = me.options.spanGaps;\n const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;\n const directUpdate = me.chart._animationsDisabled || reset || mode === 'none';\n let prevParsed = start > 0 && me.getParsed(start - 1);\n for (let i = start; i < start + count; ++i) {\n const point = points[i];\n const parsed = me.getParsed(i);\n const properties = directUpdate ? point : {};\n const nullData = isNullOrUndef(parsed[vAxis]);\n const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);\n const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? me.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);\n properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;\n properties.stop = i > 0 && (parsed[iAxis] - prevParsed[iAxis]) > maxGapLength;\n properties.parsed = parsed;\n if (includeOptions) {\n properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);\n }\n if (!directUpdate) {\n me.updateElement(point, i, properties, mode);\n }\n prevParsed = parsed;\n }\n me.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n getMaxOverflow() {\n const me = this;\n const meta = me._cachedMeta;\n const dataset = meta.dataset;\n const border = dataset.options && dataset.options.borderWidth || 0;\n const data = meta.data || [];\n if (!data.length) {\n return border;\n }\n const firstPoint = data[0].size(me.resolveDataElementOptions(0));\n const lastPoint = data[data.length - 1].size(me.resolveDataElementOptions(data.length - 1));\n return Math.max(border, firstPoint, lastPoint) / 2;\n }\n draw() {\n const meta = this._cachedMeta;\n meta.dataset.updateControlPoints(this.chart.chartArea, meta.iScale.axis);\n super.draw();\n }\n}\nLineController.id = 'line';\nLineController.defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n showLine: true,\n spanGaps: false,\n};\nLineController.overrides = {\n scales: {\n _index_: {\n type: 'category',\n },\n _value_: {\n type: 'linear',\n },\n }\n};\nfunction getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {\n const pointCount = points.length;\n let start = 0;\n let count = pointCount;\n if (meta._sorted) {\n const {iScale, _parsed} = meta;\n const axis = iScale.axis;\n const {min, max, minDefined, maxDefined} = iScale.getUserBounds();\n if (minDefined) {\n start = _limitValue(Math.min(\n _lookupByKey(_parsed, iScale.axis, min).lo,\n animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo),\n 0, pointCount - 1);\n }\n if (maxDefined) {\n count = _limitValue(Math.max(\n _lookupByKey(_parsed, iScale.axis, max).hi + 1,\n animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max)).hi + 1),\n start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n }\n return {start, count};\n}\nfunction scaleRangesChanged(meta) {\n const {xScale, yScale, _scaleRanges} = meta;\n const newRanges = {\n xmin: xScale.min,\n xmax: xScale.max,\n ymin: yScale.min,\n ymax: yScale.max\n };\n if (!_scaleRanges) {\n meta._scaleRanges = newRanges;\n return true;\n }\n const changed = _scaleRanges.xmin !== xScale.min\n\t\t|| _scaleRanges.xmax !== xScale.max\n\t\t|| _scaleRanges.ymin !== yScale.min\n\t\t|| _scaleRanges.ymax !== yScale.max;\n Object.assign(_scaleRanges, newRanges);\n return changed;\n}\n\nclass PolarAreaController extends DatasetController {\n constructor(chart, datasetIndex) {\n super(chart, datasetIndex);\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n }\n getLabelAndValue(index) {\n const me = this;\n const meta = me._cachedMeta;\n const chart = me.chart;\n const labels = chart.data.labels || [];\n const value = formatNumber(meta._parsed[index].r, chart.options.locale);\n return {\n label: labels[index] || '',\n value,\n };\n }\n update(mode) {\n const arcs = this._cachedMeta.data;\n this._updateRadius();\n this.updateElements(arcs, 0, arcs.length, mode);\n }\n _updateRadius() {\n const me = this;\n const chart = me.chart;\n const chartArea = chart.chartArea;\n const opts = chart.options;\n const minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);\n const outerRadius = Math.max(minSize / 2, 0);\n const innerRadius = Math.max(opts.cutoutPercentage ? (outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);\n const radiusLength = (outerRadius - innerRadius) / chart.getVisibleDatasetCount();\n me.outerRadius = outerRadius - (radiusLength * me.index);\n me.innerRadius = me.outerRadius - radiusLength;\n }\n updateElements(arcs, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const chart = me.chart;\n const dataset = me.getDataset();\n const opts = chart.options;\n const animationOpts = opts.animation;\n const scale = me._cachedMeta.rScale;\n const centerX = scale.xCenter;\n const centerY = scale.yCenter;\n const datasetStartAngle = scale.getIndexAngle(0) - 0.5 * PI;\n let angle = datasetStartAngle;\n let i;\n const defaultAngle = 360 / me.countVisibleElements();\n for (i = 0; i < start; ++i) {\n angle += me._computeAngle(i, mode, defaultAngle);\n }\n for (i = start; i < start + count; i++) {\n const arc = arcs[i];\n let startAngle = angle;\n let endAngle = angle + me._computeAngle(i, mode, defaultAngle);\n let outerRadius = chart.getDataVisibility(i) ? scale.getDistanceFromCenterForValue(dataset.data[i]) : 0;\n angle = endAngle;\n if (reset) {\n if (animationOpts.animateScale) {\n outerRadius = 0;\n }\n if (animationOpts.animateRotate) {\n startAngle = endAngle = datasetStartAngle;\n }\n }\n const properties = {\n x: centerX,\n y: centerY,\n innerRadius: 0,\n outerRadius,\n startAngle,\n endAngle,\n options: me.resolveDataElementOptions(i, mode)\n };\n me.updateElement(arc, i, properties, mode);\n }\n }\n countVisibleElements() {\n const dataset = this.getDataset();\n const meta = this._cachedMeta;\n let count = 0;\n meta.data.forEach((element, index) => {\n if (!isNaN(dataset.data[index]) && this.chart.getDataVisibility(index)) {\n count++;\n }\n });\n return count;\n }\n _computeAngle(index, mode, defaultAngle) {\n return this.chart.getDataVisibility(index)\n ? toRadians(this.resolveDataElementOptions(index, mode).angle || defaultAngle)\n : 0;\n }\n}\nPolarAreaController.id = 'polarArea';\nPolarAreaController.defaults = {\n dataElementType: 'arc',\n animation: {\n animateRotate: true,\n animateScale: true\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'startAngle', 'endAngle', 'innerRadius', 'outerRadius']\n },\n },\n indexAxis: 'r',\n startAngle: 0,\n};\nPolarAreaController.overrides = {\n aspectRatio: 1,\n plugins: {\n legend: {\n labels: {\n generateLabels(chart) {\n const data = chart.data;\n if (data.labels.length && data.datasets.length) {\n return data.labels.map((label, i) => {\n const meta = chart.getDatasetMeta(0);\n const style = meta.controller.getStyle(i);\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n lineWidth: style.borderWidth,\n hidden: !chart.getDataVisibility(i),\n index: i\n };\n });\n }\n return [];\n }\n },\n onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n },\n tooltip: {\n callbacks: {\n title() {\n return '';\n },\n label(context) {\n return context.chart.data.labels[context.dataIndex] + ': ' + context.formattedValue;\n }\n }\n }\n },\n scales: {\n r: {\n type: 'radialLinear',\n angleLines: {\n display: false\n },\n beginAtZero: true,\n grid: {\n circular: true\n },\n pointLabels: {\n display: false\n },\n startAngle: 0\n }\n }\n};\n\nclass PieController extends DoughnutController {\n}\nPieController.id = 'pie';\nPieController.defaults = {\n cutout: 0,\n rotation: 0,\n circumference: 360,\n radius: '100%'\n};\n\nclass RadarController extends DatasetController {\n getLabelAndValue(index) {\n const me = this;\n const vScale = me._cachedMeta.vScale;\n const parsed = me.getParsed(index);\n return {\n label: vScale.getLabels()[index],\n value: '' + vScale.getLabelForValue(parsed[vScale.axis])\n };\n }\n update(mode) {\n const me = this;\n const meta = me._cachedMeta;\n const line = meta.dataset;\n const points = meta.data || [];\n const labels = meta.iScale.getLabels();\n line.points = points;\n if (mode !== 'resize') {\n const options = me.resolveDatasetElementOptions(mode);\n if (!me.options.showLine) {\n options.borderWidth = 0;\n }\n const properties = {\n _loop: true,\n _fullLoop: labels.length === points.length,\n options\n };\n me.updateElement(line, undefined, properties, mode);\n }\n me.updateElements(points, 0, points.length, mode);\n }\n updateElements(points, start, count, mode) {\n const me = this;\n const dataset = me.getDataset();\n const scale = me._cachedMeta.rScale;\n const reset = mode === 'reset';\n for (let i = start; i < start + count; i++) {\n const point = points[i];\n const options = me.resolveDataElementOptions(i, mode);\n const pointPosition = scale.getPointPositionForValue(i, dataset.data[i]);\n const x = reset ? scale.xCenter : pointPosition.x;\n const y = reset ? scale.yCenter : pointPosition.y;\n const properties = {\n x,\n y,\n angle: pointPosition.angle,\n skip: isNaN(x) || isNaN(y),\n options\n };\n me.updateElement(point, i, properties, mode);\n }\n }\n}\nRadarController.id = 'radar';\nRadarController.defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n indexAxis: 'r',\n showLine: true,\n elements: {\n line: {\n fill: 'start'\n }\n },\n};\nRadarController.overrides = {\n aspectRatio: 1,\n scales: {\n r: {\n type: 'radialLinear',\n }\n }\n};\n\nclass ScatterController extends LineController {\n}\nScatterController.id = 'scatter';\nScatterController.defaults = {\n showLine: false,\n fill: false\n};\nScatterController.overrides = {\n interaction: {\n mode: 'point'\n },\n plugins: {\n tooltip: {\n callbacks: {\n title() {\n return '';\n },\n label(item) {\n return '(' + item.label + ', ' + item.formattedValue + ')';\n }\n }\n }\n },\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n }\n};\n\nvar controllers = /*#__PURE__*/Object.freeze({\n__proto__: null,\nBarController: BarController,\nBubbleController: BubbleController,\nDoughnutController: DoughnutController,\nLineController: LineController,\nPolarAreaController: PolarAreaController,\nPieController: PieController,\nRadarController: RadarController,\nScatterController: ScatterController\n});\n\nfunction abstract() {\n throw new Error('This method is not implemented: Check that a complete date adapter is provided.');\n}\nclass DateAdapter {\n constructor(options) {\n this.options = options || {};\n }\n formats() {\n return abstract();\n }\n parse(value, format) {\n return abstract();\n }\n format(timestamp, format) {\n return abstract();\n }\n add(timestamp, amount, unit) {\n return abstract();\n }\n diff(a, b, unit) {\n return abstract();\n }\n startOf(timestamp, unit, weekday) {\n return abstract();\n }\n endOf(timestamp, unit) {\n return abstract();\n }\n}\nDateAdapter.override = function(members) {\n Object.assign(DateAdapter.prototype, members);\n};\nvar adapters = {\n _date: DateAdapter\n};\n\nfunction getRelativePosition(e, chart) {\n if ('native' in e) {\n return {\n x: e.x,\n y: e.y\n };\n }\n return getRelativePosition$1(e, chart);\n}\nfunction evaluateAllVisibleItems(chart, handler) {\n const metasets = chart.getSortedVisibleDatasetMetas();\n let index, data, element;\n for (let i = 0, ilen = metasets.length; i < ilen; ++i) {\n ({index, data} = metasets[i]);\n for (let j = 0, jlen = data.length; j < jlen; ++j) {\n element = data[j];\n if (!element.skip) {\n handler(element, index, j);\n }\n }\n }\n}\nfunction binarySearch(metaset, axis, value, intersect) {\n const {controller, data, _sorted} = metaset;\n const iScale = controller._cachedMeta.iScale;\n if (iScale && axis === iScale.axis && _sorted && data.length) {\n const lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;\n if (!intersect) {\n return lookupMethod(data, axis, value);\n } else if (controller._sharedOptions) {\n const el = data[0];\n const range = typeof el.getRange === 'function' && el.getRange(axis);\n if (range) {\n const start = lookupMethod(data, axis, value - range);\n const end = lookupMethod(data, axis, value + range);\n return {lo: start.lo, hi: end.hi};\n }\n }\n }\n return {lo: 0, hi: data.length - 1};\n}\nfunction optimizedEvaluateItems(chart, axis, position, handler, intersect) {\n const metasets = chart.getSortedVisibleDatasetMetas();\n const value = position[axis];\n for (let i = 0, ilen = metasets.length; i < ilen; ++i) {\n const {index, data} = metasets[i];\n const {lo, hi} = binarySearch(metasets[i], axis, value, intersect);\n for (let j = lo; j <= hi; ++j) {\n const element = data[j];\n if (!element.skip) {\n handler(element, index, j);\n }\n }\n }\n}\nfunction getDistanceMetricForAxis(axis) {\n const useX = axis.indexOf('x') !== -1;\n const useY = axis.indexOf('y') !== -1;\n return function(pt1, pt2) {\n const deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;\n const deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;\n return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\n };\n}\nfunction getIntersectItems(chart, position, axis, useFinalPosition) {\n const items = [];\n if (!_isPointInArea(position, chart.chartArea, chart._minPadding)) {\n return items;\n }\n const evaluationFunc = function(element, datasetIndex, index) {\n if (element.inRange(position.x, position.y, useFinalPosition)) {\n items.push({element, datasetIndex, index});\n }\n };\n optimizedEvaluateItems(chart, axis, position, evaluationFunc, true);\n return items;\n}\nfunction getNearestItems(chart, position, axis, intersect, useFinalPosition) {\n const distanceMetric = getDistanceMetricForAxis(axis);\n let minDistance = Number.POSITIVE_INFINITY;\n let items = [];\n if (!_isPointInArea(position, chart.chartArea, chart._minPadding)) {\n return items;\n }\n const evaluationFunc = function(element, datasetIndex, index) {\n if (intersect && !element.inRange(position.x, position.y, useFinalPosition)) {\n return;\n }\n const center = element.getCenterPoint(useFinalPosition);\n if (!_isPointInArea(center, chart.chartArea, chart._minPadding)) {\n return;\n }\n const distance = distanceMetric(position, center);\n if (distance < minDistance) {\n items = [{element, datasetIndex, index}];\n minDistance = distance;\n } else if (distance === minDistance) {\n items.push({element, datasetIndex, index});\n }\n };\n optimizedEvaluateItems(chart, axis, position, evaluationFunc);\n return items;\n}\nfunction getAxisItems(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const items = [];\n const axis = options.axis;\n const rangeMethod = axis === 'x' ? 'inXRange' : 'inYRange';\n let intersectsItem = false;\n evaluateAllVisibleItems(chart, (element, datasetIndex, index) => {\n if (element[rangeMethod](position[axis], useFinalPosition)) {\n items.push({element, datasetIndex, index});\n }\n if (element.inRange(position.x, position.y, useFinalPosition)) {\n intersectsItem = true;\n }\n });\n if (options.intersect && !intersectsItem) {\n return [];\n }\n return items;\n}\nvar Interaction = {\n modes: {\n index(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'x';\n const items = options.intersect\n ? getIntersectItems(chart, position, axis, useFinalPosition)\n : getNearestItems(chart, position, axis, false, useFinalPosition);\n const elements = [];\n if (!items.length) {\n return [];\n }\n chart.getSortedVisibleDatasetMetas().forEach((meta) => {\n const index = items[0].index;\n const element = meta.data[index];\n if (element && !element.skip) {\n elements.push({element, datasetIndex: meta.index, index});\n }\n });\n return elements;\n },\n dataset(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n let items = options.intersect\n ? getIntersectItems(chart, position, axis, useFinalPosition) :\n getNearestItems(chart, position, axis, false, useFinalPosition);\n if (items.length > 0) {\n const datasetIndex = items[0].datasetIndex;\n const data = chart.getDatasetMeta(datasetIndex).data;\n items = [];\n for (let i = 0; i < data.length; ++i) {\n items.push({element: data[i], datasetIndex, index: i});\n }\n }\n return items;\n },\n point(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n return getIntersectItems(chart, position, axis, useFinalPosition);\n },\n nearest(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n return getNearestItems(chart, position, axis, options.intersect, useFinalPosition);\n },\n x(chart, e, options, useFinalPosition) {\n options.axis = 'x';\n return getAxisItems(chart, e, options, useFinalPosition);\n },\n y(chart, e, options, useFinalPosition) {\n options.axis = 'y';\n return getAxisItems(chart, e, options, useFinalPosition);\n }\n }\n};\n\nconst STATIC_POSITIONS = ['left', 'top', 'right', 'bottom'];\nfunction filterByPosition(array, position) {\n return array.filter(v => v.pos === position);\n}\nfunction filterDynamicPositionByAxis(array, axis) {\n return array.filter(v => STATIC_POSITIONS.indexOf(v.pos) === -1 && v.box.axis === axis);\n}\nfunction sortByWeight(array, reverse) {\n return array.sort((a, b) => {\n const v0 = reverse ? b : a;\n const v1 = reverse ? a : b;\n return v0.weight === v1.weight ?\n v0.index - v1.index :\n v0.weight - v1.weight;\n });\n}\nfunction wrapBoxes(boxes) {\n const layoutBoxes = [];\n let i, ilen, box;\n for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {\n box = boxes[i];\n layoutBoxes.push({\n index: i,\n box,\n pos: box.position,\n horizontal: box.isHorizontal(),\n weight: box.weight\n });\n }\n return layoutBoxes;\n}\nfunction setLayoutDims(layouts, params) {\n let i, ilen, layout;\n for (i = 0, ilen = layouts.length; i < ilen; ++i) {\n layout = layouts[i];\n if (layout.horizontal) {\n layout.width = layout.box.fullSize && params.availableWidth;\n layout.height = params.hBoxMaxHeight;\n } else {\n layout.width = params.vBoxMaxWidth;\n layout.height = layout.box.fullSize && params.availableHeight;\n }\n }\n}\nfunction buildLayoutBoxes(boxes) {\n const layoutBoxes = wrapBoxes(boxes);\n const fullSize = sortByWeight(layoutBoxes.filter(wrap => wrap.box.fullSize), true);\n const left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);\n const right = sortByWeight(filterByPosition(layoutBoxes, 'right'));\n const top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);\n const bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));\n const centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, 'x');\n const centerVertical = filterDynamicPositionByAxis(layoutBoxes, 'y');\n return {\n fullSize,\n leftAndTop: left.concat(top),\n rightAndBottom: right.concat(centerVertical).concat(bottom).concat(centerHorizontal),\n chartArea: filterByPosition(layoutBoxes, 'chartArea'),\n vertical: left.concat(right).concat(centerVertical),\n horizontal: top.concat(bottom).concat(centerHorizontal)\n };\n}\nfunction getCombinedMax(maxPadding, chartArea, a, b) {\n return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);\n}\nfunction updateMaxPadding(maxPadding, boxPadding) {\n maxPadding.top = Math.max(maxPadding.top, boxPadding.top);\n maxPadding.left = Math.max(maxPadding.left, boxPadding.left);\n maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);\n maxPadding.right = Math.max(maxPadding.right, boxPadding.right);\n}\nfunction updateDims(chartArea, params, layout) {\n const box = layout.box;\n const maxPadding = chartArea.maxPadding;\n if (!isObject(layout.pos)) {\n if (layout.size) {\n chartArea[layout.pos] -= layout.size;\n }\n layout.size = layout.horizontal ? box.height : box.width;\n chartArea[layout.pos] += layout.size;\n }\n if (box.getPadding) {\n updateMaxPadding(maxPadding, box.getPadding());\n }\n const newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right'));\n const newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom'));\n const widthChanged = newWidth !== chartArea.w;\n const heightChanged = newHeight !== chartArea.h;\n chartArea.w = newWidth;\n chartArea.h = newHeight;\n return layout.horizontal\n ? {same: widthChanged, other: heightChanged}\n : {same: heightChanged, other: widthChanged};\n}\nfunction handleMaxPadding(chartArea) {\n const maxPadding = chartArea.maxPadding;\n function updatePos(pos) {\n const change = Math.max(maxPadding[pos] - chartArea[pos], 0);\n chartArea[pos] += change;\n return change;\n }\n chartArea.y += updatePos('top');\n chartArea.x += updatePos('left');\n updatePos('right');\n updatePos('bottom');\n}\nfunction getMargins(horizontal, chartArea) {\n const maxPadding = chartArea.maxPadding;\n function marginForPositions(positions) {\n const margin = {left: 0, top: 0, right: 0, bottom: 0};\n positions.forEach((pos) => {\n margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);\n });\n return margin;\n }\n return horizontal\n ? marginForPositions(['left', 'right'])\n : marginForPositions(['top', 'bottom']);\n}\nfunction fitBoxes(boxes, chartArea, params) {\n const refitBoxes = [];\n let i, ilen, layout, box, refit, changed;\n for (i = 0, ilen = boxes.length, refit = 0; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n box.update(\n layout.width || chartArea.w,\n layout.height || chartArea.h,\n getMargins(layout.horizontal, chartArea)\n );\n const {same, other} = updateDims(chartArea, params, layout);\n refit |= same && refitBoxes.length;\n changed = changed || other;\n if (!box.fullSize) {\n refitBoxes.push(layout);\n }\n }\n return refit && fitBoxes(refitBoxes, chartArea, params) || changed;\n}\nfunction placeBoxes(boxes, chartArea, params) {\n const userPadding = params.padding;\n let x = chartArea.x;\n let y = chartArea.y;\n let i, ilen, layout, box;\n for (i = 0, ilen = boxes.length; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n if (layout.horizontal) {\n box.left = box.fullSize ? userPadding.left : chartArea.left;\n box.right = box.fullSize ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;\n box.top = y;\n box.bottom = y + box.height;\n box.width = box.right - box.left;\n y = box.bottom;\n } else {\n box.left = x;\n box.right = x + box.width;\n box.top = box.fullSize ? userPadding.top : chartArea.top;\n box.bottom = box.fullSize ? params.outerHeight - userPadding.right : chartArea.top + chartArea.h;\n box.height = box.bottom - box.top;\n x = box.right;\n }\n }\n chartArea.x = x;\n chartArea.y = y;\n}\ndefaults.set('layout', {\n padding: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n }\n});\nvar layouts = {\n addBox(chart, item) {\n if (!chart.boxes) {\n chart.boxes = [];\n }\n item.fullSize = item.fullSize || false;\n item.position = item.position || 'top';\n item.weight = item.weight || 0;\n item._layers = item._layers || function() {\n return [{\n z: 0,\n draw(chartArea) {\n item.draw(chartArea);\n }\n }];\n };\n chart.boxes.push(item);\n },\n removeBox(chart, layoutItem) {\n const index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;\n if (index !== -1) {\n chart.boxes.splice(index, 1);\n }\n },\n configure(chart, item, options) {\n item.fullSize = options.fullSize;\n item.position = options.position;\n item.weight = options.weight;\n },\n update(chart, width, height, minPadding) {\n if (!chart) {\n return;\n }\n const padding = toPadding(chart.options.layout.padding);\n const availableWidth = Math.max(width - padding.width, 0);\n const availableHeight = Math.max(height - padding.height, 0);\n const boxes = buildLayoutBoxes(chart.boxes);\n const verticalBoxes = boxes.vertical;\n const horizontalBoxes = boxes.horizontal;\n each(chart.boxes, box => {\n if (typeof box.beforeLayout === 'function') {\n box.beforeLayout();\n }\n });\n const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap) =>\n wrap.box.options && wrap.box.options.display === false ? total : total + 1, 0) || 1;\n const params = Object.freeze({\n outerWidth: width,\n outerHeight: height,\n padding,\n availableWidth,\n availableHeight,\n vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,\n hBoxMaxHeight: availableHeight / 2\n });\n const maxPadding = Object.assign({}, padding);\n updateMaxPadding(maxPadding, toPadding(minPadding));\n const chartArea = Object.assign({\n maxPadding,\n w: availableWidth,\n h: availableHeight,\n x: padding.left,\n y: padding.top\n }, padding);\n setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);\n fitBoxes(boxes.fullSize, chartArea, params);\n fitBoxes(verticalBoxes, chartArea, params);\n if (fitBoxes(horizontalBoxes, chartArea, params)) {\n fitBoxes(verticalBoxes, chartArea, params);\n }\n handleMaxPadding(chartArea);\n placeBoxes(boxes.leftAndTop, chartArea, params);\n chartArea.x += chartArea.w;\n chartArea.y += chartArea.h;\n placeBoxes(boxes.rightAndBottom, chartArea, params);\n chart.chartArea = {\n left: chartArea.left,\n top: chartArea.top,\n right: chartArea.left + chartArea.w,\n bottom: chartArea.top + chartArea.h,\n height: chartArea.h,\n width: chartArea.w,\n };\n each(boxes.chartArea, (layout) => {\n const box = layout.box;\n Object.assign(box, chart.chartArea);\n box.update(chartArea.w, chartArea.h);\n });\n }\n};\n\nclass BasePlatform {\n acquireContext(canvas, aspectRatio) {}\n releaseContext(context) {\n return false;\n }\n addEventListener(chart, type, listener) {}\n removeEventListener(chart, type, listener) {}\n getDevicePixelRatio() {\n return 1;\n }\n getMaximumSize(element, width, height, aspectRatio) {\n width = Math.max(0, width || element.width);\n height = height || element.height;\n return {\n width,\n height: Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height)\n };\n }\n isAttached(canvas) {\n return true;\n }\n}\n\nclass BasicPlatform extends BasePlatform {\n acquireContext(item) {\n return item && item.getContext && item.getContext('2d') || null;\n }\n}\n\nconst EXPANDO_KEY = '$chartjs';\nconst EVENT_TYPES = {\n touchstart: 'mousedown',\n touchmove: 'mousemove',\n touchend: 'mouseup',\n pointerenter: 'mouseenter',\n pointerdown: 'mousedown',\n pointermove: 'mousemove',\n pointerup: 'mouseup',\n pointerleave: 'mouseout',\n pointerout: 'mouseout'\n};\nconst isNullOrEmpty = value => value === null || value === '';\nfunction initCanvas(canvas, aspectRatio) {\n const style = canvas.style;\n const renderHeight = canvas.getAttribute('height');\n const renderWidth = canvas.getAttribute('width');\n canvas[EXPANDO_KEY] = {\n initial: {\n height: renderHeight,\n width: renderWidth,\n style: {\n display: style.display,\n height: style.height,\n width: style.width\n }\n }\n };\n style.display = style.display || 'block';\n style.boxSizing = style.boxSizing || 'border-box';\n if (isNullOrEmpty(renderWidth)) {\n const displayWidth = readUsedSize(canvas, 'width');\n if (displayWidth !== undefined) {\n canvas.width = displayWidth;\n }\n }\n if (isNullOrEmpty(renderHeight)) {\n if (canvas.style.height === '') {\n canvas.height = canvas.width / (aspectRatio || 2);\n } else {\n const displayHeight = readUsedSize(canvas, 'height');\n if (displayHeight !== undefined) {\n canvas.height = displayHeight;\n }\n }\n }\n return canvas;\n}\nconst eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;\nfunction addListener(node, type, listener) {\n node.addEventListener(type, listener, eventListenerOptions);\n}\nfunction removeListener(chart, type, listener) {\n chart.canvas.removeEventListener(type, listener, eventListenerOptions);\n}\nfunction fromNativeEvent(event, chart) {\n const type = EVENT_TYPES[event.type] || event.type;\n const {x, y} = getRelativePosition$1(event, chart);\n return {\n type,\n chart,\n native: event,\n x: x !== undefined ? x : null,\n y: y !== undefined ? y : null,\n };\n}\nfunction createAttachObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const container = canvas && _getParentNode(canvas);\n const element = container || canvas;\n const observer = new MutationObserver(entries => {\n const parent = _getParentNode(element);\n entries.forEach(entry => {\n for (let i = 0; i < entry.addedNodes.length; i++) {\n const added = entry.addedNodes[i];\n if (added === element || added === parent) {\n listener(entry.target);\n }\n }\n });\n });\n observer.observe(document, {childList: true, subtree: true});\n return observer;\n}\nfunction createDetachObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const container = canvas && _getParentNode(canvas);\n if (!container) {\n return;\n }\n const observer = new MutationObserver(entries => {\n entries.forEach(entry => {\n for (let i = 0; i < entry.removedNodes.length; i++) {\n if (entry.removedNodes[i] === canvas) {\n listener();\n break;\n }\n }\n });\n });\n observer.observe(container, {childList: true});\n return observer;\n}\nconst drpListeningCharts = new Map();\nlet oldDevicePixelRatio = 0;\nfunction onWindowResize() {\n const dpr = window.devicePixelRatio;\n if (dpr === oldDevicePixelRatio) {\n return;\n }\n oldDevicePixelRatio = dpr;\n drpListeningCharts.forEach((resize, chart) => {\n if (chart.currentDevicePixelRatio !== dpr) {\n resize();\n }\n });\n}\nfunction listenDevicePixelRatioChanges(chart, resize) {\n if (!drpListeningCharts.size) {\n window.addEventListener('resize', onWindowResize);\n }\n drpListeningCharts.set(chart, resize);\n}\nfunction unlistenDevicePixelRatioChanges(chart) {\n drpListeningCharts.delete(chart);\n if (!drpListeningCharts.size) {\n window.removeEventListener('resize', onWindowResize);\n }\n}\nfunction createResizeObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const container = canvas && _getParentNode(canvas);\n if (!container) {\n return;\n }\n const resize = throttled((width, height) => {\n const w = container.clientWidth;\n listener(width, height);\n if (w < container.clientWidth) {\n listener();\n }\n }, window);\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n const width = entry.contentRect.width;\n const height = entry.contentRect.height;\n if (width === 0 && height === 0) {\n return;\n }\n resize(width, height);\n });\n observer.observe(container);\n listenDevicePixelRatioChanges(chart, resize);\n return observer;\n}\nfunction releaseObserver(chart, type, observer) {\n if (observer) {\n observer.disconnect();\n }\n if (type === 'resize') {\n unlistenDevicePixelRatioChanges(chart);\n }\n}\nfunction createProxyAndListen(chart, type, listener) {\n const canvas = chart.canvas;\n const proxy = throttled((event) => {\n if (chart.ctx !== null) {\n listener(fromNativeEvent(event, chart));\n }\n }, chart, (args) => {\n const event = args[0];\n return [event, event.offsetX, event.offsetY];\n });\n addListener(canvas, type, proxy);\n return proxy;\n}\nclass DomPlatform extends BasePlatform {\n acquireContext(canvas, aspectRatio) {\n const context = canvas && canvas.getContext && canvas.getContext('2d');\n if (context && context.canvas === canvas) {\n initCanvas(canvas, aspectRatio);\n return context;\n }\n return null;\n }\n releaseContext(context) {\n const canvas = context.canvas;\n if (!canvas[EXPANDO_KEY]) {\n return false;\n }\n const initial = canvas[EXPANDO_KEY].initial;\n ['height', 'width'].forEach((prop) => {\n const value = initial[prop];\n if (isNullOrUndef(value)) {\n canvas.removeAttribute(prop);\n } else {\n canvas.setAttribute(prop, value);\n }\n });\n const style = initial.style || {};\n Object.keys(style).forEach((key) => {\n canvas.style[key] = style[key];\n });\n canvas.width = canvas.width;\n delete canvas[EXPANDO_KEY];\n return true;\n }\n addEventListener(chart, type, listener) {\n this.removeEventListener(chart, type);\n const proxies = chart.$proxies || (chart.$proxies = {});\n const handlers = {\n attach: createAttachObserver,\n detach: createDetachObserver,\n resize: createResizeObserver\n };\n const handler = handlers[type] || createProxyAndListen;\n proxies[type] = handler(chart, type, listener);\n }\n removeEventListener(chart, type) {\n const proxies = chart.$proxies || (chart.$proxies = {});\n const proxy = proxies[type];\n if (!proxy) {\n return;\n }\n const handlers = {\n attach: releaseObserver,\n detach: releaseObserver,\n resize: releaseObserver\n };\n const handler = handlers[type] || removeListener;\n handler(chart, type, proxy);\n proxies[type] = undefined;\n }\n getDevicePixelRatio() {\n return window.devicePixelRatio;\n }\n getMaximumSize(canvas, width, height, aspectRatio) {\n return getMaximumSize(canvas, width, height, aspectRatio);\n }\n isAttached(canvas) {\n const container = _getParentNode(canvas);\n return !!(container && _getParentNode(container));\n }\n}\n\nclass Element {\n constructor() {\n this.x = undefined;\n this.y = undefined;\n this.active = false;\n this.options = undefined;\n this.$animations = undefined;\n }\n tooltipPosition(useFinalPosition) {\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return {x, y};\n }\n hasValue() {\n return isNumber(this.x) && isNumber(this.y);\n }\n getProps(props, final) {\n const me = this;\n const anims = this.$animations;\n if (!final || !anims) {\n return me;\n }\n const ret = {};\n props.forEach(prop => {\n ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : me[prop];\n });\n return ret;\n }\n}\nElement.defaults = {};\nElement.defaultRoutes = undefined;\n\nconst formatters = {\n values(value) {\n return isArray(value) ? value : '' + value;\n },\n numeric(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0';\n }\n const locale = this.chart.options.locale;\n let notation;\n let delta = tickValue;\n if (ticks.length > 1) {\n const maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));\n if (maxTick < 1e-4 || maxTick > 1e+15) {\n notation = 'scientific';\n }\n delta = calculateDelta(tickValue, ticks);\n }\n const logDelta = log10(Math.abs(delta));\n const numDecimal = Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);\n const options = {notation, minimumFractionDigits: numDecimal, maximumFractionDigits: numDecimal};\n Object.assign(options, this.options.ticks.format);\n return formatNumber(tickValue, locale, options);\n },\n logarithmic(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0';\n }\n const remain = tickValue / (Math.pow(10, Math.floor(log10(tickValue))));\n if (remain === 1 || remain === 2 || remain === 5) {\n return formatters.numeric.call(this, tickValue, index, ticks);\n }\n return '';\n }\n};\nfunction calculateDelta(tickValue, ticks) {\n let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;\n if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {\n delta = tickValue - Math.floor(tickValue);\n }\n return delta;\n}\nvar Ticks = {formatters};\n\ndefaults.set('scale', {\n display: true,\n offset: false,\n reverse: false,\n beginAtZero: false,\n bounds: 'ticks',\n grace: 0,\n grid: {\n display: true,\n lineWidth: 1,\n drawBorder: true,\n drawOnChartArea: true,\n drawTicks: true,\n tickLength: 8,\n tickWidth: (_ctx, options) => options.lineWidth,\n tickColor: (_ctx, options) => options.color,\n offset: false,\n borderDash: [],\n borderDashOffset: 0.0,\n borderWidth: 1\n },\n title: {\n display: false,\n text: '',\n padding: {\n top: 4,\n bottom: 4\n }\n },\n ticks: {\n minRotation: 0,\n maxRotation: 50,\n mirror: false,\n textStrokeWidth: 0,\n textStrokeColor: '',\n padding: 3,\n display: true,\n autoSkip: true,\n autoSkipPadding: 3,\n labelOffset: 0,\n callback: Ticks.formatters.values,\n minor: {},\n major: {},\n align: 'center',\n crossAlign: 'near',\n showLabelBackdrop: false,\n backdropColor: 'rgba(255, 255, 255, 0.75)',\n backdropPadding: 2,\n }\n});\ndefaults.route('scale.ticks', 'color', '', 'color');\ndefaults.route('scale.grid', 'color', '', 'borderColor');\ndefaults.route('scale.grid', 'borderColor', '', 'borderColor');\ndefaults.route('scale.title', 'color', '', 'color');\ndefaults.describe('scale', {\n _fallback: false,\n _scriptable: (name) => !name.startsWith('before') && !name.startsWith('after') && name !== 'callback' && name !== 'parser',\n _indexable: (name) => name !== 'borderDash' && name !== 'tickBorderDash',\n});\ndefaults.describe('scales', {\n _fallback: 'scale',\n});\n\nfunction autoSkip(scale, ticks) {\n const tickOpts = scale.options.ticks;\n const ticksLimit = tickOpts.maxTicksLimit || determineMaxTicks(scale);\n const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];\n const numMajorIndices = majorIndices.length;\n const first = majorIndices[0];\n const last = majorIndices[numMajorIndices - 1];\n const newTicks = [];\n if (numMajorIndices > ticksLimit) {\n skipMajors(ticks, newTicks, majorIndices, numMajorIndices / ticksLimit);\n return newTicks;\n }\n const spacing = calculateSpacing(majorIndices, ticks, ticksLimit);\n if (numMajorIndices > 0) {\n let i, ilen;\n const avgMajorSpacing = numMajorIndices > 1 ? Math.round((last - first) / (numMajorIndices - 1)) : null;\n skip(ticks, newTicks, spacing, isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);\n for (i = 0, ilen = numMajorIndices - 1; i < ilen; i++) {\n skip(ticks, newTicks, spacing, majorIndices[i], majorIndices[i + 1]);\n }\n skip(ticks, newTicks, spacing, last, isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);\n return newTicks;\n }\n skip(ticks, newTicks, spacing);\n return newTicks;\n}\nfunction determineMaxTicks(scale) {\n const offset = scale.options.offset;\n const tickLength = scale._tickSize();\n const maxScale = scale._length / tickLength + (offset ? 0 : 1);\n const maxChart = scale._maxLength / tickLength;\n return Math.floor(Math.min(maxScale, maxChart));\n}\nfunction calculateSpacing(majorIndices, ticks, ticksLimit) {\n const evenMajorSpacing = getEvenSpacing(majorIndices);\n const spacing = ticks.length / ticksLimit;\n if (!evenMajorSpacing) {\n return Math.max(spacing, 1);\n }\n const factors = _factorize(evenMajorSpacing);\n for (let i = 0, ilen = factors.length - 1; i < ilen; i++) {\n const factor = factors[i];\n if (factor > spacing) {\n return factor;\n }\n }\n return Math.max(spacing, 1);\n}\nfunction getMajorIndices(ticks) {\n const result = [];\n let i, ilen;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n if (ticks[i].major) {\n result.push(i);\n }\n }\n return result;\n}\nfunction skipMajors(ticks, newTicks, majorIndices, spacing) {\n let count = 0;\n let next = majorIndices[0];\n let i;\n spacing = Math.ceil(spacing);\n for (i = 0; i < ticks.length; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = majorIndices[count * spacing];\n }\n }\n}\nfunction skip(ticks, newTicks, spacing, majorStart, majorEnd) {\n const start = valueOrDefault(majorStart, 0);\n const end = Math.min(valueOrDefault(majorEnd, ticks.length), ticks.length);\n let count = 0;\n let length, i, next;\n spacing = Math.ceil(spacing);\n if (majorEnd) {\n length = majorEnd - majorStart;\n spacing = length / Math.floor(length / spacing);\n }\n next = start;\n while (next < 0) {\n count++;\n next = Math.round(start + count * spacing);\n }\n for (i = Math.max(start, 0); i < end; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = Math.round(start + count * spacing);\n }\n }\n}\nfunction getEvenSpacing(arr) {\n const len = arr.length;\n let i, diff;\n if (len < 2) {\n return false;\n }\n for (diff = arr[0], i = 1; i < len; ++i) {\n if (arr[i] - arr[i - 1] !== diff) {\n return false;\n }\n }\n return diff;\n}\n\nconst reverseAlign = (align) => align === 'left' ? 'right' : align === 'right' ? 'left' : align;\nconst offsetFromEdge = (scale, edge, offset) => edge === 'top' || edge === 'left' ? scale[edge] + offset : scale[edge] - offset;\nfunction sample(arr, numItems) {\n const result = [];\n const increment = arr.length / numItems;\n const len = arr.length;\n let i = 0;\n for (; i < len; i += increment) {\n result.push(arr[Math.floor(i)]);\n }\n return result;\n}\nfunction getPixelForGridLine(scale, index, offsetGridLines) {\n const length = scale.ticks.length;\n const validIndex = Math.min(index, length - 1);\n const start = scale._startPixel;\n const end = scale._endPixel;\n const epsilon = 1e-6;\n let lineValue = scale.getPixelForTick(validIndex);\n let offset;\n if (offsetGridLines) {\n if (length === 1) {\n offset = Math.max(lineValue - start, end - lineValue);\n } else if (index === 0) {\n offset = (scale.getPixelForTick(1) - lineValue) / 2;\n } else {\n offset = (lineValue - scale.getPixelForTick(validIndex - 1)) / 2;\n }\n lineValue += validIndex < index ? offset : -offset;\n if (lineValue < start - epsilon || lineValue > end + epsilon) {\n return;\n }\n }\n return lineValue;\n}\nfunction garbageCollect(caches, length) {\n each(caches, (cache) => {\n const gc = cache.gc;\n const gcLen = gc.length / 2;\n let i;\n if (gcLen > length) {\n for (i = 0; i < gcLen; ++i) {\n delete cache.data[gc[i]];\n }\n gc.splice(0, gcLen);\n }\n });\n}\nfunction getTickMarkLength(options) {\n return options.drawTicks ? options.tickLength : 0;\n}\nfunction getTitleHeight(options, fallback) {\n if (!options.display) {\n return 0;\n }\n const font = toFont(options.font, fallback);\n const padding = toPadding(options.padding);\n const lines = isArray(options.text) ? options.text.length : 1;\n return (lines * font.lineHeight) + padding.height;\n}\nfunction createScaleContext(parent, scale) {\n return Object.assign(Object.create(parent), {\n scale,\n type: 'scale'\n });\n}\nfunction createTickContext(parent, index, tick) {\n return Object.assign(Object.create(parent), {\n tick,\n index,\n type: 'tick'\n });\n}\nfunction titleAlign(align, position, reverse) {\n let ret = _toLeftRightCenter(align);\n if ((reverse && position !== 'right') || (!reverse && position === 'right')) {\n ret = reverseAlign(ret);\n }\n return ret;\n}\nfunction titleArgs(scale, offset, position, align) {\n const {top, left, bottom, right} = scale;\n let rotation = 0;\n let maxWidth, titleX, titleY;\n if (scale.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n titleY = offsetFromEdge(scale, position, offset);\n maxWidth = right - left;\n } else {\n titleX = offsetFromEdge(scale, position, offset);\n titleY = _alignStartEnd(align, bottom, top);\n rotation = position === 'left' ? -HALF_PI : HALF_PI;\n }\n return {titleX, titleY, maxWidth, rotation};\n}\nclass Scale extends Element {\n constructor(cfg) {\n super();\n this.id = cfg.id;\n this.type = cfg.type;\n this.options = undefined;\n this.ctx = cfg.ctx;\n this.chart = cfg.chart;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.width = undefined;\n this.height = undefined;\n this._margins = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n this.maxWidth = undefined;\n this.maxHeight = undefined;\n this.paddingTop = undefined;\n this.paddingBottom = undefined;\n this.paddingLeft = undefined;\n this.paddingRight = undefined;\n this.axis = undefined;\n this.labelRotation = undefined;\n this.min = undefined;\n this.max = undefined;\n this._range = undefined;\n this.ticks = [];\n this._gridLineItems = null;\n this._labelItems = null;\n this._labelSizes = null;\n this._length = 0;\n this._maxLength = 0;\n this._longestTextCache = {};\n this._startPixel = undefined;\n this._endPixel = undefined;\n this._reversePixels = false;\n this._userMax = undefined;\n this._userMin = undefined;\n this._suggestedMax = undefined;\n this._suggestedMin = undefined;\n this._ticksLength = 0;\n this._borderValue = 0;\n this._cache = {};\n this._dataLimitsCached = false;\n this.$context = undefined;\n }\n init(options) {\n const me = this;\n me.options = options.setContext(me.getContext());\n me.axis = options.axis;\n me._userMin = me.parse(options.min);\n me._userMax = me.parse(options.max);\n me._suggestedMin = me.parse(options.suggestedMin);\n me._suggestedMax = me.parse(options.suggestedMax);\n }\n parse(raw, index) {\n return raw;\n }\n getUserBounds() {\n let {_userMin, _userMax, _suggestedMin, _suggestedMax} = this;\n _userMin = finiteOrDefault(_userMin, Number.POSITIVE_INFINITY);\n _userMax = finiteOrDefault(_userMax, Number.NEGATIVE_INFINITY);\n _suggestedMin = finiteOrDefault(_suggestedMin, Number.POSITIVE_INFINITY);\n _suggestedMax = finiteOrDefault(_suggestedMax, Number.NEGATIVE_INFINITY);\n return {\n min: finiteOrDefault(_userMin, _suggestedMin),\n max: finiteOrDefault(_userMax, _suggestedMax),\n minDefined: isNumberFinite(_userMin),\n maxDefined: isNumberFinite(_userMax)\n };\n }\n getMinMax(canStack) {\n const me = this;\n let {min, max, minDefined, maxDefined} = me.getUserBounds();\n let range;\n if (minDefined && maxDefined) {\n return {min, max};\n }\n const metas = me.getMatchingVisibleMetas();\n for (let i = 0, ilen = metas.length; i < ilen; ++i) {\n range = metas[i].controller.getMinMax(me, canStack);\n if (!minDefined) {\n min = Math.min(min, range.min);\n }\n if (!maxDefined) {\n max = Math.max(max, range.max);\n }\n }\n return {\n min: finiteOrDefault(min, finiteOrDefault(max, min)),\n max: finiteOrDefault(max, finiteOrDefault(min, max))\n };\n }\n getPadding() {\n const me = this;\n return {\n left: me.paddingLeft || 0,\n top: me.paddingTop || 0,\n right: me.paddingRight || 0,\n bottom: me.paddingBottom || 0\n };\n }\n getTicks() {\n return this.ticks;\n }\n getLabels() {\n const data = this.chart.data;\n return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];\n }\n beforeLayout() {\n this._cache = {};\n this._dataLimitsCached = false;\n }\n beforeUpdate() {\n callback(this.options.beforeUpdate, [this]);\n }\n update(maxWidth, maxHeight, margins) {\n const me = this;\n const tickOpts = me.options.ticks;\n const sampleSize = tickOpts.sampleSize;\n me.beforeUpdate();\n me.maxWidth = maxWidth;\n me.maxHeight = maxHeight;\n me._margins = margins = Object.assign({\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n }, margins);\n me.ticks = null;\n me._labelSizes = null;\n me._gridLineItems = null;\n me._labelItems = null;\n me.beforeSetDimensions();\n me.setDimensions();\n me.afterSetDimensions();\n me._maxLength = me.isHorizontal()\n ? me.width + margins.left + margins.right\n : me.height + margins.top + margins.bottom;\n if (!me._dataLimitsCached) {\n me.beforeDataLimits();\n me.determineDataLimits();\n me.afterDataLimits();\n me._range = _addGrace(me, me.options.grace);\n me._dataLimitsCached = true;\n }\n me.beforeBuildTicks();\n me.ticks = me.buildTicks() || [];\n me.afterBuildTicks();\n const samplingEnabled = sampleSize < me.ticks.length;\n me._convertTicksToLabels(samplingEnabled ? sample(me.ticks, sampleSize) : me.ticks);\n me.configure();\n me.beforeCalculateLabelRotation();\n me.calculateLabelRotation();\n me.afterCalculateLabelRotation();\n if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto')) {\n me.ticks = autoSkip(me, me.ticks);\n me._labelSizes = null;\n }\n if (samplingEnabled) {\n me._convertTicksToLabels(me.ticks);\n }\n me.beforeFit();\n me.fit();\n me.afterFit();\n me.afterUpdate();\n }\n configure() {\n const me = this;\n let reversePixels = me.options.reverse;\n let startPixel, endPixel;\n if (me.isHorizontal()) {\n startPixel = me.left;\n endPixel = me.right;\n } else {\n startPixel = me.top;\n endPixel = me.bottom;\n reversePixels = !reversePixels;\n }\n me._startPixel = startPixel;\n me._endPixel = endPixel;\n me._reversePixels = reversePixels;\n me._length = endPixel - startPixel;\n me._alignToPixels = me.options.alignToPixels;\n }\n afterUpdate() {\n callback(this.options.afterUpdate, [this]);\n }\n beforeSetDimensions() {\n callback(this.options.beforeSetDimensions, [this]);\n }\n setDimensions() {\n const me = this;\n if (me.isHorizontal()) {\n me.width = me.maxWidth;\n me.left = 0;\n me.right = me.width;\n } else {\n me.height = me.maxHeight;\n me.top = 0;\n me.bottom = me.height;\n }\n me.paddingLeft = 0;\n me.paddingTop = 0;\n me.paddingRight = 0;\n me.paddingBottom = 0;\n }\n afterSetDimensions() {\n callback(this.options.afterSetDimensions, [this]);\n }\n _callHooks(name) {\n const me = this;\n me.chart.notifyPlugins(name, me.getContext());\n callback(me.options[name], [me]);\n }\n beforeDataLimits() {\n this._callHooks('beforeDataLimits');\n }\n determineDataLimits() {}\n afterDataLimits() {\n this._callHooks('afterDataLimits');\n }\n beforeBuildTicks() {\n this._callHooks('beforeBuildTicks');\n }\n buildTicks() {\n return [];\n }\n afterBuildTicks() {\n this._callHooks('afterBuildTicks');\n }\n beforeTickToLabelConversion() {\n callback(this.options.beforeTickToLabelConversion, [this]);\n }\n generateTickLabels(ticks) {\n const me = this;\n const tickOpts = me.options.ticks;\n let i, ilen, tick;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n tick = ticks[i];\n tick.label = callback(tickOpts.callback, [tick.value, i, ticks], me);\n }\n for (i = 0; i < ilen; i++) {\n if (isNullOrUndef(ticks[i].label)) {\n ticks.splice(i, 1);\n ilen--;\n i--;\n }\n }\n }\n afterTickToLabelConversion() {\n callback(this.options.afterTickToLabelConversion, [this]);\n }\n beforeCalculateLabelRotation() {\n callback(this.options.beforeCalculateLabelRotation, [this]);\n }\n calculateLabelRotation() {\n const me = this;\n const options = me.options;\n const tickOpts = options.ticks;\n const numTicks = me.ticks.length;\n const minRotation = tickOpts.minRotation || 0;\n const maxRotation = tickOpts.maxRotation;\n let labelRotation = minRotation;\n let tickWidth, maxHeight, maxLabelDiagonal;\n if (!me._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !me.isHorizontal()) {\n me.labelRotation = minRotation;\n return;\n }\n const labelSizes = me._getLabelSizes();\n const maxLabelWidth = labelSizes.widest.width;\n const maxLabelHeight = labelSizes.highest.height;\n const maxWidth = _limitValue(me.chart.width - maxLabelWidth, 0, me.maxWidth);\n tickWidth = options.offset ? me.maxWidth / numTicks : maxWidth / (numTicks - 1);\n if (maxLabelWidth + 6 > tickWidth) {\n tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));\n maxHeight = me.maxHeight - getTickMarkLength(options.grid)\n\t\t\t\t- tickOpts.padding - getTitleHeight(options.title, me.chart.options.font);\n maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);\n labelRotation = toDegrees(Math.min(\n Math.asin(Math.min((labelSizes.highest.height + 6) / tickWidth, 1)),\n Math.asin(Math.min(maxHeight / maxLabelDiagonal, 1)) - Math.asin(maxLabelHeight / maxLabelDiagonal)\n ));\n labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));\n }\n me.labelRotation = labelRotation;\n }\n afterCalculateLabelRotation() {\n callback(this.options.afterCalculateLabelRotation, [this]);\n }\n beforeFit() {\n callback(this.options.beforeFit, [this]);\n }\n fit() {\n const me = this;\n const minSize = {\n width: 0,\n height: 0\n };\n const {chart, options: {ticks: tickOpts, title: titleOpts, grid: gridOpts}} = me;\n const display = me._isVisible();\n const isHorizontal = me.isHorizontal();\n if (display) {\n const titleHeight = getTitleHeight(titleOpts, chart.options.font);\n if (isHorizontal) {\n minSize.width = me.maxWidth;\n minSize.height = getTickMarkLength(gridOpts) + titleHeight;\n } else {\n minSize.height = me.maxHeight;\n minSize.width = getTickMarkLength(gridOpts) + titleHeight;\n }\n if (tickOpts.display && me.ticks.length) {\n const {first, last, widest, highest} = me._getLabelSizes();\n const tickPadding = tickOpts.padding * 2;\n const angleRadians = toRadians(me.labelRotation);\n const cos = Math.cos(angleRadians);\n const sin = Math.sin(angleRadians);\n if (isHorizontal) {\n const labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;\n minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);\n } else {\n const labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;\n minSize.width = Math.min(me.maxWidth, minSize.width + labelWidth + tickPadding);\n }\n me._calculatePadding(first, last, sin, cos);\n }\n }\n me._handleMargins();\n if (isHorizontal) {\n me.width = me._length = chart.width - me._margins.left - me._margins.right;\n me.height = minSize.height;\n } else {\n me.width = minSize.width;\n me.height = me._length = chart.height - me._margins.top - me._margins.bottom;\n }\n }\n _calculatePadding(first, last, sin, cos) {\n const me = this;\n const {ticks: {align, padding}, position} = me.options;\n const isRotated = me.labelRotation !== 0;\n const labelsBelowTicks = position !== 'top' && me.axis === 'x';\n if (me.isHorizontal()) {\n const offsetLeft = me.getPixelForTick(0) - me.left;\n const offsetRight = me.right - me.getPixelForTick(me.ticks.length - 1);\n let paddingLeft = 0;\n let paddingRight = 0;\n if (isRotated) {\n if (labelsBelowTicks) {\n paddingLeft = cos * first.width;\n paddingRight = sin * last.height;\n } else {\n paddingLeft = sin * first.height;\n paddingRight = cos * last.width;\n }\n } else if (align === 'start') {\n paddingRight = last.width;\n } else if (align === 'end') {\n paddingLeft = first.width;\n } else {\n paddingLeft = first.width / 2;\n paddingRight = last.width / 2;\n }\n me.paddingLeft = Math.max((paddingLeft - offsetLeft + padding) * me.width / (me.width - offsetLeft), 0);\n me.paddingRight = Math.max((paddingRight - offsetRight + padding) * me.width / (me.width - offsetRight), 0);\n } else {\n let paddingTop = last.height / 2;\n let paddingBottom = first.height / 2;\n if (align === 'start') {\n paddingTop = 0;\n paddingBottom = first.height;\n } else if (align === 'end') {\n paddingTop = last.height;\n paddingBottom = 0;\n }\n me.paddingTop = paddingTop + padding;\n me.paddingBottom = paddingBottom + padding;\n }\n }\n _handleMargins() {\n const me = this;\n if (me._margins) {\n me._margins.left = Math.max(me.paddingLeft, me._margins.left);\n me._margins.top = Math.max(me.paddingTop, me._margins.top);\n me._margins.right = Math.max(me.paddingRight, me._margins.right);\n me._margins.bottom = Math.max(me.paddingBottom, me._margins.bottom);\n }\n }\n afterFit() {\n callback(this.options.afterFit, [this]);\n }\n isHorizontal() {\n const {axis, position} = this.options;\n return position === 'top' || position === 'bottom' || axis === 'x';\n }\n isFullSize() {\n return this.options.fullSize;\n }\n _convertTicksToLabels(ticks) {\n const me = this;\n me.beforeTickToLabelConversion();\n me.generateTickLabels(ticks);\n me.afterTickToLabelConversion();\n }\n _getLabelSizes() {\n const me = this;\n let labelSizes = me._labelSizes;\n if (!labelSizes) {\n const sampleSize = me.options.ticks.sampleSize;\n let ticks = me.ticks;\n if (sampleSize < ticks.length) {\n ticks = sample(ticks, sampleSize);\n }\n me._labelSizes = labelSizes = me._computeLabelSizes(ticks, ticks.length);\n }\n return labelSizes;\n }\n _computeLabelSizes(ticks, length) {\n const {ctx, _longestTextCache: caches} = this;\n const widths = [];\n const heights = [];\n let widestLabelSize = 0;\n let highestLabelSize = 0;\n let i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel;\n for (i = 0; i < length; ++i) {\n label = ticks[i].label;\n tickFont = this._resolveTickFontOptions(i);\n ctx.font = fontString = tickFont.string;\n cache = caches[fontString] = caches[fontString] || {data: {}, gc: []};\n lineHeight = tickFont.lineHeight;\n width = height = 0;\n if (!isNullOrUndef(label) && !isArray(label)) {\n width = _measureText(ctx, cache.data, cache.gc, width, label);\n height = lineHeight;\n } else if (isArray(label)) {\n for (j = 0, jlen = label.length; j < jlen; ++j) {\n nestedLabel = label[j];\n if (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {\n width = _measureText(ctx, cache.data, cache.gc, width, nestedLabel);\n height += lineHeight;\n }\n }\n }\n widths.push(width);\n heights.push(height);\n widestLabelSize = Math.max(width, widestLabelSize);\n highestLabelSize = Math.max(height, highestLabelSize);\n }\n garbageCollect(caches, length);\n const widest = widths.indexOf(widestLabelSize);\n const highest = heights.indexOf(highestLabelSize);\n const valueAt = (idx) => ({width: widths[idx] || 0, height: heights[idx] || 0});\n return {\n first: valueAt(0),\n last: valueAt(length - 1),\n widest: valueAt(widest),\n highest: valueAt(highest),\n widths,\n heights,\n };\n }\n getLabelForValue(value) {\n return value;\n }\n getPixelForValue(value, index) {\n return NaN;\n }\n getValueForPixel(pixel) {}\n getPixelForTick(index) {\n const ticks = this.ticks;\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n return this.getPixelForValue(ticks[index].value);\n }\n getPixelForDecimal(decimal) {\n const me = this;\n if (me._reversePixels) {\n decimal = 1 - decimal;\n }\n const pixel = me._startPixel + decimal * me._length;\n return _int16Range(me._alignToPixels ? _alignPixel(me.chart, pixel, 0) : pixel);\n }\n getDecimalForPixel(pixel) {\n const decimal = (pixel - this._startPixel) / this._length;\n return this._reversePixels ? 1 - decimal : decimal;\n }\n getBasePixel() {\n return this.getPixelForValue(this.getBaseValue());\n }\n getBaseValue() {\n const {min, max} = this;\n return min < 0 && max < 0 ? max :\n min > 0 && max > 0 ? min :\n 0;\n }\n getContext(index) {\n const me = this;\n const ticks = me.ticks || [];\n if (index >= 0 && index < ticks.length) {\n const tick = ticks[index];\n return tick.$context ||\n\t\t\t\t(tick.$context = createTickContext(me.getContext(), index, tick));\n }\n return me.$context ||\n\t\t\t(me.$context = createScaleContext(me.chart.getContext(), me));\n }\n _tickSize() {\n const me = this;\n const optionTicks = me.options.ticks;\n const rot = toRadians(me.labelRotation);\n const cos = Math.abs(Math.cos(rot));\n const sin = Math.abs(Math.sin(rot));\n const labelSizes = me._getLabelSizes();\n const padding = optionTicks.autoSkipPadding || 0;\n const w = labelSizes ? labelSizes.widest.width + padding : 0;\n const h = labelSizes ? labelSizes.highest.height + padding : 0;\n return me.isHorizontal()\n ? h * cos > w * sin ? w / cos : h / sin\n : h * sin < w * cos ? h / cos : w / sin;\n }\n _isVisible() {\n const display = this.options.display;\n if (display !== 'auto') {\n return !!display;\n }\n return this.getMatchingVisibleMetas().length > 0;\n }\n _computeGridLineItems(chartArea) {\n const me = this;\n const axis = me.axis;\n const chart = me.chart;\n const options = me.options;\n const {grid, position} = options;\n const offset = grid.offset;\n const isHorizontal = me.isHorizontal();\n const ticks = me.ticks;\n const ticksLength = ticks.length + (offset ? 1 : 0);\n const tl = getTickMarkLength(grid);\n const items = [];\n const borderOpts = grid.setContext(me.getContext());\n const axisWidth = borderOpts.drawBorder ? borderOpts.borderWidth : 0;\n const axisHalfWidth = axisWidth / 2;\n const alignBorderValue = function(pixel) {\n return _alignPixel(chart, pixel, axisWidth);\n };\n let borderValue, i, lineValue, alignedLineValue;\n let tx1, ty1, tx2, ty2, x1, y1, x2, y2;\n if (position === 'top') {\n borderValue = alignBorderValue(me.bottom);\n ty1 = me.bottom - tl;\n ty2 = borderValue - axisHalfWidth;\n y1 = alignBorderValue(chartArea.top) + axisHalfWidth;\n y2 = chartArea.bottom;\n } else if (position === 'bottom') {\n borderValue = alignBorderValue(me.top);\n y1 = chartArea.top;\n y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;\n ty1 = borderValue + axisHalfWidth;\n ty2 = me.top + tl;\n } else if (position === 'left') {\n borderValue = alignBorderValue(me.right);\n tx1 = me.right - tl;\n tx2 = borderValue - axisHalfWidth;\n x1 = alignBorderValue(chartArea.left) + axisHalfWidth;\n x2 = chartArea.right;\n } else if (position === 'right') {\n borderValue = alignBorderValue(me.left);\n x1 = chartArea.left;\n x2 = alignBorderValue(chartArea.right) - axisHalfWidth;\n tx1 = borderValue + axisHalfWidth;\n tx2 = me.left + tl;\n } else if (axis === 'x') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.top + chartArea.bottom) / 2 + 0.5);\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n borderValue = alignBorderValue(me.chart.scales[positionAxisID].getPixelForValue(value));\n }\n y1 = chartArea.top;\n y2 = chartArea.bottom;\n ty1 = borderValue + axisHalfWidth;\n ty2 = ty1 + tl;\n } else if (axis === 'y') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.left + chartArea.right) / 2);\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n borderValue = alignBorderValue(me.chart.scales[positionAxisID].getPixelForValue(value));\n }\n tx1 = borderValue - axisHalfWidth;\n tx2 = tx1 - tl;\n x1 = chartArea.left;\n x2 = chartArea.right;\n }\n for (i = 0; i < ticksLength; ++i) {\n const optsAtIndex = grid.setContext(me.getContext(i));\n const lineWidth = optsAtIndex.lineWidth;\n const lineColor = optsAtIndex.color;\n const borderDash = grid.borderDash || [];\n const borderDashOffset = optsAtIndex.borderDashOffset;\n const tickWidth = optsAtIndex.tickWidth;\n const tickColor = optsAtIndex.tickColor;\n const tickBorderDash = optsAtIndex.tickBorderDash || [];\n const tickBorderDashOffset = optsAtIndex.tickBorderDashOffset;\n lineValue = getPixelForGridLine(me, i, offset);\n if (lineValue === undefined) {\n continue;\n }\n alignedLineValue = _alignPixel(chart, lineValue, lineWidth);\n if (isHorizontal) {\n tx1 = tx2 = x1 = x2 = alignedLineValue;\n } else {\n ty1 = ty2 = y1 = y2 = alignedLineValue;\n }\n items.push({\n tx1,\n ty1,\n tx2,\n ty2,\n x1,\n y1,\n x2,\n y2,\n width: lineWidth,\n color: lineColor,\n borderDash,\n borderDashOffset,\n tickWidth,\n tickColor,\n tickBorderDash,\n tickBorderDashOffset,\n });\n }\n me._ticksLength = ticksLength;\n me._borderValue = borderValue;\n return items;\n }\n _computeLabelItems(chartArea) {\n const me = this;\n const axis = me.axis;\n const options = me.options;\n const {position, ticks: optionTicks} = options;\n const isHorizontal = me.isHorizontal();\n const ticks = me.ticks;\n const {align, crossAlign, padding, mirror} = optionTicks;\n const tl = getTickMarkLength(options.grid);\n const tickAndPadding = tl + padding;\n const hTickAndPadding = mirror ? -padding : tickAndPadding;\n const rotation = -toRadians(me.labelRotation);\n const items = [];\n let i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;\n let textBaseline = 'middle';\n if (position === 'top') {\n y = me.bottom - hTickAndPadding;\n textAlign = me._getXAxisLabelAlignment();\n } else if (position === 'bottom') {\n y = me.top + hTickAndPadding;\n textAlign = me._getXAxisLabelAlignment();\n } else if (position === 'left') {\n const ret = me._getYAxisLabelAlignment(tl);\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (position === 'right') {\n const ret = me._getYAxisLabelAlignment(tl);\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (axis === 'x') {\n if (position === 'center') {\n y = ((chartArea.top + chartArea.bottom) / 2) + tickAndPadding;\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n y = me.chart.scales[positionAxisID].getPixelForValue(value) + tickAndPadding;\n }\n textAlign = me._getXAxisLabelAlignment();\n } else if (axis === 'y') {\n if (position === 'center') {\n x = ((chartArea.left + chartArea.right) / 2) - tickAndPadding;\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n x = me.chart.scales[positionAxisID].getPixelForValue(value);\n }\n textAlign = me._getYAxisLabelAlignment(tl).textAlign;\n }\n if (axis === 'y') {\n if (align === 'start') {\n textBaseline = 'top';\n } else if (align === 'end') {\n textBaseline = 'bottom';\n }\n }\n const labelSizes = me._getLabelSizes();\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n label = tick.label;\n const optsAtIndex = optionTicks.setContext(me.getContext(i));\n pixel = me.getPixelForTick(i) + optionTicks.labelOffset;\n font = me._resolveTickFontOptions(i);\n lineHeight = font.lineHeight;\n lineCount = isArray(label) ? label.length : 1;\n const halfCount = lineCount / 2;\n const color = optsAtIndex.color;\n const strokeColor = optsAtIndex.textStrokeColor;\n const strokeWidth = optsAtIndex.textStrokeWidth;\n if (isHorizontal) {\n x = pixel;\n if (position === 'top') {\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = -lineCount * lineHeight + lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight + lineHeight;\n } else {\n textOffset = -labelSizes.highest.height + lineHeight / 2;\n }\n } else {\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight;\n } else {\n textOffset = labelSizes.highest.height - lineCount * lineHeight;\n }\n }\n if (mirror) {\n textOffset *= -1;\n }\n } else {\n y = pixel;\n textOffset = (1 - lineCount) * lineHeight / 2;\n }\n let backdrop;\n if (optsAtIndex.showLabelBackdrop) {\n const labelPadding = toPadding(optsAtIndex.backdropPadding);\n const height = labelSizes.heights[i];\n const width = labelSizes.widths[i];\n let top = y + textOffset - labelPadding.top;\n let left = x - labelPadding.left;\n switch (textBaseline) {\n case 'middle':\n top -= height / 2;\n break;\n case 'bottom':\n top -= height;\n break;\n }\n switch (textAlign) {\n case 'center':\n left -= width / 2;\n break;\n case 'right':\n left -= width;\n break;\n }\n backdrop = {\n left,\n top,\n width: width + labelPadding.width,\n height: height + labelPadding.height,\n color: optsAtIndex.backdropColor,\n };\n }\n items.push({\n rotation,\n label,\n font,\n color,\n strokeColor,\n strokeWidth,\n textOffset,\n textAlign,\n textBaseline,\n translation: [x, y],\n backdrop,\n });\n }\n return items;\n }\n _getXAxisLabelAlignment() {\n const me = this;\n const {position, ticks} = me.options;\n const rotation = -toRadians(me.labelRotation);\n if (rotation) {\n return position === 'top' ? 'left' : 'right';\n }\n let align = 'center';\n if (ticks.align === 'start') {\n align = 'left';\n } else if (ticks.align === 'end') {\n align = 'right';\n }\n return align;\n }\n _getYAxisLabelAlignment(tl) {\n const me = this;\n const {position, ticks: {crossAlign, mirror, padding}} = me.options;\n const labelSizes = me._getLabelSizes();\n const tickAndPadding = tl + padding;\n const widest = labelSizes.widest.width;\n let textAlign;\n let x;\n if (position === 'left') {\n if (mirror) {\n textAlign = 'left';\n x = me.right + padding;\n } else {\n x = me.right - tickAndPadding;\n if (crossAlign === 'near') {\n textAlign = 'right';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x -= (widest / 2);\n } else {\n textAlign = 'left';\n x = me.left;\n }\n }\n } else if (position === 'right') {\n if (mirror) {\n textAlign = 'right';\n x = me.left + padding;\n } else {\n x = me.left + tickAndPadding;\n if (crossAlign === 'near') {\n textAlign = 'left';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x += widest / 2;\n } else {\n textAlign = 'right';\n x = me.right;\n }\n }\n } else {\n textAlign = 'right';\n }\n return {textAlign, x};\n }\n _computeLabelArea() {\n const me = this;\n if (me.options.ticks.mirror) {\n return;\n }\n const chart = me.chart;\n const position = me.options.position;\n if (position === 'left' || position === 'right') {\n return {top: 0, left: me.left, bottom: chart.height, right: me.right};\n } if (position === 'top' || position === 'bottom') {\n return {top: me.top, left: 0, bottom: me.bottom, right: chart.width};\n }\n }\n drawBackground() {\n const {ctx, options: {backgroundColor}, left, top, width, height} = this;\n if (backgroundColor) {\n ctx.save();\n ctx.fillStyle = backgroundColor;\n ctx.fillRect(left, top, width, height);\n ctx.restore();\n }\n }\n getLineWidthForValue(value) {\n const me = this;\n const grid = me.options.grid;\n if (!me._isVisible() || !grid.display) {\n return 0;\n }\n const ticks = me.ticks;\n const index = ticks.findIndex(t => t.value === value);\n if (index >= 0) {\n const opts = grid.setContext(me.getContext(index));\n return opts.lineWidth;\n }\n return 0;\n }\n drawGrid(chartArea) {\n const me = this;\n const grid = me.options.grid;\n const ctx = me.ctx;\n const items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));\n let i, ilen;\n const drawLine = (p1, p2, style) => {\n if (!style.width || !style.color) {\n return;\n }\n ctx.save();\n ctx.lineWidth = style.width;\n ctx.strokeStyle = style.color;\n ctx.setLineDash(style.borderDash || []);\n ctx.lineDashOffset = style.borderDashOffset;\n ctx.beginPath();\n ctx.moveTo(p1.x, p1.y);\n ctx.lineTo(p2.x, p2.y);\n ctx.stroke();\n ctx.restore();\n };\n if (grid.display) {\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n const item = items[i];\n if (grid.drawOnChartArea) {\n drawLine(\n {x: item.x1, y: item.y1},\n {x: item.x2, y: item.y2},\n item\n );\n }\n if (grid.drawTicks) {\n drawLine(\n {x: item.tx1, y: item.ty1},\n {x: item.tx2, y: item.ty2},\n {\n color: item.tickColor,\n width: item.tickWidth,\n borderDash: item.tickBorderDash,\n borderDashOffset: item.tickBorderDashOffset\n }\n );\n }\n }\n }\n }\n drawBorder() {\n const me = this;\n const {chart, ctx, options: {grid}} = me;\n const borderOpts = grid.setContext(me.getContext());\n const axisWidth = grid.drawBorder ? borderOpts.borderWidth : 0;\n if (!axisWidth) {\n return;\n }\n const lastLineWidth = grid.setContext(me.getContext(0)).lineWidth;\n const borderValue = me._borderValue;\n let x1, x2, y1, y2;\n if (me.isHorizontal()) {\n x1 = _alignPixel(chart, me.left, axisWidth) - axisWidth / 2;\n x2 = _alignPixel(chart, me.right, lastLineWidth) + lastLineWidth / 2;\n y1 = y2 = borderValue;\n } else {\n y1 = _alignPixel(chart, me.top, axisWidth) - axisWidth / 2;\n y2 = _alignPixel(chart, me.bottom, lastLineWidth) + lastLineWidth / 2;\n x1 = x2 = borderValue;\n }\n ctx.save();\n ctx.lineWidth = borderOpts.borderWidth;\n ctx.strokeStyle = borderOpts.borderColor;\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n ctx.restore();\n }\n drawLabels(chartArea) {\n const me = this;\n const optionTicks = me.options.ticks;\n if (!optionTicks.display) {\n return;\n }\n const ctx = me.ctx;\n const area = me._computeLabelArea();\n if (area) {\n clipArea(ctx, area);\n }\n const items = me._labelItems || (me._labelItems = me._computeLabelItems(chartArea));\n let i, ilen;\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n const item = items[i];\n const tickFont = item.font;\n const label = item.label;\n if (item.backdrop) {\n ctx.fillStyle = item.backdrop.color;\n ctx.fillRect(item.backdrop.left, item.backdrop.top, item.backdrop.width, item.backdrop.height);\n }\n let y = item.textOffset;\n renderText(ctx, label, 0, y, tickFont, item);\n }\n if (area) {\n unclipArea(ctx);\n }\n }\n drawTitle() {\n const {ctx, options: {position, title, reverse}} = this;\n if (!title.display) {\n return;\n }\n const font = toFont(title.font);\n const padding = toPadding(title.padding);\n const align = title.align;\n let offset = font.lineHeight / 2;\n if (position === 'bottom') {\n offset += padding.bottom;\n if (isArray(title.text)) {\n offset += font.lineHeight * (title.text.length - 1);\n }\n } else {\n offset += padding.top;\n }\n const {titleX, titleY, maxWidth, rotation} = titleArgs(this, offset, position, align);\n renderText(ctx, title.text, 0, 0, font, {\n color: title.color,\n maxWidth,\n rotation,\n textAlign: titleAlign(align, position, reverse),\n textBaseline: 'middle',\n translation: [titleX, titleY],\n });\n }\n draw(chartArea) {\n const me = this;\n if (!me._isVisible()) {\n return;\n }\n me.drawBackground();\n me.drawGrid(chartArea);\n me.drawBorder();\n me.drawTitle();\n me.drawLabels(chartArea);\n }\n _layers() {\n const me = this;\n const opts = me.options;\n const tz = opts.ticks && opts.ticks.z || 0;\n const gz = opts.grid && opts.grid.z || 0;\n if (!me._isVisible() || me.draw !== Scale.prototype.draw) {\n return [{\n z: tz,\n draw(chartArea) {\n me.draw(chartArea);\n }\n }];\n }\n return [{\n z: gz,\n draw(chartArea) {\n me.drawBackground();\n me.drawGrid(chartArea);\n me.drawTitle();\n }\n }, {\n z: gz + 1,\n draw() {\n me.drawBorder();\n }\n }, {\n z: tz,\n draw(chartArea) {\n me.drawLabels(chartArea);\n }\n }];\n }\n getMatchingVisibleMetas(type) {\n const me = this;\n const metas = me.chart.getSortedVisibleDatasetMetas();\n const axisID = me.axis + 'AxisID';\n const result = [];\n let i, ilen;\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n const meta = metas[i];\n if (meta[axisID] === me.id && (!type || meta.type === type)) {\n result.push(meta);\n }\n }\n return result;\n }\n _resolveTickFontOptions(index) {\n const opts = this.options.ticks.setContext(this.getContext(index));\n return toFont(opts.font);\n }\n _maxDigits() {\n const me = this;\n const fontSize = me._resolveTickFontOptions(0).lineHeight;\n return (me.isHorizontal() ? me.width : me.height) / fontSize;\n }\n}\n\nclass TypedRegistry {\n constructor(type, scope, override) {\n this.type = type;\n this.scope = scope;\n this.override = override;\n this.items = Object.create(null);\n }\n isForType(type) {\n return Object.prototype.isPrototypeOf.call(this.type.prototype, type.prototype);\n }\n register(item) {\n const me = this;\n const proto = Object.getPrototypeOf(item);\n let parentScope;\n if (isIChartComponent(proto)) {\n parentScope = me.register(proto);\n }\n const items = me.items;\n const id = item.id;\n const scope = me.scope + '.' + id;\n if (!id) {\n throw new Error('class does not have id: ' + item);\n }\n if (id in items) {\n return scope;\n }\n items[id] = item;\n registerDefaults(item, scope, parentScope);\n if (me.override) {\n defaults.override(item.id, item.overrides);\n }\n return scope;\n }\n get(id) {\n return this.items[id];\n }\n unregister(item) {\n const items = this.items;\n const id = item.id;\n const scope = this.scope;\n if (id in items) {\n delete items[id];\n }\n if (scope && id in defaults[scope]) {\n delete defaults[scope][id];\n if (this.override) {\n delete overrides[id];\n }\n }\n }\n}\nfunction registerDefaults(item, scope, parentScope) {\n const itemDefaults = merge(Object.create(null), [\n parentScope ? defaults.get(parentScope) : {},\n defaults.get(scope),\n item.defaults\n ]);\n defaults.set(scope, itemDefaults);\n if (item.defaultRoutes) {\n routeDefaults(scope, item.defaultRoutes);\n }\n if (item.descriptors) {\n defaults.describe(scope, item.descriptors);\n }\n}\nfunction routeDefaults(scope, routes) {\n Object.keys(routes).forEach(property => {\n const propertyParts = property.split('.');\n const sourceName = propertyParts.pop();\n const sourceScope = [scope].concat(propertyParts).join('.');\n const parts = routes[property].split('.');\n const targetName = parts.pop();\n const targetScope = parts.join('.');\n defaults.route(sourceScope, sourceName, targetScope, targetName);\n });\n}\nfunction isIChartComponent(proto) {\n return 'id' in proto && 'defaults' in proto;\n}\n\nclass Registry {\n constructor() {\n this.controllers = new TypedRegistry(DatasetController, 'datasets', true);\n this.elements = new TypedRegistry(Element, 'elements');\n this.plugins = new TypedRegistry(Object, 'plugins');\n this.scales = new TypedRegistry(Scale, 'scales');\n this._typedRegistries = [this.controllers, this.scales, this.elements];\n }\n add(...args) {\n this._each('register', args);\n }\n remove(...args) {\n this._each('unregister', args);\n }\n addControllers(...args) {\n this._each('register', args, this.controllers);\n }\n addElements(...args) {\n this._each('register', args, this.elements);\n }\n addPlugins(...args) {\n this._each('register', args, this.plugins);\n }\n addScales(...args) {\n this._each('register', args, this.scales);\n }\n getController(id) {\n return this._get(id, this.controllers, 'controller');\n }\n getElement(id) {\n return this._get(id, this.elements, 'element');\n }\n getPlugin(id) {\n return this._get(id, this.plugins, 'plugin');\n }\n getScale(id) {\n return this._get(id, this.scales, 'scale');\n }\n removeControllers(...args) {\n this._each('unregister', args, this.controllers);\n }\n removeElements(...args) {\n this._each('unregister', args, this.elements);\n }\n removePlugins(...args) {\n this._each('unregister', args, this.plugins);\n }\n removeScales(...args) {\n this._each('unregister', args, this.scales);\n }\n _each(method, args, typedRegistry) {\n const me = this;\n [...args].forEach(arg => {\n const reg = typedRegistry || me._getRegistryForType(arg);\n if (typedRegistry || reg.isForType(arg) || (reg === me.plugins && arg.id)) {\n me._exec(method, reg, arg);\n } else {\n each(arg, item => {\n const itemReg = typedRegistry || me._getRegistryForType(item);\n me._exec(method, itemReg, item);\n });\n }\n });\n }\n _exec(method, registry, component) {\n const camelMethod = _capitalize(method);\n callback(component['before' + camelMethod], [], component);\n registry[method](component);\n callback(component['after' + camelMethod], [], component);\n }\n _getRegistryForType(type) {\n for (let i = 0; i < this._typedRegistries.length; i++) {\n const reg = this._typedRegistries[i];\n if (reg.isForType(type)) {\n return reg;\n }\n }\n return this.plugins;\n }\n _get(id, typedRegistry, type) {\n const item = typedRegistry.get(id);\n if (item === undefined) {\n throw new Error('\"' + id + '\" is not a registered ' + type + '.');\n }\n return item;\n }\n}\nvar registry = new Registry();\n\nclass PluginService {\n constructor() {\n this._init = [];\n }\n notify(chart, hook, args, filter) {\n const me = this;\n if (hook === 'beforeInit') {\n me._init = me._createDescriptors(chart, true);\n me._notify(me._init, chart, 'install');\n }\n const descriptors = filter ? me._descriptors(chart).filter(filter) : me._descriptors(chart);\n const result = me._notify(descriptors, chart, hook, args);\n if (hook === 'destroy') {\n me._notify(descriptors, chart, 'stop');\n me._notify(me._init, chart, 'uninstall');\n }\n return result;\n }\n _notify(descriptors, chart, hook, args) {\n args = args || {};\n for (const descriptor of descriptors) {\n const plugin = descriptor.plugin;\n const method = plugin[hook];\n const params = [chart, args, descriptor.options];\n if (callback(method, params, plugin) === false && args.cancelable) {\n return false;\n }\n }\n return true;\n }\n invalidate() {\n if (!isNullOrUndef(this._cache)) {\n this._oldCache = this._cache;\n this._cache = undefined;\n }\n }\n _descriptors(chart) {\n if (this._cache) {\n return this._cache;\n }\n const descriptors = this._cache = this._createDescriptors(chart);\n this._notifyStateChanges(chart);\n return descriptors;\n }\n _createDescriptors(chart, all) {\n const config = chart && chart.config;\n const options = valueOrDefault(config.options && config.options.plugins, {});\n const plugins = allPlugins(config);\n return options === false && !all ? [] : createDescriptors(chart, plugins, options, all);\n }\n _notifyStateChanges(chart) {\n const previousDescriptors = this._oldCache || [];\n const descriptors = this._cache;\n const diff = (a, b) => a.filter(x => !b.some(y => x.plugin.id === y.plugin.id));\n this._notify(diff(previousDescriptors, descriptors), chart, 'stop');\n this._notify(diff(descriptors, previousDescriptors), chart, 'start');\n }\n}\nfunction allPlugins(config) {\n const plugins = [];\n const keys = Object.keys(registry.plugins.items);\n for (let i = 0; i < keys.length; i++) {\n plugins.push(registry.getPlugin(keys[i]));\n }\n const local = config.plugins || [];\n for (let i = 0; i < local.length; i++) {\n const plugin = local[i];\n if (plugins.indexOf(plugin) === -1) {\n plugins.push(plugin);\n }\n }\n return plugins;\n}\nfunction getOpts(options, all) {\n if (!all && options === false) {\n return null;\n }\n if (options === true) {\n return {};\n }\n return options;\n}\nfunction createDescriptors(chart, plugins, options, all) {\n const result = [];\n const context = chart.getContext();\n for (let i = 0; i < plugins.length; i++) {\n const plugin = plugins[i];\n const id = plugin.id;\n const opts = getOpts(options[id], all);\n if (opts === null) {\n continue;\n }\n result.push({\n plugin,\n options: pluginOpts(chart.config, plugin, opts, context)\n });\n }\n return result;\n}\nfunction pluginOpts(config, plugin, opts, context) {\n const keys = config.pluginScopeKeys(plugin);\n const scopes = config.getOptionScopes(opts, keys);\n return config.createResolver(scopes, context, [''], {scriptable: false, indexable: false, allKeys: true});\n}\n\nfunction getIndexAxis(type, options) {\n const datasetDefaults = defaults.datasets[type] || {};\n const datasetOptions = (options.datasets || {})[type] || {};\n return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';\n}\nfunction getAxisFromDefaultScaleID(id, indexAxis) {\n let axis = id;\n if (id === '_index_') {\n axis = indexAxis;\n } else if (id === '_value_') {\n axis = indexAxis === 'x' ? 'y' : 'x';\n }\n return axis;\n}\nfunction getDefaultScaleIDFromAxis(axis, indexAxis) {\n return axis === indexAxis ? '_index_' : '_value_';\n}\nfunction axisFromPosition(position) {\n if (position === 'top' || position === 'bottom') {\n return 'x';\n }\n if (position === 'left' || position === 'right') {\n return 'y';\n }\n}\nfunction determineAxis(id, scaleOptions) {\n if (id === 'x' || id === 'y') {\n return id;\n }\n return scaleOptions.axis || axisFromPosition(scaleOptions.position) || id.charAt(0).toLowerCase();\n}\nfunction mergeScaleConfig(config, options) {\n const chartDefaults = overrides[config.type] || {scales: {}};\n const configScales = options.scales || {};\n const chartIndexAxis = getIndexAxis(config.type, options);\n const firstIDs = Object.create(null);\n const scales = Object.create(null);\n Object.keys(configScales).forEach(id => {\n const scaleConf = configScales[id];\n const axis = determineAxis(id, scaleConf);\n const defaultId = getDefaultScaleIDFromAxis(axis, chartIndexAxis);\n const defaultScaleOptions = chartDefaults.scales || {};\n firstIDs[axis] = firstIDs[axis] || id;\n scales[id] = mergeIf(Object.create(null), [{axis}, scaleConf, defaultScaleOptions[axis], defaultScaleOptions[defaultId]]);\n });\n config.data.datasets.forEach(dataset => {\n const type = dataset.type || config.type;\n const indexAxis = dataset.indexAxis || getIndexAxis(type, options);\n const datasetDefaults = overrides[type] || {};\n const defaultScaleOptions = datasetDefaults.scales || {};\n Object.keys(defaultScaleOptions).forEach(defaultID => {\n const axis = getAxisFromDefaultScaleID(defaultID, indexAxis);\n const id = dataset[axis + 'AxisID'] || firstIDs[axis] || axis;\n scales[id] = scales[id] || Object.create(null);\n mergeIf(scales[id], [{axis}, configScales[id], defaultScaleOptions[defaultID]]);\n });\n });\n Object.keys(scales).forEach(key => {\n const scale = scales[key];\n mergeIf(scale, [defaults.scales[scale.type], defaults.scale]);\n });\n return scales;\n}\nfunction initOptions(config) {\n const options = config.options || (config.options = {});\n options.plugins = valueOrDefault(options.plugins, {});\n options.scales = mergeScaleConfig(config, options);\n}\nfunction initData(data) {\n data = data || {};\n data.datasets = data.datasets || [];\n data.labels = data.labels || [];\n return data;\n}\nfunction initConfig(config) {\n config = config || {};\n config.data = initData(config.data);\n initOptions(config);\n return config;\n}\nconst keyCache = new Map();\nconst keysCached = new Set();\nfunction cachedKeys(cacheKey, generate) {\n let keys = keyCache.get(cacheKey);\n if (!keys) {\n keys = generate();\n keyCache.set(cacheKey, keys);\n keysCached.add(keys);\n }\n return keys;\n}\nconst addIfFound = (set, obj, key) => {\n const opts = resolveObjectKey(obj, key);\n if (opts !== undefined) {\n set.add(opts);\n }\n};\nclass Config {\n constructor(config) {\n this._config = initConfig(config);\n this._scopeCache = new Map();\n this._resolverCache = new Map();\n }\n get type() {\n return this._config.type;\n }\n set type(type) {\n this._config.type = type;\n }\n get data() {\n return this._config.data;\n }\n set data(data) {\n this._config.data = initData(data);\n }\n get options() {\n return this._config.options;\n }\n set options(options) {\n this._config.options = options;\n }\n get plugins() {\n return this._config.plugins;\n }\n update() {\n const config = this._config;\n this.clearCache();\n initOptions(config);\n }\n clearCache() {\n this._scopeCache.clear();\n this._resolverCache.clear();\n }\n datasetScopeKeys(datasetType) {\n return cachedKeys(datasetType,\n () => [[\n `datasets.${datasetType}`,\n ''\n ]]);\n }\n datasetAnimationScopeKeys(datasetType, transition) {\n return cachedKeys(`${datasetType}.transition.${transition}`,\n () => [\n [\n `datasets.${datasetType}.transitions.${transition}`,\n `transitions.${transition}`,\n ],\n [\n `datasets.${datasetType}`,\n ''\n ]\n ]);\n }\n datasetElementScopeKeys(datasetType, elementType) {\n return cachedKeys(`${datasetType}-${elementType}`,\n () => [[\n `datasets.${datasetType}.elements.${elementType}`,\n `datasets.${datasetType}`,\n `elements.${elementType}`,\n ''\n ]]);\n }\n pluginScopeKeys(plugin) {\n const id = plugin.id;\n const type = this.type;\n return cachedKeys(`${type}-plugin-${id}`,\n () => [[\n `plugins.${id}`,\n ...plugin.additionalOptionScopes || [],\n ]]);\n }\n _cachedScopes(mainScope, resetCache) {\n const _scopeCache = this._scopeCache;\n let cache = _scopeCache.get(mainScope);\n if (!cache || resetCache) {\n cache = new Map();\n _scopeCache.set(mainScope, cache);\n }\n return cache;\n }\n getOptionScopes(mainScope, keyLists, resetCache) {\n const {options, type} = this;\n const cache = this._cachedScopes(mainScope, resetCache);\n const cached = cache.get(keyLists);\n if (cached) {\n return cached;\n }\n const scopes = new Set();\n keyLists.forEach(keys => {\n if (mainScope) {\n scopes.add(mainScope);\n keys.forEach(key => addIfFound(scopes, mainScope, key));\n }\n keys.forEach(key => addIfFound(scopes, options, key));\n keys.forEach(key => addIfFound(scopes, overrides[type] || {}, key));\n keys.forEach(key => addIfFound(scopes, defaults, key));\n keys.forEach(key => addIfFound(scopes, descriptors, key));\n });\n const array = [...scopes];\n if (keysCached.has(keyLists)) {\n cache.set(keyLists, array);\n }\n return array;\n }\n chartOptionScopes() {\n const {options, type} = this;\n return [\n options,\n overrides[type] || {},\n defaults.datasets[type] || {},\n {type},\n defaults,\n descriptors\n ];\n }\n resolveNamedOptions(scopes, names, context, prefixes = ['']) {\n const result = {$shared: true};\n const {resolver, subPrefixes} = getResolver(this._resolverCache, scopes, prefixes);\n let options = resolver;\n if (needContext(resolver, names)) {\n result.$shared = false;\n context = isFunction(context) ? context() : context;\n const subResolver = this.createResolver(scopes, context, subPrefixes);\n options = _attachContext(resolver, context, subResolver);\n }\n for (const prop of names) {\n result[prop] = options[prop];\n }\n return result;\n }\n createResolver(scopes, context, prefixes = [''], descriptorDefaults) {\n const {resolver} = getResolver(this._resolverCache, scopes, prefixes);\n return isObject(context)\n ? _attachContext(resolver, context, undefined, descriptorDefaults)\n : resolver;\n }\n}\nfunction getResolver(resolverCache, scopes, prefixes) {\n let cache = resolverCache.get(scopes);\n if (!cache) {\n cache = new Map();\n resolverCache.set(scopes, cache);\n }\n const cacheKey = prefixes.join();\n let cached = cache.get(cacheKey);\n if (!cached) {\n const resolver = _createResolver(scopes, prefixes);\n cached = {\n resolver,\n subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover'))\n };\n cache.set(cacheKey, cached);\n }\n return cached;\n}\nfunction needContext(proxy, names) {\n const {isScriptable, isIndexable} = _descriptors(proxy);\n for (const prop of names) {\n if ((isScriptable(prop) && isFunction(proxy[prop]))\n || (isIndexable(prop) && isArray(proxy[prop]))) {\n return true;\n }\n }\n return false;\n}\n\nvar version = \"3.3.2\";\n\nconst KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];\nfunction positionIsHorizontal(position, axis) {\n return position === 'top' || position === 'bottom' || (KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x');\n}\nfunction compare2Level(l1, l2) {\n return function(a, b) {\n return a[l1] === b[l1]\n ? a[l2] - b[l2]\n : a[l1] - b[l1];\n };\n}\nfunction onAnimationsComplete(context) {\n const chart = context.chart;\n const animationOptions = chart.options.animation;\n chart.notifyPlugins('afterRender');\n callback(animationOptions && animationOptions.onComplete, [context], chart);\n}\nfunction onAnimationProgress(context) {\n const chart = context.chart;\n const animationOptions = chart.options.animation;\n callback(animationOptions && animationOptions.onProgress, [context], chart);\n}\nfunction isDomSupported() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\nfunction getCanvas(item) {\n if (isDomSupported() && typeof item === 'string') {\n item = document.getElementById(item);\n } else if (item && item.length) {\n item = item[0];\n }\n if (item && item.canvas) {\n item = item.canvas;\n }\n return item;\n}\nconst instances = {};\nconst getChart = (key) => {\n const canvas = getCanvas(key);\n return Object.values(instances).filter((c) => c.canvas === canvas).pop();\n};\nclass Chart {\n constructor(item, config) {\n const me = this;\n this.config = config = new Config(config);\n const initialCanvas = getCanvas(item);\n const existingChart = getChart(initialCanvas);\n if (existingChart) {\n throw new Error(\n 'Canvas is already in use. Chart with ID \\'' + existingChart.id + '\\'' +\n\t\t\t\t' must be destroyed before the canvas can be reused.'\n );\n }\n const options = config.createResolver(config.chartOptionScopes(), me.getContext());\n this.platform = me._initializePlatform(initialCanvas, config);\n const context = me.platform.acquireContext(initialCanvas, options.aspectRatio);\n const canvas = context && context.canvas;\n const height = canvas && canvas.height;\n const width = canvas && canvas.width;\n this.id = uid();\n this.ctx = context;\n this.canvas = canvas;\n this.width = width;\n this.height = height;\n this._options = options;\n this._aspectRatio = this.aspectRatio;\n this._layers = [];\n this._metasets = [];\n this._stacks = undefined;\n this.boxes = [];\n this.currentDevicePixelRatio = undefined;\n this.chartArea = undefined;\n this._active = [];\n this._lastEvent = undefined;\n this._listeners = {};\n this._responsiveListeners = undefined;\n this._sortedMetasets = [];\n this.scales = {};\n this.scale = undefined;\n this._plugins = new PluginService();\n this.$proxies = {};\n this._hiddenIndices = {};\n this.attached = false;\n this._animationsDisabled = undefined;\n this.$context = undefined;\n this._doResize = debounce(() => this.update('resize'), options.resizeDelay || 0);\n instances[me.id] = me;\n if (!context || !canvas) {\n console.error(\"Failed to create chart: can't acquire context from the given item\");\n return;\n }\n animator.listen(me, 'complete', onAnimationsComplete);\n animator.listen(me, 'progress', onAnimationProgress);\n me._initialize();\n if (me.attached) {\n me.update();\n }\n }\n get aspectRatio() {\n const {options: {aspectRatio, maintainAspectRatio}, width, height, _aspectRatio} = this;\n if (!isNullOrUndef(aspectRatio)) {\n return aspectRatio;\n }\n if (maintainAspectRatio && _aspectRatio) {\n return _aspectRatio;\n }\n return height ? width / height : null;\n }\n get data() {\n return this.config.data;\n }\n set data(data) {\n this.config.data = data;\n }\n get options() {\n return this._options;\n }\n set options(options) {\n this.config.options = options;\n }\n _initialize() {\n const me = this;\n me.notifyPlugins('beforeInit');\n if (me.options.responsive) {\n me.resize();\n } else {\n retinaScale(me, me.options.devicePixelRatio);\n }\n me.bindEvents();\n me.notifyPlugins('afterInit');\n return me;\n }\n _initializePlatform(canvas, config) {\n if (config.platform) {\n return new config.platform();\n } else if (!isDomSupported() || (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas)) {\n return new BasicPlatform();\n }\n return new DomPlatform();\n }\n clear() {\n clearCanvas(this.canvas, this.ctx);\n return this;\n }\n stop() {\n animator.stop(this);\n return this;\n }\n resize(width, height) {\n if (!animator.running(this)) {\n this._resize(width, height);\n } else {\n this._resizeBeforeDraw = {width, height};\n }\n }\n _resize(width, height) {\n const me = this;\n const options = me.options;\n const canvas = me.canvas;\n const aspectRatio = options.maintainAspectRatio && me.aspectRatio;\n const newSize = me.platform.getMaximumSize(canvas, width, height, aspectRatio);\n const newRatio = options.devicePixelRatio || me.platform.getDevicePixelRatio();\n me.width = newSize.width;\n me.height = newSize.height;\n me._aspectRatio = me.aspectRatio;\n if (!retinaScale(me, newRatio, true)) {\n return;\n }\n me.notifyPlugins('resize', {size: newSize});\n callback(options.onResize, [me, newSize], me);\n if (me.attached) {\n if (me._doResize()) {\n me.render();\n }\n }\n }\n ensureScalesHaveIDs() {\n const options = this.options;\n const scalesOptions = options.scales || {};\n each(scalesOptions, (axisOptions, axisID) => {\n axisOptions.id = axisID;\n });\n }\n buildOrUpdateScales() {\n const me = this;\n const options = me.options;\n const scaleOpts = options.scales;\n const scales = me.scales;\n const updated = Object.keys(scales).reduce((obj, id) => {\n obj[id] = false;\n return obj;\n }, {});\n let items = [];\n if (scaleOpts) {\n items = items.concat(\n Object.keys(scaleOpts).map((id) => {\n const scaleOptions = scaleOpts[id];\n const axis = determineAxis(id, scaleOptions);\n const isRadial = axis === 'r';\n const isHorizontal = axis === 'x';\n return {\n options: scaleOptions,\n dposition: isRadial ? 'chartArea' : isHorizontal ? 'bottom' : 'left',\n dtype: isRadial ? 'radialLinear' : isHorizontal ? 'category' : 'linear'\n };\n })\n );\n }\n each(items, (item) => {\n const scaleOptions = item.options;\n const id = scaleOptions.id;\n const axis = determineAxis(id, scaleOptions);\n const scaleType = valueOrDefault(scaleOptions.type, item.dtype);\n if (scaleOptions.position === undefined || positionIsHorizontal(scaleOptions.position, axis) !== positionIsHorizontal(item.dposition)) {\n scaleOptions.position = item.dposition;\n }\n updated[id] = true;\n let scale = null;\n if (id in scales && scales[id].type === scaleType) {\n scale = scales[id];\n } else {\n const scaleClass = registry.getScale(scaleType);\n scale = new scaleClass({\n id,\n type: scaleType,\n ctx: me.ctx,\n chart: me\n });\n scales[scale.id] = scale;\n }\n scale.init(scaleOptions, options);\n });\n each(updated, (hasUpdated, id) => {\n if (!hasUpdated) {\n delete scales[id];\n }\n });\n each(scales, (scale) => {\n layouts.configure(me, scale, scale.options);\n layouts.addBox(me, scale);\n });\n }\n _updateMetasets() {\n const me = this;\n const metasets = me._metasets;\n const numData = me.data.datasets.length;\n const numMeta = metasets.length;\n metasets.sort((a, b) => a.index - b.index);\n if (numMeta > numData) {\n for (let i = numData; i < numMeta; ++i) {\n me._destroyDatasetMeta(i);\n }\n metasets.splice(numData, numMeta - numData);\n }\n me._sortedMetasets = metasets.slice(0).sort(compare2Level('order', 'index'));\n }\n _removeUnreferencedMetasets() {\n const me = this;\n const {_metasets: metasets, data: {datasets}} = me;\n if (metasets.length > datasets.length) {\n delete me._stacks;\n }\n metasets.forEach((meta, index) => {\n if (datasets.filter(x => x === meta._dataset).length === 0) {\n me._destroyDatasetMeta(index);\n }\n });\n }\n buildOrUpdateControllers() {\n const me = this;\n const newControllers = [];\n const datasets = me.data.datasets;\n let i, ilen;\n me._removeUnreferencedMetasets();\n for (i = 0, ilen = datasets.length; i < ilen; i++) {\n const dataset = datasets[i];\n let meta = me.getDatasetMeta(i);\n const type = dataset.type || me.config.type;\n if (meta.type && meta.type !== type) {\n me._destroyDatasetMeta(i);\n meta = me.getDatasetMeta(i);\n }\n meta.type = type;\n meta.indexAxis = dataset.indexAxis || getIndexAxis(type, me.options);\n meta.order = dataset.order || 0;\n meta.index = i;\n meta.label = '' + dataset.label;\n meta.visible = me.isDatasetVisible(i);\n if (meta.controller) {\n meta.controller.updateIndex(i);\n meta.controller.linkScales();\n } else {\n const ControllerClass = registry.getController(type);\n const {datasetElementType, dataElementType} = defaults.datasets[type];\n Object.assign(ControllerClass.prototype, {\n dataElementType: registry.getElement(dataElementType),\n datasetElementType: datasetElementType && registry.getElement(datasetElementType)\n });\n meta.controller = new ControllerClass(me, i);\n newControllers.push(meta.controller);\n }\n }\n me._updateMetasets();\n return newControllers;\n }\n _resetElements() {\n const me = this;\n each(me.data.datasets, (dataset, datasetIndex) => {\n me.getDatasetMeta(datasetIndex).controller.reset();\n }, me);\n }\n reset() {\n this._resetElements();\n this.notifyPlugins('reset');\n }\n update(mode) {\n const me = this;\n const config = me.config;\n config.update();\n me._options = config.createResolver(config.chartOptionScopes(), me.getContext());\n each(me.scales, (scale) => {\n layouts.removeBox(me, scale);\n });\n const animsDisabled = me._animationsDisabled = !me.options.animation;\n me.ensureScalesHaveIDs();\n me.buildOrUpdateScales();\n const existingEvents = new Set(Object.keys(me._listeners));\n const newEvents = new Set(me.options.events);\n if (!setsEqual(existingEvents, newEvents) || !!this._responsiveListeners !== me.options.responsive) {\n me.unbindEvents();\n me.bindEvents();\n }\n me._plugins.invalidate();\n if (me.notifyPlugins('beforeUpdate', {mode, cancelable: true}) === false) {\n return;\n }\n const newControllers = me.buildOrUpdateControllers();\n me.notifyPlugins('beforeElementsUpdate');\n let minPadding = 0;\n for (let i = 0, ilen = me.data.datasets.length; i < ilen; i++) {\n const {controller} = me.getDatasetMeta(i);\n const reset = !animsDisabled && newControllers.indexOf(controller) === -1;\n controller.buildOrUpdateElements(reset);\n minPadding = Math.max(+controller.getMaxOverflow(), minPadding);\n }\n me._minPadding = minPadding;\n me._updateLayout(minPadding);\n if (!animsDisabled) {\n each(newControllers, (controller) => {\n controller.reset();\n });\n }\n me._updateDatasets(mode);\n me.notifyPlugins('afterUpdate', {mode});\n me._layers.sort(compare2Level('z', '_idx'));\n if (me._lastEvent) {\n me._eventHandler(me._lastEvent, true);\n }\n me.render();\n }\n _updateLayout(minPadding) {\n const me = this;\n if (me.notifyPlugins('beforeLayout', {cancelable: true}) === false) {\n return;\n }\n layouts.update(me, me.width, me.height, minPadding);\n const area = me.chartArea;\n const noArea = area.width <= 0 || area.height <= 0;\n me._layers = [];\n each(me.boxes, (box) => {\n if (noArea && box.position === 'chartArea') {\n return;\n }\n if (box.configure) {\n box.configure();\n }\n me._layers.push(...box._layers());\n }, me);\n me._layers.forEach((item, index) => {\n item._idx = index;\n });\n me.notifyPlugins('afterLayout');\n }\n _updateDatasets(mode) {\n const me = this;\n const isFunction = typeof mode === 'function';\n if (me.notifyPlugins('beforeDatasetsUpdate', {mode, cancelable: true}) === false) {\n return;\n }\n for (let i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {\n me._updateDataset(i, isFunction ? mode({datasetIndex: i}) : mode);\n }\n me.notifyPlugins('afterDatasetsUpdate', {mode});\n }\n _updateDataset(index, mode) {\n const me = this;\n const meta = me.getDatasetMeta(index);\n const args = {meta, index, mode, cancelable: true};\n if (me.notifyPlugins('beforeDatasetUpdate', args) === false) {\n return;\n }\n meta.controller._update(mode);\n args.cancelable = false;\n me.notifyPlugins('afterDatasetUpdate', args);\n }\n render() {\n const me = this;\n if (me.notifyPlugins('beforeRender', {cancelable: true}) === false) {\n return;\n }\n if (animator.has(me)) {\n if (me.attached && !animator.running(me)) {\n animator.start(me);\n }\n } else {\n me.draw();\n onAnimationsComplete({chart: me});\n }\n }\n draw() {\n const me = this;\n let i;\n if (me._resizeBeforeDraw) {\n const {width, height} = me._resizeBeforeDraw;\n me._resize(width, height);\n me._resizeBeforeDraw = null;\n }\n me.clear();\n if (me.width <= 0 || me.height <= 0) {\n return;\n }\n if (me.notifyPlugins('beforeDraw', {cancelable: true}) === false) {\n return;\n }\n const layers = me._layers;\n for (i = 0; i < layers.length && layers[i].z <= 0; ++i) {\n layers[i].draw(me.chartArea);\n }\n me._drawDatasets();\n for (; i < layers.length; ++i) {\n layers[i].draw(me.chartArea);\n }\n me.notifyPlugins('afterDraw');\n }\n _getSortedDatasetMetas(filterVisible) {\n const me = this;\n const metasets = me._sortedMetasets;\n const result = [];\n let i, ilen;\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n const meta = metasets[i];\n if (!filterVisible || meta.visible) {\n result.push(meta);\n }\n }\n return result;\n }\n getSortedVisibleDatasetMetas() {\n return this._getSortedDatasetMetas(true);\n }\n _drawDatasets() {\n const me = this;\n if (me.notifyPlugins('beforeDatasetsDraw', {cancelable: true}) === false) {\n return;\n }\n const metasets = me.getSortedVisibleDatasetMetas();\n for (let i = metasets.length - 1; i >= 0; --i) {\n me._drawDataset(metasets[i]);\n }\n me.notifyPlugins('afterDatasetsDraw');\n }\n _drawDataset(meta) {\n const me = this;\n const ctx = me.ctx;\n const clip = meta._clip;\n const area = me.chartArea;\n const args = {\n meta,\n index: meta.index,\n cancelable: true\n };\n if (me.notifyPlugins('beforeDatasetDraw', args) === false) {\n return;\n }\n clipArea(ctx, {\n left: clip.left === false ? 0 : area.left - clip.left,\n right: clip.right === false ? me.width : area.right + clip.right,\n top: clip.top === false ? 0 : area.top - clip.top,\n bottom: clip.bottom === false ? me.height : area.bottom + clip.bottom\n });\n meta.controller.draw();\n unclipArea(ctx);\n args.cancelable = false;\n me.notifyPlugins('afterDatasetDraw', args);\n }\n getElementsAtEventForMode(e, mode, options, useFinalPosition) {\n const method = Interaction.modes[mode];\n if (typeof method === 'function') {\n return method(this, e, options, useFinalPosition);\n }\n return [];\n }\n getDatasetMeta(datasetIndex) {\n const me = this;\n const dataset = me.data.datasets[datasetIndex];\n const metasets = me._metasets;\n let meta = metasets.filter(x => x && x._dataset === dataset).pop();\n if (!meta) {\n meta = {\n type: null,\n data: [],\n dataset: null,\n controller: null,\n hidden: null,\n xAxisID: null,\n yAxisID: null,\n order: dataset && dataset.order || 0,\n index: datasetIndex,\n _dataset: dataset,\n _parsed: [],\n _sorted: false\n };\n metasets.push(meta);\n }\n return meta;\n }\n getContext() {\n return this.$context || (this.$context = {chart: this, type: 'chart'});\n }\n getVisibleDatasetCount() {\n return this.getSortedVisibleDatasetMetas().length;\n }\n isDatasetVisible(datasetIndex) {\n const dataset = this.data.datasets[datasetIndex];\n if (!dataset) {\n return false;\n }\n const meta = this.getDatasetMeta(datasetIndex);\n return typeof meta.hidden === 'boolean' ? !meta.hidden : !dataset.hidden;\n }\n setDatasetVisibility(datasetIndex, visible) {\n const meta = this.getDatasetMeta(datasetIndex);\n meta.hidden = !visible;\n }\n toggleDataVisibility(index) {\n this._hiddenIndices[index] = !this._hiddenIndices[index];\n }\n getDataVisibility(index) {\n return !this._hiddenIndices[index];\n }\n _updateDatasetVisibility(datasetIndex, visible) {\n const me = this;\n const mode = visible ? 'show' : 'hide';\n const meta = me.getDatasetMeta(datasetIndex);\n const anims = meta.controller._resolveAnimations(undefined, mode);\n me.setDatasetVisibility(datasetIndex, visible);\n anims.update(meta, {visible});\n me.update((ctx) => ctx.datasetIndex === datasetIndex ? mode : undefined);\n }\n hide(datasetIndex) {\n this._updateDatasetVisibility(datasetIndex, false);\n }\n show(datasetIndex) {\n this._updateDatasetVisibility(datasetIndex, true);\n }\n _destroyDatasetMeta(datasetIndex) {\n const me = this;\n const meta = me._metasets && me._metasets[datasetIndex];\n if (meta && meta.controller) {\n meta.controller._destroy();\n delete me._metasets[datasetIndex];\n }\n }\n destroy() {\n const me = this;\n const {canvas, ctx} = me;\n let i, ilen;\n me.stop();\n animator.remove(me);\n for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {\n me._destroyDatasetMeta(i);\n }\n me.config.clearCache();\n if (canvas) {\n me.unbindEvents();\n clearCanvas(canvas, ctx);\n me.platform.releaseContext(ctx);\n me.canvas = null;\n me.ctx = null;\n }\n me.notifyPlugins('destroy');\n delete instances[me.id];\n }\n toBase64Image(...args) {\n return this.canvas.toDataURL(...args);\n }\n bindEvents() {\n this.bindUserEvents();\n if (this.options.responsive) {\n this.bindResponsiveEvents();\n } else {\n this.attached = true;\n }\n }\n bindUserEvents() {\n const me = this;\n const listeners = me._listeners;\n const platform = me.platform;\n const _add = (type, listener) => {\n platform.addEventListener(me, type, listener);\n listeners[type] = listener;\n };\n const listener = function(e, x, y) {\n e.offsetX = x;\n e.offsetY = y;\n me._eventHandler(e);\n };\n each(me.options.events, (type) => _add(type, listener));\n }\n bindResponsiveEvents() {\n const me = this;\n if (!me._responsiveListeners) {\n me._responsiveListeners = {};\n }\n const listeners = me._responsiveListeners;\n const platform = me.platform;\n const _add = (type, listener) => {\n platform.addEventListener(me, type, listener);\n listeners[type] = listener;\n };\n const _remove = (type, listener) => {\n if (listeners[type]) {\n platform.removeEventListener(me, type, listener);\n delete listeners[type];\n }\n };\n const listener = (width, height) => {\n if (me.canvas) {\n me.resize(width, height);\n }\n };\n let detached;\n const attached = () => {\n _remove('attach', attached);\n me.attached = true;\n me.resize();\n _add('resize', listener);\n _add('detach', detached);\n };\n detached = () => {\n me.attached = false;\n _remove('resize', listener);\n _add('attach', attached);\n };\n if (platform.isAttached(me.canvas)) {\n attached();\n } else {\n detached();\n }\n }\n unbindEvents() {\n const me = this;\n each(me._listeners, (listener, type) => {\n me.platform.removeEventListener(me, type, listener);\n });\n me._listeners = {};\n each(me._responsiveListeners, (listener, type) => {\n me.platform.removeEventListener(me, type, listener);\n });\n me._responsiveListeners = undefined;\n }\n updateHoverStyle(items, mode, enabled) {\n const prefix = enabled ? 'set' : 'remove';\n let meta, item, i, ilen;\n if (mode === 'dataset') {\n meta = this.getDatasetMeta(items[0].datasetIndex);\n meta.controller['_' + prefix + 'DatasetHoverStyle']();\n }\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n item = items[i];\n const controller = item && this.getDatasetMeta(item.datasetIndex).controller;\n if (controller) {\n controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);\n }\n }\n }\n getActiveElements() {\n return this._active || [];\n }\n setActiveElements(activeElements) {\n const me = this;\n const lastActive = me._active || [];\n const active = activeElements.map(({datasetIndex, index}) => {\n const meta = me.getDatasetMeta(datasetIndex);\n if (!meta) {\n throw new Error('No dataset found at index ' + datasetIndex);\n }\n return {\n datasetIndex,\n element: meta.data[index],\n index,\n };\n });\n const changed = !_elementsEqual(active, lastActive);\n if (changed) {\n me._active = active;\n me._updateHoverStyles(active, lastActive);\n }\n }\n notifyPlugins(hook, args, filter) {\n return this._plugins.notify(this, hook, args, filter);\n }\n _updateHoverStyles(active, lastActive, replay) {\n const me = this;\n const hoverOptions = me.options.hover;\n const diff = (a, b) => a.filter(x => !b.some(y => x.datasetIndex === y.datasetIndex && x.index === y.index));\n const deactivated = diff(lastActive, active);\n const activated = replay ? active : diff(active, lastActive);\n if (deactivated.length) {\n me.updateHoverStyle(deactivated, hoverOptions.mode, false);\n }\n if (activated.length && hoverOptions.mode) {\n me.updateHoverStyle(activated, hoverOptions.mode, true);\n }\n }\n _eventHandler(e, replay) {\n const me = this;\n const args = {event: e, replay, cancelable: true};\n const eventFilter = (plugin) => (plugin.options.events || this.options.events).includes(e.type);\n if (me.notifyPlugins('beforeEvent', args, eventFilter) === false) {\n return;\n }\n const changed = me._handleEvent(e, replay);\n args.cancelable = false;\n me.notifyPlugins('afterEvent', args, eventFilter);\n if (changed || args.changed) {\n me.render();\n }\n return me;\n }\n _handleEvent(e, replay) {\n const me = this;\n const {_active: lastActive = [], options} = me;\n const hoverOptions = options.hover;\n const useFinalPosition = replay;\n let active = [];\n let changed = false;\n let lastEvent = null;\n if (e.type !== 'mouseout') {\n active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions, useFinalPosition);\n lastEvent = e.type === 'click' ? me._lastEvent : e;\n }\n me._lastEvent = null;\n if (_isPointInArea(e, me.chartArea, me._minPadding)) {\n callback(options.onHover, [e, active, me], me);\n if (e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu') {\n callback(options.onClick, [e, active, me], me);\n }\n }\n changed = !_elementsEqual(active, lastActive);\n if (changed || replay) {\n me._active = active;\n me._updateHoverStyles(active, lastActive, replay);\n }\n me._lastEvent = lastEvent;\n return changed;\n }\n}\nconst invalidatePlugins = () => each(Chart.instances, (chart) => chart._plugins.invalidate());\nconst enumerable = true;\nObject.defineProperties(Chart, {\n defaults: {\n enumerable,\n value: defaults\n },\n instances: {\n enumerable,\n value: instances\n },\n overrides: {\n enumerable,\n value: overrides\n },\n registry: {\n enumerable,\n value: registry\n },\n version: {\n enumerable,\n value: version\n },\n getChart: {\n enumerable,\n value: getChart\n },\n register: {\n enumerable,\n value: (...items) => {\n registry.add(...items);\n invalidatePlugins();\n }\n },\n unregister: {\n enumerable,\n value: (...items) => {\n registry.remove(...items);\n invalidatePlugins();\n }\n }\n});\n\nfunction clipArc(ctx, element, endAngle) {\n const {startAngle, pixelMargin, x, y, outerRadius, innerRadius} = element;\n let angleMargin = pixelMargin / outerRadius;\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, startAngle - angleMargin, endAngle + angleMargin);\n if (innerRadius > pixelMargin) {\n angleMargin = pixelMargin / innerRadius;\n ctx.arc(x, y, innerRadius, endAngle + angleMargin, startAngle - angleMargin, true);\n } else {\n ctx.arc(x, y, pixelMargin, endAngle + HALF_PI, startAngle - HALF_PI);\n }\n ctx.closePath();\n ctx.clip();\n}\nfunction toRadiusCorners(value) {\n return _readValueToProps(value, ['outerStart', 'outerEnd', 'innerStart', 'innerEnd']);\n}\nfunction parseBorderRadius$1(arc, innerRadius, outerRadius, angleDelta) {\n const o = toRadiusCorners(arc.options.borderRadius);\n const halfThickness = (outerRadius - innerRadius) / 2;\n const innerLimit = Math.min(halfThickness, angleDelta * innerRadius / 2);\n const computeOuterLimit = (val) => {\n const outerArcLimit = (outerRadius - Math.min(halfThickness, val)) * angleDelta / 2;\n return _limitValue(val, 0, Math.min(halfThickness, outerArcLimit));\n };\n return {\n outerStart: computeOuterLimit(o.outerStart),\n outerEnd: computeOuterLimit(o.outerEnd),\n innerStart: _limitValue(o.innerStart, 0, innerLimit),\n innerEnd: _limitValue(o.innerEnd, 0, innerLimit),\n };\n}\nfunction rThetaToXY(r, theta, x, y) {\n return {\n x: x + r * Math.cos(theta),\n y: y + r * Math.sin(theta),\n };\n}\nfunction pathArc(ctx, element, offset, end) {\n const {x, y, startAngle: start, pixelMargin, innerRadius: innerR} = element;\n const outerRadius = Math.max(element.outerRadius + offset - pixelMargin, 0);\n const innerRadius = innerR > 0 ? innerR + offset + pixelMargin : 0;\n const alpha = end - start;\n const beta = Math.max(0.001, alpha * outerRadius - offset / PI) / outerRadius;\n const angleOffset = (alpha - beta) / 2;\n const startAngle = start + angleOffset;\n const endAngle = end - angleOffset;\n const {outerStart, outerEnd, innerStart, innerEnd} = parseBorderRadius$1(element, innerRadius, outerRadius, endAngle - startAngle);\n const outerStartAdjustedRadius = outerRadius - outerStart;\n const outerEndAdjustedRadius = outerRadius - outerEnd;\n const outerStartAdjustedAngle = startAngle + outerStart / outerStartAdjustedRadius;\n const outerEndAdjustedAngle = endAngle - outerEnd / outerEndAdjustedRadius;\n const innerStartAdjustedRadius = innerRadius + innerStart;\n const innerEndAdjustedRadius = innerRadius + innerEnd;\n const innerStartAdjustedAngle = startAngle + innerStart / innerStartAdjustedRadius;\n const innerEndAdjustedAngle = endAngle - innerEnd / innerEndAdjustedRadius;\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, outerStartAdjustedAngle, outerEndAdjustedAngle);\n if (outerEnd > 0) {\n const pCenter = rThetaToXY(outerEndAdjustedRadius, outerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle, endAngle + HALF_PI);\n }\n const p4 = rThetaToXY(innerEndAdjustedRadius, endAngle, x, y);\n ctx.lineTo(p4.x, p4.y);\n if (innerEnd > 0) {\n const pCenter = rThetaToXY(innerEndAdjustedRadius, innerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, innerEnd, endAngle + HALF_PI, innerEndAdjustedAngle + Math.PI);\n }\n ctx.arc(x, y, innerRadius, endAngle - (innerEnd / innerRadius), startAngle + (innerStart / innerRadius), true);\n if (innerStart > 0) {\n const pCenter = rThetaToXY(innerStartAdjustedRadius, innerStartAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, innerStart, innerStartAdjustedAngle + Math.PI, startAngle - HALF_PI);\n }\n const p8 = rThetaToXY(outerStartAdjustedRadius, startAngle, x, y);\n ctx.lineTo(p8.x, p8.y);\n if (outerStart > 0) {\n const pCenter = rThetaToXY(outerStartAdjustedRadius, outerStartAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerStart, startAngle - HALF_PI, outerStartAdjustedAngle);\n }\n ctx.closePath();\n}\nfunction drawArc(ctx, element, offset) {\n const {fullCircles, startAngle, circumference} = element;\n let endAngle = element.endAngle;\n if (fullCircles) {\n pathArc(ctx, element, offset, startAngle + TAU);\n for (let i = 0; i < fullCircles; ++i) {\n ctx.fill();\n }\n if (!isNaN(circumference)) {\n endAngle = startAngle + circumference % TAU;\n if (circumference % TAU === 0) {\n endAngle += TAU;\n }\n }\n }\n pathArc(ctx, element, offset, endAngle);\n ctx.fill();\n return endAngle;\n}\nfunction drawFullCircleBorders(ctx, element, inner) {\n const {x, y, startAngle, pixelMargin, fullCircles} = element;\n const outerRadius = Math.max(element.outerRadius - pixelMargin, 0);\n const innerRadius = element.innerRadius + pixelMargin;\n let i;\n if (inner) {\n clipArc(ctx, element, startAngle + TAU);\n }\n ctx.beginPath();\n ctx.arc(x, y, innerRadius, startAngle + TAU, startAngle, true);\n for (i = 0; i < fullCircles; ++i) {\n ctx.stroke();\n }\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, startAngle, startAngle + TAU);\n for (i = 0; i < fullCircles; ++i) {\n ctx.stroke();\n }\n}\nfunction drawBorder(ctx, element, offset, endAngle) {\n const {options} = element;\n const inner = options.borderAlign === 'inner';\n if (!options.borderWidth) {\n return;\n }\n if (inner) {\n ctx.lineWidth = options.borderWidth * 2;\n ctx.lineJoin = 'round';\n } else {\n ctx.lineWidth = options.borderWidth;\n ctx.lineJoin = 'bevel';\n }\n if (element.fullCircles) {\n drawFullCircleBorders(ctx, element, inner);\n }\n if (inner) {\n clipArc(ctx, element, endAngle);\n }\n pathArc(ctx, element, offset, endAngle);\n ctx.stroke();\n}\nclass ArcElement extends Element {\n constructor(cfg) {\n super();\n this.options = undefined;\n this.circumference = undefined;\n this.startAngle = undefined;\n this.endAngle = undefined;\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n this.pixelMargin = 0;\n this.fullCircles = 0;\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n inRange(chartX, chartY, useFinalPosition) {\n const point = this.getProps(['x', 'y'], useFinalPosition);\n const {angle, distance} = getAngleFromPoint(point, {x: chartX, y: chartY});\n const {startAngle, endAngle, innerRadius, outerRadius, circumference} = this.getProps([\n 'startAngle',\n 'endAngle',\n 'innerRadius',\n 'outerRadius',\n 'circumference'\n ], useFinalPosition);\n const betweenAngles = circumference >= TAU || _angleBetween(angle, startAngle, endAngle);\n const withinRadius = (distance >= innerRadius && distance <= outerRadius);\n return (betweenAngles && withinRadius);\n }\n getCenterPoint(useFinalPosition) {\n const {x, y, startAngle, endAngle, innerRadius, outerRadius} = this.getProps([\n 'x',\n 'y',\n 'startAngle',\n 'endAngle',\n 'innerRadius',\n 'outerRadius',\n 'circumference'\n ], useFinalPosition);\n const halfAngle = (startAngle + endAngle) / 2;\n const halfRadius = (innerRadius + outerRadius) / 2;\n return {\n x: x + Math.cos(halfAngle) * halfRadius,\n y: y + Math.sin(halfAngle) * halfRadius\n };\n }\n tooltipPosition(useFinalPosition) {\n return this.getCenterPoint(useFinalPosition);\n }\n draw(ctx) {\n const me = this;\n const {options, circumference} = me;\n const offset = (options.offset || 0) / 2;\n me.pixelMargin = (options.borderAlign === 'inner') ? 0.33 : 0;\n me.fullCircles = circumference > TAU ? Math.floor(circumference / TAU) : 0;\n if (circumference === 0 || me.innerRadius < 0 || me.outerRadius < 0) {\n return;\n }\n ctx.save();\n let radiusOffset = 0;\n if (offset) {\n radiusOffset = offset / 2;\n const halfAngle = (me.startAngle + me.endAngle) / 2;\n ctx.translate(Math.cos(halfAngle) * radiusOffset, Math.sin(halfAngle) * radiusOffset);\n if (me.circumference >= PI) {\n radiusOffset = offset;\n }\n }\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n const endAngle = drawArc(ctx, me, radiusOffset);\n drawBorder(ctx, me, radiusOffset, endAngle);\n ctx.restore();\n }\n}\nArcElement.id = 'arc';\nArcElement.defaults = {\n borderAlign: 'center',\n borderColor: '#fff',\n borderRadius: 0,\n borderWidth: 2,\n offset: 0,\n angle: undefined,\n};\nArcElement.defaultRoutes = {\n backgroundColor: 'backgroundColor'\n};\n\nfunction setStyle(ctx, options, style = options) {\n ctx.lineCap = valueOrDefault(style.borderCapStyle, options.borderCapStyle);\n ctx.setLineDash(valueOrDefault(style.borderDash, options.borderDash));\n ctx.lineDashOffset = valueOrDefault(style.borderDashOffset, options.borderDashOffset);\n ctx.lineJoin = valueOrDefault(style.borderJoinStyle, options.borderJoinStyle);\n ctx.lineWidth = valueOrDefault(style.borderWidth, options.borderWidth);\n ctx.strokeStyle = valueOrDefault(style.borderColor, options.borderColor);\n}\nfunction lineTo(ctx, previous, target) {\n ctx.lineTo(target.x, target.y);\n}\nfunction getLineMethod(options) {\n if (options.stepped) {\n return _steppedLineTo;\n }\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierCurveTo;\n }\n return lineTo;\n}\nfunction pathVars(points, segment, params = {}) {\n const count = points.length;\n const {start: paramsStart = 0, end: paramsEnd = count - 1} = params;\n const {start: segmentStart, end: segmentEnd} = segment;\n const start = Math.max(paramsStart, segmentStart);\n const end = Math.min(paramsEnd, segmentEnd);\n const outside = paramsStart < segmentStart && paramsEnd < segmentStart || paramsStart > segmentEnd && paramsEnd > segmentEnd;\n return {\n count,\n start,\n loop: segment.loop,\n ilen: end < start && !outside ? count + end - start : end - start\n };\n}\nfunction pathSegment(ctx, line, segment, params) {\n const {points, options} = line;\n const {count, start, loop, ilen} = pathVars(points, segment, params);\n const lineMethod = getLineMethod(options);\n let {move = true, reverse} = params || {};\n let i, point, prev;\n for (i = 0; i <= ilen; ++i) {\n point = points[(start + (reverse ? ilen - i : i)) % count];\n if (point.skip) {\n continue;\n } else if (move) {\n ctx.moveTo(point.x, point.y);\n move = false;\n } else {\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n prev = point;\n }\n if (loop) {\n point = points[(start + (reverse ? ilen : 0)) % count];\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n return !!loop;\n}\nfunction fastPathSegment(ctx, line, segment, params) {\n const points = line.points;\n const {count, start, ilen} = pathVars(points, segment, params);\n const {move = true, reverse} = params || {};\n let avgX = 0;\n let countX = 0;\n let i, point, prevX, minY, maxY, lastY;\n const pointIndex = (index) => (start + (reverse ? ilen - index : index)) % count;\n const drawX = () => {\n if (minY !== maxY) {\n ctx.lineTo(avgX, maxY);\n ctx.lineTo(avgX, minY);\n ctx.lineTo(avgX, lastY);\n }\n };\n if (move) {\n point = points[pointIndex(0)];\n ctx.moveTo(point.x, point.y);\n }\n for (i = 0; i <= ilen; ++i) {\n point = points[pointIndex(i)];\n if (point.skip) {\n continue;\n }\n const x = point.x;\n const y = point.y;\n const truncX = x | 0;\n if (truncX === prevX) {\n if (y < minY) {\n minY = y;\n } else if (y > maxY) {\n maxY = y;\n }\n avgX = (countX * avgX + x) / ++countX;\n } else {\n drawX();\n ctx.lineTo(x, y);\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n }\n lastY = y;\n }\n drawX();\n}\nfunction _getSegmentMethod(line) {\n const opts = line.options;\n const borderDash = opts.borderDash && opts.borderDash.length;\n const useFastPath = !line._decimated && !line._loop && !opts.tension && opts.cubicInterpolationMode !== 'monotone' && !opts.stepped && !borderDash;\n return useFastPath ? fastPathSegment : pathSegment;\n}\nfunction _getInterpolationMethod(options) {\n if (options.stepped) {\n return _steppedInterpolation;\n }\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierInterpolation;\n }\n return _pointInLine;\n}\nfunction strokePathWithCache(ctx, line, start, count) {\n let path = line._path;\n if (!path) {\n path = line._path = new Path2D();\n if (line.path(path, start, count)) {\n path.closePath();\n }\n }\n setStyle(ctx, line.options);\n ctx.stroke(path);\n}\nfunction strokePathDirect(ctx, line, start, count) {\n const {segments, options} = line;\n const segmentMethod = _getSegmentMethod(line);\n for (const segment of segments) {\n setStyle(ctx, options, segment.style);\n ctx.beginPath();\n if (segmentMethod(ctx, line, segment, {start, end: start + count - 1})) {\n ctx.closePath();\n }\n ctx.stroke();\n }\n}\nconst usePath2D = typeof Path2D === 'function';\nfunction draw(ctx, line, start, count) {\n if (usePath2D && line.segments.length === 1) {\n strokePathWithCache(ctx, line, start, count);\n } else {\n strokePathDirect(ctx, line, start, count);\n }\n}\nclass LineElement extends Element {\n constructor(cfg) {\n super();\n this.animated = true;\n this.options = undefined;\n this._loop = undefined;\n this._fullLoop = undefined;\n this._path = undefined;\n this._points = undefined;\n this._segments = undefined;\n this._decimated = false;\n this._pointsUpdated = false;\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n updateControlPoints(chartArea, indexAxis) {\n const me = this;\n const options = me.options;\n if ((options.tension || options.cubicInterpolationMode === 'monotone') && !options.stepped && !me._pointsUpdated) {\n const loop = options.spanGaps ? me._loop : me._fullLoop;\n _updateBezierControlPoints(me._points, options, chartArea, loop, indexAxis);\n me._pointsUpdated = true;\n }\n }\n set points(points) {\n const me = this;\n me._points = points;\n delete me._segments;\n delete me._path;\n me._pointsUpdated = false;\n }\n get points() {\n return this._points;\n }\n get segments() {\n return this._segments || (this._segments = _computeSegments(this, this.options.segment));\n }\n first() {\n const segments = this.segments;\n const points = this.points;\n return segments.length && points[segments[0].start];\n }\n last() {\n const segments = this.segments;\n const points = this.points;\n const count = segments.length;\n return count && points[segments[count - 1].end];\n }\n interpolate(point, property) {\n const me = this;\n const options = me.options;\n const value = point[property];\n const points = me.points;\n const segments = _boundSegments(me, {property, start: value, end: value});\n if (!segments.length) {\n return;\n }\n const result = [];\n const _interpolate = _getInterpolationMethod(options);\n let i, ilen;\n for (i = 0, ilen = segments.length; i < ilen; ++i) {\n const {start, end} = segments[i];\n const p1 = points[start];\n const p2 = points[end];\n if (p1 === p2) {\n result.push(p1);\n continue;\n }\n const t = Math.abs((value - p1[property]) / (p2[property] - p1[property]));\n const interpolated = _interpolate(p1, p2, t, options.stepped);\n interpolated[property] = point[property];\n result.push(interpolated);\n }\n return result.length === 1 ? result[0] : result;\n }\n pathSegment(ctx, segment, params) {\n const segmentMethod = _getSegmentMethod(this);\n return segmentMethod(ctx, this, segment, params);\n }\n path(ctx, start, count) {\n const me = this;\n const segments = me.segments;\n const segmentMethod = _getSegmentMethod(me);\n let loop = me._loop;\n start = start || 0;\n count = count || (me.points.length - start);\n for (const segment of segments) {\n loop &= segmentMethod(ctx, me, segment, {start, end: start + count - 1});\n }\n return !!loop;\n }\n draw(ctx, chartArea, start, count) {\n const me = this;\n const options = me.options || {};\n const points = me.points || [];\n if (!points.length || !options.borderWidth) {\n return;\n }\n ctx.save();\n draw(ctx, me, start, count);\n ctx.restore();\n if (me.animated) {\n me._pointsUpdated = false;\n me._path = undefined;\n }\n }\n}\nLineElement.id = 'line';\nLineElement.defaults = {\n borderCapStyle: 'butt',\n borderDash: [],\n borderDashOffset: 0,\n borderJoinStyle: 'miter',\n borderWidth: 3,\n capBezierPoints: true,\n cubicInterpolationMode: 'default',\n fill: false,\n spanGaps: false,\n stepped: false,\n tension: 0,\n};\nLineElement.defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n};\nLineElement.descriptors = {\n _scriptable: true,\n _indexable: (name) => name !== 'borderDash' && name !== 'fill',\n};\n\nfunction inRange$1(el, pos, axis, useFinalPosition) {\n const options = el.options;\n const {[axis]: value} = el.getProps([axis], useFinalPosition);\n return (Math.abs(pos - value) < options.radius + options.hitRadius);\n}\nclass PointElement extends Element {\n constructor(cfg) {\n super();\n this.options = undefined;\n this.parsed = undefined;\n this.skip = undefined;\n this.stop = undefined;\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n inRange(mouseX, mouseY, useFinalPosition) {\n const options = this.options;\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return ((Math.pow(mouseX - x, 2) + Math.pow(mouseY - y, 2)) < Math.pow(options.hitRadius + options.radius, 2));\n }\n inXRange(mouseX, useFinalPosition) {\n return inRange$1(this, mouseX, 'x', useFinalPosition);\n }\n inYRange(mouseY, useFinalPosition) {\n return inRange$1(this, mouseY, 'y', useFinalPosition);\n }\n getCenterPoint(useFinalPosition) {\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return {x, y};\n }\n size(options) {\n options = options || this.options || {};\n let radius = options.radius || 0;\n radius = Math.max(radius, radius && options.hoverRadius || 0);\n const borderWidth = radius && options.borderWidth || 0;\n return (radius + borderWidth) * 2;\n }\n draw(ctx) {\n const me = this;\n const options = me.options;\n if (me.skip || options.radius < 0.1) {\n return;\n }\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n ctx.fillStyle = options.backgroundColor;\n drawPoint(ctx, options, me.x, me.y);\n }\n getRange() {\n const options = this.options || {};\n return options.radius + options.hitRadius;\n }\n}\nPointElement.id = 'point';\nPointElement.defaults = {\n borderWidth: 1,\n hitRadius: 1,\n hoverBorderWidth: 1,\n hoverRadius: 4,\n pointStyle: 'circle',\n radius: 3,\n rotation: 0\n};\nPointElement.defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n};\n\nfunction getBarBounds(bar, useFinalPosition) {\n const {x, y, base, width, height} = bar.getProps(['x', 'y', 'base', 'width', 'height'], useFinalPosition);\n let left, right, top, bottom, half;\n if (bar.horizontal) {\n half = height / 2;\n left = Math.min(x, base);\n right = Math.max(x, base);\n top = y - half;\n bottom = y + half;\n } else {\n half = width / 2;\n left = x - half;\n right = x + half;\n top = Math.min(y, base);\n bottom = Math.max(y, base);\n }\n return {left, top, right, bottom};\n}\nfunction parseBorderSkipped(bar) {\n let edge = bar.options.borderSkipped;\n const res = {};\n if (!edge) {\n return res;\n }\n edge = bar.horizontal\n ? parseEdge(edge, 'left', 'right', bar.base > bar.x)\n : parseEdge(edge, 'bottom', 'top', bar.base < bar.y);\n res[edge] = true;\n return res;\n}\nfunction parseEdge(edge, a, b, reverse) {\n if (reverse) {\n edge = swap(edge, a, b);\n edge = startEnd(edge, b, a);\n } else {\n edge = startEnd(edge, a, b);\n }\n return edge;\n}\nfunction swap(orig, v1, v2) {\n return orig === v1 ? v2 : orig === v2 ? v1 : orig;\n}\nfunction startEnd(v, start, end) {\n return v === 'start' ? start : v === 'end' ? end : v;\n}\nfunction skipOrLimit(skip, value, min, max) {\n return skip ? 0 : Math.max(Math.min(value, max), min);\n}\nfunction parseBorderWidth(bar, maxW, maxH) {\n const value = bar.options.borderWidth;\n const skip = parseBorderSkipped(bar);\n const o = toTRBL(value);\n return {\n t: skipOrLimit(skip.top, o.top, 0, maxH),\n r: skipOrLimit(skip.right, o.right, 0, maxW),\n b: skipOrLimit(skip.bottom, o.bottom, 0, maxH),\n l: skipOrLimit(skip.left, o.left, 0, maxW)\n };\n}\nfunction parseBorderRadius(bar, maxW, maxH) {\n const {enableBorderRadius} = bar.getProps(['enableBorderRadius']);\n const value = bar.options.borderRadius;\n const o = toTRBLCorners(value);\n const maxR = Math.min(maxW, maxH);\n const skip = parseBorderSkipped(bar);\n const enableBorder = enableBorderRadius || isObject(value);\n return {\n topLeft: skipOrLimit(!enableBorder || skip.top || skip.left, o.topLeft, 0, maxR),\n topRight: skipOrLimit(!enableBorder || skip.top || skip.right, o.topRight, 0, maxR),\n bottomLeft: skipOrLimit(!enableBorder || skip.bottom || skip.left, o.bottomLeft, 0, maxR),\n bottomRight: skipOrLimit(!enableBorder || skip.bottom || skip.right, o.bottomRight, 0, maxR)\n };\n}\nfunction boundingRects(bar) {\n const bounds = getBarBounds(bar);\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n const border = parseBorderWidth(bar, width / 2, height / 2);\n const radius = parseBorderRadius(bar, width / 2, height / 2);\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height,\n radius\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b,\n radius: {\n topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),\n topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),\n bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),\n bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r)),\n }\n }\n };\n}\nfunction inRange(bar, x, y, useFinalPosition) {\n const skipX = x === null;\n const skipY = y === null;\n const skipBoth = skipX && skipY;\n const bounds = bar && !skipBoth && getBarBounds(bar, useFinalPosition);\n return bounds\n\t\t&& (skipX || x >= bounds.left && x <= bounds.right)\n\t\t&& (skipY || y >= bounds.top && y <= bounds.bottom);\n}\nfunction hasRadius(radius) {\n return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;\n}\nfunction addNormalRectPath(ctx, rect) {\n ctx.rect(rect.x, rect.y, rect.w, rect.h);\n}\nclass BarElement extends Element {\n constructor(cfg) {\n super();\n this.options = undefined;\n this.horizontal = undefined;\n this.base = undefined;\n this.width = undefined;\n this.height = undefined;\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n draw(ctx) {\n const options = this.options;\n const {inner, outer} = boundingRects(this);\n const addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;\n ctx.save();\n if (outer.w !== inner.w || outer.h !== inner.h) {\n ctx.beginPath();\n addRectPath(ctx, outer);\n ctx.clip();\n addRectPath(ctx, inner);\n ctx.fillStyle = options.borderColor;\n ctx.fill('evenodd');\n }\n ctx.beginPath();\n addRectPath(ctx, inner);\n ctx.fillStyle = options.backgroundColor;\n ctx.fill();\n ctx.restore();\n }\n inRange(mouseX, mouseY, useFinalPosition) {\n return inRange(this, mouseX, mouseY, useFinalPosition);\n }\n inXRange(mouseX, useFinalPosition) {\n return inRange(this, mouseX, null, useFinalPosition);\n }\n inYRange(mouseY, useFinalPosition) {\n return inRange(this, null, mouseY, useFinalPosition);\n }\n getCenterPoint(useFinalPosition) {\n const {x, y, base, horizontal} = this.getProps(['x', 'y', 'base', 'horizontal'], useFinalPosition);\n return {\n x: horizontal ? (x + base) / 2 : x,\n y: horizontal ? y : (y + base) / 2\n };\n }\n getRange(axis) {\n return axis === 'x' ? this.width / 2 : this.height / 2;\n }\n}\nBarElement.id = 'bar';\nBarElement.defaults = {\n borderSkipped: 'start',\n borderWidth: 0,\n borderRadius: 0,\n enableBorderRadius: true,\n pointStyle: undefined\n};\nBarElement.defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n};\n\nvar elements = /*#__PURE__*/Object.freeze({\n__proto__: null,\nArcElement: ArcElement,\nLineElement: LineElement,\nPointElement: PointElement,\nBarElement: BarElement\n});\n\nfunction lttbDecimation(data, start, count, availableWidth, options) {\n const samples = options.samples || availableWidth;\n if (samples >= count) {\n return data.slice(start, start + count);\n }\n const decimated = [];\n const bucketWidth = (count - 2) / (samples - 2);\n let sampledIndex = 0;\n const endIndex = start + count - 1;\n let a = start;\n let i, maxAreaPoint, maxArea, area, nextA;\n decimated[sampledIndex++] = data[a];\n for (i = 0; i < samples - 2; i++) {\n let avgX = 0;\n let avgY = 0;\n let j;\n const avgRangeStart = Math.floor((i + 1) * bucketWidth) + 1 + start;\n const avgRangeEnd = Math.min(Math.floor((i + 2) * bucketWidth) + 1, count) + start;\n const avgRangeLength = avgRangeEnd - avgRangeStart;\n for (j = avgRangeStart; j < avgRangeEnd; j++) {\n avgX += data[j].x;\n avgY += data[j].y;\n }\n avgX /= avgRangeLength;\n avgY /= avgRangeLength;\n const rangeOffs = Math.floor(i * bucketWidth) + 1 + start;\n const rangeTo = Math.floor((i + 1) * bucketWidth) + 1 + start;\n const {x: pointAx, y: pointAy} = data[a];\n maxArea = area = -1;\n for (j = rangeOffs; j < rangeTo; j++) {\n area = 0.5 * Math.abs(\n (pointAx - avgX) * (data[j].y - pointAy) -\n (pointAx - data[j].x) * (avgY - pointAy)\n );\n if (area > maxArea) {\n maxArea = area;\n maxAreaPoint = data[j];\n nextA = j;\n }\n }\n decimated[sampledIndex++] = maxAreaPoint;\n a = nextA;\n }\n decimated[sampledIndex++] = data[endIndex];\n return decimated;\n}\nfunction minMaxDecimation(data, start, count, availableWidth) {\n let avgX = 0;\n let countX = 0;\n let i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;\n const decimated = [];\n const endIndex = start + count - 1;\n const xMin = data[start].x;\n const xMax = data[endIndex].x;\n const dx = xMax - xMin;\n for (i = start; i < start + count; ++i) {\n point = data[i];\n x = (point.x - xMin) / dx * availableWidth;\n y = point.y;\n const truncX = x | 0;\n if (truncX === prevX) {\n if (y < minY) {\n minY = y;\n minIndex = i;\n } else if (y > maxY) {\n maxY = y;\n maxIndex = i;\n }\n avgX = (countX * avgX + point.x) / ++countX;\n } else {\n const lastIndex = i - 1;\n if (!isNullOrUndef(minIndex) && !isNullOrUndef(maxIndex)) {\n const intermediateIndex1 = Math.min(minIndex, maxIndex);\n const intermediateIndex2 = Math.max(minIndex, maxIndex);\n if (intermediateIndex1 !== startIndex && intermediateIndex1 !== lastIndex) {\n decimated.push({\n ...data[intermediateIndex1],\n x: avgX,\n });\n }\n if (intermediateIndex2 !== startIndex && intermediateIndex2 !== lastIndex) {\n decimated.push({\n ...data[intermediateIndex2],\n x: avgX\n });\n }\n }\n if (i > 0 && lastIndex !== startIndex) {\n decimated.push(data[lastIndex]);\n }\n decimated.push(point);\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n minIndex = maxIndex = startIndex = i;\n }\n }\n return decimated;\n}\nfunction cleanDecimatedDataset(dataset) {\n if (dataset._decimated) {\n const data = dataset._data;\n delete dataset._decimated;\n delete dataset._data;\n Object.defineProperty(dataset, 'data', {value: data});\n }\n}\nfunction cleanDecimatedData(chart) {\n chart.data.datasets.forEach((dataset) => {\n cleanDecimatedDataset(dataset);\n });\n}\nfunction getStartAndCountOfVisiblePointsSimplified(meta, points) {\n const pointCount = points.length;\n let start = 0;\n let count;\n const {iScale} = meta;\n const {min, max, minDefined, maxDefined} = iScale.getUserBounds();\n if (minDefined) {\n start = _limitValue(_lookupByKey(points, iScale.axis, min).lo, 0, pointCount - 1);\n }\n if (maxDefined) {\n count = _limitValue(_lookupByKey(points, iScale.axis, max).hi + 1, start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n return {start, count};\n}\nvar plugin_decimation = {\n id: 'decimation',\n defaults: {\n algorithm: 'min-max',\n enabled: false,\n },\n beforeElementsUpdate: (chart, args, options) => {\n if (!options.enabled) {\n cleanDecimatedData(chart);\n return;\n }\n const availableWidth = chart.width;\n chart.data.datasets.forEach((dataset, datasetIndex) => {\n const {_data, indexAxis} = dataset;\n const meta = chart.getDatasetMeta(datasetIndex);\n const data = _data || dataset.data;\n if (resolve([indexAxis, chart.options.indexAxis]) === 'y') {\n return;\n }\n if (meta.type !== 'line') {\n return;\n }\n const xAxis = chart.scales[meta.xAxisID];\n if (xAxis.type !== 'linear' && xAxis.type !== 'time') {\n return;\n }\n if (chart.options.parsing) {\n return;\n }\n let {start, count} = getStartAndCountOfVisiblePointsSimplified(meta, data);\n if (count <= 4 * availableWidth) {\n cleanDecimatedDataset(dataset);\n return;\n }\n if (isNullOrUndef(_data)) {\n dataset._data = data;\n delete dataset.data;\n Object.defineProperty(dataset, 'data', {\n configurable: true,\n enumerable: true,\n get: function() {\n return this._decimated;\n },\n set: function(d) {\n this._data = d;\n }\n });\n }\n let decimated;\n switch (options.algorithm) {\n case 'lttb':\n decimated = lttbDecimation(data, start, count, availableWidth, options);\n break;\n case 'min-max':\n decimated = minMaxDecimation(data, start, count, availableWidth);\n break;\n default:\n throw new Error(`Unsupported decimation algorithm '${options.algorithm}'`);\n }\n dataset._decimated = decimated;\n });\n },\n destroy(chart) {\n cleanDecimatedData(chart);\n }\n};\n\nfunction getLineByIndex(chart, index) {\n const meta = chart.getDatasetMeta(index);\n const visible = meta && chart.isDatasetVisible(index);\n return visible ? meta.dataset : null;\n}\nfunction parseFillOption(line) {\n const options = line.options;\n const fillOption = options.fill;\n let fill = valueOrDefault(fillOption && fillOption.target, fillOption);\n if (fill === undefined) {\n fill = !!options.backgroundColor;\n }\n if (fill === false || fill === null) {\n return false;\n }\n if (fill === true) {\n return 'origin';\n }\n return fill;\n}\nfunction decodeFill(line, index, count) {\n const fill = parseFillOption(line);\n if (isObject(fill)) {\n return isNaN(fill.value) ? false : fill;\n }\n let target = parseFloat(fill);\n if (isNumberFinite(target) && Math.floor(target) === target) {\n if (fill[0] === '-' || fill[0] === '+') {\n target = index + target;\n }\n if (target === index || target < 0 || target >= count) {\n return false;\n }\n return target;\n }\n return ['origin', 'start', 'end', 'stack'].indexOf(fill) >= 0 && fill;\n}\nfunction computeLinearBoundary(source) {\n const {scale = {}, fill} = source;\n let target = null;\n let horizontal;\n if (fill === 'start') {\n target = scale.bottom;\n } else if (fill === 'end') {\n target = scale.top;\n } else if (isObject(fill)) {\n target = scale.getPixelForValue(fill.value);\n } else if (scale.getBasePixel) {\n target = scale.getBasePixel();\n }\n if (isNumberFinite(target)) {\n horizontal = scale.isHorizontal();\n return {\n x: horizontal ? target : null,\n y: horizontal ? null : target\n };\n }\n return null;\n}\nclass simpleArc {\n constructor(opts) {\n this.x = opts.x;\n this.y = opts.y;\n this.radius = opts.radius;\n }\n pathSegment(ctx, bounds, opts) {\n const {x, y, radius} = this;\n bounds = bounds || {start: 0, end: TAU};\n ctx.arc(x, y, radius, bounds.end, bounds.start, true);\n return !opts.bounds;\n }\n interpolate(point) {\n const {x, y, radius} = this;\n const angle = point.angle;\n return {\n x: x + Math.cos(angle) * radius,\n y: y + Math.sin(angle) * radius,\n angle\n };\n }\n}\nfunction computeCircularBoundary(source) {\n const {scale, fill} = source;\n const options = scale.options;\n const length = scale.getLabels().length;\n const target = [];\n const start = options.reverse ? scale.max : scale.min;\n const end = options.reverse ? scale.min : scale.max;\n let i, center, value;\n if (fill === 'start') {\n value = start;\n } else if (fill === 'end') {\n value = end;\n } else if (isObject(fill)) {\n value = fill.value;\n } else {\n value = scale.getBaseValue();\n }\n if (options.grid.circular) {\n center = scale.getPointPositionForValue(0, start);\n return new simpleArc({\n x: center.x,\n y: center.y,\n radius: scale.getDistanceFromCenterForValue(value)\n });\n }\n for (i = 0; i < length; ++i) {\n target.push(scale.getPointPositionForValue(i, value));\n }\n return target;\n}\nfunction computeBoundary(source) {\n const scale = source.scale || {};\n if (scale.getPointPositionForValue) {\n return computeCircularBoundary(source);\n }\n return computeLinearBoundary(source);\n}\nfunction pointsFromSegments(boundary, line) {\n const {x = null, y = null} = boundary || {};\n const linePoints = line.points;\n const points = [];\n line.segments.forEach((segment) => {\n const first = linePoints[segment.start];\n const last = linePoints[segment.end];\n if (y !== null) {\n points.push({x: first.x, y});\n points.push({x: last.x, y});\n } else if (x !== null) {\n points.push({x, y: first.y});\n points.push({x, y: last.y});\n }\n });\n return points;\n}\nfunction buildStackLine(source) {\n const {chart, scale, index, line} = source;\n const points = [];\n const segments = line.segments;\n const sourcePoints = line.points;\n const linesBelow = getLinesBelow(chart, index);\n linesBelow.push(createBoundaryLine({x: null, y: scale.bottom}, line));\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n for (let j = segment.start; j <= segment.end; j++) {\n addPointsBelow(points, sourcePoints[j], linesBelow);\n }\n }\n return new LineElement({points, options: {}});\n}\nconst isLineAndNotInHideAnimation = (meta) => meta.type === 'line' && !meta.hidden;\nfunction getLinesBelow(chart, index) {\n const below = [];\n const metas = chart.getSortedVisibleDatasetMetas();\n for (let i = 0; i < metas.length; i++) {\n const meta = metas[i];\n if (meta.index === index) {\n break;\n }\n if (isLineAndNotInHideAnimation(meta)) {\n below.unshift(meta.dataset);\n }\n }\n return below;\n}\nfunction addPointsBelow(points, sourcePoint, linesBelow) {\n const postponed = [];\n for (let j = 0; j < linesBelow.length; j++) {\n const line = linesBelow[j];\n const {first, last, point} = findPoint(line, sourcePoint, 'x');\n if (!point || (first && last)) {\n continue;\n }\n if (first) {\n postponed.unshift(point);\n } else {\n points.push(point);\n if (!last) {\n break;\n }\n }\n }\n points.push(...postponed);\n}\nfunction findPoint(line, sourcePoint, property) {\n const point = line.interpolate(sourcePoint, property);\n if (!point) {\n return {};\n }\n const pointValue = point[property];\n const segments = line.segments;\n const linePoints = line.points;\n let first = false;\n let last = false;\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n const firstValue = linePoints[segment.start][property];\n const lastValue = linePoints[segment.end][property];\n if (pointValue >= firstValue && pointValue <= lastValue) {\n first = pointValue === firstValue;\n last = pointValue === lastValue;\n break;\n }\n }\n return {first, last, point};\n}\nfunction getTarget(source) {\n const {chart, fill, line} = source;\n if (isNumberFinite(fill)) {\n return getLineByIndex(chart, fill);\n }\n if (fill === 'stack') {\n return buildStackLine(source);\n }\n const boundary = computeBoundary(source);\n if (boundary instanceof simpleArc) {\n return boundary;\n }\n return createBoundaryLine(boundary, line);\n}\nfunction createBoundaryLine(boundary, line) {\n let points = [];\n let _loop = false;\n if (isArray(boundary)) {\n _loop = true;\n points = boundary;\n } else {\n points = pointsFromSegments(boundary, line);\n }\n return points.length ? new LineElement({\n points,\n options: {tension: 0},\n _loop,\n _fullLoop: _loop\n }) : null;\n}\nfunction resolveTarget(sources, index, propagate) {\n const source = sources[index];\n let fill = source.fill;\n const visited = [index];\n let target;\n if (!propagate) {\n return fill;\n }\n while (fill !== false && visited.indexOf(fill) === -1) {\n if (!isNumberFinite(fill)) {\n return fill;\n }\n target = sources[fill];\n if (!target) {\n return false;\n }\n if (target.visible) {\n return fill;\n }\n visited.push(fill);\n fill = target.fill;\n }\n return false;\n}\nfunction _clip(ctx, target, clipY) {\n ctx.beginPath();\n target.path(ctx);\n ctx.lineTo(target.last().x, clipY);\n ctx.lineTo(target.first().x, clipY);\n ctx.closePath();\n ctx.clip();\n}\nfunction getBounds(property, first, last, loop) {\n if (loop) {\n return;\n }\n let start = first[property];\n let end = last[property];\n if (property === 'angle') {\n start = _normalizeAngle(start);\n end = _normalizeAngle(end);\n }\n return {property, start, end};\n}\nfunction _getEdge(a, b, prop, fn) {\n if (a && b) {\n return fn(a[prop], b[prop]);\n }\n return a ? a[prop] : b ? b[prop] : 0;\n}\nfunction _segments(line, target, property) {\n const segments = line.segments;\n const points = line.points;\n const tpoints = target.points;\n const parts = [];\n for (const segment of segments) {\n const bounds = getBounds(property, points[segment.start], points[segment.end], segment.loop);\n if (!target.segments) {\n parts.push({\n source: segment,\n target: bounds,\n start: points[segment.start],\n end: points[segment.end]\n });\n continue;\n }\n const targetSegments = _boundSegments(target, bounds);\n for (const tgt of targetSegments) {\n const subBounds = getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);\n const fillSources = _boundSegment(segment, points, subBounds);\n for (const fillSource of fillSources) {\n parts.push({\n source: fillSource,\n target: tgt,\n start: {\n [property]: _getEdge(bounds, subBounds, 'start', Math.max)\n },\n end: {\n [property]: _getEdge(bounds, subBounds, 'end', Math.min)\n }\n });\n }\n }\n }\n return parts;\n}\nfunction clipBounds(ctx, scale, bounds) {\n const {top, bottom} = scale.chart.chartArea;\n const {property, start, end} = bounds || {};\n if (property === 'x') {\n ctx.beginPath();\n ctx.rect(start, top, end - start, bottom - top);\n ctx.clip();\n }\n}\nfunction interpolatedLineTo(ctx, target, point, property) {\n const interpolatedPoint = target.interpolate(point, property);\n if (interpolatedPoint) {\n ctx.lineTo(interpolatedPoint.x, interpolatedPoint.y);\n }\n}\nfunction _fill(ctx, cfg) {\n const {line, target, property, color, scale} = cfg;\n const segments = _segments(line, target, property);\n for (const {source: src, target: tgt, start, end} of segments) {\n const {style: {backgroundColor = color} = {}} = src;\n ctx.save();\n ctx.fillStyle = backgroundColor;\n clipBounds(ctx, scale, getBounds(property, start, end));\n ctx.beginPath();\n const lineLoop = !!line.pathSegment(ctx, src);\n if (lineLoop) {\n ctx.closePath();\n } else {\n interpolatedLineTo(ctx, target, end, property);\n }\n const targetLoop = !!target.pathSegment(ctx, tgt, {move: lineLoop, reverse: true});\n const loop = lineLoop && targetLoop;\n if (!loop) {\n interpolatedLineTo(ctx, target, start, property);\n }\n ctx.closePath();\n ctx.fill(loop ? 'evenodd' : 'nonzero');\n ctx.restore();\n }\n}\nfunction doFill(ctx, cfg) {\n const {line, target, above, below, area, scale} = cfg;\n const property = line._loop ? 'angle' : cfg.axis;\n ctx.save();\n if (property === 'x' && below !== above) {\n _clip(ctx, target, area.top);\n _fill(ctx, {line, target, color: above, scale, property});\n ctx.restore();\n ctx.save();\n _clip(ctx, target, area.bottom);\n }\n _fill(ctx, {line, target, color: below, scale, property});\n ctx.restore();\n}\nfunction drawfill(ctx, source, area) {\n const target = getTarget(source);\n const {line, scale, axis} = source;\n const lineOpts = line.options;\n const fillOption = lineOpts.fill;\n const color = lineOpts.backgroundColor;\n const {above = color, below = color} = fillOption || {};\n if (target && line.points.length) {\n clipArea(ctx, area);\n doFill(ctx, {line, target, above, below, area, scale, axis});\n unclipArea(ctx);\n }\n}\nvar plugin_filler = {\n id: 'filler',\n afterDatasetsUpdate(chart, _args, options) {\n const count = (chart.data.datasets || []).length;\n const sources = [];\n let meta, i, line, source;\n for (i = 0; i < count; ++i) {\n meta = chart.getDatasetMeta(i);\n line = meta.dataset;\n source = null;\n if (line && line.options && line instanceof LineElement) {\n source = {\n visible: chart.isDatasetVisible(i),\n index: i,\n fill: decodeFill(line, i, count),\n chart,\n axis: meta.controller.options.indexAxis,\n scale: meta.vScale,\n line,\n };\n }\n meta.$filler = source;\n sources.push(source);\n }\n for (i = 0; i < count; ++i) {\n source = sources[i];\n if (!source || source.fill === false) {\n continue;\n }\n source.fill = resolveTarget(sources, i, options.propagate);\n }\n },\n beforeDraw(chart, _args, options) {\n const draw = options.drawTime === 'beforeDraw';\n const metasets = chart.getSortedVisibleDatasetMetas();\n const area = chart.chartArea;\n for (let i = metasets.length - 1; i >= 0; --i) {\n const source = metasets[i].$filler;\n if (!source) {\n continue;\n }\n source.line.updateControlPoints(area, source.axis);\n if (draw) {\n drawfill(chart.ctx, source, area);\n }\n }\n },\n beforeDatasetsDraw(chart, _args, options) {\n if (options.drawTime !== 'beforeDatasetsDraw') {\n return;\n }\n const metasets = chart.getSortedVisibleDatasetMetas();\n for (let i = metasets.length - 1; i >= 0; --i) {\n const source = metasets[i].$filler;\n if (source) {\n drawfill(chart.ctx, source, chart.chartArea);\n }\n }\n },\n beforeDatasetDraw(chart, args, options) {\n const source = args.meta.$filler;\n if (!source || source.fill === false || options.drawTime !== 'beforeDatasetDraw') {\n return;\n }\n drawfill(chart.ctx, source, chart.chartArea);\n },\n defaults: {\n propagate: true,\n drawTime: 'beforeDatasetDraw'\n }\n};\n\nconst getBoxSize = (labelOpts, fontSize) => {\n let {boxHeight = fontSize, boxWidth = fontSize} = labelOpts;\n if (labelOpts.usePointStyle) {\n boxHeight = Math.min(boxHeight, fontSize);\n boxWidth = Math.min(boxWidth, fontSize);\n }\n return {\n boxWidth,\n boxHeight,\n itemHeight: Math.max(fontSize, boxHeight)\n };\n};\nconst itemsEqual = (a, b) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index;\nclass Legend extends Element {\n constructor(config) {\n super();\n this._added = false;\n this.legendHitBoxes = [];\n this._hoveredItem = null;\n this.doughnutMode = false;\n this.chart = config.chart;\n this.options = config.options;\n this.ctx = config.ctx;\n this.legendItems = undefined;\n this.columnSizes = undefined;\n this.lineWidths = undefined;\n this.maxHeight = undefined;\n this.maxWidth = undefined;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.height = undefined;\n this.width = undefined;\n this._margins = undefined;\n this.position = undefined;\n this.weight = undefined;\n this.fullSize = undefined;\n }\n update(maxWidth, maxHeight, margins) {\n const me = this;\n me.maxWidth = maxWidth;\n me.maxHeight = maxHeight;\n me._margins = margins;\n me.setDimensions();\n me.buildLabels();\n me.fit();\n }\n setDimensions() {\n const me = this;\n if (me.isHorizontal()) {\n me.width = me.maxWidth;\n me.left = 0;\n me.right = me.width;\n } else {\n me.height = me.maxHeight;\n me.top = 0;\n me.bottom = me.height;\n }\n }\n buildLabels() {\n const me = this;\n const labelOpts = me.options.labels || {};\n let legendItems = callback(labelOpts.generateLabels, [me.chart], me) || [];\n if (labelOpts.filter) {\n legendItems = legendItems.filter((item) => labelOpts.filter(item, me.chart.data));\n }\n if (labelOpts.sort) {\n legendItems = legendItems.sort((a, b) => labelOpts.sort(a, b, me.chart.data));\n }\n if (me.options.reverse) {\n legendItems.reverse();\n }\n me.legendItems = legendItems;\n }\n fit() {\n const me = this;\n const {options, ctx} = me;\n if (!options.display) {\n me.width = me.height = 0;\n return;\n }\n const labelOpts = options.labels;\n const labelFont = toFont(labelOpts.font);\n const fontSize = labelFont.size;\n const titleHeight = me._computeTitleHeight();\n const {boxWidth, itemHeight} = getBoxSize(labelOpts, fontSize);\n let width, height;\n ctx.font = labelFont.string;\n if (me.isHorizontal()) {\n width = me.maxWidth;\n height = me._fitRows(titleHeight, fontSize, boxWidth, itemHeight) + 10;\n } else {\n height = me.maxHeight;\n width = me._fitCols(titleHeight, fontSize, boxWidth, itemHeight) + 10;\n }\n me.width = Math.min(width, options.maxWidth || me.maxWidth);\n me.height = Math.min(height, options.maxHeight || me.maxHeight);\n }\n _fitRows(titleHeight, fontSize, boxWidth, itemHeight) {\n const me = this;\n const {ctx, maxWidth, options: {labels: {padding}}} = me;\n const hitboxes = me.legendHitBoxes = [];\n const lineWidths = me.lineWidths = [0];\n const lineHeight = itemHeight + padding;\n let totalHeight = titleHeight;\n ctx.textAlign = 'left';\n ctx.textBaseline = 'middle';\n let row = -1;\n let top = -lineHeight;\n me.legendItems.forEach((legendItem, i) => {\n const itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;\n if (i === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) {\n totalHeight += lineHeight;\n lineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0;\n top += lineHeight;\n row++;\n }\n hitboxes[i] = {left: 0, top, row, width: itemWidth, height: itemHeight};\n lineWidths[lineWidths.length - 1] += itemWidth + padding;\n });\n return totalHeight;\n }\n _fitCols(titleHeight, fontSize, boxWidth, itemHeight) {\n const me = this;\n const {ctx, maxHeight, options: {labels: {padding}}} = me;\n const hitboxes = me.legendHitBoxes = [];\n const columnSizes = me.columnSizes = [];\n const heightLimit = maxHeight - titleHeight;\n let totalWidth = padding;\n let currentColWidth = 0;\n let currentColHeight = 0;\n let left = 0;\n let top = 0;\n let col = 0;\n me.legendItems.forEach((legendItem, i) => {\n const itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;\n if (i > 0 && currentColHeight + fontSize + 2 * padding > heightLimit) {\n totalWidth += currentColWidth + padding;\n columnSizes.push({width: currentColWidth, height: currentColHeight});\n left += currentColWidth + padding;\n col++;\n top = 0;\n currentColWidth = currentColHeight = 0;\n }\n currentColWidth = Math.max(currentColWidth, itemWidth);\n currentColHeight += fontSize + padding;\n hitboxes[i] = {left, top, col, width: itemWidth, height: itemHeight};\n top += itemHeight + padding;\n });\n totalWidth += currentColWidth;\n columnSizes.push({width: currentColWidth, height: currentColHeight});\n return totalWidth;\n }\n adjustHitBoxes() {\n const me = this;\n if (!me.options.display) {\n return;\n }\n const titleHeight = me._computeTitleHeight();\n const {legendHitBoxes: hitboxes, options: {align, labels: {padding}}} = me;\n if (this.isHorizontal()) {\n let row = 0;\n let left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]);\n for (const hitbox of hitboxes) {\n if (row !== hitbox.row) {\n row = hitbox.row;\n left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]);\n }\n hitbox.top += me.top + titleHeight + padding;\n hitbox.left = left;\n left += hitbox.width + padding;\n }\n } else {\n let col = 0;\n let top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height);\n for (const hitbox of hitboxes) {\n if (hitbox.col !== col) {\n col = hitbox.col;\n top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height);\n }\n hitbox.top = top;\n hitbox.left += me.left + padding;\n top += hitbox.height + padding;\n }\n }\n }\n isHorizontal() {\n return this.options.position === 'top' || this.options.position === 'bottom';\n }\n draw() {\n const me = this;\n if (me.options.display) {\n const ctx = me.ctx;\n clipArea(ctx, me);\n me._draw();\n unclipArea(ctx);\n }\n }\n _draw() {\n const me = this;\n const {options: opts, columnSizes, lineWidths, ctx} = me;\n const {align, labels: labelOpts} = opts;\n const defaultColor = defaults.color;\n const rtlHelper = getRtlAdapter(opts.rtl, me.left, me.width);\n const labelFont = toFont(labelOpts.font);\n const {color: fontColor, padding} = labelOpts;\n const fontSize = labelFont.size;\n const halfFontSize = fontSize / 2;\n let cursor;\n me.drawTitle();\n ctx.textAlign = rtlHelper.textAlign('left');\n ctx.textBaseline = 'middle';\n ctx.lineWidth = 0.5;\n ctx.font = labelFont.string;\n const {boxWidth, boxHeight, itemHeight} = getBoxSize(labelOpts, fontSize);\n const drawLegendBox = function(x, y, legendItem) {\n if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {\n return;\n }\n ctx.save();\n const lineWidth = valueOrDefault(legendItem.lineWidth, 1);\n ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);\n ctx.lineCap = valueOrDefault(legendItem.lineCap, 'butt');\n ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);\n ctx.lineJoin = valueOrDefault(legendItem.lineJoin, 'miter');\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);\n ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));\n if (labelOpts.usePointStyle) {\n const drawOptions = {\n radius: boxWidth * Math.SQRT2 / 2,\n pointStyle: legendItem.pointStyle,\n rotation: legendItem.rotation,\n borderWidth: lineWidth\n };\n const centerX = rtlHelper.xPlus(x, boxWidth / 2);\n const centerY = y + halfFontSize;\n drawPoint(ctx, drawOptions, centerX, centerY);\n } else {\n const yBoxTop = y + Math.max((fontSize - boxHeight) / 2, 0);\n const xBoxLeft = rtlHelper.leftForLtr(x, boxWidth);\n const borderRadius = toTRBLCorners(legendItem.borderRadius);\n ctx.beginPath();\n if (Object.values(borderRadius).some(v => v !== 0)) {\n addRoundedRectPath(ctx, {\n x: xBoxLeft,\n y: yBoxTop,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius,\n });\n } else {\n ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);\n }\n ctx.fill();\n if (lineWidth !== 0) {\n ctx.stroke();\n }\n }\n ctx.restore();\n };\n const fillText = function(x, y, legendItem) {\n renderText(ctx, legendItem.text, x, y + (itemHeight / 2), labelFont, {\n strikethrough: legendItem.hidden,\n textAlign: legendItem.textAlign\n });\n };\n const isHorizontal = me.isHorizontal();\n const titleHeight = this._computeTitleHeight();\n if (isHorizontal) {\n cursor = {\n x: _alignStartEnd(align, me.left + padding, me.right - lineWidths[0]),\n y: me.top + padding + titleHeight,\n line: 0\n };\n } else {\n cursor = {\n x: me.left + padding,\n y: _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - columnSizes[0].height),\n line: 0\n };\n }\n overrideTextDirection(me.ctx, opts.textDirection);\n const lineHeight = itemHeight + padding;\n me.legendItems.forEach((legendItem, i) => {\n ctx.strokeStyle = legendItem.fontColor || fontColor;\n ctx.fillStyle = legendItem.fontColor || fontColor;\n const textWidth = ctx.measureText(legendItem.text).width;\n const textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));\n const width = boxWidth + (fontSize / 2) + textWidth;\n let x = cursor.x;\n let y = cursor.y;\n rtlHelper.setWidth(me.width);\n if (isHorizontal) {\n if (i > 0 && x + width + padding > me.right) {\n y = cursor.y += lineHeight;\n cursor.line++;\n x = cursor.x = _alignStartEnd(align, me.left + padding, me.right - lineWidths[cursor.line]);\n }\n } else if (i > 0 && y + lineHeight > me.bottom) {\n x = cursor.x = x + columnSizes[cursor.line].width + padding;\n cursor.line++;\n y = cursor.y = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - columnSizes[cursor.line].height);\n }\n const realX = rtlHelper.x(x);\n drawLegendBox(realX, y, legendItem);\n x = _textX(textAlign, x + boxWidth + halfFontSize, me.right);\n fillText(rtlHelper.x(x), y, legendItem);\n if (isHorizontal) {\n cursor.x += width + padding;\n } else {\n cursor.y += lineHeight;\n }\n });\n restoreTextDirection(me.ctx, opts.textDirection);\n }\n drawTitle() {\n const me = this;\n const opts = me.options;\n const titleOpts = opts.title;\n const titleFont = toFont(titleOpts.font);\n const titlePadding = toPadding(titleOpts.padding);\n if (!titleOpts.display) {\n return;\n }\n const rtlHelper = getRtlAdapter(opts.rtl, me.left, me.width);\n const ctx = me.ctx;\n const position = titleOpts.position;\n const halfFontSize = titleFont.size / 2;\n const topPaddingPlusHalfFontSize = titlePadding.top + halfFontSize;\n let y;\n let left = me.left;\n let maxWidth = me.width;\n if (this.isHorizontal()) {\n maxWidth = Math.max(...me.lineWidths);\n y = me.top + topPaddingPlusHalfFontSize;\n left = _alignStartEnd(opts.align, left, me.right - maxWidth);\n } else {\n const maxHeight = me.columnSizes.reduce((acc, size) => Math.max(acc, size.height), 0);\n y = topPaddingPlusHalfFontSize + _alignStartEnd(opts.align, me.top, me.bottom - maxHeight - opts.labels.padding - me._computeTitleHeight());\n }\n const x = _alignStartEnd(position, left, left + maxWidth);\n ctx.textAlign = rtlHelper.textAlign(_toLeftRightCenter(position));\n ctx.textBaseline = 'middle';\n ctx.strokeStyle = titleOpts.color;\n ctx.fillStyle = titleOpts.color;\n ctx.font = titleFont.string;\n renderText(ctx, titleOpts.text, x, y, titleFont);\n }\n _computeTitleHeight() {\n const titleOpts = this.options.title;\n const titleFont = toFont(titleOpts.font);\n const titlePadding = toPadding(titleOpts.padding);\n return titleOpts.display ? titleFont.lineHeight + titlePadding.height : 0;\n }\n _getLegendItemAt(x, y) {\n const me = this;\n let i, hitBox, lh;\n if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {\n lh = me.legendHitBoxes;\n for (i = 0; i < lh.length; ++i) {\n hitBox = lh[i];\n if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {\n return me.legendItems[i];\n }\n }\n }\n return null;\n }\n handleEvent(e) {\n const me = this;\n const opts = me.options;\n if (!isListened(e.type, opts)) {\n return;\n }\n const hoveredItem = me._getLegendItemAt(e.x, e.y);\n if (e.type === 'mousemove') {\n const previous = me._hoveredItem;\n const sameItem = itemsEqual(previous, hoveredItem);\n if (previous && !sameItem) {\n callback(opts.onLeave, [e, previous, me], me);\n }\n me._hoveredItem = hoveredItem;\n if (hoveredItem && !sameItem) {\n callback(opts.onHover, [e, hoveredItem, me], me);\n }\n } else if (hoveredItem) {\n callback(opts.onClick, [e, hoveredItem, me], me);\n }\n }\n}\nfunction isListened(type, opts) {\n if (type === 'mousemove' && (opts.onHover || opts.onLeave)) {\n return true;\n }\n if (opts.onClick && (type === 'click' || type === 'mouseup')) {\n return true;\n }\n return false;\n}\nvar plugin_legend = {\n id: 'legend',\n _element: Legend,\n start(chart, _args, options) {\n const legend = chart.legend = new Legend({ctx: chart.ctx, options, chart});\n layouts.configure(chart, legend, options);\n layouts.addBox(chart, legend);\n },\n stop(chart) {\n layouts.removeBox(chart, chart.legend);\n delete chart.legend;\n },\n beforeUpdate(chart, _args, options) {\n const legend = chart.legend;\n layouts.configure(chart, legend, options);\n legend.options = options;\n },\n afterUpdate(chart) {\n const legend = chart.legend;\n legend.buildLabels();\n legend.adjustHitBoxes();\n },\n afterEvent(chart, args) {\n if (!args.replay) {\n chart.legend.handleEvent(args.event);\n }\n },\n defaults: {\n display: true,\n position: 'top',\n align: 'center',\n fullSize: true,\n reverse: false,\n weight: 1000,\n onClick(e, legendItem, legend) {\n const index = legendItem.datasetIndex;\n const ci = legend.chart;\n if (ci.isDatasetVisible(index)) {\n ci.hide(index);\n legendItem.hidden = true;\n } else {\n ci.show(index);\n legendItem.hidden = false;\n }\n },\n onHover: null,\n onLeave: null,\n labels: {\n color: (ctx) => ctx.chart.options.color,\n boxWidth: 40,\n padding: 10,\n generateLabels(chart) {\n const datasets = chart.data.datasets;\n const {labels: {usePointStyle, pointStyle, textAlign, color}} = chart.legend.options;\n return chart._getSortedDatasetMetas().map((meta) => {\n const style = meta.controller.getStyle(usePointStyle ? 0 : undefined);\n const borderWidth = toPadding(style.borderWidth);\n return {\n text: datasets[meta.index].label,\n fillStyle: style.backgroundColor,\n fontColor: color,\n hidden: !meta.visible,\n lineCap: style.borderCapStyle,\n lineDash: style.borderDash,\n lineDashOffset: style.borderDashOffset,\n lineJoin: style.borderJoinStyle,\n lineWidth: (borderWidth.width + borderWidth.height) / 4,\n strokeStyle: style.borderColor,\n pointStyle: pointStyle || style.pointStyle,\n rotation: style.rotation,\n textAlign: textAlign || style.textAlign,\n borderRadius: 0,\n datasetIndex: meta.index\n };\n }, this);\n }\n },\n title: {\n color: (ctx) => ctx.chart.options.color,\n display: false,\n position: 'center',\n text: '',\n }\n },\n descriptors: {\n _scriptable: (name) => !name.startsWith('on'),\n labels: {\n _scriptable: (name) => !['generateLabels', 'filter', 'sort'].includes(name),\n }\n },\n};\n\nclass Title extends Element {\n constructor(config) {\n super();\n this.chart = config.chart;\n this.options = config.options;\n this.ctx = config.ctx;\n this._padding = undefined;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.width = undefined;\n this.height = undefined;\n this.position = undefined;\n this.weight = undefined;\n this.fullSize = undefined;\n }\n update(maxWidth, maxHeight) {\n const me = this;\n const opts = me.options;\n me.left = 0;\n me.top = 0;\n if (!opts.display) {\n me.width = me.height = me.right = me.bottom = 0;\n return;\n }\n me.width = me.right = maxWidth;\n me.height = me.bottom = maxHeight;\n const lineCount = isArray(opts.text) ? opts.text.length : 1;\n me._padding = toPadding(opts.padding);\n const textSize = lineCount * toFont(opts.font).lineHeight + me._padding.height;\n if (me.isHorizontal()) {\n me.height = textSize;\n } else {\n me.width = textSize;\n }\n }\n isHorizontal() {\n const pos = this.options.position;\n return pos === 'top' || pos === 'bottom';\n }\n _drawArgs(offset) {\n const {top, left, bottom, right, options} = this;\n const align = options.align;\n let rotation = 0;\n let maxWidth, titleX, titleY;\n if (this.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n titleY = top + offset;\n maxWidth = right - left;\n } else {\n if (options.position === 'left') {\n titleX = left + offset;\n titleY = _alignStartEnd(align, bottom, top);\n rotation = PI * -0.5;\n } else {\n titleX = right - offset;\n titleY = _alignStartEnd(align, top, bottom);\n rotation = PI * 0.5;\n }\n maxWidth = bottom - top;\n }\n return {titleX, titleY, maxWidth, rotation};\n }\n draw() {\n const me = this;\n const ctx = me.ctx;\n const opts = me.options;\n if (!opts.display) {\n return;\n }\n const fontOpts = toFont(opts.font);\n const lineHeight = fontOpts.lineHeight;\n const offset = lineHeight / 2 + me._padding.top;\n const {titleX, titleY, maxWidth, rotation} = me._drawArgs(offset);\n renderText(ctx, opts.text, 0, 0, fontOpts, {\n color: opts.color,\n maxWidth,\n rotation,\n textAlign: _toLeftRightCenter(opts.align),\n textBaseline: 'middle',\n translation: [titleX, titleY],\n });\n }\n}\nfunction createTitle(chart, titleOpts) {\n const title = new Title({\n ctx: chart.ctx,\n options: titleOpts,\n chart\n });\n layouts.configure(chart, title, titleOpts);\n layouts.addBox(chart, title);\n chart.titleBlock = title;\n}\nvar plugin_title = {\n id: 'title',\n _element: Title,\n start(chart, _args, options) {\n createTitle(chart, options);\n },\n stop(chart) {\n const titleBlock = chart.titleBlock;\n layouts.removeBox(chart, titleBlock);\n delete chart.titleBlock;\n },\n beforeUpdate(chart, _args, options) {\n const title = chart.titleBlock;\n layouts.configure(chart, title, options);\n title.options = options;\n },\n defaults: {\n align: 'center',\n display: false,\n font: {\n weight: 'bold',\n },\n fullSize: true,\n padding: 10,\n position: 'top',\n text: '',\n weight: 2000\n },\n defaultRoutes: {\n color: 'color'\n },\n descriptors: {\n _scriptable: true,\n _indexable: false,\n },\n};\n\nconst positioners = {\n average(items) {\n if (!items.length) {\n return false;\n }\n let i, len;\n let x = 0;\n let y = 0;\n let count = 0;\n for (i = 0, len = items.length; i < len; ++i) {\n const el = items[i].element;\n if (el && el.hasValue()) {\n const pos = el.tooltipPosition();\n x += pos.x;\n y += pos.y;\n ++count;\n }\n }\n return {\n x: x / count,\n y: y / count\n };\n },\n nearest(items, eventPosition) {\n if (!items.length) {\n return false;\n }\n let x = eventPosition.x;\n let y = eventPosition.y;\n let minDistance = Number.POSITIVE_INFINITY;\n let i, len, nearestElement;\n for (i = 0, len = items.length; i < len; ++i) {\n const el = items[i].element;\n if (el && el.hasValue()) {\n const center = el.getCenterPoint();\n const d = distanceBetweenPoints(eventPosition, center);\n if (d < minDistance) {\n minDistance = d;\n nearestElement = el;\n }\n }\n }\n if (nearestElement) {\n const tp = nearestElement.tooltipPosition();\n x = tp.x;\n y = tp.y;\n }\n return {\n x,\n y\n };\n }\n};\nfunction pushOrConcat(base, toPush) {\n if (toPush) {\n if (isArray(toPush)) {\n Array.prototype.push.apply(base, toPush);\n } else {\n base.push(toPush);\n }\n }\n return base;\n}\nfunction splitNewlines(str) {\n if ((typeof str === 'string' || str instanceof String) && str.indexOf('\\n') > -1) {\n return str.split('\\n');\n }\n return str;\n}\nfunction createTooltipItem(chart, item) {\n const {element, datasetIndex, index} = item;\n const controller = chart.getDatasetMeta(datasetIndex).controller;\n const {label, value} = controller.getLabelAndValue(index);\n return {\n chart,\n label,\n parsed: controller.getParsed(index),\n raw: chart.data.datasets[datasetIndex].data[index],\n formattedValue: value,\n dataset: controller.getDataset(),\n dataIndex: index,\n datasetIndex,\n element\n };\n}\nfunction getTooltipSize(tooltip, options) {\n const ctx = tooltip._chart.ctx;\n const {body, footer, title} = tooltip;\n const {boxWidth, boxHeight} = options;\n const bodyFont = toFont(options.bodyFont);\n const titleFont = toFont(options.titleFont);\n const footerFont = toFont(options.footerFont);\n const titleLineCount = title.length;\n const footerLineCount = footer.length;\n const bodyLineItemCount = body.length;\n const padding = toPadding(options.padding);\n let height = padding.height;\n let width = 0;\n let combinedBodyLength = body.reduce((count, bodyItem) => count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length, 0);\n combinedBodyLength += tooltip.beforeBody.length + tooltip.afterBody.length;\n if (titleLineCount) {\n height += titleLineCount * titleFont.lineHeight\n\t\t\t+ (titleLineCount - 1) * options.titleSpacing\n\t\t\t+ options.titleMarginBottom;\n }\n if (combinedBodyLength) {\n const bodyLineHeight = options.displayColors ? Math.max(boxHeight, bodyFont.lineHeight) : bodyFont.lineHeight;\n height += bodyLineItemCount * bodyLineHeight\n\t\t\t+ (combinedBodyLength - bodyLineItemCount) * bodyFont.lineHeight\n\t\t\t+ (combinedBodyLength - 1) * options.bodySpacing;\n }\n if (footerLineCount) {\n height += options.footerMarginTop\n\t\t\t+ footerLineCount * footerFont.lineHeight\n\t\t\t+ (footerLineCount - 1) * options.footerSpacing;\n }\n let widthPadding = 0;\n const maxLineWidth = function(line) {\n width = Math.max(width, ctx.measureText(line).width + widthPadding);\n };\n ctx.save();\n ctx.font = titleFont.string;\n each(tooltip.title, maxLineWidth);\n ctx.font = bodyFont.string;\n each(tooltip.beforeBody.concat(tooltip.afterBody), maxLineWidth);\n widthPadding = options.displayColors ? (boxWidth + 2) : 0;\n each(body, (bodyItem) => {\n each(bodyItem.before, maxLineWidth);\n each(bodyItem.lines, maxLineWidth);\n each(bodyItem.after, maxLineWidth);\n });\n widthPadding = 0;\n ctx.font = footerFont.string;\n each(tooltip.footer, maxLineWidth);\n ctx.restore();\n width += padding.width;\n return {width, height};\n}\nfunction determineYAlign(chart, size) {\n const {y, height} = size;\n if (y < height / 2) {\n return 'top';\n } else if (y > (chart.height - height / 2)) {\n return 'bottom';\n }\n return 'center';\n}\nfunction doesNotFitWithAlign(xAlign, chart, options, size) {\n const {x, width} = size;\n const caret = options.caretSize + options.caretPadding;\n if (xAlign === 'left' && x + width + caret > chart.width) {\n return true;\n }\n if (xAlign === 'right' && x - width - caret < 0) {\n return true;\n }\n}\nfunction determineXAlign(chart, options, size, yAlign) {\n const {x, width} = size;\n const {width: chartWidth, chartArea: {left, right}} = chart;\n let xAlign = 'center';\n if (yAlign === 'center') {\n xAlign = x <= (left + right) / 2 ? 'left' : 'right';\n } else if (x <= width / 2) {\n xAlign = 'left';\n } else if (x >= chartWidth - width / 2) {\n xAlign = 'right';\n }\n if (doesNotFitWithAlign(xAlign, chart, options, size)) {\n xAlign = 'center';\n }\n return xAlign;\n}\nfunction determineAlignment(chart, options, size) {\n const yAlign = options.yAlign || determineYAlign(chart, size);\n return {\n xAlign: options.xAlign || determineXAlign(chart, options, size, yAlign),\n yAlign\n };\n}\nfunction alignX(size, xAlign) {\n let {x, width} = size;\n if (xAlign === 'right') {\n x -= width;\n } else if (xAlign === 'center') {\n x -= (width / 2);\n }\n return x;\n}\nfunction alignY(size, yAlign, paddingAndSize) {\n let {y, height} = size;\n if (yAlign === 'top') {\n y += paddingAndSize;\n } else if (yAlign === 'bottom') {\n y -= height + paddingAndSize;\n } else {\n y -= (height / 2);\n }\n return y;\n}\nfunction getBackgroundPoint(options, size, alignment, chart) {\n const {caretSize, caretPadding, cornerRadius} = options;\n const {xAlign, yAlign} = alignment;\n const paddingAndSize = caretSize + caretPadding;\n const radiusAndPadding = cornerRadius + caretPadding;\n let x = alignX(size, xAlign);\n const y = alignY(size, yAlign, paddingAndSize);\n if (yAlign === 'center') {\n if (xAlign === 'left') {\n x += paddingAndSize;\n } else if (xAlign === 'right') {\n x -= paddingAndSize;\n }\n } else if (xAlign === 'left') {\n x -= radiusAndPadding;\n } else if (xAlign === 'right') {\n x += radiusAndPadding;\n }\n return {\n x: _limitValue(x, 0, chart.width - size.width),\n y: _limitValue(y, 0, chart.height - size.height)\n };\n}\nfunction getAlignedX(tooltip, align, options) {\n const padding = toPadding(options.padding);\n return align === 'center'\n ? tooltip.x + tooltip.width / 2\n : align === 'right'\n ? tooltip.x + tooltip.width - padding.right\n : tooltip.x + padding.left;\n}\nfunction getBeforeAfterBodyLines(callback) {\n return pushOrConcat([], splitNewlines(callback));\n}\nfunction createTooltipContext(parent, tooltip, tooltipItems) {\n return Object.assign(Object.create(parent), {\n tooltip,\n tooltipItems,\n type: 'tooltip'\n });\n}\nfunction overrideCallbacks(callbacks, context) {\n const override = context && context.dataset && context.dataset.tooltip && context.dataset.tooltip.callbacks;\n return override ? callbacks.override(override) : callbacks;\n}\nclass Tooltip extends Element {\n constructor(config) {\n super();\n this.opacity = 0;\n this._active = [];\n this._chart = config._chart;\n this._eventPosition = undefined;\n this._size = undefined;\n this._cachedAnimations = undefined;\n this._tooltipItems = [];\n this.$animations = undefined;\n this.$context = undefined;\n this.options = config.options;\n this.dataPoints = undefined;\n this.title = undefined;\n this.beforeBody = undefined;\n this.body = undefined;\n this.afterBody = undefined;\n this.footer = undefined;\n this.xAlign = undefined;\n this.yAlign = undefined;\n this.x = undefined;\n this.y = undefined;\n this.height = undefined;\n this.width = undefined;\n this.caretX = undefined;\n this.caretY = undefined;\n this.labelColors = undefined;\n this.labelPointStyles = undefined;\n this.labelTextColors = undefined;\n }\n initialize(options) {\n this.options = options;\n this._cachedAnimations = undefined;\n this.$context = undefined;\n }\n _resolveAnimations() {\n const me = this;\n const cached = me._cachedAnimations;\n if (cached) {\n return cached;\n }\n const chart = me._chart;\n const options = me.options.setContext(me.getContext());\n const opts = options.enabled && chart.options.animation && options.animations;\n const animations = new Animations(me._chart, opts);\n if (opts._cacheable) {\n me._cachedAnimations = Object.freeze(animations);\n }\n return animations;\n }\n getContext() {\n const me = this;\n return me.$context ||\n\t\t\t(me.$context = createTooltipContext(me._chart.getContext(), me, me._tooltipItems));\n }\n getTitle(context, options) {\n const me = this;\n const {callbacks} = options;\n const beforeTitle = callbacks.beforeTitle.apply(me, [context]);\n const title = callbacks.title.apply(me, [context]);\n const afterTitle = callbacks.afterTitle.apply(me, [context]);\n let lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeTitle));\n lines = pushOrConcat(lines, splitNewlines(title));\n lines = pushOrConcat(lines, splitNewlines(afterTitle));\n return lines;\n }\n getBeforeBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(options.callbacks.beforeBody.apply(this, [tooltipItems]));\n }\n getBody(tooltipItems, options) {\n const me = this;\n const {callbacks} = options;\n const bodyItems = [];\n each(tooltipItems, (context) => {\n const bodyItem = {\n before: [],\n lines: [],\n after: []\n };\n const scoped = overrideCallbacks(callbacks, context);\n pushOrConcat(bodyItem.before, splitNewlines(scoped.beforeLabel.call(me, context)));\n pushOrConcat(bodyItem.lines, scoped.label.call(me, context));\n pushOrConcat(bodyItem.after, splitNewlines(scoped.afterLabel.call(me, context)));\n bodyItems.push(bodyItem);\n });\n return bodyItems;\n }\n getAfterBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(options.callbacks.afterBody.apply(this, [tooltipItems]));\n }\n getFooter(tooltipItems, options) {\n const me = this;\n const {callbacks} = options;\n const beforeFooter = callbacks.beforeFooter.apply(me, [tooltipItems]);\n const footer = callbacks.footer.apply(me, [tooltipItems]);\n const afterFooter = callbacks.afterFooter.apply(me, [tooltipItems]);\n let lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeFooter));\n lines = pushOrConcat(lines, splitNewlines(footer));\n lines = pushOrConcat(lines, splitNewlines(afterFooter));\n return lines;\n }\n _createItems(options) {\n const me = this;\n const active = me._active;\n const data = me._chart.data;\n const labelColors = [];\n const labelPointStyles = [];\n const labelTextColors = [];\n let tooltipItems = [];\n let i, len;\n for (i = 0, len = active.length; i < len; ++i) {\n tooltipItems.push(createTooltipItem(me._chart, active[i]));\n }\n if (options.filter) {\n tooltipItems = tooltipItems.filter((element, index, array) => options.filter(element, index, array, data));\n }\n if (options.itemSort) {\n tooltipItems = tooltipItems.sort((a, b) => options.itemSort(a, b, data));\n }\n each(tooltipItems, (context) => {\n const scoped = overrideCallbacks(options.callbacks, context);\n labelColors.push(scoped.labelColor.call(me, context));\n labelPointStyles.push(scoped.labelPointStyle.call(me, context));\n labelTextColors.push(scoped.labelTextColor.call(me, context));\n });\n me.labelColors = labelColors;\n me.labelPointStyles = labelPointStyles;\n me.labelTextColors = labelTextColors;\n me.dataPoints = tooltipItems;\n return tooltipItems;\n }\n update(changed, replay) {\n const me = this;\n const options = me.options.setContext(me.getContext());\n const active = me._active;\n let properties;\n let tooltipItems = [];\n if (!active.length) {\n if (me.opacity !== 0) {\n properties = {\n opacity: 0\n };\n }\n } else {\n const position = positioners[options.position].call(me, active, me._eventPosition);\n tooltipItems = me._createItems(options);\n me.title = me.getTitle(tooltipItems, options);\n me.beforeBody = me.getBeforeBody(tooltipItems, options);\n me.body = me.getBody(tooltipItems, options);\n me.afterBody = me.getAfterBody(tooltipItems, options);\n me.footer = me.getFooter(tooltipItems, options);\n const size = me._size = getTooltipSize(me, options);\n const positionAndSize = Object.assign({}, position, size);\n const alignment = determineAlignment(me._chart, options, positionAndSize);\n const backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, me._chart);\n me.xAlign = alignment.xAlign;\n me.yAlign = alignment.yAlign;\n properties = {\n opacity: 1,\n x: backgroundPoint.x,\n y: backgroundPoint.y,\n width: size.width,\n height: size.height,\n caretX: position.x,\n caretY: position.y\n };\n }\n me._tooltipItems = tooltipItems;\n me.$context = undefined;\n if (properties) {\n me._resolveAnimations().update(me, properties);\n }\n if (changed && options.external) {\n options.external.call(me, {chart: me._chart, tooltip: me, replay});\n }\n }\n drawCaret(tooltipPoint, ctx, size, options) {\n const caretPosition = this.getCaretPosition(tooltipPoint, size, options);\n ctx.lineTo(caretPosition.x1, caretPosition.y1);\n ctx.lineTo(caretPosition.x2, caretPosition.y2);\n ctx.lineTo(caretPosition.x3, caretPosition.y3);\n }\n getCaretPosition(tooltipPoint, size, options) {\n const {xAlign, yAlign} = this;\n const {cornerRadius, caretSize} = options;\n const {x: ptX, y: ptY} = tooltipPoint;\n const {width, height} = size;\n let x1, x2, x3, y1, y2, y3;\n if (yAlign === 'center') {\n y2 = ptY + (height / 2);\n if (xAlign === 'left') {\n x1 = ptX;\n x2 = x1 - caretSize;\n y1 = y2 + caretSize;\n y3 = y2 - caretSize;\n } else {\n x1 = ptX + width;\n x2 = x1 + caretSize;\n y1 = y2 - caretSize;\n y3 = y2 + caretSize;\n }\n x3 = x1;\n } else {\n if (xAlign === 'left') {\n x2 = ptX + cornerRadius + (caretSize);\n } else if (xAlign === 'right') {\n x2 = ptX + width - cornerRadius - caretSize;\n } else {\n x2 = this.caretX;\n }\n if (yAlign === 'top') {\n y1 = ptY;\n y2 = y1 - caretSize;\n x1 = x2 - caretSize;\n x3 = x2 + caretSize;\n } else {\n y1 = ptY + height;\n y2 = y1 + caretSize;\n x1 = x2 + caretSize;\n x3 = x2 - caretSize;\n }\n y3 = y1;\n }\n return {x1, x2, x3, y1, y2, y3};\n }\n drawTitle(pt, ctx, options) {\n const me = this;\n const title = me.title;\n const length = title.length;\n let titleFont, titleSpacing, i;\n if (length) {\n const rtlHelper = getRtlAdapter(options.rtl, me.x, me.width);\n pt.x = getAlignedX(me, options.titleAlign, options);\n ctx.textAlign = rtlHelper.textAlign(options.titleAlign);\n ctx.textBaseline = 'middle';\n titleFont = toFont(options.titleFont);\n titleSpacing = options.titleSpacing;\n ctx.fillStyle = options.titleColor;\n ctx.font = titleFont.string;\n for (i = 0; i < length; ++i) {\n ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2);\n pt.y += titleFont.lineHeight + titleSpacing;\n if (i + 1 === length) {\n pt.y += options.titleMarginBottom - titleSpacing;\n }\n }\n }\n }\n _drawColorBox(ctx, pt, i, rtlHelper, options) {\n const me = this;\n const labelColors = me.labelColors[i];\n const labelPointStyle = me.labelPointStyles[i];\n const {boxHeight, boxWidth} = options;\n const bodyFont = toFont(options.bodyFont);\n const colorX = getAlignedX(me, 'left', options);\n const rtlColorX = rtlHelper.x(colorX);\n const yOffSet = boxHeight < bodyFont.lineHeight ? (bodyFont.lineHeight - boxHeight) / 2 : 0;\n const colorY = pt.y + yOffSet;\n if (options.usePointStyle) {\n const drawOptions = {\n radius: Math.min(boxWidth, boxHeight) / 2,\n pointStyle: labelPointStyle.pointStyle,\n rotation: labelPointStyle.rotation,\n borderWidth: 1\n };\n const centerX = rtlHelper.leftForLtr(rtlColorX, boxWidth) + boxWidth / 2;\n const centerY = colorY + boxHeight / 2;\n ctx.strokeStyle = options.multiKeyBackground;\n ctx.fillStyle = options.multiKeyBackground;\n drawPoint(ctx, drawOptions, centerX, centerY);\n ctx.strokeStyle = labelColors.borderColor;\n ctx.fillStyle = labelColors.backgroundColor;\n drawPoint(ctx, drawOptions, centerX, centerY);\n } else {\n ctx.lineWidth = labelColors.borderWidth || 1;\n ctx.strokeStyle = labelColors.borderColor;\n ctx.setLineDash(labelColors.borderDash || []);\n ctx.lineDashOffset = labelColors.borderDashOffset || 0;\n const outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth);\n const innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - 2);\n const borderRadius = toTRBLCorners(labelColors.borderRadius);\n if (Object.values(borderRadius).some(v => v !== 0)) {\n ctx.beginPath();\n ctx.fillStyle = options.multiKeyBackground;\n addRoundedRectPath(ctx, {\n x: outerX,\n y: colorY,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius,\n });\n ctx.fill();\n ctx.stroke();\n ctx.fillStyle = labelColors.backgroundColor;\n ctx.beginPath();\n addRoundedRectPath(ctx, {\n x: innerX,\n y: colorY + 1,\n w: boxWidth - 2,\n h: boxHeight - 2,\n radius: borderRadius,\n });\n ctx.fill();\n } else {\n ctx.fillStyle = options.multiKeyBackground;\n ctx.fillRect(outerX, colorY, boxWidth, boxHeight);\n ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);\n ctx.fillStyle = labelColors.backgroundColor;\n ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);\n }\n }\n ctx.fillStyle = me.labelTextColors[i];\n }\n drawBody(pt, ctx, options) {\n const me = this;\n const {body} = me;\n const {bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth} = options;\n const bodyFont = toFont(options.bodyFont);\n let bodyLineHeight = bodyFont.lineHeight;\n let xLinePadding = 0;\n const rtlHelper = getRtlAdapter(options.rtl, me.x, me.width);\n const fillLineOfText = function(line) {\n ctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyLineHeight / 2);\n pt.y += bodyLineHeight + bodySpacing;\n };\n const bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);\n let bodyItem, textColor, lines, i, j, ilen, jlen;\n ctx.textAlign = bodyAlign;\n ctx.textBaseline = 'middle';\n ctx.font = bodyFont.string;\n pt.x = getAlignedX(me, bodyAlignForCalculation, options);\n ctx.fillStyle = options.bodyColor;\n each(me.beforeBody, fillLineOfText);\n xLinePadding = displayColors && bodyAlignForCalculation !== 'right'\n ? bodyAlign === 'center' ? (boxWidth / 2 + 1) : (boxWidth + 2)\n : 0;\n for (i = 0, ilen = body.length; i < ilen; ++i) {\n bodyItem = body[i];\n textColor = me.labelTextColors[i];\n ctx.fillStyle = textColor;\n each(bodyItem.before, fillLineOfText);\n lines = bodyItem.lines;\n if (displayColors && lines.length) {\n me._drawColorBox(ctx, pt, i, rtlHelper, options);\n bodyLineHeight = Math.max(bodyFont.lineHeight, boxHeight);\n }\n for (j = 0, jlen = lines.length; j < jlen; ++j) {\n fillLineOfText(lines[j]);\n bodyLineHeight = bodyFont.lineHeight;\n }\n each(bodyItem.after, fillLineOfText);\n }\n xLinePadding = 0;\n bodyLineHeight = bodyFont.lineHeight;\n each(me.afterBody, fillLineOfText);\n pt.y -= bodySpacing;\n }\n drawFooter(pt, ctx, options) {\n const me = this;\n const footer = me.footer;\n const length = footer.length;\n let footerFont, i;\n if (length) {\n const rtlHelper = getRtlAdapter(options.rtl, me.x, me.width);\n pt.x = getAlignedX(me, options.footerAlign, options);\n pt.y += options.footerMarginTop;\n ctx.textAlign = rtlHelper.textAlign(options.footerAlign);\n ctx.textBaseline = 'middle';\n footerFont = toFont(options.footerFont);\n ctx.fillStyle = options.footerColor;\n ctx.font = footerFont.string;\n for (i = 0; i < length; ++i) {\n ctx.fillText(footer[i], rtlHelper.x(pt.x), pt.y + footerFont.lineHeight / 2);\n pt.y += footerFont.lineHeight + options.footerSpacing;\n }\n }\n }\n drawBackground(pt, ctx, tooltipSize, options) {\n const {xAlign, yAlign} = this;\n const {x, y} = pt;\n const {width, height} = tooltipSize;\n const radius = options.cornerRadius;\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n ctx.beginPath();\n ctx.moveTo(x + radius, y);\n if (yAlign === 'top') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + width - radius, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + radius);\n if (yAlign === 'center' && xAlign === 'right') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + width, y + height - radius);\n ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\n if (yAlign === 'bottom') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + radius, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - radius);\n if (yAlign === 'center' && xAlign === 'left') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x, y + radius);\n ctx.quadraticCurveTo(x, y, x + radius, y);\n ctx.closePath();\n ctx.fill();\n if (options.borderWidth > 0) {\n ctx.stroke();\n }\n }\n _updateAnimationTarget(options) {\n const me = this;\n const chart = me._chart;\n const anims = me.$animations;\n const animX = anims && anims.x;\n const animY = anims && anims.y;\n if (animX || animY) {\n const position = positioners[options.position].call(me, me._active, me._eventPosition);\n if (!position) {\n return;\n }\n const size = me._size = getTooltipSize(me, options);\n const positionAndSize = Object.assign({}, position, me._size);\n const alignment = determineAlignment(chart, options, positionAndSize);\n const point = getBackgroundPoint(options, positionAndSize, alignment, chart);\n if (animX._to !== point.x || animY._to !== point.y) {\n me.xAlign = alignment.xAlign;\n me.yAlign = alignment.yAlign;\n me.width = size.width;\n me.height = size.height;\n me.caretX = position.x;\n me.caretY = position.y;\n me._resolveAnimations().update(me, point);\n }\n }\n }\n draw(ctx) {\n const me = this;\n const options = me.options.setContext(me.getContext());\n let opacity = me.opacity;\n if (!opacity) {\n return;\n }\n me._updateAnimationTarget(options);\n const tooltipSize = {\n width: me.width,\n height: me.height\n };\n const pt = {\n x: me.x,\n y: me.y\n };\n opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;\n const padding = toPadding(options.padding);\n const hasTooltipContent = me.title.length || me.beforeBody.length || me.body.length || me.afterBody.length || me.footer.length;\n if (options.enabled && hasTooltipContent) {\n ctx.save();\n ctx.globalAlpha = opacity;\n me.drawBackground(pt, ctx, tooltipSize, options);\n overrideTextDirection(ctx, options.textDirection);\n pt.y += padding.top;\n me.drawTitle(pt, ctx, options);\n me.drawBody(pt, ctx, options);\n me.drawFooter(pt, ctx, options);\n restoreTextDirection(ctx, options.textDirection);\n ctx.restore();\n }\n }\n getActiveElements() {\n return this._active || [];\n }\n setActiveElements(activeElements, eventPosition) {\n const me = this;\n const lastActive = me._active;\n const active = activeElements.map(({datasetIndex, index}) => {\n const meta = me._chart.getDatasetMeta(datasetIndex);\n if (!meta) {\n throw new Error('Cannot find a dataset at index ' + datasetIndex);\n }\n return {\n datasetIndex,\n element: meta.data[index],\n index,\n };\n });\n const changed = !_elementsEqual(lastActive, active);\n const positionChanged = me._positionChanged(active, eventPosition);\n if (changed || positionChanged) {\n me._active = active;\n me._eventPosition = eventPosition;\n me.update(true);\n }\n }\n handleEvent(e, replay) {\n const me = this;\n const options = me.options;\n const lastActive = me._active || [];\n let changed = false;\n let active = [];\n if (e.type !== 'mouseout') {\n active = me._chart.getElementsAtEventForMode(e, options.mode, options, replay);\n if (options.reverse) {\n active.reverse();\n }\n }\n const positionChanged = me._positionChanged(active, e);\n changed = replay || !_elementsEqual(active, lastActive) || positionChanged;\n if (changed) {\n me._active = active;\n if (options.enabled || options.external) {\n me._eventPosition = {\n x: e.x,\n y: e.y\n };\n me.update(true, replay);\n }\n }\n return changed;\n }\n _positionChanged(active, e) {\n const {caretX, caretY, options} = this;\n const position = positioners[options.position].call(this, active, e);\n return position !== false && (caretX !== position.x || caretY !== position.y);\n }\n}\nTooltip.positioners = positioners;\nvar plugin_tooltip = {\n id: 'tooltip',\n _element: Tooltip,\n positioners,\n afterInit(chart, _args, options) {\n if (options) {\n chart.tooltip = new Tooltip({_chart: chart, options});\n }\n },\n beforeUpdate(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n reset(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n afterDraw(chart) {\n const tooltip = chart.tooltip;\n const args = {\n tooltip\n };\n if (chart.notifyPlugins('beforeTooltipDraw', args) === false) {\n return;\n }\n if (tooltip) {\n tooltip.draw(chart.ctx);\n }\n chart.notifyPlugins('afterTooltipDraw', args);\n },\n afterEvent(chart, args) {\n if (chart.tooltip) {\n const useFinalPosition = args.replay;\n if (chart.tooltip.handleEvent(args.event, useFinalPosition)) {\n args.changed = true;\n }\n }\n },\n defaults: {\n enabled: true,\n external: null,\n position: 'average',\n backgroundColor: 'rgba(0,0,0,0.8)',\n titleColor: '#fff',\n titleFont: {\n weight: 'bold',\n },\n titleSpacing: 2,\n titleMarginBottom: 6,\n titleAlign: 'left',\n bodyColor: '#fff',\n bodySpacing: 2,\n bodyFont: {\n },\n bodyAlign: 'left',\n footerColor: '#fff',\n footerSpacing: 2,\n footerMarginTop: 6,\n footerFont: {\n weight: 'bold',\n },\n footerAlign: 'left',\n padding: 6,\n caretPadding: 2,\n caretSize: 5,\n cornerRadius: 6,\n boxHeight: (ctx, opts) => opts.bodyFont.size,\n boxWidth: (ctx, opts) => opts.bodyFont.size,\n multiKeyBackground: '#fff',\n displayColors: true,\n borderColor: 'rgba(0,0,0,0)',\n borderWidth: 0,\n animation: {\n duration: 400,\n easing: 'easeOutQuart',\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'width', 'height', 'caretX', 'caretY'],\n },\n opacity: {\n easing: 'linear',\n duration: 200\n }\n },\n callbacks: {\n beforeTitle: noop,\n title(tooltipItems) {\n if (tooltipItems.length > 0) {\n const item = tooltipItems[0];\n const labels = item.chart.data.labels;\n const labelCount = labels ? labels.length : 0;\n if (this && this.options && this.options.mode === 'dataset') {\n return item.dataset.label || '';\n } else if (item.label) {\n return item.label;\n } else if (labelCount > 0 && item.dataIndex < labelCount) {\n return labels[item.dataIndex];\n }\n }\n return '';\n },\n afterTitle: noop,\n beforeBody: noop,\n beforeLabel: noop,\n label(tooltipItem) {\n if (this && this.options && this.options.mode === 'dataset') {\n return tooltipItem.label + ': ' + tooltipItem.formattedValue || tooltipItem.formattedValue;\n }\n let label = tooltipItem.dataset.label || '';\n if (label) {\n label += ': ';\n }\n const value = tooltipItem.formattedValue;\n if (!isNullOrUndef(value)) {\n label += value;\n }\n return label;\n },\n labelColor(tooltipItem) {\n const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n const options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n borderColor: options.borderColor,\n backgroundColor: options.backgroundColor,\n borderWidth: options.borderWidth,\n borderDash: options.borderDash,\n borderDashOffset: options.borderDashOffset,\n borderRadius: 0,\n };\n },\n labelTextColor() {\n return this.options.bodyColor;\n },\n labelPointStyle(tooltipItem) {\n const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n const options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n pointStyle: options.pointStyle,\n rotation: options.rotation,\n };\n },\n afterLabel: noop,\n afterBody: noop,\n beforeFooter: noop,\n footer: noop,\n afterFooter: noop\n }\n },\n defaultRoutes: {\n bodyFont: 'font',\n footerFont: 'font',\n titleFont: 'font'\n },\n descriptors: {\n _scriptable: (name) => name !== 'filter' && name !== 'itemSort' && name !== 'external',\n _indexable: false,\n callbacks: {\n _scriptable: false,\n _indexable: false,\n },\n animation: {\n _fallback: false\n },\n animations: {\n _fallback: 'animation'\n }\n },\n additionalOptionScopes: ['interaction']\n};\n\nvar plugins = /*#__PURE__*/Object.freeze({\n__proto__: null,\nDecimation: plugin_decimation,\nFiller: plugin_filler,\nLegend: plugin_legend,\nTitle: plugin_title,\nTooltip: plugin_tooltip\n});\n\nconst addIfString = (labels, raw, index) => typeof raw === 'string'\n ? labels.push(raw) - 1\n : isNaN(raw) ? null : index;\nfunction findOrAddLabel(labels, raw, index) {\n const first = labels.indexOf(raw);\n if (first === -1) {\n return addIfString(labels, raw, index);\n }\n const last = labels.lastIndexOf(raw);\n return first !== last ? index : first;\n}\nconst validIndex = (index, max) => index === null ? null : _limitValue(Math.round(index), 0, max);\nclass CategoryScale extends Scale {\n constructor(cfg) {\n super(cfg);\n this._startValue = undefined;\n this._valueRange = 0;\n }\n parse(raw, index) {\n if (isNullOrUndef(raw)) {\n return null;\n }\n const labels = this.getLabels();\n index = isFinite(index) && labels[index] === raw ? index\n : findOrAddLabel(labels, raw, valueOrDefault(index, raw));\n return validIndex(index, labels.length - 1);\n }\n determineDataLimits() {\n const me = this;\n const {minDefined, maxDefined} = me.getUserBounds();\n let {min, max} = me.getMinMax(true);\n if (me.options.bounds === 'ticks') {\n if (!minDefined) {\n min = 0;\n }\n if (!maxDefined) {\n max = me.getLabels().length - 1;\n }\n }\n me.min = min;\n me.max = max;\n }\n buildTicks() {\n const me = this;\n const min = me.min;\n const max = me.max;\n const offset = me.options.offset;\n const ticks = [];\n let labels = me.getLabels();\n labels = (min === 0 && max === labels.length - 1) ? labels : labels.slice(min, max + 1);\n me._valueRange = Math.max(labels.length - (offset ? 0 : 1), 1);\n me._startValue = me.min - (offset ? 0.5 : 0);\n for (let value = min; value <= max; value++) {\n ticks.push({value});\n }\n return ticks;\n }\n getLabelForValue(value) {\n const me = this;\n const labels = me.getLabels();\n if (value >= 0 && value < labels.length) {\n return labels[value];\n }\n return value;\n }\n configure() {\n const me = this;\n super.configure();\n if (!me.isHorizontal()) {\n me._reversePixels = !me._reversePixels;\n }\n }\n getPixelForValue(value) {\n const me = this;\n if (typeof value !== 'number') {\n value = me.parse(value);\n }\n return value === null ? NaN : me.getPixelForDecimal((value - me._startValue) / me._valueRange);\n }\n getPixelForTick(index) {\n const me = this;\n const ticks = me.ticks;\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n return me.getPixelForValue(ticks[index].value);\n }\n getValueForPixel(pixel) {\n const me = this;\n return Math.round(me._startValue + me.getDecimalForPixel(pixel) * me._valueRange);\n }\n getBasePixel() {\n return this.bottom;\n }\n}\nCategoryScale.id = 'category';\nCategoryScale.defaults = {\n ticks: {\n callback: CategoryScale.prototype.getLabelForValue\n }\n};\n\nfunction generateTicks$1(generationOptions, dataRange) {\n const ticks = [];\n const MIN_SPACING = 1e-14;\n const {bounds, step, min, max, precision, count, maxTicks, maxDigits, includeBounds} = generationOptions;\n const unit = step || 1;\n const maxSpaces = maxTicks - 1;\n const {min: rmin, max: rmax} = dataRange;\n const minDefined = !isNullOrUndef(min);\n const maxDefined = !isNullOrUndef(max);\n const countDefined = !isNullOrUndef(count);\n const minSpacing = (rmax - rmin) / (maxDigits + 1);\n let spacing = niceNum((rmax - rmin) / maxSpaces / unit) * unit;\n let factor, niceMin, niceMax, numSpaces;\n if (spacing < MIN_SPACING && !minDefined && !maxDefined) {\n return [{value: rmin}, {value: rmax}];\n }\n numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing);\n if (numSpaces > maxSpaces) {\n spacing = niceNum(numSpaces * spacing / maxSpaces / unit) * unit;\n }\n if (!isNullOrUndef(precision)) {\n factor = Math.pow(10, precision);\n spacing = Math.ceil(spacing * factor) / factor;\n }\n if (bounds === 'ticks') {\n niceMin = Math.floor(rmin / spacing) * spacing;\n niceMax = Math.ceil(rmax / spacing) * spacing;\n } else {\n niceMin = rmin;\n niceMax = rmax;\n }\n if (minDefined && maxDefined && step && almostWhole((max - min) / step, spacing / 1000)) {\n numSpaces = Math.min((max - min) / spacing, maxTicks);\n spacing = (max - min) / numSpaces;\n niceMin = min;\n niceMax = max;\n } else if (countDefined) {\n niceMin = minDefined ? min : niceMin;\n niceMax = maxDefined ? max : niceMax;\n numSpaces = count - 1;\n spacing = (niceMax - niceMin) / numSpaces;\n } else {\n numSpaces = (niceMax - niceMin) / spacing;\n if (almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {\n numSpaces = Math.round(numSpaces);\n } else {\n numSpaces = Math.ceil(numSpaces);\n }\n }\n const decimalPlaces = Math.max(\n _decimalPlaces(spacing),\n _decimalPlaces(niceMin),\n );\n factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);\n niceMin = Math.round(niceMin * factor) / factor;\n niceMax = Math.round(niceMax * factor) / factor;\n let j = 0;\n if (minDefined) {\n if (includeBounds && niceMin !== min) {\n ticks.push({value: min});\n if (niceMin < min) {\n j++;\n }\n if (almostEquals(Math.round((niceMin + j * spacing) * factor) / factor, min, relativeLabelSize(min, minSpacing, generationOptions))) {\n j++;\n }\n } else if (niceMin < min) {\n j++;\n }\n }\n for (; j < numSpaces; ++j) {\n ticks.push({value: Math.round((niceMin + j * spacing) * factor) / factor});\n }\n if (maxDefined && includeBounds && niceMax !== max) {\n if (almostEquals(ticks[ticks.length - 1].value, max, relativeLabelSize(max, minSpacing, generationOptions))) {\n ticks[ticks.length - 1].value = max;\n } else {\n ticks.push({value: max});\n }\n } else if (!maxDefined || niceMax === max) {\n ticks.push({value: niceMax});\n }\n return ticks;\n}\nfunction relativeLabelSize(value, minSpacing, {horizontal, minRotation}) {\n const rad = toRadians(minRotation);\n const ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;\n const length = 0.75 * minSpacing * ('' + value).length;\n return Math.min(minSpacing / ratio, length);\n}\nclass LinearScaleBase extends Scale {\n constructor(cfg) {\n super(cfg);\n this.start = undefined;\n this.end = undefined;\n this._startValue = undefined;\n this._endValue = undefined;\n this._valueRange = 0;\n }\n parse(raw, index) {\n if (isNullOrUndef(raw)) {\n return null;\n }\n if ((typeof raw === 'number' || raw instanceof Number) && !isFinite(+raw)) {\n return null;\n }\n return +raw;\n }\n handleTickRangeOptions() {\n const me = this;\n const {beginAtZero} = me.options;\n const {minDefined, maxDefined} = me.getUserBounds();\n let {min, max} = me;\n const setMin = v => (min = minDefined ? min : v);\n const setMax = v => (max = maxDefined ? max : v);\n if (beginAtZero) {\n const minSign = sign(min);\n const maxSign = sign(max);\n if (minSign < 0 && maxSign < 0) {\n setMax(0);\n } else if (minSign > 0 && maxSign > 0) {\n setMin(0);\n }\n }\n if (min === max) {\n setMax(max + 1);\n if (!beginAtZero) {\n setMin(min - 1);\n }\n }\n me.min = min;\n me.max = max;\n }\n getTickLimit() {\n const me = this;\n const tickOpts = me.options.ticks;\n let {maxTicksLimit, stepSize} = tickOpts;\n let maxTicks;\n if (stepSize) {\n maxTicks = Math.ceil(me.max / stepSize) - Math.floor(me.min / stepSize) + 1;\n } else {\n maxTicks = me.computeTickLimit();\n maxTicksLimit = maxTicksLimit || 11;\n }\n if (maxTicksLimit) {\n maxTicks = Math.min(maxTicksLimit, maxTicks);\n }\n return maxTicks;\n }\n computeTickLimit() {\n return Number.POSITIVE_INFINITY;\n }\n buildTicks() {\n const me = this;\n const opts = me.options;\n const tickOpts = opts.ticks;\n let maxTicks = me.getTickLimit();\n maxTicks = Math.max(2, maxTicks);\n const numericGeneratorOptions = {\n maxTicks,\n bounds: opts.bounds,\n min: opts.min,\n max: opts.max,\n precision: tickOpts.precision,\n step: tickOpts.stepSize,\n count: tickOpts.count,\n maxDigits: me._maxDigits(),\n horizontal: me.isHorizontal(),\n minRotation: tickOpts.minRotation || 0,\n includeBounds: tickOpts.includeBounds !== false\n };\n const dataRange = me._range || me;\n const ticks = generateTicks$1(numericGeneratorOptions, dataRange);\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, me, 'value');\n }\n if (opts.reverse) {\n ticks.reverse();\n me.start = me.max;\n me.end = me.min;\n } else {\n me.start = me.min;\n me.end = me.max;\n }\n return ticks;\n }\n configure() {\n const me = this;\n const ticks = me.ticks;\n let start = me.min;\n let end = me.max;\n super.configure();\n if (me.options.offset && ticks.length) {\n const offset = (end - start) / Math.max(ticks.length - 1, 1) / 2;\n start -= offset;\n end += offset;\n }\n me._startValue = start;\n me._endValue = end;\n me._valueRange = end - start;\n }\n getLabelForValue(value) {\n return formatNumber(value, this.chart.options.locale);\n }\n}\n\nclass LinearScale extends LinearScaleBase {\n determineDataLimits() {\n const me = this;\n const {min, max} = me.getMinMax(true);\n me.min = isNumberFinite(min) ? min : 0;\n me.max = isNumberFinite(max) ? max : 1;\n me.handleTickRangeOptions();\n }\n computeTickLimit() {\n const me = this;\n const horizontal = me.isHorizontal();\n const length = horizontal ? me.width : me.height;\n const minRotation = toRadians(me.options.ticks.minRotation);\n const ratio = (horizontal ? Math.sin(minRotation) : Math.cos(minRotation)) || 0.001;\n const tickFont = me._resolveTickFontOptions(0);\n return Math.ceil(length / Math.min(40, tickFont.lineHeight / ratio));\n }\n getPixelForValue(value) {\n return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);\n }\n getValueForPixel(pixel) {\n return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;\n }\n}\nLinearScale.id = 'linear';\nLinearScale.defaults = {\n ticks: {\n callback: Ticks.formatters.numeric\n }\n};\n\nfunction isMajor(tickVal) {\n const remain = tickVal / (Math.pow(10, Math.floor(log10(tickVal))));\n return remain === 1;\n}\nfunction generateTicks(generationOptions, dataRange) {\n const endExp = Math.floor(log10(dataRange.max));\n const endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));\n const ticks = [];\n let tickVal = finiteOrDefault(generationOptions.min, Math.pow(10, Math.floor(log10(dataRange.min))));\n let exp = Math.floor(log10(tickVal));\n let significand = Math.floor(tickVal / Math.pow(10, exp));\n let precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;\n do {\n ticks.push({value: tickVal, major: isMajor(tickVal)});\n ++significand;\n if (significand === 10) {\n significand = 1;\n ++exp;\n precision = exp >= 0 ? 1 : precision;\n }\n tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;\n } while (exp < endExp || (exp === endExp && significand < endSignificand));\n const lastTick = finiteOrDefault(generationOptions.max, tickVal);\n ticks.push({value: lastTick, major: isMajor(tickVal)});\n return ticks;\n}\nclass LogarithmicScale extends Scale {\n constructor(cfg) {\n super(cfg);\n this.start = undefined;\n this.end = undefined;\n this._startValue = undefined;\n this._valueRange = 0;\n }\n parse(raw, index) {\n const value = LinearScaleBase.prototype.parse.apply(this, [raw, index]);\n if (value === 0) {\n this._zero = true;\n return undefined;\n }\n return isNumberFinite(value) && value > 0 ? value : null;\n }\n determineDataLimits() {\n const me = this;\n const {min, max} = me.getMinMax(true);\n me.min = isNumberFinite(min) ? Math.max(0, min) : null;\n me.max = isNumberFinite(max) ? Math.max(0, max) : null;\n if (me.options.beginAtZero) {\n me._zero = true;\n }\n me.handleTickRangeOptions();\n }\n handleTickRangeOptions() {\n const me = this;\n const {minDefined, maxDefined} = me.getUserBounds();\n let min = me.min;\n let max = me.max;\n const setMin = v => (min = minDefined ? min : v);\n const setMax = v => (max = maxDefined ? max : v);\n const exp = (v, m) => Math.pow(10, Math.floor(log10(v)) + m);\n if (min === max) {\n if (min <= 0) {\n setMin(1);\n setMax(10);\n } else {\n setMin(exp(min, -1));\n setMax(exp(max, +1));\n }\n }\n if (min <= 0) {\n setMin(exp(max, -1));\n }\n if (max <= 0) {\n setMax(exp(min, +1));\n }\n if (me._zero && me.min !== me._suggestedMin && min === exp(me.min, 0)) {\n setMin(exp(min, -1));\n }\n me.min = min;\n me.max = max;\n }\n buildTicks() {\n const me = this;\n const opts = me.options;\n const generationOptions = {\n min: me._userMin,\n max: me._userMax\n };\n const ticks = generateTicks(generationOptions, me);\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, me, 'value');\n }\n if (opts.reverse) {\n ticks.reverse();\n me.start = me.max;\n me.end = me.min;\n } else {\n me.start = me.min;\n me.end = me.max;\n }\n return ticks;\n }\n getLabelForValue(value) {\n return value === undefined ? '0' : formatNumber(value, this.chart.options.locale);\n }\n configure() {\n const me = this;\n const start = me.min;\n super.configure();\n me._startValue = log10(start);\n me._valueRange = log10(me.max) - log10(start);\n }\n getPixelForValue(value) {\n const me = this;\n if (value === undefined || value === 0) {\n value = me.min;\n }\n if (value === null || isNaN(value)) {\n return NaN;\n }\n return me.getPixelForDecimal(value === me.min\n ? 0\n : (log10(value) - me._startValue) / me._valueRange);\n }\n getValueForPixel(pixel) {\n const me = this;\n const decimal = me.getDecimalForPixel(pixel);\n return Math.pow(10, me._startValue + decimal * me._valueRange);\n }\n}\nLogarithmicScale.id = 'logarithmic';\nLogarithmicScale.defaults = {\n ticks: {\n callback: Ticks.formatters.logarithmic,\n major: {\n enabled: true\n }\n }\n};\n\nfunction getTickBackdropHeight(opts) {\n const tickOpts = opts.ticks;\n if (tickOpts.display && opts.display) {\n const padding = toPadding(tickOpts.backdropPadding);\n return valueOrDefault(tickOpts.font && tickOpts.font.size, defaults.font.size) + padding.height;\n }\n return 0;\n}\nfunction measureLabelSize(ctx, lineHeight, label) {\n if (isArray(label)) {\n return {\n w: _longestText(ctx, ctx.font, label),\n h: label.length * lineHeight\n };\n }\n return {\n w: ctx.measureText(label).width,\n h: lineHeight\n };\n}\nfunction determineLimits(angle, pos, size, min, max) {\n if (angle === min || angle === max) {\n return {\n start: pos - (size / 2),\n end: pos + (size / 2)\n };\n } else if (angle < min || angle > max) {\n return {\n start: pos - size,\n end: pos\n };\n }\n return {\n start: pos,\n end: pos + size\n };\n}\nfunction fitWithPointLabels(scale) {\n const furthestLimits = {\n l: 0,\n r: scale.width,\n t: 0,\n b: scale.height - scale.paddingTop\n };\n const furthestAngles = {};\n let i, textSize, pointPosition;\n const labelSizes = [];\n const padding = [];\n const valueCount = scale.getLabels().length;\n for (i = 0; i < valueCount; i++) {\n const opts = scale.options.pointLabels.setContext(scale.getContext(i));\n padding[i] = opts.padding;\n pointPosition = scale.getPointPosition(i, scale.drawingArea + padding[i]);\n const plFont = toFont(opts.font);\n scale.ctx.font = plFont.string;\n textSize = measureLabelSize(scale.ctx, plFont.lineHeight, scale._pointLabels[i]);\n labelSizes[i] = textSize;\n const angleRadians = scale.getIndexAngle(i);\n const angle = toDegrees(angleRadians);\n const hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);\n const vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);\n if (hLimits.start < furthestLimits.l) {\n furthestLimits.l = hLimits.start;\n furthestAngles.l = angleRadians;\n }\n if (hLimits.end > furthestLimits.r) {\n furthestLimits.r = hLimits.end;\n furthestAngles.r = angleRadians;\n }\n if (vLimits.start < furthestLimits.t) {\n furthestLimits.t = vLimits.start;\n furthestAngles.t = angleRadians;\n }\n if (vLimits.end > furthestLimits.b) {\n furthestLimits.b = vLimits.end;\n furthestAngles.b = angleRadians;\n }\n }\n scale._setReductions(scale.drawingArea, furthestLimits, furthestAngles);\n scale._pointLabelItems = [];\n const opts = scale.options;\n const tickBackdropHeight = getTickBackdropHeight(opts);\n const outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);\n for (i = 0; i < valueCount; i++) {\n const extra = (i === 0 ? tickBackdropHeight / 2 : 0);\n const pointLabelPosition = scale.getPointPosition(i, outerDistance + extra + padding[i]);\n const angle = toDegrees(scale.getIndexAngle(i));\n const size = labelSizes[i];\n adjustPointPositionForLabelHeight(angle, size, pointLabelPosition);\n const textAlign = getTextAlignForAngle(angle);\n let left;\n if (textAlign === 'left') {\n left = pointLabelPosition.x;\n } else if (textAlign === 'center') {\n left = pointLabelPosition.x - (size.w / 2);\n } else {\n left = pointLabelPosition.x - size.w;\n }\n const right = left + size.w;\n scale._pointLabelItems[i] = {\n x: pointLabelPosition.x,\n y: pointLabelPosition.y,\n textAlign,\n left,\n top: pointLabelPosition.y,\n right,\n bottom: pointLabelPosition.y + size.h,\n };\n }\n}\nfunction getTextAlignForAngle(angle) {\n if (angle === 0 || angle === 180) {\n return 'center';\n } else if (angle < 180) {\n return 'left';\n }\n return 'right';\n}\nfunction adjustPointPositionForLabelHeight(angle, textSize, position) {\n if (angle === 90 || angle === 270) {\n position.y -= (textSize.h / 2);\n } else if (angle > 270 || angle < 90) {\n position.y -= textSize.h;\n }\n}\nfunction drawPointLabels(scale, labelCount) {\n const {ctx, options: {pointLabels}} = scale;\n for (let i = labelCount - 1; i >= 0; i--) {\n const optsAtIndex = pointLabels.setContext(scale.getContext(i));\n const plFont = toFont(optsAtIndex.font);\n const {x, y, textAlign, left, top, right, bottom} = scale._pointLabelItems[i];\n const {backdropColor} = optsAtIndex;\n if (!isNullOrUndef(backdropColor)) {\n const padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillStyle = backdropColor;\n ctx.fillRect(left - padding.left, top - padding.top, right - left + padding.width, bottom - top + padding.height);\n }\n renderText(\n ctx,\n scale._pointLabels[i],\n x,\n y + (plFont.lineHeight / 2),\n plFont,\n {\n color: optsAtIndex.color,\n textAlign: textAlign,\n textBaseline: 'middle'\n }\n );\n }\n}\nfunction pathRadiusLine(scale, radius, circular, labelCount) {\n const {ctx} = scale;\n if (circular) {\n ctx.arc(scale.xCenter, scale.yCenter, radius, 0, TAU);\n } else {\n let pointPosition = scale.getPointPosition(0, radius);\n ctx.moveTo(pointPosition.x, pointPosition.y);\n for (let i = 1; i < labelCount; i++) {\n pointPosition = scale.getPointPosition(i, radius);\n ctx.lineTo(pointPosition.x, pointPosition.y);\n }\n }\n}\nfunction drawRadiusLine(scale, gridLineOpts, radius, labelCount) {\n const ctx = scale.ctx;\n const circular = gridLineOpts.circular;\n const {color, lineWidth} = gridLineOpts;\n if ((!circular && !labelCount) || !color || !lineWidth || radius < 0) {\n return;\n }\n ctx.save();\n ctx.strokeStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash(gridLineOpts.borderDash);\n ctx.lineDashOffset = gridLineOpts.borderDashOffset;\n ctx.beginPath();\n pathRadiusLine(scale, radius, circular, labelCount);\n ctx.closePath();\n ctx.stroke();\n ctx.restore();\n}\nfunction numberOrZero(param) {\n return isNumber(param) ? param : 0;\n}\nclass RadialLinearScale extends LinearScaleBase {\n constructor(cfg) {\n super(cfg);\n this.xCenter = undefined;\n this.yCenter = undefined;\n this.drawingArea = undefined;\n this._pointLabels = [];\n this._pointLabelItems = [];\n }\n setDimensions() {\n const me = this;\n me.width = me.maxWidth;\n me.height = me.maxHeight;\n me.paddingTop = getTickBackdropHeight(me.options) / 2;\n me.xCenter = Math.floor(me.width / 2);\n me.yCenter = Math.floor((me.height - me.paddingTop) / 2);\n me.drawingArea = Math.min(me.height - me.paddingTop, me.width) / 2;\n }\n determineDataLimits() {\n const me = this;\n const {min, max} = me.getMinMax(false);\n me.min = isNumberFinite(min) && !isNaN(min) ? min : 0;\n me.max = isNumberFinite(max) && !isNaN(max) ? max : 0;\n me.handleTickRangeOptions();\n }\n computeTickLimit() {\n return Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));\n }\n generateTickLabels(ticks) {\n const me = this;\n LinearScaleBase.prototype.generateTickLabels.call(me, ticks);\n me._pointLabels = me.getLabels().map((value, index) => {\n const label = callback(me.options.pointLabels.callback, [value, index], me);\n return label || label === 0 ? label : '';\n });\n }\n fit() {\n const me = this;\n const opts = me.options;\n if (opts.display && opts.pointLabels.display) {\n fitWithPointLabels(me);\n } else {\n me.setCenterPoint(0, 0, 0, 0);\n }\n }\n _setReductions(largestPossibleRadius, furthestLimits, furthestAngles) {\n const me = this;\n let radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l);\n let radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r);\n let radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t);\n let radiusReductionBottom = -Math.max(furthestLimits.b - (me.height - me.paddingTop), 0) / Math.cos(furthestAngles.b);\n radiusReductionLeft = numberOrZero(radiusReductionLeft);\n radiusReductionRight = numberOrZero(radiusReductionRight);\n radiusReductionTop = numberOrZero(radiusReductionTop);\n radiusReductionBottom = numberOrZero(radiusReductionBottom);\n me.drawingArea = Math.max(largestPossibleRadius / 2, Math.min(\n Math.floor(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2),\n Math.floor(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2)));\n me.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom);\n }\n setCenterPoint(leftMovement, rightMovement, topMovement, bottomMovement) {\n const me = this;\n const maxRight = me.width - rightMovement - me.drawingArea;\n const maxLeft = leftMovement + me.drawingArea;\n const maxTop = topMovement + me.drawingArea;\n const maxBottom = (me.height - me.paddingTop) - bottomMovement - me.drawingArea;\n me.xCenter = Math.floor(((maxLeft + maxRight) / 2) + me.left);\n me.yCenter = Math.floor(((maxTop + maxBottom) / 2) + me.top + me.paddingTop);\n }\n getIndexAngle(index) {\n const angleMultiplier = TAU / this.getLabels().length;\n const startAngle = this.options.startAngle || 0;\n return _normalizeAngle(index * angleMultiplier + toRadians(startAngle));\n }\n getDistanceFromCenterForValue(value) {\n const me = this;\n if (isNullOrUndef(value)) {\n return NaN;\n }\n const scalingFactor = me.drawingArea / (me.max - me.min);\n if (me.options.reverse) {\n return (me.max - value) * scalingFactor;\n }\n return (value - me.min) * scalingFactor;\n }\n getValueForDistanceFromCenter(distance) {\n if (isNullOrUndef(distance)) {\n return NaN;\n }\n const me = this;\n const scaledDistance = distance / (me.drawingArea / (me.max - me.min));\n return me.options.reverse ? me.max - scaledDistance : me.min + scaledDistance;\n }\n getPointPosition(index, distanceFromCenter) {\n const me = this;\n const angle = me.getIndexAngle(index) - HALF_PI;\n return {\n x: Math.cos(angle) * distanceFromCenter + me.xCenter,\n y: Math.sin(angle) * distanceFromCenter + me.yCenter,\n angle\n };\n }\n getPointPositionForValue(index, value) {\n return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));\n }\n getBasePosition(index) {\n return this.getPointPositionForValue(index || 0, this.getBaseValue());\n }\n getPointLabelPosition(index) {\n const {left, top, right, bottom} = this._pointLabelItems[index];\n return {\n left,\n top,\n right,\n bottom,\n };\n }\n drawBackground() {\n const me = this;\n const {backgroundColor, grid: {circular}} = me.options;\n if (backgroundColor) {\n const ctx = me.ctx;\n ctx.save();\n ctx.beginPath();\n pathRadiusLine(me, me.getDistanceFromCenterForValue(me._endValue), circular, me.getLabels().length);\n ctx.closePath();\n ctx.fillStyle = backgroundColor;\n ctx.fill();\n ctx.restore();\n }\n }\n drawGrid() {\n const me = this;\n const ctx = me.ctx;\n const opts = me.options;\n const {angleLines, grid} = opts;\n const labelCount = me.getLabels().length;\n let i, offset, position;\n if (opts.pointLabels.display) {\n drawPointLabels(me, labelCount);\n }\n if (grid.display) {\n me.ticks.forEach((tick, index) => {\n if (index !== 0) {\n offset = me.getDistanceFromCenterForValue(tick.value);\n const optsAtIndex = grid.setContext(me.getContext(index - 1));\n drawRadiusLine(me, optsAtIndex, offset, labelCount);\n }\n });\n }\n if (angleLines.display) {\n ctx.save();\n for (i = me.getLabels().length - 1; i >= 0; i--) {\n const optsAtIndex = angleLines.setContext(me.getContext(i));\n const {color, lineWidth} = optsAtIndex;\n if (!lineWidth || !color) {\n continue;\n }\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = color;\n ctx.setLineDash(optsAtIndex.borderDash);\n ctx.lineDashOffset = optsAtIndex.borderDashOffset;\n offset = me.getDistanceFromCenterForValue(opts.ticks.reverse ? me.min : me.max);\n position = me.getPointPosition(i, offset);\n ctx.beginPath();\n ctx.moveTo(me.xCenter, me.yCenter);\n ctx.lineTo(position.x, position.y);\n ctx.stroke();\n }\n ctx.restore();\n }\n }\n drawBorder() {}\n drawLabels() {\n const me = this;\n const ctx = me.ctx;\n const opts = me.options;\n const tickOpts = opts.ticks;\n if (!tickOpts.display) {\n return;\n }\n const startAngle = me.getIndexAngle(0);\n let offset, width;\n ctx.save();\n ctx.translate(me.xCenter, me.yCenter);\n ctx.rotate(startAngle);\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n me.ticks.forEach((tick, index) => {\n if (index === 0 && !opts.reverse) {\n return;\n }\n const optsAtIndex = tickOpts.setContext(me.getContext(index));\n const tickFont = toFont(optsAtIndex.font);\n offset = me.getDistanceFromCenterForValue(me.ticks[index].value);\n if (optsAtIndex.showLabelBackdrop) {\n width = ctx.measureText(tick.label).width;\n ctx.fillStyle = optsAtIndex.backdropColor;\n const padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillRect(\n -width / 2 - padding.left,\n -offset - tickFont.size / 2 - padding.top,\n width + padding.width,\n tickFont.size + padding.height\n );\n }\n renderText(ctx, tick.label, 0, -offset, tickFont, {\n color: optsAtIndex.color,\n });\n });\n ctx.restore();\n }\n drawTitle() {}\n}\nRadialLinearScale.id = 'radialLinear';\nRadialLinearScale.defaults = {\n display: true,\n animate: true,\n position: 'chartArea',\n angleLines: {\n display: true,\n lineWidth: 1,\n borderDash: [],\n borderDashOffset: 0.0\n },\n grid: {\n circular: false\n },\n startAngle: 0,\n ticks: {\n showLabelBackdrop: true,\n callback: Ticks.formatters.numeric\n },\n pointLabels: {\n backdropColor: undefined,\n backdropPadding: 2,\n display: true,\n font: {\n size: 10\n },\n callback(label) {\n return label;\n },\n padding: 5\n }\n};\nRadialLinearScale.defaultRoutes = {\n 'angleLines.color': 'borderColor',\n 'pointLabels.color': 'color',\n 'ticks.color': 'color'\n};\nRadialLinearScale.descriptors = {\n angleLines: {\n _fallback: 'grid'\n }\n};\n\nconst INTERVALS = {\n millisecond: {common: true, size: 1, steps: 1000},\n second: {common: true, size: 1000, steps: 60},\n minute: {common: true, size: 60000, steps: 60},\n hour: {common: true, size: 3600000, steps: 24},\n day: {common: true, size: 86400000, steps: 30},\n week: {common: false, size: 604800000, steps: 4},\n month: {common: true, size: 2.628e9, steps: 12},\n quarter: {common: false, size: 7.884e9, steps: 4},\n year: {common: true, size: 3.154e10}\n};\nconst UNITS = (Object.keys(INTERVALS));\nfunction sorter(a, b) {\n return a - b;\n}\nfunction parse(scale, input) {\n if (isNullOrUndef(input)) {\n return null;\n }\n const adapter = scale._adapter;\n const {parser, round, isoWeekday} = scale._parseOpts;\n let value = input;\n if (typeof parser === 'function') {\n value = parser(value);\n }\n if (!isNumberFinite(value)) {\n value = typeof parser === 'string'\n ? adapter.parse(value, parser)\n : adapter.parse(value);\n }\n if (value === null) {\n return null;\n }\n if (round) {\n value = round === 'week' && (isNumber(isoWeekday) || isoWeekday === true)\n ? adapter.startOf(value, 'isoWeek', isoWeekday)\n : adapter.startOf(value, round);\n }\n return +value;\n}\nfunction determineUnitForAutoTicks(minUnit, min, max, capacity) {\n const ilen = UNITS.length;\n for (let i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {\n const interval = INTERVALS[UNITS[i]];\n const factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER;\n if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {\n return UNITS[i];\n }\n }\n return UNITS[ilen - 1];\n}\nfunction determineUnitForFormatting(scale, numTicks, minUnit, min, max) {\n for (let i = UNITS.length - 1; i >= UNITS.indexOf(minUnit); i--) {\n const unit = UNITS[i];\n if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= numTicks - 1) {\n return unit;\n }\n }\n return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];\n}\nfunction determineMajorUnit(unit) {\n for (let i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {\n if (INTERVALS[UNITS[i]].common) {\n return UNITS[i];\n }\n }\n}\nfunction addTick(ticks, time, timestamps) {\n if (!timestamps) {\n ticks[time] = true;\n } else if (timestamps.length) {\n const {lo, hi} = _lookup(timestamps, time);\n const timestamp = timestamps[lo] >= time ? timestamps[lo] : timestamps[hi];\n ticks[timestamp] = true;\n }\n}\nfunction setMajorTicks(scale, ticks, map, majorUnit) {\n const adapter = scale._adapter;\n const first = +adapter.startOf(ticks[0].value, majorUnit);\n const last = ticks[ticks.length - 1].value;\n let major, index;\n for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {\n index = map[major];\n if (index >= 0) {\n ticks[index].major = true;\n }\n }\n return ticks;\n}\nfunction ticksFromTimestamps(scale, values, majorUnit) {\n const ticks = [];\n const map = {};\n const ilen = values.length;\n let i, value;\n for (i = 0; i < ilen; ++i) {\n value = values[i];\n map[value] = i;\n ticks.push({\n value,\n major: false\n });\n }\n return (ilen === 0 || !majorUnit) ? ticks : setMajorTicks(scale, ticks, map, majorUnit);\n}\nclass TimeScale extends Scale {\n constructor(props) {\n super(props);\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n this._unit = 'day';\n this._majorUnit = undefined;\n this._offsets = {};\n this._normalized = false;\n this._parseOpts = undefined;\n }\n init(scaleOpts, opts) {\n const time = scaleOpts.time || (scaleOpts.time = {});\n const adapter = this._adapter = new adapters._date(scaleOpts.adapters.date);\n mergeIf(time.displayFormats, adapter.formats());\n this._parseOpts = {\n parser: time.parser,\n round: time.round,\n isoWeekday: time.isoWeekday\n };\n super.init(scaleOpts);\n this._normalized = opts.normalized;\n }\n parse(raw, index) {\n if (raw === undefined) {\n return null;\n }\n return parse(this, raw);\n }\n beforeLayout() {\n super.beforeLayout();\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n }\n determineDataLimits() {\n const me = this;\n const options = me.options;\n const adapter = me._adapter;\n const unit = options.time.unit || 'day';\n let {min, max, minDefined, maxDefined} = me.getUserBounds();\n function _applyBounds(bounds) {\n if (!minDefined && !isNaN(bounds.min)) {\n min = Math.min(min, bounds.min);\n }\n if (!maxDefined && !isNaN(bounds.max)) {\n max = Math.max(max, bounds.max);\n }\n }\n if (!minDefined || !maxDefined) {\n _applyBounds(me._getLabelBounds());\n if (options.bounds !== 'ticks' || options.ticks.source !== 'labels') {\n _applyBounds(me.getMinMax(false));\n }\n }\n min = isNumberFinite(min) && !isNaN(min) ? min : +adapter.startOf(Date.now(), unit);\n max = isNumberFinite(max) && !isNaN(max) ? max : +adapter.endOf(Date.now(), unit) + 1;\n me.min = Math.min(min, max - 1);\n me.max = Math.max(min + 1, max);\n }\n _getLabelBounds() {\n const arr = this.getLabelTimestamps();\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n if (arr.length) {\n min = arr[0];\n max = arr[arr.length - 1];\n }\n return {min, max};\n }\n buildTicks() {\n const me = this;\n const options = me.options;\n const timeOpts = options.time;\n const tickOpts = options.ticks;\n const timestamps = tickOpts.source === 'labels' ? me.getLabelTimestamps() : me._generate();\n if (options.bounds === 'ticks' && timestamps.length) {\n me.min = me._userMin || timestamps[0];\n me.max = me._userMax || timestamps[timestamps.length - 1];\n }\n const min = me.min;\n const max = me.max;\n const ticks = _filterBetween(timestamps, min, max);\n me._unit = timeOpts.unit || (tickOpts.autoSkip\n ? determineUnitForAutoTicks(timeOpts.minUnit, me.min, me.max, me._getLabelCapacity(min))\n : determineUnitForFormatting(me, ticks.length, timeOpts.minUnit, me.min, me.max));\n me._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined\n : determineMajorUnit(me._unit);\n me.initOffsets(timestamps);\n if (options.reverse) {\n ticks.reverse();\n }\n return ticksFromTimestamps(me, ticks, me._majorUnit);\n }\n initOffsets(timestamps) {\n const me = this;\n let start = 0;\n let end = 0;\n let first, last;\n if (me.options.offset && timestamps.length) {\n first = me.getDecimalForValue(timestamps[0]);\n if (timestamps.length === 1) {\n start = 1 - first;\n } else {\n start = (me.getDecimalForValue(timestamps[1]) - first) / 2;\n }\n last = me.getDecimalForValue(timestamps[timestamps.length - 1]);\n if (timestamps.length === 1) {\n end = last;\n } else {\n end = (last - me.getDecimalForValue(timestamps[timestamps.length - 2])) / 2;\n }\n }\n const limit = timestamps.length < 3 ? 0.5 : 0.25;\n start = _limitValue(start, 0, limit);\n end = _limitValue(end, 0, limit);\n me._offsets = {start, end, factor: 1 / (start + 1 + end)};\n }\n _generate() {\n const me = this;\n const adapter = me._adapter;\n const min = me.min;\n const max = me.max;\n const options = me.options;\n const timeOpts = options.time;\n const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, me._getLabelCapacity(min));\n const stepSize = valueOrDefault(timeOpts.stepSize, 1);\n const weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n const hasWeekday = isNumber(weekday) || weekday === true;\n const ticks = {};\n let first = min;\n let time, count;\n if (hasWeekday) {\n first = +adapter.startOf(first, 'isoWeek', weekday);\n }\n first = +adapter.startOf(first, hasWeekday ? 'day' : minor);\n if (adapter.diff(max, min, minor) > 100000 * stepSize) {\n throw new Error(min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor);\n }\n const timestamps = options.ticks.source === 'data' && me.getDataTimestamps();\n for (time = first, count = 0; time < max; time = +adapter.add(time, stepSize, minor), count++) {\n addTick(ticks, time, timestamps);\n }\n if (time === max || options.bounds === 'ticks' || count === 1) {\n addTick(ticks, time, timestamps);\n }\n return Object.keys(ticks).sort((a, b) => a - b).map(x => +x);\n }\n getLabelForValue(value) {\n const me = this;\n const adapter = me._adapter;\n const timeOpts = me.options.time;\n if (timeOpts.tooltipFormat) {\n return adapter.format(value, timeOpts.tooltipFormat);\n }\n return adapter.format(value, timeOpts.displayFormats.datetime);\n }\n _tickFormatFunction(time, index, ticks, format) {\n const me = this;\n const options = me.options;\n const formats = options.time.displayFormats;\n const unit = me._unit;\n const majorUnit = me._majorUnit;\n const minorFormat = unit && formats[unit];\n const majorFormat = majorUnit && formats[majorUnit];\n const tick = ticks[index];\n const major = majorUnit && majorFormat && tick && tick.major;\n const label = me._adapter.format(time, format || (major ? majorFormat : minorFormat));\n const formatter = options.ticks.callback;\n return formatter ? callback(formatter, [label, index, ticks], me) : label;\n }\n generateTickLabels(ticks) {\n let i, ilen, tick;\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n tick.label = this._tickFormatFunction(tick.value, i, ticks);\n }\n }\n getDecimalForValue(value) {\n const me = this;\n return value === null ? NaN : (value - me.min) / (me.max - me.min);\n }\n getPixelForValue(value) {\n const me = this;\n const offsets = me._offsets;\n const pos = me.getDecimalForValue(value);\n return me.getPixelForDecimal((offsets.start + pos) * offsets.factor);\n }\n getValueForPixel(pixel) {\n const me = this;\n const offsets = me._offsets;\n const pos = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return me.min + pos * (me.max - me.min);\n }\n _getLabelSize(label) {\n const me = this;\n const ticksOpts = me.options.ticks;\n const tickLabelWidth = me.ctx.measureText(label).width;\n const angle = toRadians(me.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);\n const cosRotation = Math.cos(angle);\n const sinRotation = Math.sin(angle);\n const tickFontSize = me._resolveTickFontOptions(0).size;\n return {\n w: (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation),\n h: (tickLabelWidth * sinRotation) + (tickFontSize * cosRotation)\n };\n }\n _getLabelCapacity(exampleTime) {\n const me = this;\n const timeOpts = me.options.time;\n const displayFormats = timeOpts.displayFormats;\n const format = displayFormats[timeOpts.unit] || displayFormats.millisecond;\n const exampleLabel = me._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(me, [exampleTime], me._majorUnit), format);\n const size = me._getLabelSize(exampleLabel);\n const capacity = Math.floor(me.isHorizontal() ? me.width / size.w : me.height / size.h) - 1;\n return capacity > 0 ? capacity : 1;\n }\n getDataTimestamps() {\n const me = this;\n let timestamps = me._cache.data || [];\n let i, ilen;\n if (timestamps.length) {\n return timestamps;\n }\n const metas = me.getMatchingVisibleMetas();\n if (me._normalized && metas.length) {\n return (me._cache.data = metas[0].controller.getAllParsedValues(me));\n }\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n timestamps = timestamps.concat(metas[i].controller.getAllParsedValues(me));\n }\n return (me._cache.data = me.normalize(timestamps));\n }\n getLabelTimestamps() {\n const me = this;\n const timestamps = me._cache.labels || [];\n let i, ilen;\n if (timestamps.length) {\n return timestamps;\n }\n const labels = me.getLabels();\n for (i = 0, ilen = labels.length; i < ilen; ++i) {\n timestamps.push(parse(me, labels[i]));\n }\n return (me._cache.labels = me._normalized ? timestamps : me.normalize(timestamps));\n }\n normalize(values) {\n return _arrayUnique(values.sort(sorter));\n }\n}\nTimeScale.id = 'time';\nTimeScale.defaults = {\n bounds: 'data',\n adapters: {},\n time: {\n parser: false,\n unit: false,\n round: false,\n isoWeekday: false,\n minUnit: 'millisecond',\n displayFormats: {}\n },\n ticks: {\n source: 'auto',\n major: {\n enabled: false\n }\n }\n};\n\nfunction interpolate(table, val, reverse) {\n let prevSource, nextSource, prevTarget, nextTarget;\n if (reverse) {\n prevSource = Math.floor(val);\n nextSource = Math.ceil(val);\n prevTarget = table[prevSource];\n nextTarget = table[nextSource];\n } else {\n const result = _lookup(table, val);\n prevTarget = result.lo;\n nextTarget = result.hi;\n prevSource = table[prevTarget];\n nextSource = table[nextTarget];\n }\n const span = nextSource - prevSource;\n return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;\n}\nclass TimeSeriesScale extends TimeScale {\n constructor(props) {\n super(props);\n this._table = [];\n this._maxIndex = undefined;\n }\n initOffsets() {\n const me = this;\n const timestamps = me._getTimestampsForTable();\n me._table = me.buildLookupTable(timestamps);\n me._maxIndex = me._table.length - 1;\n super.initOffsets(timestamps);\n }\n buildLookupTable(timestamps) {\n const me = this;\n const {min, max} = me;\n if (!timestamps.length) {\n return [\n {time: min, pos: 0},\n {time: max, pos: 1}\n ];\n }\n const items = [min];\n let i, ilen, curr;\n for (i = 0, ilen = timestamps.length; i < ilen; ++i) {\n curr = timestamps[i];\n if (curr > min && curr < max) {\n items.push(curr);\n }\n }\n items.push(max);\n return items;\n }\n _getTimestampsForTable() {\n const me = this;\n let timestamps = me._cache.all || [];\n if (timestamps.length) {\n return timestamps;\n }\n const data = me.getDataTimestamps();\n const label = me.getLabelTimestamps();\n if (data.length && label.length) {\n timestamps = me.normalize(data.concat(label));\n } else {\n timestamps = data.length ? data : label;\n }\n timestamps = me._cache.all = timestamps;\n return timestamps;\n }\n getPixelForValue(value, index) {\n const me = this;\n const offsets = me._offsets;\n const pos = me._normalized && me._maxIndex > 0 && !isNullOrUndef(index)\n ? index / me._maxIndex : me.getDecimalForValue(value);\n return me.getPixelForDecimal((offsets.start + pos) * offsets.factor);\n }\n getDecimalForValue(value) {\n return interpolate(this._table, value) / this._maxIndex;\n }\n getValueForPixel(pixel) {\n const me = this;\n const offsets = me._offsets;\n const decimal = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return interpolate(me._table, decimal * this._maxIndex, true);\n }\n}\nTimeSeriesScale.id = 'timeseries';\nTimeSeriesScale.defaults = TimeScale.defaults;\n\nvar scales = /*#__PURE__*/Object.freeze({\n__proto__: null,\nCategoryScale: CategoryScale,\nLinearScale: LinearScale,\nLogarithmicScale: LogarithmicScale,\nRadialLinearScale: RadialLinearScale,\nTimeScale: TimeScale,\nTimeSeriesScale: TimeSeriesScale\n});\n\nconst registerables = [\n controllers,\n elements,\n plugins,\n scales,\n];\n\nexport { Animation, Animations, ArcElement, BarController, BarElement, BasePlatform, BasicPlatform, BubbleController, CategoryScale, Chart, DatasetController, plugin_decimation as Decimation, DomPlatform, DoughnutController, Element, plugin_filler as Filler, Interaction, plugin_legend as Legend, LineController, LineElement, LinearScale, LogarithmicScale, PieController, PointElement, PolarAreaController, RadarController, RadialLinearScale, Scale, ScatterController, Ticks, TimeScale, TimeSeriesScale, plugin_title as Title, plugin_tooltip as Tooltip, adapters as _adapters, animator, controllers, elements, layouts, plugins, registerables, registry, scales };\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,CAAC,IAAIC,gBAAd,EAAgCC,CAAC,IAAIC,OAArC,EAA8CC,CAAC,IAAIC,OAAnD,EAA4DC,CAAC,IAAIC,MAAjE,EAAwEC,CAAC,IA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