From ad123bec78478899ba2294574ca047ddfa1492d8 Mon Sep 17 00:00:00 2001 From: piglione73 Date: Thu, 15 Mar 2018 17:10:08 +0100 Subject: [PATCH 1/4] Fork started --- .gitignore | 1 + gauge.min.js.map | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d1ec22f9..80ef9d30 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ dist/ complexity/ *es6.js test/cjs/bundle.js +package-lock.json diff --git a/gauge.min.js.map b/gauge.min.js.map index 1f0d7483..34a50f79 100644 --- a/gauge.min.js.map +++ b/gauge.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["gauge.min.js"],"names":["ns","_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_possibleConstructorReturn","self","call","ReferenceError","_inherits","subClass","superClass","TypeError","prototype","Object","create","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","_classCallCheck","instance","Constructor","vendorize","prop","window","global","vendors","s","capitalized","charAt","toUpperCase","substr","vendorProp","step","time","draw","start","rule","duration","end","anim","progress","percent","animationTransformed","isFinite","isNaN","frame","requestAnimationFrame","inProgress","Collection","apply","this","arguments","verifyError","err","DOMException","result","prepareTicks","options","majorTicks","push","drawings","formatMajorTickNumber","minValue","maxValue","tickSide","roundRect","context","x","y","w","h","r","beginPath","moveTo","lineTo","quadraticCurveTo","closePath","padValue","val","dec","valueDec","int","valueInt","strVal","n","parseFloat","Math","abs","toFixed","toString","split","round","num","right","hasDec","majorTicksDec","majorTicksInt","indexOf","join","replace","radians","degrees","PI","radialPoint","radius","angle","sin","cos","linearGradient","colorFrom","colorTo","isVertical","undefined","grad","createLinearGradient","addColorStop","drawShadow","restore","save","borderShadowWidth","shadowBlur","shadowColor","colorBorderShadow","drawNeedleShadow","needleShadow","shadowOffsetX","shadowOffsetY","colorNeedleShadowDown","font","target","baseSize","reset","strokeStyle","lineWidth","drawValueTextShadow","offset","blur","valueTextShadow","colorValueTextShadow","drawValueBox","max","valueBox","addLength","maxValueWidth","repeat","String","parseInt","concat","map","text","valueText","tunit","runit","tw","measureText","Number","width","th","fontValueSize","sw","valueBoxStroke","bmax","bw","bh","br","valueBoxBorderRadius","obw","valueBoxWidth","bx","by","gy","rect","grd","createRadialGradient","colorValueBoxRect","colorValueBoxRectEnd","stroke","colorValueBoxShadow","colorValueBoxBackground","fillStyle","fill","colorValueText","textAlign","textBaseline","fillText","normalizedValue","min","dt","normal","indented","drawRadialBorder","arc","maxRadialRadius","pxRatio","SmartCanvas","pixelRatio","maxRadius","borderOuterWidth","borderMiddleWidth","borderInnerWidth","drawRadialPlate","d0","r0","r1","r2","r3","shadowDrawn","colorBorderOuter","colorBorderOuterEnd","colorBorderMiddle","colorBorderMiddleEnd","colorBorderInner","colorBorderInnerEnd","colorPlateEnd","colorPlate","drawRadialHighlights","hlWidth","highlightsWidth","radialTicksRadius","highlights","vd","ticksAngle","hlt","rotate","HPI","startAngle","to","color","drawRadialMinorTicks","range","delta","minTicks","minorTicks","ratio","colorMinorTicks","colorStrokeTicks","exactTicks","closeStrokedPath","unit","barWidth","barStrokeWidth","drawRadialMajorTicks","colors","colorMajorTicks","radialNextAngle","strokeTicks","drawRadialNumbers","points","isAnimated","animationTarget","colorNumbers","plateValueAngle","textWidth","textHeight","fontNumbersSize","textRadius","sqrt","point","numbersMargin","drawRadialTitle","title","colorTitle","drawRadialUnits","units","colorUnits","drawRadialNeedle","needle","needleCircleSize","rIn","needleEnd","rStart","needleStart","pad1","needleWidth","pad2","isFixed","colorNeedle","colorNeedleEnd","needleType","colorNeedleShadowUp","needleCircleOuter","colorNeedleCircleOuter","colorNeedleCircleOuterEnd","needleCircleInner","colorNeedleCircleInner","colorNeedleCircleInnerEnd","drawRadialValueBox","drawRadialProgressBar","rMax","rMin","half","sa","ea","colorBarStroke","colorBar","barShadow","clip","colorBarShadow","barProgress","colorBarProgress","displayValue","gauge","animatedValue","drawRectangle","colorStart","colorEnd","drawLinearBorder","drawLinearPlate","borderRadius","w1","w2","w3","w4","h1","h2","h3","h4","x2","x3","x4","y2","y3","y4","aliasingOffset","barDimensions","hasTitle","hasUnits","hasValue","titleMargin","unitsMargin","valueMargin","strokeWidth","barBeginCircle","barLength","barMargin","x0","y0","dx","hasLeft","hasRight","ticksWidth","dy","barOffset","ticksLength","X","Y","baseX","baseY","ticksPadding","drawLinearBarShape","type","_barDimensions","fullBarLength","direction","alpha","asin","cosAlpha","sinAlpha","x1","y1","cutRadius","rx","ry","colorBarEnd","colorBarProgressEnd","drawLinearBar","hasTicksBar","notWhich","needleSide","numberSide","drawLinearBarProgress","drawLinearBarHighlights","_context$barDimension","tickOffset","interval","eX","eH","eY","hLeft","hRight","entry","eStart","eW","drawLinearTick","drawLinearTicks","ticks","minVal","maxVal","lineLength","_context$barDimension2","tickX","tickY","tickLen","tickLeft","tickRight","drawLinearMajorTicks","_drawings$prepareTick","_drawings$prepareTick2","_slicedToArray","valuePerNonExactTick","tick","_context$barDimension3","rightTicks","leftTicks","sX","sY","drawLinearTickStroke","drawLinearMinorTicks","_drawings$prepareTick3","_drawings$prepareTick4","ticksWidthMinor","drawLinearMajorTicksNumbers","_context$barDimension4","tickValues","numLeft","numRight","textX","textY","numberOffset","textMargin","drawLinearTitle","_context$barDimension5","fontTitleSize","drawLinearUnits","_context$barDimension6","fontUnitsSize","drawLinearBarNeedle","_context$barDimension7","position","tickWidth","baseLength","needleLength","toLowerCase","drawLinearArrowNeedle","drawLinearLineNeedle","barStart","nLeft","nRight","needleStyle","isRight","peakLength","bodyLength","halfWidth","drawLinearValueBox","boxWidth","sliceIterator","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","_get","get","object","property","receiver","Function","desc","getOwnPropertyDescriptor","parent","getPrototypeOf","getter","_set","set","setter","_createClass","defineProperties","props","descriptor","defineProperty","key","protoProps","staticProps","assign","firstSource","nextSource","keysArray","keys","nextIndex","len","nextKey","searchElement","fromIndex","k","O","Infinity","relativeStart","relativeEnd","final","EventEmitter","_events","addListener","on","removeListener","off","event","_len","args","_key","_len2","handlers","_key2","handler","wrapper","_handler","index","splice","callback","setTimeout","Date","getTime","rules","linear","p","quad","pow","dequad","quint","dequint","cycle","acos","decycle","bounce","debounce","a","b","elastic","delastic","Animation","_this","cancel","performance","now","id","DomObserver","element","toDashed","Type","mutationsObserved","isObservable","MutationObserver","GAUGES_NO_AUTO_INIT","domReady","traverse","bind","node","tagName","getAttribute","elements","document","getElementsByTagName","process","observe","body","childList","subtree","attributes","characterData","attributeOldValue","characterDataOldValue","records","record","attributeName","isValidNode","oldValue","addedNodes","ii","ss","_this2","JSON","parse","stringify","hasOwnProperty","toAttributeName","attributeValue","renderTo","observer","forEach","attr","disconnect","destroy","_prop","part","_options","update","test","e","camelCase","str","dashed","readyState","addEventListener","attachEvent","canvas","height","collection","init","style","elementClone","cloneNode","getContext","contextClone","drawWidth","drawHeight","drawX","drawY","minSide","initialized","translate","clearRect","onRedraw","scale","redraw","devicePixelRatio","matchMedia","GenericOptions","animateOnInit","borders","listeners","animation","animationDuration","animationRule","fontNumbers","fontTitle","fontUnits","fontValue","fontNumbersStyle","fontTitleStyle","fontUnitsStyle","fontValueStyle","fontNumbersWeight","fontTitleWeight","fontUnitsWeight","fontValueWeight","getElementById","version","gauges","BaseGauge","_EventEmitter","_this3","className","name","HTMLCanvasElement","parentNode","offsetWidth","offsetHeight","_value","configure","emit","_this4","ensureValue","fromValue","animate","newValue","toCamelCase","defaultRadialGaugeOptions","useMinPath","RadialGauge","_BaseGauge","_ref","commit","drawImage","_context","initialize","defaultLinearGaugeOptions","LinearGauge","_BaseGauge2","_ref2","drawBox","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,SAASA,GAAK,YAUf,SAASC,GAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,GAAIG,GAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAOC,EAAKD,GAAKH,EAAIG,EAAM,O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AAQ7C,MAAQ6C,EAAQM,UAGxBN,EAAQ7C,MAAQ6C,EAAQK,WACxBL,EAAQ7C,MAAQ6C,EAAQK,UAGrBokB,GAAUU,UAAUnlB,OAI5BqmB,GACT5B,GASgB,UAAP3oB,IACPA,EAAgB,YAAIuqB,IAGxB5B,GAAU0B,WAAW,cAAeC,IAA8C,mBAAXK,SAA0BzpB,OAAOqd,OAAOve,GAAKyD,WAAYA,EAAW4jB,eAAgBA,GAAevF,UAAWA,GAAU6G,UAAWA,GAAUtkB,SAAUA,GAASsI,YAAaA,GAAYyV,YAAaA,GAAYtgB,UAAWA,KAAgC,mBAAX6oB,QAAyBA,OAAOC,QAAU5oB","file":"gauge.min.js","sourcesContent":["/*!\n * The MIT License (MIT)\n * \n * Copyright (c) 2016 Mykhailo Stadnyk \n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * @version 2.1.4\n */\n(function(ns) {'use strict';\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _set = function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if (\"value\" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * @external {Object.assign} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n */\n/* istanbul ignore next */\nif (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function value(target, firstSource) {\n 'use strict';\n\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n var i = 1;\n\n for (; i < arguments.length; i++) {\n var nextSource = arguments[i];\n\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n var nextIndex = 0,\n len = keysArray.length;\n\n for (; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n\n return to;\n }\n });\n}\n\n/**\n * @external {Array.indexOf} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\n */\n/* istanbul ignore next */\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement, fromIndex) {\n var k;\n\n if (this === null) {\n throw new TypeError('\"this\" is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n\n if (len === 0) {\n return -1;\n }\n\n var n = +fromIndex || 0;\n\n if (Math.abs(n) === Infinity) {\n n = 0;\n }\n\n if (n >= len) {\n return -1;\n }\n\n k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\n\n while (k < len) {\n if (k in O && O[k] === searchElement) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n };\n}\n\n/**\n * @external {Array.fill} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill\n */\n/* istanbul ignore next */\nif (!Array.prototype.fill) {\n Array.prototype.fill = function (value) {\n if (this === null) {\n throw new TypeError('this is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n var start = arguments[1];\n var relativeStart = start >> 0;\n var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);\n var end = arguments[2];\n var relativeEnd = end === undefined ? len : end >> 0;\n var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);\n while (k < final) {\n O[k] = value;\n k++;\n }\n\n return O;\n };\n}\n\n/**\n * mocking window\n */\nif (typeof window === 'undefined') {\n window = typeof global === 'undefined' ? {} : global;\n}\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n/**\n * Look-ups for a proper vendor-specific property and returns its value\n *\n * @example\n * var requestAnimationFrame = vendorize('requestAnimationFrame');\n * // it will refer properly to:\n * // - window.requestAnimationFrame by default or to\n * // - window.webkitRequestAnimationFrame or to\n * // - window.mozRequestAnimationFrame or to\n * // - window.msRequestAnimationFrame or to\n * // - window.oRequestAnimationFrame\n * // depending on the current browser vendor\n *\n * @author Mykhailo Stadnyk \n * @param {string} prop\n * @param {HTMLElement|Window|object} [from] - default is window\n * @returns {*}\n */\nfunction vendorize(prop, from) {\n /* istanbul ignore else: no reason to cover */\n if (!from) {\n from = typeof window === 'undefined' ? global : window;\n }\n\n if (typeof from[prop] !== 'undefined') {\n return from[prop];\n }\n\n var vendors = ['webkit', 'moz', 'ms', 'o'];\n var i = 0;\n var s = vendors.length;\n var capitalized = prop.charAt(0).toUpperCase() + prop.substr(1);\n\n for (; i < s; i++) {\n var vendorProp = from[vendors[i] + capitalized];\n\n /* istanbul ignore if: requires very complex environment to test (specific browser version) */\n if (typeof vendorProp !== 'undefined') {\n return vendorProp;\n }\n }\n\n return null;\n}\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Class EventEmitter - base event manager\n */\n\nvar EventEmitter = function () {\n /**\n * @constructor\n */\n function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this._events = {};\n\n this.addListener = this.on;\n this.removeListener = this.off;\n }\n\n /**\n * Returns all event listeners\n *\n * @return {object}\n */\n\n\n _createClass(EventEmitter, [{\n key: 'emit',\n\n\n /**\n * Emits given event bypassing to each registered handler given args\n *\n * @param {string} event\n * @param {...*} args\n */\n value: function emit(event) {\n if (this._events[event]) {\n var i = 0;\n var s = this._events[event].length;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n for (; i < s; i++) {\n this._events[event][i] && this._events[event][i].apply(this, args);\n }\n }\n }\n\n /**\n * Registers given handler for given event to be called only once when\n * event is emitted\n *\n * @param {string} event\n * @param {...function} handlers\n */\n\n }, {\n key: 'once',\n value: function once(event) {\n for (var _len2 = arguments.length, handlers = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n handlers[_key2 - 1] = arguments[_key2];\n }\n\n var i = 0;\n var s = handlers.length;\n var self = this;\n\n var _loop = function _loop() {\n var handler = handlers[i];\n var wrapper = function wrapper() {\n self.off(event, wrapper);\n handler.apply(self, arguments);\n };\n\n handlers[i] = wrapper;\n };\n\n for (; i < s; i++) {\n _loop();\n }\n\n this.on.apply(this, [event].concat(handlers));\n }\n\n /**\n * Registers given handlers for a given events to be called each time event\n * is emitted\n *\n * @param {string} event\n * @param {...function} handlers\n */\n\n }, {\n key: 'on',\n value: function on(event) {\n if (!this._events[event]) {\n this._events[event] = [];\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n this._events[event].push(arguments.length <= i + 1 ? undefined : arguments[i + 1]);\n }\n }\n\n /**\n * Un-registers previously registered event handlers\n *\n * @param {string} event\n * @param {...function} handlers\n */\n\n }, {\n key: 'off',\n value: function off(event) {\n if (!this._events[event]) {\n return;\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n var _handler = arguments.length <= i + 1 ? undefined : arguments[i + 1];\n var index = void 0;\n\n while (~(index = this._events[event].indexOf(_handler))) {\n this._events[event].splice(index, 1);\n }\n }\n }\n\n /**\n * Removes all listeners for a given event\n *\n * @param {string} event\n */\n\n }, {\n key: 'removeAllListeners',\n value: function removeAllListeners(event) {\n delete this._events[event];\n }\n }, {\n key: 'listeners',\n get: function get() {\n return this._events;\n }\n }]);\n\n return EventEmitter;\n}();\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n/* jshint -W079 */\n\n/**\n * @ignore\n * @typedef {object} ns\n */\n\n/* istanbul ignore next */\n/**\n * @type {function(callback: function(time: number): number, element?: HTMLElement)}\n * @access private\n */\n\n\nvar requestAnimationFrame = vendorize('requestAnimationFrame') || function (callback) {\n return setTimeout(function () {\n return callback(new Date().getTime());\n }, 1000 / 60);\n};\n\n/**\n * Generic AnimationRule function interface\n *\n * @typedef {function(percent: number): number} AnimationRule\n */\n\n/**\n * Callback for animation step draw event.\n * It will be called each time animation step is executed, bypassing\n * as first argument a percent of animation completeness. It is expected\n * that this callback will do an actual work of animating an elements or\n * whatever, as far as animation engine is just calculating and executing\n * animation steps without any knowledge about things under animation.\n *\n * @typedef {function(percent: number): *} DrawEventCallback\n */\n\n/**\n * Callback for animation complete event.\n * It is called once each animation is complete.\n *\n * @typedef {function(): *} EndEventCallback\n */\n\n/**\n * Predefined known animation rules.\n * It's a simple collection of math for some most used animations.\n *\n * @typedef {{linear: AnimationRule, quad: AnimationRule, dequad: AnimationRule, quint: AnimationRule, dequint: AnimationRule, cycle: AnimationRule, decycle: AnimationRule, bounce: AnimationRule, debounce: AnimationRule, elastic: AnimationRule, delastic: AnimationRule}} AnimationRules\n */\n\n/* istanbul ignore next: no reason covering this */\nvar rules = {\n linear: function linear(p) {\n return p;\n },\n quad: function quad(p) {\n return Math.pow(p, 2);\n },\n dequad: function dequad(p) {\n return 1 - rules.quad(1 - p);\n },\n quint: function quint(p) {\n return Math.pow(p, 5);\n },\n dequint: function dequint(p) {\n return 1 - Math.pow(1 - p, 5);\n },\n cycle: function cycle(p) {\n return 1 - Math.sin(Math.acos(p));\n },\n decycle: function decycle(p) {\n return Math.sin(Math.acos(1 - p));\n },\n bounce: function bounce(p) {\n return 1 - rules.debounce(1 - p);\n },\n debounce: function debounce(p) {\n var a = 0,\n b = 1;\n for (; 1; a += b, b /= 2) {\n if (p >= (7 - 4 * a) / 11) {\n return -Math.pow((11 - 6 * a - 11 * p) / 4, 2) + Math.pow(b, 2);\n }\n }\n },\n elastic: function elastic(p) {\n return 1 - rules.delastic(1 - p);\n },\n delastic: function delastic(p) {\n var x = 1.5;\n return Math.pow(2, 10 * (p - 1)) * Math.cos(20 * Math.PI * x / 3 * p);\n }\n};\n\n/* istanbul ignore next: private, not testable */\n/**\n * Evaluates animation step and decides if the next step required or\n * stops animation calling a proper events.\n *\n * @access private\n * @param {number} time\n * @param {DrawEventCallback} draw\n * @param {number} start\n * @param {AnimationRule} rule\n * @param {number} duration\n * @param {EndEventCallback} end\n * @param {Animation} anim\n */\nfunction step(time, draw, start, rule, duration, end, anim) {\n if (typeof rule !== 'function') {\n throw new TypeError('Invalid animation rule:', rule);\n }\n\n var progress = time - start;\n var percent = progress / duration;\n var animationTransformed = 0;\n\n if (percent > 1) {\n percent = 1;\n }\n\n if (percent !== 1) {\n animationTransformed = rule(percent);\n\n // make sure we have correct number after applying animation\n // transformation\n if (isFinite(animationTransformed) && !isNaN(animationTransformed)) {\n percent = animationTransformed;\n }\n }\n\n draw && draw(percent);\n\n if (progress < duration) {\n anim.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rule, duration, end, anim);\n });\n } else {\n end && end();\n anim.inProgress = false;\n }\n}\n\n/**\n * Animation engine API for JavaScript-based animations.\n * This is simply an animation core framework which simplifies creation\n * of various animations for generic purposes.\n *\n * @example\n * // create 'linear' animation engine, 500ms duration\n * let linear = new Animation('linear', 500);\n *\n * // create 'elastic' animation engine\n * let elastic = new Animation('elastic');\n *\n * // define animation behavior\n * let bounced = new Animation('bounce', 500, percent => {\n * let value = parseInt(percent * 100, 10);\n *\n * $('div.bounced').css({\n * width: value + '%',\n * height: value + '%'\n * });\n * });\n *\n * // execute animation\n * bounced.animate();\n *\n * // execute animation and handle when its finished\n * bounced.animate(null, () => {\n * console.log('Animation finished!');\n * });\n */\n\nvar Animation = function () {\n\n /**\n * @constructor\n * @param {string|AnimationRule} rule\n * @param {number} duration\n * @param {DrawEventCallback} [draw]\n * @param {EndEventCallback} [end]\n */\n function Animation() {\n var rule = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'linear';\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var draw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};\n\n _classCallCheck(this, Animation);\n\n /**\n * Overall animation duration in milliseconds.\n * By default is equal to 250 ms.\n *\n * @type {number}\n */\n this.duration = duration;\n\n /**\n * Animation rule. By default is linear animation.\n * Animation rule is a subject to animation rules, which are\n * a simple object containing math-based methods for calculating\n * animation steps.\n *\n * @type {string|AnimationRule}\n */\n this.rule = rule;\n\n /**\n * Callback function for the animation step draw event.\n *\n * @type {DrawEventCallback}\n */\n this.draw = draw;\n\n /**\n * Callback for the animation complete event.\n *\n * @type {EndEventCallback}\n */\n this.end = end;\n\n if (typeof this.draw !== 'function') {\n throw new TypeError('Invalid animation draw callback:', draw);\n }\n\n if (typeof this.end !== 'function') {\n throw new TypeError('Invalid animation end callback:', end);\n }\n }\n\n /* istanbul ignore next: non-testable */\n /**\n * Performs animation calling each animation step draw callback and\n * end callback at the end of animation. Callbacks are optional to this\n * method call. If them are not bypassed will be used that ones which\n * was pre-set on constructing an Animation object or pre-set after\n * construction.\n *\n * @example\n * function draw(percent) {\n * $('.my-animated-divs').css({\n * width: parseInt(percent * 100, 10) + '%'\n * });\n * }\n * function done() {\n * console.log('Animation complete!');\n * }\n *\n * // Define 'draw' and 'end' callbacks on construction\n * var animation = new Animation('cycle', 500, draw, done);\n * animation.animate();\n *\n * // Define 'draw' and 'end' callbacks after construction\n * var animation = new Animation('cycle', 500);\n * animation.draw = draw;\n * animation.end = done;\n * animation.animate();\n *\n * // Define 'draw' and 'end' callbacks at animation\n * var animation = new Animation('cycle', 500);\n * animation.animate(draw, done);\n *\n * @param {DrawEventCallback} [draw]\n * @param {EndEventCallback} [end]\n */\n\n\n _createClass(Animation, [{\n key: 'animate',\n value: function animate(draw, end) {\n var _this = this;\n\n this.frame && this.cancel();\n\n // noinspection JSUnresolvedVariable\n var start = window.performance && window.performance.now ? window.performance.now() : vendorize('animationStartTime') || Date.now();\n\n draw = draw || this.draw;\n end = end || this.end;\n\n this.draw = draw;\n this.end = end;\n\n /**\n * Current requested animation frame identifier\n *\n * @type {number}\n */\n this.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rules[_this.rule] || _this.rule, _this.duration, end, _this);\n });\n }\n\n /**\n * Cancels current animation if any\n */\n\n }, {\n key: 'cancel',\n value: function cancel() {\n if (this.frame) {\n var cancelAnimationFrame = vendorize('cancelAnimationFrame') ||\n /* istanbul ignore next */\n function (id) {};\n\n cancelAnimationFrame(this.frame);\n this.frame = null;\n }\n }\n\n /**\n * Destroys this object properly\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n this.cancel();\n this.draw = null;\n this.end = null;\n }\n }]);\n\n return Animation;\n}();\n\n/**\n * Animation rules bound statically to Animation constructor.\n *\n * @type {AnimationRules}\n * @static\n */\n\n\nAnimation.rules = rules;\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n/**\n * @typedef {{ constructor: function(options: GenericOptions): GaugeInterface, draw: function(): GaugeInterface, destroy: function, update: function(options: GenericOptions) }} GaugeInterface\n */\n/**\n * @typedef {{parse: function, stringify: function}} JSON\n * @external {JSON} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON\n */\n/**\n * @ignore\n * @typedef {{MutationObserver: function}} ns\n */\n\n/**\n * DOM Observer.\n * It will observe DOM document for a configured element types and\n * instantiate associated Types for an existing or newly added DOM elements\n *\n * @example\n * class ProgressBar {\n * constructor(options) {}\n * draw() {}\n * }\n *\n * // It will observe DOM document for elements
\n * // having attribute 'data-type=\"progress\"'\n * // and instantiate for each new instance of ProgressBar\n *\n * new DomParser({color: 'red'}, 'div', 'progress', ProgressBar);\n *\n * // assume we could have HTML like this\n * //
\n * // in this case all matching attributes names for a given options will be\n * // parsed and bypassed to an instance from HTML attributes\n */\n\nvar DomObserver = function () {\n\n /**\n * @constructor\n * @param {object} options\n * @param {string} element\n * @param {string} type\n */\n function DomObserver(options, element, type) {\n _classCallCheck(this, DomObserver);\n\n //noinspection JSUnresolvedVariable\n /**\n * Default instantiation options for the given type\n *\n * @type {Object}\n */\n this.options = options;\n\n /**\n * Name of an element to lookup/observe\n *\n * @type {string}\n */\n this.element = element.toLowerCase();\n\n /**\n * data-type attribute value to lookup\n *\n * @type {string}\n */\n this.type = DomObserver.toDashed(type);\n\n /**\n * Actual type constructor to instantiate for each found element\n *\n * @type {Function}\n */\n this.Type = ns[type];\n\n /**\n * Signals if mutations observer for this type or not\n *\n * @type {boolean}\n */\n this.mutationsObserved = false;\n\n /**\n * Flag specifies whenever the browser supports observing\n * of DOM tree mutations or not\n *\n * @type {boolean}\n */\n this.isObservable = !!window.MutationObserver;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n if (!window.GAUGES_NO_AUTO_INIT) {\n DomObserver.domReady(this.traverse.bind(this));\n }\n }\n\n /**\n * Checks if given node is valid node to process\n *\n * @param {Node|HTMLElement} node\n * @returns {boolean}\n */\n\n\n _createClass(DomObserver, [{\n key: 'isValidNode',\n value: function isValidNode(node) {\n //noinspection JSUnresolvedVariable\n return !!(node.tagName && node.tagName.toLowerCase() === this.element && node.getAttribute('data-type') === this.type);\n }\n\n /**\n * Traverse entire current DOM tree and process matching nodes.\n * Usually it should be called only once on document initialization.\n */\n\n }, {\n key: 'traverse',\n value: function traverse() {\n var elements = document.getElementsByTagName(this.element);\n var i = 0,\n s = elements.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n this.process(elements[i]);\n }\n\n if (this.isObservable && !this.mutationsObserved) {\n new MutationObserver(this.observe.bind(this)).observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n attributeOldValue: true,\n characterDataOldValue: true\n });\n\n this.mutationsObserved = true;\n }\n }\n\n /**\n * Observes given mutation records for an elements to process\n *\n * @param {MutationRecord[]} records\n */\n\n }, {\n key: 'observe',\n value: function observe(records) {\n var i = 0;\n var s = records.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n var record = records[i];\n\n if (record.type === 'attributes' && record.attributeName === 'data-type' && this.isValidNode(record.target) && record.oldValue !== this.type) // skip false-positive mutations\n {\n setTimeout(this.process.bind(this, record.target));\n } else if (record.addedNodes && record.addedNodes.length) {\n var ii = 0;\n var ss = record.addedNodes.length;\n\n for (; ii < ss; ii++) {\n setTimeout(this.process.bind(this, record.addedNodes[ii]));\n }\n }\n }\n }\n\n /**\n * Parses given attribute value to a proper JavaScript value.\n * For example it will parse some stringified value to a proper type\n * value, e.g. 'true' => true, 'null' => null, '{\"prop\": 20}' => {prop: 20}\n *\n * @param {*} value\n * @return {*}\n */\n\n }, {\n key: 'process',\n\n\n /**\n * Processes a given node, instantiating a proper type constructor for it\n *\n * @param {Node|HTMLElement} node\n * @returns {GaugeInterface|null}\n */\n value: function process(node) {\n var _this2 = this;\n\n if (!this.isValidNode(node)) return null;\n\n var prop = void 0;\n var options = JSON.parse(JSON.stringify(this.options));\n var instance = null;\n\n for (prop in options) {\n /* istanbul ignore else: non-testable in most cases */\n if (options.hasOwnProperty(prop)) {\n var attributeName = DomObserver.toAttributeName(prop);\n var attributeValue = DomObserver.parse(node.getAttribute(attributeName));\n\n if (attributeValue !== null && attributeValue !== undefined) {\n options[prop] = attributeValue;\n }\n }\n }\n\n options.renderTo = node;\n instance = new this.Type(options);\n instance.draw && instance.draw();\n\n if (!this.isObservable) return instance;\n\n instance.observer = new MutationObserver(function (records) {\n records.forEach(function (record) {\n if (record.type === 'attributes') {\n var attr = record.attributeName.toLowerCase();\n var type = node.getAttribute(attr).toLowerCase();\n\n if (attr === 'data-type' && type && type !== _this2.type) {\n instance.observer.disconnect();\n delete instance.observer;\n instance.destroy && instance.destroy();\n } else if (attr.substr(0, 5) === 'data-') {\n var _prop = attr.substr(5).split('-').map(function (part, i) {\n return !i ? part : part.charAt(0).toUpperCase() + part.substr(1);\n }).join('');\n var _options = {};\n\n _options[_prop] = DomObserver.parse(node.getAttribute(record.attributeName));\n\n if (_prop === 'value') {\n instance && (instance.value = _options[_prop]);\n } else {\n instance.update && instance.update(_options);\n }\n }\n }\n });\n });\n\n //noinspection JSCheckFunctionSignatures\n instance.observer.observe(node, { attributes: true });\n\n return instance;\n }\n\n /**\n * Transforms camelCase string to dashed string\n *\n * @static\n * @param {string} camelCase\n * @return {string}\n */\n\n }], [{\n key: 'parse',\n value: function parse(value) {\n // parse boolean\n if (value === 'true') return true;\n if (value === 'false') return false;\n\n // parse undefined\n if (value === 'undefined') return undefined;\n\n // parse null\n if (value === 'null') return null;\n\n // Comma-separated strings to array parsing.\n // It won't match strings which contains non alphanumeric characters to\n // prevent strings like 'rgba(0,0,0,0)' or JSON-like from being parsed.\n // Typically it simply allows easily declare arrays as comma-separated\n // numbers or plain strings. If something more complicated is\n // required it can be declared using JSON format syntax\n if (/^[-+#.\\w\\d\\s]+(?:,[-+#.\\w\\d\\s]*)+$/.test(value)) {\n return value.split(',');\n }\n\n // parse JSON\n try {\n return JSON.parse(value);\n } catch (e) {}\n\n // plain value - no need to parse\n return value;\n }\n }, {\n key: 'toDashed',\n value: function toDashed(camelCase) {\n var arr = camelCase.split(/(?=[A-Z])/);\n var i = 1;\n var s = arr.length;\n var str = arr[0].toLowerCase();\n\n for (; i < s; i++) {\n str += '-' + arr[i].toLowerCase();\n }\n\n return str;\n }\n\n /**\n * Transforms dashed string to CamelCase representation\n *\n * @param {string} dashed\n * @param {boolean} [capitalized]\n * @return {string}\n */\n\n }, {\n key: 'toCamelCase',\n value: function toCamelCase(dashed) {\n var capitalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n var arr = dashed.split(/-/);\n var i = 0;\n var s = arr.length;\n var str = '';\n\n for (; i < s; i++) {\n if (!(i || capitalized)) {\n str += arr[i].toLowerCase();\n } else {\n str += arr[i][0].toUpperCase() + arr[i].substr(1).toLowerCase();\n }\n }\n\n return str;\n }\n\n /**\n * Transforms camel case property name to dash separated attribute name\n *\n * @static\n * @param {string} str\n * @returns {string}\n */\n\n }, {\n key: 'toAttributeName',\n value: function toAttributeName(str) {\n return 'data-' + DomObserver.toDashed(str);\n }\n\n /**\n * Cross-browser DOM ready handler\n *\n * @static\n * @param {Function} handler\n */\n\n }, {\n key: 'domReady',\n value: function domReady(handler) {\n if (/comp|inter|loaded/.test((window.document || {}).readyState + '')) return handler();\n\n if (window.addEventListener) window.addEventListener('DOMContentLoaded', handler, false);else if (window.attachEvent) window.attachEvent('onload', handler);\n }\n }]);\n\n return DomObserver;\n}();\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * @ignore\n * @typedef {object} ns\n */\n\n/**\n * Drawings on canvas using hidden canvas as a cache for better\n * performance drawings during canvas animations. SmartCanvas also\n * adopts a canvas to\n */\n\n\nvar SmartCanvas = function () {\n\n /**\n * @constructor\n * @param {HTMLCanvasElement} canvas\n * @param {number} [width]\n * @param {number} [height]\n */\n function SmartCanvas(canvas, width, height) {\n _classCallCheck(this, SmartCanvas);\n\n SmartCanvas.collection.push(this);\n\n /**\n * Canvas base width\n *\n * @type {number}\n */\n this.width = width || 0;\n\n /**\n * Canvas base height\n *\n * @type {number}\n */\n this.height = height || 0;\n\n /**\n * Target drawings canvas element\n *\n * @type {HTMLCanvasElement}\n */\n this.element = canvas;\n\n this.init();\n }\n\n /**\n * Initializes canvases and contexts\n */\n\n\n _createClass(SmartCanvas, [{\n key: 'init',\n value: function init() {\n var pixelRatio = SmartCanvas.pixelRatio;\n\n this.element.width = this.width * pixelRatio;\n this.element.height = this.height * pixelRatio;\n\n this.element.style.width = this.width + 'px';\n this.element.style.height = this.height + 'px';\n\n /**\n * Canvas caching element\n *\n * @type {HTMLCanvasElement|Node}\n */\n this.elementClone = this.element.cloneNode(true);\n\n //noinspection JSUnresolvedVariable\n /**\n * Target drawings canvas element 2D context\n *\n * @type {CanvasRenderingContext2D}\n */\n this.context = this.element.getContext('2d');\n\n /**\n * Canvas caching element 2D context\n *\n * @type {CanvasRenderingContext2D}\n */\n this.contextClone = this.elementClone.getContext('2d');\n\n /**\n * Actual drawings width\n *\n * @type {number}\n */\n this.drawWidth = this.element.width;\n\n /**\n * Actual drawings height\n *\n * @type {number}\n */\n this.drawHeight = this.element.height;\n\n /**\n * X-coordinate of drawings zero point\n *\n * @type {number}\n */\n this.drawX = this.drawWidth / 2;\n\n /**\n * Y-coordinate of drawings zero point\n *\n * @type {number}\n */\n this.drawY = this.drawHeight / 2;\n\n /**\n * Minimal side length in pixels of the drawing\n *\n * @type {number}\n */\n this.minSide = this.drawX < this.drawY ? this.drawX : this.drawY;\n\n this.elementClone.initialized = false;\n\n this.contextClone.translate(this.drawX, this.drawY);\n this.contextClone.save();\n\n this.context.translate(this.drawX, this.drawY);\n this.context.save();\n\n this.context.max = this.contextClone.max = this.minSide;\n this.context.maxRadius = this.contextClone.maxRadius = null;\n }\n\n /**\n * Destroys this object, removing the references from memory\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = SmartCanvas.collection.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n SmartCanvas.collection.splice(index, 1);\n }\n\n this.context.clearRect(-this.drawX, -this.drawY, this.drawWidth, this.drawHeight);\n\n // dereference all created elements\n this.context.max = null;\n delete this.context.max;\n\n this.context.maxRadius = null;\n delete this.context.maxRadius;\n\n this.context = null;\n this.contextClone = null;\n this.elementClone = null;\n this.element = null;\n\n /**\n * On canvas redraw event callback\n *\n * @type {function|null|undefined}\n */\n this.onRedraw = null;\n }\n\n /**\n * Commits the drawings\n */\n\n }, {\n key: 'commit',\n value: function commit() {\n var scale = SmartCanvas.pixelRatio;\n\n if (scale !== 1) {\n this.contextClone.scale(scale, scale);\n this.contextClone.save();\n }\n\n return this;\n }\n\n /**\n * Redraw this object\n */\n\n }, {\n key: 'redraw',\n value: function redraw() {\n this.init();\n\n /**\n * On canvas redraw event callback\n *\n * @type {function(): *}\n */\n this.onRedraw && this.onRedraw();\n\n return this;\n }\n\n /**\n * Returns current device pixel ratio\n *\n * @returns {number}\n */\n\n }], [{\n key: 'redraw',\n\n\n /**\n * Forces redraw all canvas in the current collection\n */\n value: function redraw() {\n var i = 0;\n var s = SmartCanvas.collection.length;\n\n for (; i < s; i++) {\n SmartCanvas.collection[i].redraw();\n }\n }\n }, {\n key: 'pixelRatio',\n get: function get() {\n /* istanbul ignore next */\n //noinspection JSUnresolvedVariable\n return window.devicePixelRatio || 1;\n }\n }]);\n\n return SmartCanvas;\n}();\n\nSmartCanvas.collection = [];\n\n/* istanbul ignore next: very browser-specific testing required to cover */\n//noinspection JSUnresolvedVariable\nif (window.matchMedia) {\n //noinspection JSUnresolvedFunction\n window.matchMedia('screen and (min-resolution: 2dppx)').addListener(SmartCanvas.redraw);\n}\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Describes rendering target element. Can be either string identifier of\n * the element or the element itself.\n *\n * @typedef {HTMLElement|string} RenderTarget\n */\n\n/**\n * Highlight area definition.\n * It describes highlight area starting from value to value using\n * color. Color can be describes with hex, rgb or rgba value.\n *\n * @typedef {{ from: number, to: number, color: string}} Highlight\n */\n\n/**\n * Shared generic gauges options\n *\n * @type {{renderTo: RenderTarget, width: number, height: number, minValue: number, maxValue: number, value: number, units: string|boolean, majorTicks: number[]|string[], exactTicks: boolean, minorTicks: number, strokeTicks: boolean, animatedValue: boolean, animateOnInit: boolean, title: string|boolean, borders: boolean, valueInt: number, valueDec: number, majorTicksInt: number, majorTicksDec: number, animation: boolean, animationDuration: number, animationRule: string|AnimationRule, colorPlate: string, colorPlateEnd: string, colorMajorTicks: string, colorMinorTicks: string, colorStrokeTicks: string, colorTitle: string, colorUnits: string, colorNumbers: string, colorNeedle: string, colorNeedleEnd: string, colorValueText: string, colorValueTextShadow: string, colorBorderShadow: string, colorBorderOuter: string, colorBorderOuterEnd: string, colorBorderMiddle: string, colorBorderMiddleEnd: string, colorBorderInner: string, colorBorderInnerEnd: string, colorValueBoxRect: string, colorValueBoxRectEnd: string, colorValueBoxBackground: string, colorValueBoxShadow: string, colorNeedleShadowUp: string, colorNeedleShadowDown: string, needle: boolean, needleShadow: boolean, needleType: string, needleStart: number, needleEnd: number, needleWidth: number, borderOuterWidth: number, borderMiddleWidth: number, borderInnerWidth: number, borderShadowWidth: number, valueBox: boolean, valueBoxWidth: number, valueBoxStroke: number, valueText: string, valueTextShadow: boolean, valueBoxBorderRadius: number, highlights: Highlight[], highlightsWidth: number, fontNumbers: string, fontTitle: string, fontUnits: string, fontValue: string, fontTitleSize: number, fontValueSize: number, fontUnitsSize: number, fontNumbersSize: number, fontNumbersStyle: string, fontTitleStyle: string, fontUnitsStyle: string, fontValueStyle: string, fontNumbersWeight: string, fontTitleWeight: string, fontUnitsWeight: string, fontValueWeight: string, barWidth: number, barStrokeWidth: number, barProgress: boolean, colorBar: string, colorBarStroke: string, colorBarProgress: string, colorBarShadow: string, barShadow: number, listeners: object}} GenericOptions\n */\nvar GenericOptions = {\n // basic options\n renderTo: null,\n width: 0,\n height: 0,\n minValue: 0,\n maxValue: 100,\n value: 0,\n units: false,\n exactTicks: false,\n majorTicks: [0, 20, 40, 60, 80, 100],\n minorTicks: 10,\n strokeTicks: true,\n animatedValue: false,\n animateOnInit: false,\n title: false,\n borders: true,\n numbersMargin: 1,\n\n listeners: null,\n\n // number formats\n valueInt: 3,\n valueDec: 2,\n majorTicksInt: 1,\n majorTicksDec: 0,\n\n // animations\n animation: true,\n animationDuration: 500,\n animationRule: 'cycle',\n\n // colors\n colorPlate: '#fff',\n colorPlateEnd: '',\n colorMajorTicks: '#444',\n colorMinorTicks: '#666',\n colorStrokeTicks: '',\n colorTitle: '#888',\n colorUnits: '#888',\n colorNumbers: '#444',\n colorNeedle: 'rgba(240,128,128,1)',\n colorNeedleEnd: 'rgba(255,160,122,.9)',\n colorValueText: '#444',\n colorValueTextShadow: 'rgba(0,0,0,0.3)',\n colorBorderShadow: 'rgba(0,0,0,0.5)',\n colorBorderOuter: '#ddd',\n colorBorderOuterEnd: '#aaa',\n colorBorderMiddle: '#eee',\n colorBorderMiddleEnd: '#f0f0f0',\n colorBorderInner: '#fafafa',\n colorBorderInnerEnd: '#ccc',\n colorValueBoxRect: '#888',\n colorValueBoxRectEnd: '#666',\n colorValueBoxBackground: '#babab2',\n colorValueBoxShadow: 'rgba(0,0,0,1)',\n colorNeedleShadowUp: 'rgba(2,255,255,0.2)',\n colorNeedleShadowDown: 'rgba(188,143,143,0.45)',\n colorBarStroke: '#222',\n colorBar: '#ccc',\n colorBarProgress: '#888',\n colorBarShadow: '#000',\n\n fontNumbers: 'Arial',\n fontTitle: 'Arial',\n fontUnits: 'Arial',\n fontValue: 'Arial',\n\n fontNumbersSize: 20,\n fontTitleSize: 24,\n fontUnitsSize: 22,\n fontValueSize: 26,\n\n fontNumbersStyle: 'normal',\n fontTitleStyle: 'normal',\n fontUnitsStyle: 'normal',\n fontValueStyle: 'normal',\n\n fontNumbersWeight: 'normal',\n fontTitleWeight: 'normal',\n fontUnitsWeight: 'normal',\n fontValueWeight: 'normal',\n\n // needle\n needle: true,\n needleShadow: true,\n needleType: 'arrow',\n needleStart: 5,\n needleEnd: 85,\n needleWidth: 4,\n\n // borders\n borderOuterWidth: 3,\n borderMiddleWidth: 3,\n borderInnerWidth: 3,\n borderShadowWidth: 3,\n\n // value and highlights\n valueBox: true,\n valueBoxStroke: 5,\n valueBoxWidth: 0,\n valueText: '',\n valueTextShadow: true,\n valueBoxBorderRadius: 2.5,\n\n // highlights\n highlights: [{ from: 20, to: 60, color: '#eee' }, { from: 60, to: 80, color: '#ccc' }, { from: 80, to: 100, color: '#999' }],\n highlightsWidth: 15,\n\n // progress bar\n barWidth: 20, // percents\n barStrokeWidth: 0, // pixels\n barProgress: true,\n barShadow: 0\n};\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Gauge collections type.\n *\n * It is used ES5 declaration here, because babel\n * transpiles inheritance incorrectly in this case.\n *\n * @class Collection\n * @constructor\n */\nfunction Collection() {\n Array.prototype.constructor.apply(this, arguments);\n}\n\nCollection.prototype = Object.create(Array.prototype);\nCollection.prototype.constructor = Collection;\n\n/**\n * Returns gauge object by its identifier or index in the collection\n *\n * @param {string|number} id\n * @return {*}\n */\nCollection.prototype.get = function (id) {\n if (typeof id === 'string') {\n var i = 0;\n var s = this.length;\n\n for (; i < s; i++) {\n var canvas = this[i].options.renderTo.tagName ? this[i].options.renderTo :\n /* istanbul ignore next: should be tested with e2e tests */\n document.getElementById(this[i].options.renderTo || '');\n\n if (canvas.getAttribute('id') === id) {\n return this[i];\n }\n }\n } else if (typeof id === 'number') {\n return this[id];\n }\n\n return null;\n};\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nvar version = '2.1.4';\n\nvar round = Math.round;\nvar abs = Math.abs;\n\nvar gauges = new Collection();\n\ngauges.version = version;\n\n/**\n * Basic abstract BaseGauge class implementing common functionality\n * for different type of gauges.\n *\n * It should not be instantiated directly but must be extended by a final\n * gauge implementation.\n *\n * @abstract\n * @example\n *\n * class MyCoolGauge extends BaseGauge {\n *\n * // theses methods below MUST be implemented:\n *\n * constructor(options) {\n * // ... do something with options\n * super(options);\n * // ... implement anything else\n * }\n *\n * draw() {\n * // ... some implementation here\n * return this;\n * }\n * }\n */\n\nvar BaseGauge = function (_EventEmitter) {\n _inherits(BaseGauge, _EventEmitter);\n\n /**\n * Fired each time gauge is initialized on a page\n *\n * @event BaseGauge#init\n */\n\n /**\n * Fired each time gauge scene is rendered\n *\n * @event BaseGauge#render\n */\n\n /**\n * Fired each time gauge object is destroyed\n *\n * @event BaseGauge#destroy\n */\n\n /**\n * Fired each time before animation is started on the gauge\n *\n * @event BaseGauge#animationStart\n */\n\n /**\n * Fired each time animation scene is complete\n *\n * @event BaseGauge#animate\n * @type {number} percent\n * @type {number} value\n */\n\n /**\n * Fired each time animation is complete on the gauge\n *\n * @event BaseGauge#animationEnd\n */\n\n /**\n * @event BaseGauge#value\n * @type {number} newValue\n * @type {number} oldValue\n */\n\n /**\n * @constructor\n * @abstract\n * @param {GenericOptions} options\n */\n function BaseGauge(options) {\n _classCallCheck(this, BaseGauge);\n\n var _this3 = _possibleConstructorReturn(this, (BaseGauge.__proto__ || Object.getPrototypeOf(BaseGauge)).call(this));\n\n var className = _this3.constructor.name;\n\n if (className === 'BaseGauge') {\n throw new TypeError('Attempt to instantiate abstract class!');\n }\n\n gauges.push(_this3);\n\n if (options.listeners) {\n Object.keys(options.listeners).forEach(function (event) {\n var handlers = options.listeners[event] instanceof Array ? options.listeners[event] : [options.listeners[event]];\n\n handlers.forEach(function (handler) {\n _this3.on(event, handler);\n });\n });\n }\n\n //noinspection JSUnresolvedVariable\n /**\n * Gauges version string\n *\n * @type {string}\n */\n _this3.version = version;\n\n /**\n * Gauge type class\n *\n * @type {BaseGauge} type\n */\n _this3.type = ns[className] || BaseGauge;\n\n /**\n * True if gauge has been drawn for the first time, false otherwise.\n *\n * @type {boolean}\n */\n _this3.initialized = false;\n\n options.minValue = parseFloat(options.minValue);\n options.maxValue = parseFloat(options.maxValue);\n options.value = parseFloat(options.value) || 0;\n\n if (!options.borders) {\n options.borderInnerWidth = options.borderMiddleWidth = options.borderOuterWidth = 0;\n }\n\n if (!options.renderTo) {\n throw TypeError('Canvas element was not specified when creating ' + 'the Gauge object!');\n }\n\n var canvas = options.renderTo.tagName ? options.renderTo :\n /* istanbul ignore next: to be tested with e2e tests */\n document.getElementById(options.renderTo);\n\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw TypeError('Given gauge canvas element is invalid!');\n }\n\n options.width = parseFloat(options.width) || 0;\n options.height = parseFloat(options.height) || 0;\n\n if (!options.width || !options.height) {\n if (!options.width) options.width = canvas.parentNode ? canvas.parentNode.offsetWidth : canvas.offsetWidth;\n if (!options.height) options.height = canvas.parentNode ? canvas.parentNode.offsetHeight : canvas.offsetHeight;\n }\n\n /**\n * Gauge options\n *\n * @type {GenericOptions} options\n */\n _this3.options = options || {};\n\n if (_this3.options.animateOnInit) {\n _this3._value = _this3.options.value;\n _this3.options.value = _this3.options.minValue;\n }\n\n /**\n * @type {SmartCanvas} canvas\n */\n _this3.canvas = new SmartCanvas(canvas, options.width, options.height);\n _this3.canvas.onRedraw = _this3.draw.bind(_this3);\n\n /**\n * @type {Animation} animation\n */\n _this3.animation = new Animation(options.animationRule, options.animationDuration);\n return _this3;\n }\n\n /**\n * Sets new value for this gauge.\n * If gauge is animated by configuration it will trigger a proper animation.\n * Upsetting a value triggers gauge redraw.\n *\n * @param {number} value\n */\n\n\n _createClass(BaseGauge, [{\n key: 'update',\n\n\n /**\n * Updates gauge configuration options at runtime and redraws the gauge\n *\n * @param {RadialGaugeOptions} options\n * @returns {BaseGauge}\n */\n value: function update(options) {\n Object.assign(this.options, this.type.configure(options || {}));\n\n this.canvas.width = this.options.width;\n this.canvas.height = this.options.height;\n\n this.animation.rule = this.options.animationRule;\n this.animation.duration = this.options.animationDuration;\n\n this.canvas.redraw();\n\n return this;\n }\n\n /**\n * Performs destruction of this object properly\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = gauges.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n //noinspection JSUnresolvedFunction\n gauges.splice(index, 1);\n }\n\n this.canvas.destroy();\n this.canvas = null;\n\n this.animation.destroy();\n this.animation = null;\n\n this.emit('destroy');\n }\n\n /**\n * Returns gauges version string\n *\n * @return {string}\n */\n\n }, {\n key: 'draw',\n\n\n /**\n * Triggering gauge render on a canvas.\n *\n * @abstract\n * @returns {BaseGauge}\n */\n value: function draw() {\n if (this.options.animateOnInit && !this.initialized) {\n this.value = this._value;\n this.initialized = true;\n this.emit('init');\n }\n\n this.emit('render');\n\n return this;\n }\n\n /**\n * Inject given gauge object into DOM\n *\n * @param {string} type\n * @param {GenericOptions} options\n */\n\n }, {\n key: 'value',\n set: function set(value) {\n var _this4 = this;\n\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n var fromValue = this.options.value;\n\n if (value === fromValue) {\n return;\n }\n\n if (this.options.animation) {\n if (this.animation.frame) {\n // animation is already in progress -\n // forget related old animation value\n // @see https://github.com/Mikhus/canvas-gauges/issues/94\n this.options.value = this._value;\n\n // if there is no actual value change requested stop it\n if (this._value === value) {\n this.animation.cancel();\n delete this._value;\n return;\n }\n }\n\n /**\n * @type {number}\n * @access private\n */\n if (this._value === undefined) {\n this._value = value;\n }\n\n this.emit('animationStart');\n\n this.animation.animate(function (percent) {\n var newValue = fromValue + (value - fromValue) * percent;\n\n _this4.options.animatedValue && _this4.emit('value', newValue, _this4.value);\n\n _this4.options.value = newValue;\n\n _this4.draw();\n\n _this4.emit('animate', percent, _this4.options.value);\n }, function () {\n if (_this4._value !== undefined) {\n _this4.emit('value', _this4._value, _this4.value);\n _this4.options.value = _this4._value;\n delete _this4._value;\n }\n\n _this4.draw();\n _this4.emit('animationEnd');\n });\n } else {\n this.emit('value', value, this.value);\n this.options.value = value;\n this.draw();\n }\n }\n\n /**\n * Returns current value of the gauge\n *\n * @return {number}\n */\n ,\n get: function get() {\n return typeof this._value === 'undefined' ? this.options.value : this._value;\n }\n\n /**\n * Updates gauge options\n *\n * @param {*} options\n * @return {BaseGauge}\n * @access protected\n */\n\n }], [{\n key: 'configure',\n value: function configure(options) {\n return options;\n }\n }, {\n key: 'initialize',\n value: function initialize(type, options) {\n return new DomObserver(options, 'canvas', type);\n }\n\n /**\n * Initializes gauge from a given HTML element\n * (given element should be valid HTML canvas gauge definition)\n *\n * @param {HTMLElement} element\n */\n\n }, {\n key: 'fromElement',\n value: function fromElement(element) {\n var type = DomObserver.toCamelCase(element.getAttribute('data-type'));\n var attributes = element.attributes;\n var i = 0;\n var s = attributes.length;\n var options = {};\n\n if (!type) {\n return;\n }\n\n if (!/Gauge$/.test(type)) {\n type += 'Gauge';\n }\n\n for (; i < s; i++) {\n options[DomObserver.toCamelCase(attributes[i].name.replace(/^data-/, ''), false)] = DomObserver.parse(attributes[i].value);\n }\n\n new DomObserver(options, element.tagName, type).process(element);\n }\n\n /**\n * Ensures value is proper number\n *\n * @param {*} value\n * @param {number} min\n * @return {number}\n */\n\n }, {\n key: 'ensureValue',\n value: function ensureValue(value) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n value = parseFloat(value);\n\n if (isNaN(value) || !isFinite(value)) {\n value = parseFloat(min) || 0;\n }\n\n return value;\n }\n }, {\n key: 'version',\n get: function get() {\n return version;\n }\n }]);\n\n return BaseGauge;\n}(EventEmitter);\n\n/**\n * @ignore\n * @typedef {object} ns\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['BaseGauge'] = BaseGauge;\n ns['gauges'] = (window.document || {})['gauges'] = gauges;\n}\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * @access private\n * @typedef {CanvasRenderingContext2D|{max: number, maxRadius: number, barDimensions: object}} Canvas2DContext\n */\n\n/* istanbul ignore next: private, not testable */\n/**\n * Examines if a given error is something to throw or to ignore\n *\n * @param {Error} err\n */\nfunction verifyError(err) {\n // there is some unpredictable error in FF in some circumstances\n // which we found simply safe to ignore than to fight with it\n // noinspection JSUnresolvedVariable\n if (err instanceof DOMException && err.result === 0x8053000b) {\n return; // ignore it\n }\n\n throw err;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Prepares major ticks data\n *\n * @access private\n * @param {GenericOptions|{ tickSide: string }} options\n * @return {[boolean, boolean]}\n */\nfunction prepareTicks(options) {\n if (!(options.majorTicks instanceof Array)) {\n options.majorTicks = options.majorTicks ? [options.majorTicks] : [];\n }\n\n if (!options.majorTicks.length) {\n options.majorTicks.push(drawings.formatMajorTickNumber(options.minValue, options));\n options.majorTicks.push(drawings.formatMajorTickNumber(options.maxValue, options));\n }\n\n return [options.tickSide !== 'right', options.tickSide !== 'left'];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws rounded corners rectangle\n *\n * @param {Canvas2DContext} context\n * @param {number} x\n * @param {number} y\n * @param {number} w\n * @param {number} h\n * @param {number} r\n */\nfunction roundRect(context, x, y, w, h, r) {\n context.beginPath();\n\n context.moveTo(x + r, y);\n context.lineTo(x + w - r, y);\n\n context.quadraticCurveTo(x + w, y, x + w, y + r);\n context.lineTo(x + w, y + h - r);\n\n context.quadraticCurveTo(x + w, y + h, x + w - r, y + h);\n context.lineTo(x + r, y + h);\n\n context.quadraticCurveTo(x, y + h, x, y + h - r);\n context.lineTo(x, y + r);\n\n context.quadraticCurveTo(x, y, x + r, y);\n\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Pads a given value with leading zeros using the given options\n *\n * @param {number} val\n * @param {RadialGaugeOptions|{valueInt: number, valueDec: number}} options\n * @returns {string}\n */\nfunction padValue(val, options) {\n var dec = options.valueDec;\n var int = options.valueInt;\n var i = 0;\n var s = void 0,\n strVal = void 0,\n n = void 0;\n\n val = parseFloat(val);\n n = val < 0;\n val = Math.abs(val);\n\n if (dec > 0) {\n strVal = val.toFixed(dec).toString().split('.');\n s = int - strVal[0].length;\n\n for (; i < s; ++i) {\n strVal[0] = '0' + strVal[0];\n }\n\n strVal = (n ? '-' : '') + strVal[0] + '.' + strVal[1];\n } else {\n strVal = Math.round(val).toString();\n s = int - strVal.length;\n\n for (; i < s; ++i) {\n strVal = '0' + strVal;\n }\n\n strVal = (n ? '-' : '') + strVal;\n }\n\n return strVal;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Formats a number for display on the dial's plate using the majorTicksFormat\n * config option.\n *\n * @param {number} num number to format\n * @param {object} options\n * @returns {string} formatted number\n */\nfunction formatMajorTickNumber(num, options) {\n var right = void 0,\n hasDec = false;\n\n // First, force the correct number of digits right of the decimal.\n if (options.majorTicksDec === 0) {\n right = Math.round(num).toString();\n } else {\n right = num.toFixed(options.majorTicksDec);\n }\n\n // Second, force the correct number of digits left of the decimal.\n if (options.majorTicksInt > 1) {\n // Does this number have a decimal?\n hasDec = ~right.indexOf('.');\n\n // Is this number a negative number?\n if (~right.indexOf('-')) {\n return '-' + [options.majorTicksInt + options.majorTicksDec + 2 + (hasDec ? 1 : 0) - right.length].join('0') + right.replace('-', '');\n } else {\n return [options.majorTicksInt + options.majorTicksDec + 1 + (hasDec ? 1 : 0) - right.length].join('0') + right;\n }\n }\n\n return right;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Transforms degrees to radians\n *\n * @param {number} degrees\n * @returns {number}\n */\nfunction radians(degrees) {\n return degrees * Math.PI / 180;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Calculates and returns radial point coordinates\n *\n * @param {number} radius\n * @param {number} angle\n * @returns {{x: number, y: number}}\n */\nfunction radialPoint(radius, angle) {\n return { x: -radius * Math.sin(angle), y: radius * Math.cos(angle) };\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Creates and returns linear gradient canvas object\n *\n * @param {Canvas2DContext} context\n * @param {string} colorFrom\n * @param {string} colorTo\n * @param {number} length\n * @param {boolean} [isVertical]\n * @param {number} [from]\n * @returns {CanvasGradient}\n */\nfunction linearGradient(context, colorFrom, colorTo, length) {\n var isVertical = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n var from = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n\n var grad = context.createLinearGradient(isVertical ? 0 : from, isVertical ? from : 0, isVertical ? 0 : length, isVertical ? length : 0);\n\n grad.addColorStop(0, colorFrom);\n grad.addColorStop(1, colorTo);\n\n return grad;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws the shadow if it was not drawn\n *\n * @param {Canvas2DContext} context\n * @param {GenericOptions} options\n * @param {boolean} shadowDrawn\n * @return {boolean}\n */\nfunction drawShadow(context, options) {\n var shadowDrawn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (shadowDrawn) {\n context.restore();\n return true;\n }\n\n context.save();\n\n var w = options.borderShadowWidth;\n\n if (w) {\n context.shadowBlur = w;\n context.shadowColor = options.colorBorderShadow;\n }\n\n return true;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge needle shadow\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawNeedleShadow(context, options) {\n if (!options.needleShadow) return;\n\n context.shadowOffsetX = 2;\n context.shadowOffsetY = 2;\n context.shadowBlur = 10;\n context.shadowColor = options.colorNeedleShadowDown;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Constructs font styles for canvas fonts\n *\n * @param {GenericOptions} options\n * @param {string} target\n * @param {number} baseSize\n */\nfunction font(options, target, baseSize) {\n return options['font' + target + 'Style'] + ' ' + options['font' + target + 'Weight'] + ' ' + options['font' + target + 'Size'] * baseSize + 'px ' + options['font' + target];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Resets some context settings\n *\n * @param {Canvas2DContext} context\n */\nfunction reset(context) {\n context.shadowOffsetX = null;\n context.shadowOffsetY = null;\n context.shadowBlur = null;\n context.shadowColor = '';\n context.strokeStyle = null;\n context.lineWidth = 0;\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Declares to drow value text shadow if configured\n *\n * @param context\n * @param options\n * @param offset\n * @param blur\n */\nfunction drawValueTextShadow(context, options, offset, blur) {\n if (options.valueTextShadow) {\n context.shadowOffsetX = offset;\n context.shadowOffsetY = offset;\n context.shadowBlur = blur;\n context.shadowColor = options.colorValueTextShadow;\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws value box at given position\n *\n * @param {Canvas2DContext} context\n * @param {GenericOptions} options\n * @param {number|string} value\n * @param {number} x\n * @param {number} y\n * @param {number} max\n */\nfunction drawValueBox(context, options, value, x, y, max) {\n if (!options.valueBox) return;\n\n reset(context);\n\n var addLength = options.valueDec ? 1 + options.valueDec : 0;\n var maxValueWidth = '9'.repeat(Math.max.apply(null, [String(parseInt(value)).length + addLength].concat(options.majorTicks.map(function (val) {\n return String(parseInt(val, 10)).length + addLength;\n }))));\n var text = options.valueText || padValue(value, options);\n var tunit = max / 200;\n var runit = max / 100;\n var offset = 0.4 * runit;\n var blur = 1.2 * runit;\n\n context.font = font(options, 'Value', tunit);\n drawValueTextShadow(context, options, offset, blur);\n\n var tw = context.measureText(options.valueText ? text : '-' + padValue(Number(maxValueWidth), options)).width;\n\n reset(context);\n\n var th = parseFloat(options.fontValueSize) * tunit + offset + blur;\n var sw = runit * parseFloat(options.valueBoxStroke);\n var bmax = max * 2 - sw * 2;\n\n var bw = tw + 10 * runit;\n var bh = 1.1 * th + offset + blur;\n var br = runit * options.valueBoxBorderRadius;\n var obw = (parseFloat(options.valueBoxWidth) || 0) / 100 * bmax;\n\n obw > bw && (bw = obw);\n bw > bmax && (bw = bmax);\n\n var bx = x - bw / 2;\n var by = y - bh / 2;\n var gy = y - 5.75 * runit;\n\n context.beginPath();\n\n if (br) roundRect(context, bx, by, bw, bh, br);else context.rect(bx, by, bw, bh);\n\n if (sw) {\n var grd = context.createRadialGradient(x, gy, runit * 10, x, gy, runit * 20);\n\n grd.addColorStop(0, options.colorValueBoxRect);\n grd.addColorStop(1, options.colorValueBoxRectEnd);\n\n context.strokeStyle = grd;\n context.lineWidth = sw;\n context.stroke();\n }\n\n if (options.colorValueBoxShadow) {\n context.shadowBlur = 1.2 * runit;\n context.shadowColor = options.colorValueBoxShadow;\n }\n\n if (options.colorValueBoxBackground) {\n context.fillStyle = options.colorValueBoxBackground;\n context.fill();\n }\n\n context.closePath();\n context.restore();\n\n drawValueTextShadow(context, options, offset, blur);\n\n context.fillStyle = options.colorValueText;\n context.textAlign = 'center';\n context.textBaseline = 'alphabetic';\n context.fillText(text, bx + bw / 2, y + bh / 2 - th / 3);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Returns normalized value\n *\n * @param {GenericOptions} options\n * @return {{normal: number, indented: number}}\n */\nfunction normalizedValue(options) {\n var value = options.value;\n var min = options.minValue;\n var max = options.maxValue;\n var dt = (max - min) * 0.01;\n\n return {\n normal: value < min ? min : value > max ? max : value,\n indented: value < min ? min - dt : value > max ? max + dt : value\n };\n}\n\nvar drawings = {\n roundRect: roundRect,\n padValue: padValue,\n formatMajorTickNumber: formatMajorTickNumber,\n radians: radians,\n radialPoint: radialPoint,\n linearGradient: linearGradient,\n drawNeedleShadow: drawNeedleShadow,\n drawValueBox: drawValueBox,\n verifyError: verifyError,\n prepareTicks: prepareTicks,\n drawShadow: drawShadow,\n font: font,\n normalizedValue: normalizedValue\n};\n\ndrawings;\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nvar PI = Math.PI;\nvar HPI = PI / 2;\n\n/**\n * Gauge configuration options\n *\n * @typedef {GenericOptions|{exactTicks: boolean, ticksAngle: number, startAngle: number, colorNeedleCircleOuter: string, colorNeedleCircleOuterEnd: string, colorNeedleCircleInner: string, colorNeedleCircleInnerEnd: string, needleCircleSize: number, needleCircleInner: boolean, needleCircleOuter: boolean, animationTarget: string, useMinPath: boolean}} RadialGaugeOptions\n */\n\n/**\n * Default gauge configuration options\n *\n * @access private\n * @type {RadialGaugeOptions}\n */\nvar defaultRadialGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n ticksAngle: 270,\n startAngle: 45,\n\n // colors\n colorNeedleCircleOuter: '#f0f0f0',\n colorNeedleCircleOuterEnd: '#ccc',\n colorNeedleCircleInner: '#e8e8e8',\n colorNeedleCircleInnerEnd: '#f5f5f5',\n\n // needle\n needleCircleSize: 10,\n needleCircleInner: true,\n needleCircleOuter: true,\n needleStart: 20,\n\n // custom animations\n animationTarget: 'needle', // 'needle' or 'plate'\n useMinPath: false,\n\n barWidth: 0\n});\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gradient-filled circle on a canvas\n *\n * @access private\n * @param {number} radius\n * @param {number} width\n * @param {Canvas2DContext} context\n * @param {string} start gradient start color\n * @param {string} end gradient end color\n */\nfunction drawRadialBorder(radius, width, context, start, end) {\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(radius), 0, PI * 2, true);\n context.lineWidth = width;\n context.strokeStyle = end ? drawings.linearGradient(context, start, end, radius) : start;\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Returns max radius without borders for the gauge\n *\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n * @return {number}\n */\nfunction maxRadialRadius(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n\n if (!context.maxRadius) {\n context.maxRadius = context.max - options.borderShadowWidth - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio + (options.borderOuterWidth ? 0.5 : 0) + (options.borderMiddleWidth ? 0.5 : 0) + (options.borderInnerWidth ? 0.5 : 0);\n }\n\n return context.maxRadius;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge plate on the canvas\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialPlate(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n var d0 = options.borderShadowWidth * pxRatio;\n var r0 = context.max - d0 - options.borderOuterWidth * pxRatio / 2;\n var r1 = r0 - options.borderOuterWidth * pxRatio / 2 - options.borderMiddleWidth * pxRatio / 2 + 0.5;\n var r2 = r1 - options.borderMiddleWidth * pxRatio / 2 - options.borderInnerWidth * pxRatio / 2 + 0.5;\n var r3 = maxRadialRadius(context, options);\n var grad = void 0;\n var shadowDrawn = false;\n\n context.save();\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r0, options.borderOuterWidth * pxRatio, context, options.colorBorderOuter, options.colorBorderOuterEnd);\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r1, options.borderMiddleWidth * pxRatio, context, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r2, options.borderInnerWidth * pxRatio, context, options.colorBorderInner, options.colorBorderInnerEnd);\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(r3), 0, PI * 2, true);\n\n if (options.colorPlateEnd) {\n grad = context.createRadialGradient(0, 0, r3 / 2, 0, 0, r3);\n grad.addColorStop(0, options.colorPlate);\n grad.addColorStop(1, options.colorPlateEnd);\n } else {\n grad = options.colorPlate;\n }\n\n context.fillStyle = grad;\n\n context.fill();\n context.closePath();\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge highlight areas on a canvas\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialHighlights(context, options) {\n var hlWidth = context.max * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!hlWidth) return;\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options) - hlWidth / 2);\n var i = 0,\n s = options.highlights.length;\n var vd = (options.maxValue - options.minValue) / options.ticksAngle;\n\n context.save();\n\n for (; i < s; i++) {\n var hlt = options.highlights[i];\n\n context.beginPath();\n\n context.rotate(HPI);\n context.arc(0, 0, r, drawings.radians(options.startAngle + (hlt.from - options.minValue) / vd), drawings.radians(options.startAngle + (hlt.to - options.minValue) / vd), false);\n context.strokeStyle = hlt.color;\n context.lineWidth = hlWidth;\n context.stroke();\n context.closePath();\n\n context.restore();\n context.save();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws minor ticks bar on a canvas\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialMinorTicks(context, options) {\n var radius = radialTicksRadius(context, options);\n var s = void 0,\n range = void 0,\n angle = void 0;\n var i = 0;\n var delta = 0;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n\n context.lineWidth = SmartCanvas.pixelRatio;\n context.strokeStyle = options.colorMinorTicks || options.colorStrokeTicks;\n\n context.save();\n\n if (options.exactTicks) {\n range = options.maxValue - options.minValue;\n s = minTicks ? range / minTicks : 0;\n delta = (options.majorTicks[0] % minTicks || 0) * ratio;\n } else {\n s = minTicks * (options.majorTicks.length - 1);\n }\n\n for (; i < s; ++i) {\n angle = options.startAngle + delta + i * (options.ticksAngle / s);\n\n context.rotate(drawings.radians(angle));\n\n context.beginPath();\n context.moveTo(0, radius);\n context.lineTo(0, radius - context.max * 0.075);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Returns ticks radius\n *\n * @access private\n * @param context\n * @param options\n * @return {number}\n */\nfunction radialTicksRadius(context, options) {\n var unit = context.max / 100;\n\n return maxRadialRadius(context, options) - 5 * unit - (options.barWidth ? (parseFloat(options.barStrokeWidth) || 0) * 2 + ((parseFloat(options.barWidth) || 0) + 5) * unit : 0);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge major ticks bar on a canvas\n *\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialMajorTicks(context, options) {\n drawings.prepareTicks(options);\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options));\n var i = void 0,\n colors = void 0;\n var s = options.majorTicks.length;\n var pixelRatio = SmartCanvas.pixelRatio;\n\n context.lineWidth = 2 * pixelRatio;\n context.save();\n\n colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(s).fill(options.colorStrokeTicks || options.colorMajorTicks);\n\n i = 0;\n for (; i < s; ++i) {\n context.strokeStyle = colors[i];\n context.rotate(drawings.radians(radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s)));\n\n context.beginPath();\n context.moveTo(0, r);\n context.lineTo(0, r - context.max * 0.15);\n closeStrokedPath(context);\n }\n\n if (options.strokeTicks) {\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n context.rotate(HPI);\n\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\nfunction radialNextAngle(options, i, s) {\n if (options.exactTicks) {\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n return options.startAngle + ratio * (i - options.minValue);\n }\n\n return options.startAngle + i * (options.ticksAngle / (s - 1));\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Strokes, closes path and restores previous context state\n *\n * @param {Canvas2DContext} context\n */\nfunction closeStrokedPath(context) {\n context.stroke();\n context.restore();\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge bar numbers\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialNumbers(context, options) {\n var radius = radialTicksRadius(context, options) - context.max * 0.15;\n var points = {};\n var i = 0;\n var s = options.majorTicks.length;\n var isAnimated = options.animationTarget !== 'needle';\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(s).fill(options.colorNumbers);\n\n var plateValueAngle = isAnimated ? -(options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle : 0;\n\n if (isAnimated) {\n context.save();\n context.rotate(-drawings.radians(plateValueAngle));\n }\n\n context.font = drawings.font(options, 'Numbers', context.max / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n\n for (; i < s; ++i) {\n var angle = plateValueAngle + radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s);\n var textWidth = context.measureText(options.majorTicks[i]).width;\n var textHeight = options.fontNumbersSize;\n var textRadius = Math.sqrt(textWidth * textWidth + textHeight * textHeight) / 2;\n var point = drawings.radialPoint(radius - textRadius - options.numbersMargin / 100 * context.max, drawings.radians(angle));\n\n if (angle === 360) angle = 0;\n\n if (points[angle]) {\n continue; //already drawn at this place, skipping\n }\n\n points[angle] = true;\n\n context.fillStyle = colors[i];\n context.fillText(options.majorTicks[i], point.x, point.y);\n }\n\n isAnimated && context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge title\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialTitle(context, options) {\n if (!options.title) return;\n\n context.save();\n context.font = drawings.font(options, 'Title', context.max / 200);\n context.fillStyle = options.colorTitle;\n context.textAlign = 'center';\n context.fillText(options.title, 0, -context.max / 4.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws units name on the gauge\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialUnits(context, options) {\n if (!options.units) return;\n\n context.save();\n context.font = drawings.font(options, 'Units', context.max / 200);\n context.fillStyle = options.colorUnits;\n context.textAlign = 'center';\n context.fillText(options.units, 0, context.max / 3.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge needle\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialNeedle(context, options) {\n if (!options.needle) return;\n\n var value = options.ticksAngle < 360 ? drawings.normalizedValue(options).indented : options.value;\n var max = maxRadialRadius(context, options);\n //noinspection JSUnresolvedFunction\n var r1 = abs(max / 100 * options.needleCircleSize);\n //noinspection JSUnresolvedFunction\n var r2 = abs(max / 100 * options.needleCircleSize * 0.75);\n //noinspection JSUnresolvedFunction\n var rIn = abs(max / 100 * options.needleEnd);\n //noinspection JSUnresolvedFunction\n var rStart = abs(options.needleStart ? max / 100 * options.needleStart : 0);\n //noinspection JSUnresolvedFunction\n var pad1 = max / 100 * options.needleWidth;\n var pad2 = max / 100 * options.needleWidth / 2;\n var pixelRatio = SmartCanvas.pixelRatio;\n var isFixed = options.animationTarget !== 'needle';\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n context.rotate(drawings.radians(isFixed ? options.startAngle : options.startAngle + (value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle));\n\n context.fillStyle = drawings.linearGradient(context, options.colorNeedle, options.colorNeedleEnd, rIn - rStart);\n\n if (options.needleType === 'arrow') {\n context.beginPath();\n context.moveTo(-pad2, -rStart);\n context.lineTo(-pad1, 0);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(pixelRatio, rIn);\n context.lineTo(pad1, 0);\n context.lineTo(pad2, -rStart);\n context.closePath();\n context.fill();\n\n context.beginPath();\n context.lineTo(-0.5 * pixelRatio, rIn);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(-pad1, 0);\n context.lineTo(-pad2, -rStart);\n context.lineTo(pad2 / 2 * pixelRatio - 2 * pixelRatio, -rStart);\n context.closePath();\n context.fillStyle = options.colorNeedleShadowUp;\n context.fill();\n } else {\n // simple line needle\n context.beginPath();\n context.moveTo(-pad2, rIn);\n context.lineTo(-pad2, rStart);\n context.lineTo(pad2, rStart);\n context.lineTo(pad2, rIn);\n context.closePath();\n context.fill();\n }\n\n if (options.needleCircleSize) {\n context.restore();\n\n drawings.drawNeedleShadow(context, options);\n\n if (options.needleCircleOuter) {\n context.beginPath();\n context.arc(0, 0, r1, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleOuter, options.colorNeedleCircleOuterEnd, r1);\n context.fill();\n context.closePath();\n }\n\n if (options.needleCircleInner) {\n context.beginPath();\n context.arc(0, 0, r2, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleInner, options.colorNeedleCircleInnerEnd, r2);\n context.fill();\n context.closePath();\n }\n\n context.restore();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge value box\n *\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n * @param {number} value\n */\nfunction drawRadialValueBox(context, options, value) {\n drawings.drawValueBox(context, options, value, 0, context.max - context.max * 0.33, context.max);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge progress bar\n *\n * @param {Canvas2DContext} context\n * @param {RadialGaugeOptions} options\n */\nfunction drawRadialProgressBar(context, options) {\n var unit = context.max / 100;\n var rMax = maxRadialRadius(context, options) - 5 * unit;\n var sw = parseFloat(options.barStrokeWidth) || 0;\n var w = (parseFloat(options.barWidth) || 0) * unit;\n var rMin = rMax - sw * 2 - w;\n var half = (rMax - rMin) / 2;\n var r = rMin + half;\n var delta = sw / r;\n var sa = options.startAngle;\n var ea = options.startAngle + options.ticksAngle;\n\n context.save();\n context.rotate(HPI);\n\n if (sw) {\n // draw stroke\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa) - delta, drawings.radians(ea) + delta, false);\n context.strokeStyle = options.colorBarStroke;\n context.lineWidth = half * 2;\n context.stroke();\n context.closePath();\n }\n\n if (w) {\n // draw bar\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(ea), false);\n context.strokeStyle = options.colorBar;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n\n if (options.barShadow) {\n // draw shadow\n context.beginPath();\n context.arc(0, 0, rMax, drawings.radians(sa), drawings.radians(ea), false);\n context.clip();\n\n context.beginPath();\n context.strokeStyle = options.colorBar;\n context.lineWidth = 1;\n context.shadowBlur = options.barShadow;\n context.shadowColor = options.colorBarShadow;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n context.arc(0, 0, rMax, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n context.stroke();\n context.closePath();\n\n context.restore();\n context.rotate(HPI);\n }\n\n // draw bar progress\n if (options.barProgress) {\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(sa + (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle), false);\n context.strokeStyle = options.colorBarProgress;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n }\n }\n\n context.restore();\n}\n\n/**\n * Find and return gauge value to display\n *\n * @param {RadialGauge} gauge\n */\nfunction displayValue(gauge) {\n if (gauge.options.animatedValue) {\n return gauge.options.value;\n }\n\n return gauge.value;\n}\n\n/**\n * Minimalistic HTML5 Canvas Gauge\n * @example\n * var gauge = new RadialGauge({\n * renderTo: 'gauge-id', // identifier of HTML canvas element or element itself\n * width: 400,\n * height: 400,\n * units: 'Km/h',\n * title: false,\n * value: 0,\n * minValue: 0,\n * maxValue: 220,\n * majorTicks: [\n * '0','20','40','60','80','100','120','140','160','180','200','220'\n * ],\n * minorTicks: 2,\n * strokeTicks: false,\n * highlights: [\n * { from: 0, to: 50, color: 'rgba(0,255,0,.15)' },\n * { from: 50, to: 100, color: 'rgba(255,255,0,.15)' },\n * { from: 100, to: 150, color: 'rgba(255,30,0,.25)' },\n * { from: 150, to: 200, color: 'rgba(255,0,225,.25)' },\n * { from: 200, to: 220, color: 'rgba(0,0,255,.25)' }\n * ],\n * colorPlate: '#222',\n * colorMajorTicks: '#f5f5f5',\n * colorMinorTicks: '#ddd',\n * colorTitle: '#fff',\n * colorUnits: '#ccc',\n * colorNumbers: '#eee',\n * colorNeedleStart: 'rgba(240, 128, 128, 1)',\n * colorNeedleEnd: 'rgba(255, 160, 122, .9)',\n * valueBox: true,\n * animationRule: 'bounce'\n * });\n * // draw initially\n * gauge.draw();\n * // animate\n * setInterval(() => {\n * gauge.value = Math.random() * -220 + 220;\n * }, 1000);\n */\n\nvar RadialGauge = function (_BaseGauge) {\n _inherits(RadialGauge, _BaseGauge);\n\n /**\n * Fired each time before gauge plate is drawn\n *\n * @event RadialGauge#beforePlate\n */\n\n /**\n * Fired each time before gauge highlight areas are drawn\n *\n * @event RadialGauge#beforeHighlights\n */\n\n /**\n * Fired each time before gauge minor ticks are drawn\n *\n * @event RadialGauge#beforeMinorTicks\n */\n\n /**\n * Fired each time before gauge major ticks are drawn\n *\n * @event RadialGauge#beforeMajorTicks\n */\n\n /**\n * Fired each time before gauge tick numbers are drawn\n *\n * @event RadialGauge#beforeNumbers\n */\n\n /**\n * Fired each time before gauge title is drawn\n *\n * @event RadialGauge#beforeTitle\n */\n\n /**\n * Fired each time before gauge units text is drawn\n *\n * @event RadialGauge#beforeUnits\n */\n\n /**\n * Fired each time before gauge progress bar is drawn\n *\n * @event RadialGauge#beforeProgressBar\n */\n\n /**\n * Fired each time before gauge value box is drawn\n *\n * @event RadialGauge#beforeValueBox\n */\n\n /**\n * Fired each time before gauge needle is drawn\n *\n * @event RadialGauge#beforeNeedle\n */\n\n /**\n * @constructor\n * @param {RadialGaugeOptions} options\n */\n function RadialGauge(options) {\n _classCallCheck(this, RadialGauge);\n\n options = Object.assign({}, defaultRadialGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (RadialGauge.__proto__ || Object.getPrototypeOf(RadialGauge)).call(this, RadialGauge.configure(options)));\n }\n\n /**\n * Checks and updates gauge options properly\n *\n * @param {*} options\n * @return {*}\n * @access protected\n */\n\n\n _createClass(RadialGauge, [{\n key: 'draw',\n\n\n /**\n * Triggering gauge render on a canvas.\n *\n * @returns {RadialGauge}\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref[0],\n y = _ref[1],\n w = _ref[2],\n h = _ref[3];\n\n var options = this.options;\n\n if (options.animationTarget === 'needle') {\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(context, options);\n this.emit('beforeHighlights');\n drawRadialHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(context, options);\n this.emit('beforeTitle');\n drawRadialTitle(context, options);\n this.emit('beforeUnits');\n drawRadialUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n this.emit('beforeNeedle');\n drawRadialNeedle(canvas.context, options);\n } else {\n var plateValueAngle = -drawings.radians((options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle);\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(canvas.context, options);\n\n canvas.context.rotate(plateValueAngle);\n\n // animated\n this.emit('beforeHighlights');\n drawRadialHighlights(canvas.context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(canvas.context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(canvas.context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(canvas.context, options);\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n\n // non-animated\n canvas.context.rotate(-plateValueAngle);\n canvas.context.save();\n\n if (!canvas.elementClone.initialized) {\n var _context = canvas.contextClone;\n\n // clear the cache\n _context.clearRect(x, y, w, h);\n _context.save();\n\n this.emit('beforeTitle');\n drawRadialTitle(_context, options);\n this.emit('beforeUnits');\n drawRadialUnits(_context, options);\n this.emit('beforeNeedle');\n drawRadialNeedle(_context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n }\n\n // value box animations\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n\n _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }, {\n key: 'value',\n\n\n /**\n * Sets the value for radial gauge\n *\n * @param {number} value\n */\n set: function set(value) {\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n if (this.options.animation && this.options.ticksAngle === 360 && this.options.useMinPath) {\n this._value = value;\n value = this.options.value + ((value - this.options.value) % 360 + 540) % 360 - 180;\n }\n\n _set(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', value, this);\n }\n\n /**\n * Returns current gauge value\n *\n * @return {number}\n */\n ,\n get: function get() {\n return _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', this);\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n if (options.barWidth > 50) options.barWidth = 50;\n\n /* istanbul ignore if */\n if (isNaN(options.startAngle)) options.startAngle = 45;\n /* istanbul ignore if */\n if (isNaN(options.ticksAngle)) options.ticksAngle = 270;\n\n /* istanbul ignore if */\n if (options.ticksAngle > 360) options.ticksAngle = 360;\n /* istanbul ignore if */\n if (options.ticksAngle < 0) options.ticksAngle = 0;\n\n /* istanbul ignore if */\n if (options.startAngle < 0) options.startAngle = 0;\n /* istanbul ignore if */\n if (options.startAngle > 360) options.startAngle = 360;\n\n return options;\n }\n }]);\n\n return RadialGauge;\n}(BaseGauge);\n\n/**\n * @ignore\n * @typedef {object} ns\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['RadialGauge'] = RadialGauge;\n}\n\nBaseGauge.initialize('RadialGauge', defaultRadialGaugeOptions);\n\n/*!\n * The MIT License (MIT)\n *\n * Copyright (c) 2016 Mykhailo Stadnyk \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Linear gauge configuration options\n *\n * @typedef {GenericOptions|{borderRadius: number, barBeginCircle: number, tickSide: string, needleSide: string, numberSide: string, ticksWidth: number, ticksWidthMinor: number, ticksPadding: number, barLength: number, colorBarEnd: string, colorBarProgressEnd: string}} LinearGaugeOptions\n */\n\n/**\n * Default linear gauge configuration options\n *\n * @type {LinearGaugeOptions}\n */\nvar defaultLinearGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n borderRadius: 0,\n // width: 150,\n // height: 400,\n\n // bar\n barBeginCircle: 30, // percents\n colorBarEnd: '',\n colorBarProgressEnd: '',\n\n needleWidth: 6,\n\n tickSide: 'both', // available: 'left', 'right', 'both'\n needleSide: 'both', // available: 'left', 'right', 'both'\n\n numberSide: 'both', // available: 'left', 'right', 'both'\n\n ticksWidth: 10,\n ticksWidthMinor: 5,\n ticksPadding: 5,\n barLength: 85,\n fontTitleSize: 26,\n\n highlightsWidth: 10\n});\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws rectangle on a canvas\n *\n * @param {Canvas2DContext} context\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\n * @param {number} x x-coordinate of the top-left corner\n * @param {number} y y-coordinate of the top-left corner\n * @param {number} w width of the rectangle\n * @param {number} h height of the rectangle\n * @param {string} colorStart base fill color of the rectangle\n * @param {string} [colorEnd] gradient color of the rectangle\n */\nfunction drawRectangle(context, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.fillStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, w > h ? w : h, h > w, w > h ? x : y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws rectangle on a canvas\n *\n * @param {Canvas2DContext} context\n * @param {number} width width of the border\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\n * @param {number} x x-coordinate of the top-left corner\n * @param {number} y y-coordinate of the top-left corner\n * @param {number} w width of the rectangle\n * @param {number} h height of the rectangle\n * @param {string} colorStart base fill color of the rectangle\n * @param {string} [colorEnd] gradient color of the rectangle\n */\nfunction drawLinearBorder(context, width, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.lineWidth = width;\n context.strokeStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, h, true, y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws linear gauge plate\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} x\n * @param {number} y\n * @param {number} w\n * @param {number} h\n */\nfunction drawLinearPlate(context, options, x, y, w, h) {\n var pxRatio = SmartCanvas.pixelRatio;\n context.save();\n\n var r = options.borderRadius * pxRatio;\n var w1 = w - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var w2 = w1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var w3 = w2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var w4 = w3 - options.borderInnerWidth * pxRatio;\n\n var h1 = h - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var h2 = h1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var h3 = h2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var h4 = h3 - options.borderInnerWidth * pxRatio;\n\n var x2 = x - (w2 - w1) / 2;\n var x3 = x2 - (w3 - w2) / 2;\n var x4 = x3 - (w4 - w3) / 2;\n\n var y2 = y - (h2 - h1) / 2;\n var y3 = y2 - (h3 - h2) / 2;\n var y4 = y3 - (h4 - h3) / 2;\n var aliasingOffset = 0;\n var shadowDrawn = false;\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderOuterWidth * pxRatio, r, x + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, y + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, w1, h1, options.colorBorderOuter, options.colorBorderOuterEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderMiddleWidth * pxRatio, r -= 1 + aliasingOffset * 2, x2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, y2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, w2 + aliasingOffset * 2, h2 + aliasingOffset * 2, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderInnerWidth * pxRatio, r -= 1 + aliasingOffset * 2, x3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, y3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, w3 + aliasingOffset * 2, h3 + aliasingOffset * 2, options.colorBorderInner, options.colorBorderInnerEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n drawRectangle(context, r, x4, y4, w4 + aliasingOffset * 2, h4 + aliasingOffset * 2, options.colorPlate, options.colorPlateEnd);\n\n context.restore();\n\n return [x4, y4, w4, h4];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Calculates and returns linear gauge base bar dimensions.\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions|{barStrokeWidth: number, barBeginCircle: number, barWidth: number, hasLeft: boolean, hasRight: boolean}} options\n * @param {number} x\n * @param {number} y\n * @param {number} w\n * @param {number} h\n * @return {{isVertical: boolean, width: number, length: number, barWidth: number, barLength: number, strokeWidth: number, barMargin: number, radius: number, x0: number, y0: number, barOffset: number, titleMargin: number, unitsMargin: number, X: number, Y: number, baseX: number, baseY: number, ticksPadding: number}}\n */\nfunction barDimensions(context, options, x, y, w, h) {\n var pixelRatio = SmartCanvas.pixelRatio;\n var isVertical = h >= w;\n var width = isVertical ? w * 0.85 : h;\n var length = isVertical ? h : w;\n\n //noinspection JSUnresolvedFunction\n x = isVertical ? round(x + (w - width) / 2) : x;\n\n var hasTitle = !!options.title;\n var hasUnits = !!options.units;\n var hasValue = !!options.valueBox;\n\n var titleMargin = void 0;\n var unitsMargin = void 0;\n var valueMargin = void 0;\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n unitsMargin = round(length * 0.05);\n //noinspection JSUnresolvedFunction\n titleMargin = round(length * 0.075);\n //noinspection JSUnresolvedFunction\n valueMargin = round(length * 0.11);\n\n if (hasTitle) {\n length -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) length -= unitsMargin;\n if (hasValue) length -= valueMargin;\n } else {\n //noinspection JSUnresolvedFunction\n unitsMargin = titleMargin = round(width * 0.15);\n\n if (hasTitle) {\n width -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) width -= unitsMargin;\n }\n\n var strokeWidth = options.barStrokeWidth * 2;\n //noinspection JSUnresolvedFunction\n var radius = options.barBeginCircle ? round(width * options.barBeginCircle / 200 - strokeWidth / 2) : 0;\n //noinspection JSUnresolvedFunction\n var barWidth = round(width * options.barWidth / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barLength = round(length * options.barLength / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barMargin = round((length - barLength) / 2);\n\n // coordinates for arc of the bar if configured\n //noinspection JSUnresolvedFunction\n var x0 = round(x + (isVertical ? width / 2 : barMargin + radius));\n //noinspection JSUnresolvedFunction\n var y0 = round(y + (isVertical ? length - barMargin - radius + strokeWidth / 2 : width / 2));\n var dx = isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n var dy = !isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n\n //noinspection JSUndefinedPropertyAssignment\n context.barDimensions = {\n isVertical: isVertical,\n width: width,\n length: length,\n barWidth: barWidth,\n barLength: barLength,\n strokeWidth: strokeWidth,\n barMargin: barMargin,\n radius: radius,\n pixelRatio: pixelRatio,\n barOffset: null,\n titleMargin: hasTitle ? titleMargin : 0,\n unitsMargin: hasUnits ? unitsMargin : 0,\n get ticksLength() {\n return this.barLength - this.barOffset - this.strokeWidth;\n },\n X: x + dx,\n Y: y + dy,\n x0: x0 + dx,\n y0: y0 + dy,\n baseX: x,\n baseY: y,\n ticksPadding: options.ticksPadding / 100\n };\n\n return context.barDimensions;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws bar shape from the given options on a given canvas context\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {string} type\n * @param {number} x\n * @param {number} y\n * @param {number} w\n * @param {number} h\n */\nfunction drawLinearBarShape(context, options, type, x, y, w, h) {\n var _barDimensions = barDimensions(context, options, x, y, w, h),\n isVertical = _barDimensions.isVertical,\n width = _barDimensions.width,\n barWidth = _barDimensions.barWidth,\n barLength = _barDimensions.barLength,\n strokeWidth = _barDimensions.strokeWidth,\n barMargin = _barDimensions.barMargin,\n radius = _barDimensions.radius,\n x0 = _barDimensions.x0,\n y0 = _barDimensions.y0,\n X = _barDimensions.X,\n Y = _barDimensions.Y;\n\n var fullBarLength = barLength;\n\n context.save();\n context.beginPath();\n\n if (options.barBeginCircle) {\n var direction = drawings.radians(isVertical ? 270 : 0);\n var alpha = Math.asin(barWidth / 2 / radius);\n var cosAlpha = Math.cos(alpha);\n var sinAlpha = Math.sin(alpha);\n\n var x1 = x0 + (isVertical ? radius * sinAlpha : radius * cosAlpha - strokeWidth / 2);\n var y1 = isVertical ? y0 - radius * cosAlpha : y0 + radius * sinAlpha;\n //noinspection JSUnresolvedFunction\n var cutRadius = isVertical ? abs(y1 - y0) : abs(x1 - x0);\n\n //noinspection JSUnresolvedFunction\n context.barDimensions.barOffset = round(cutRadius + radius);\n\n // bottom point\n //noinspection JSUnresolvedFunction\n var x2 = isVertical ? round(x0 - radius * sinAlpha) : x1;\n //noinspection JSUnresolvedFunction\n var y2 = isVertical ? y1 : round(y0 - radius * sinAlpha);\n\n if (type === 'progress') {\n barLength = context.barDimensions.barOffset + (barLength - context.barDimensions.barOffset) * (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue);\n }\n\n // bar ends at\n //noinspection JSUnresolvedFunction\n var x3 = round(x1 + barLength - context.barDimensions.barOffset + strokeWidth / 2); // h\n //noinspection JSUnresolvedFunction\n var y3 = round(y1 - barLength + context.barDimensions.barOffset - strokeWidth / 2); // v\n\n context.arc(x0, y0, radius, direction + alpha, direction - alpha);\n\n if (isVertical) {\n context.moveTo(x1, y2);\n context.lineTo(x1, y3);\n context.lineTo(x2, y3);\n context.lineTo(x2, y2);\n } else {\n context.moveTo(x1, y2);\n context.lineTo(x3, y2);\n context.lineTo(x3, y1);\n context.lineTo(x1, y1);\n }\n } else {\n // simply rectangle\n //noinspection JSUnresolvedFunction\n var rx = round(isVertical ? X + (width - barWidth) / 2 : X + barMargin);\n //noinspection JSUnresolvedFunction\n var ry = round(isVertical ? Y + barLength + barMargin : Y + (width - barWidth) / 2);\n\n if (type === 'progress') {\n barLength *= (options.value - options.minValue) / (options.maxValue - options.minValue);\n }\n\n if (isVertical) context.rect(rx, ry, barWidth, -barLength);else context.rect(rx, ry, barLength, barWidth);\n }\n\n if (type !== 'progress' && options.barStrokeWidth) {\n context.lineWidth = strokeWidth;\n context.strokeStyle = options.colorBarStroke;\n //context.lineJoin = 'round';\n context.stroke();\n }\n\n if (type !== 'progress' && options.colorBar) {\n context.fillStyle = options.colorBarEnd ? drawings.linearGradient(context, options.colorBar, options.colorBarEnd, barLength, isVertical, isVertical ? Y : X) : options.colorBar;\n context.fill();\n } else if (type === 'progress' && options.colorBarProgress) {\n context.fillStyle = options.colorBarProgressEnd ? drawings.linearGradient(context, options.colorBarProgress, options.colorBarProgressEnd, fullBarLength, isVertical, isVertical ? Y : X) : options.colorBarProgress;\n context.fill();\n }\n\n context.closePath();\n\n // fix dimensions for further usage\n if (options.barBeginCircle) context.barDimensions.radius += strokeWidth;\n\n context.barDimensions.barWidth += strokeWidth;\n context.barDimensions.barLength += strokeWidth;\n}\n\n/**\n * Draws gauge bar\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} x x-coordinate of the top-left corner of the gauge\n * @param {number} y y-coordinate of the top-left corner of the gauge\n * @param {number} w width of the gauge\n * @param {number} h height of the gauge\n */\nfunction drawLinearBar(context, options, x, y, w, h) {\n drawLinearBarShape(context, options, '', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Helper function to calculate bar ticks presence on the sides\n *\n * @param {string} notWhich\n * @param {LinearGaugeOptions} options\n * @return {boolean}\n */\nfunction hasTicksBar(notWhich, options) {\n return options.needleSide !== notWhich || options.tickSide !== notWhich || options.numberSide !== notWhich;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge bar progress\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} x x-coordinate of the top-left corner of the gauge\n * @param {number} y y-coordinate of the top-left corner of the gauge\n * @param {number} w width of the gauge\n * @param {number} h height of the gauge\n */\nfunction drawLinearBarProgress(context, options, x, y, w, h) {\n options.barProgress && drawLinearBarShape(context, options, 'progress', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws gauge bar highlighted areas\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearBarHighlights(context, options) {\n var _context$barDimension = context.barDimensions,\n isVertical = _context$barDimension.isVertical,\n width = _context$barDimension.width,\n length = _context$barDimension.length,\n barWidth = _context$barDimension.barWidth,\n barOffset = _context$barDimension.barOffset,\n barMargin = _context$barDimension.barMargin,\n X = _context$barDimension.X,\n Y = _context$barDimension.Y,\n ticksLength = _context$barDimension.ticksLength,\n ticksPadding = _context$barDimension.ticksPadding;\n\n var hlWidth = width * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!options.highlights || !hlWidth) return;\n\n var hasLeft = options.tickSide !== 'right';\n var hasRight = options.tickSide !== 'left';\n var i = 0;\n var s = options.highlights.length;\n var tickOffset = (width - barWidth) / 2;\n var interval = options.maxValue - options.minValue;\n //noinspection JSUnresolvedFunction\n var eX = round(isVertical ? X + tickOffset : X + barMargin + barOffset);\n var eH = hlWidth;\n var eY = isVertical ? Y + length - barMargin - barOffset : Y + tickOffset;\n //noinspection JSUnresolvedFunction\n var hLeft = round((options.ticksWidth / 100 + ticksPadding) * width) + (hlWidth - options.ticksWidth / 100 * width);\n //noinspection JSUnresolvedFunction\n var hRight = round(barWidth + ticksPadding * width);\n\n context.save();\n\n for (; i < s; i++) {\n var entry = options.highlights[i];\n //noinspection JSUnresolvedFunction\n var eStart = ticksLength * abs(options.minValue - entry.from) / interval;\n //noinspection JSUnresolvedFunction\n var eW = ticksLength * abs((entry.to - entry.from) / interval);\n\n context.beginPath();\n context.fillStyle = entry.color;\n\n if (isVertical) {\n if (hasLeft) context.rect(eX - hLeft, eY - eStart, eH, -eW);\n\n if (hasRight) context.rect(eX + hRight, eY - eStart, eH, -eW);\n } else {\n if (hasLeft) context.rect(eX + eStart, eY - hLeft, eW, eH);\n\n if (hasRight) context.rect(eX + eStart, eY + hRight, eW, eH);\n }\n\n context.fill();\n context.closePath();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws a tick line on a linear gauge\n *\n * @param {Canvas2DContext} context\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\nfunction drawLinearTick(context, x1, y1, x2, y2) {\n context.beginPath();\n\n context.moveTo(x1, y1);\n context.lineTo(x2, y2);\n context.stroke();\n\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws ticks\n *\n * @param {Canvas2DContext} context\n * @param {string} color\n * @param {number[]} ticks\n * @param {number} minVal\n * @param {number} maxVal\n * @param {boolean} hasLeft\n * @param {boolean} hasRight\n * @param {number} lineWidth\n * @param {number} lineLength\n */\nfunction drawLinearTicks(context, color, ticks, minVal, maxVal, hasLeft, hasRight, lineWidth, lineLength) {\n var _context$barDimension2 = context.barDimensions,\n isVertical = _context$barDimension2.isVertical,\n length = _context$barDimension2.length,\n barWidth = _context$barDimension2.barWidth,\n barOffset = _context$barDimension2.barOffset,\n barMargin = _context$barDimension2.barMargin,\n pixelRatio = _context$barDimension2.pixelRatio,\n width = _context$barDimension2.width,\n X = _context$barDimension2.X,\n Y = _context$barDimension2.Y,\n ticksLength = _context$barDimension2.ticksLength,\n ticksPadding = _context$barDimension2.ticksPadding;\n\n var tickOffset = (width - barWidth) / 2;\n var tickX = void 0,\n tickY = void 0;\n var i = 0;\n var s = ticks.length;\n var val = void 0;\n var tickLen = lineLength * width;\n var tickLeft = tickOffset - ticksPadding * width;\n var tickRight = tickOffset + barWidth + tickLen + ticksPadding * width;\n var colors = color instanceof Array ? color : new Array(ticks.length).fill(color);\n\n context.lineWidth = lineWidth * pixelRatio;\n context.save();\n\n var ratio = ticksLength / (maxVal - minVal);\n for (; i < s; i++) {\n val = ticks[i];\n context.strokeStyle = colors[i];\n\n if (isVertical) {\n tickY = Y + length - barMargin - barOffset + (minVal - val) * ratio;\n\n if (hasLeft) {\n tickX = X + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n\n if (hasRight) {\n tickX = X + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n } else {\n tickX = X + barMargin + barOffset - (minVal - val) * ratio;\n\n if (hasLeft) {\n tickY = Y + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, tickX, round(tickY - tickLen));\n }\n\n if (hasRight) {\n tickY = Y + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, round(tickY), tickX, tickY - tickLen);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws major ticks\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearMajorTicks(context, options) {\n var _drawings$prepareTick = drawings.prepareTicks(options),\n _drawings$prepareTick2 = _slicedToArray(_drawings$prepareTick, 2),\n hasLeft = _drawings$prepareTick2[0],\n hasRight = _drawings$prepareTick2[1];\n\n var lineWidth = 2;\n var valuePerNonExactTick = (options.maxValue - options.minValue) / (options.majorTicks.length - 1);\n var colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(options.majorTicks.length).fill(options.colorStrokeTicks || options.colorMajorTicks);\n var ticks = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n\n drawLinearTicks(context, colors, ticks, options.minValue, options.maxValue, hasLeft, hasRight, lineWidth, options.ticksWidth / 100);\n\n if (options.strokeTicks) {\n var _context$barDimension3 = context.barDimensions,\n isVertical = _context$barDimension3.isVertical,\n length = _context$barDimension3.length,\n width = _context$barDimension3.width,\n barWidth = _context$barDimension3.barWidth,\n barMargin = _context$barDimension3.barMargin,\n barOffset = _context$barDimension3.barOffset,\n X = _context$barDimension3.X,\n Y = _context$barDimension3.Y,\n ticksLength = _context$barDimension3.ticksLength,\n pixelRatio = _context$barDimension3.pixelRatio,\n ticksPadding = _context$barDimension3.ticksPadding;\n\n var rightTicks = (width - barWidth) / 2 + barWidth + ticksPadding * width;\n var leftTicks = (width - barWidth) / 2 - ticksPadding * width;\n var sX = void 0,\n sY = void 0,\n eX = void 0,\n eY = void 0;\n\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n\n lineWidth *= pixelRatio;\n\n if (isVertical) {\n sY = Y + length - barMargin - barOffset + lineWidth / 2;\n eY = sY - ticksLength - lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n } else {\n sX = X + barMargin + barOffset - lineWidth / 2;\n eX = sX + ticksLength + lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws ticks stroke\n *\n * @param {Canvas2DContext} context\n * @param {number} sX\n * @param {number} sY\n * @param {number} eX\n * @param {number} eY\n */\nfunction drawLinearTickStroke(context, sX, sY, eX, eY) {\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws minor ticks\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearMinorTicks(context, options) {\n var _drawings$prepareTick3 = drawings.prepareTicks(options),\n _drawings$prepareTick4 = _slicedToArray(_drawings$prepareTick3, 2),\n hasLeft = _drawings$prepareTick4[0],\n hasRight = _drawings$prepareTick4[1];\n\n var ticks = [];\n var i = options.minValue;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var valuePerNonExactTick = minTicks ? (options.maxValue - options.minValue) / (minTicks * (options.majorTicks.length - 1)) : 0;\n\n if (minTicks) {\n if (options.exactTicks) {\n var delta = options.majorTicks[0] % minTicks || 0;\n\n for (; i < options.maxValue; i += minTicks) {\n ticks.push(delta + i);\n }\n } else {\n for (; i < options.maxValue; i += valuePerNonExactTick) {\n ticks.push(i);\n }\n }\n }\n\n drawLinearTicks(context, options.colorMinorTicks || options.colorStrokeTicks, ticks, options.minValue, options.maxValue, hasLeft, hasRight, 1, options.ticksWidthMinor / 100);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws major tick numbers\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearMajorTicksNumbers(context, options) {\n var _context$barDimension4 = context.barDimensions,\n isVertical = _context$barDimension4.isVertical,\n length = _context$barDimension4.length,\n width = _context$barDimension4.width,\n barWidth = _context$barDimension4.barWidth,\n barMargin = _context$barDimension4.barMargin,\n barOffset = _context$barDimension4.barOffset,\n X = _context$barDimension4.X,\n Y = _context$barDimension4.Y,\n ticksLength = _context$barDimension4.ticksLength,\n ticksPadding = _context$barDimension4.ticksPadding;\n\n var range = options.maxValue - options.minValue;\n var valuePerNonExactTick = range / (options.majorTicks.length - 1);\n var tickValues = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n var ticks = tickValues.length;\n var hasLeft = options.numberSide !== 'right';\n var hasRight = options.numberSide !== 'left';\n var textHeight = options.fontNumbersSize * width / 200;\n var i = 0;\n var ticksWidth = (options.ticksWidth / 100 + ticksPadding * 2) * width;\n var numLeft = (width - barWidth) / 2 - ticksWidth;\n var numRight = (width - barWidth) / 2 + barWidth + ticksWidth;\n var textX = void 0,\n textY = void 0,\n textWidth = void 0,\n numberOffset = void 0,\n tick = void 0;\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(ticks).fill(options.colorNumbers);\n var textMargin = options.numbersMargin / 100 * width;\n\n context.font = drawings.font(options, 'Numbers', width / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n\n for (; i < ticks; i++) {\n context.fillStyle = colors[i];\n tick = options.majorTicks[i];\n numberOffset = options.exactTicks ? ticksLength * ((tickValues[i] - options.minValue) / range) : i * ticksLength / (ticks - 1);\n\n if (isVertical) {\n textY = Y + length - barMargin - barOffset - numberOffset + textHeight / 3;\n\n if (hasLeft) {\n context.textAlign = 'right';\n context.fillText(tick, X + numLeft - textMargin, textY);\n }\n\n if (hasRight) {\n context.textAlign = 'left';\n context.fillText(tick, X + numRight + textMargin, textY);\n }\n } else {\n textWidth = context.measureText(tick).width;\n textX = X + barMargin + barOffset + numberOffset;\n\n if (hasLeft) {\n context.fillText(tick, textX, Y + numLeft - textMargin);\n }\n\n if (hasRight) {\n context.fillText(tick, textX, Y + numRight + textHeight + textMargin);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws linear gauge title\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearTitle(context, options) {\n if (!options.title) return;\n\n var _context$barDimension5 = context.barDimensions,\n isVertical = _context$barDimension5.isVertical,\n width = _context$barDimension5.width,\n length = _context$barDimension5.length,\n baseX = _context$barDimension5.baseX,\n baseY = _context$barDimension5.baseY,\n titleMargin = _context$barDimension5.titleMargin;\n\n var textHeight = options.fontTitleSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + titleMargin / 2 - (isVertical ? textHeight : textHeight / 2) - 0.025 * (isVertical ? length : width));\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorTitle;\n context.font = drawings.font(options, 'Title', width / 200);\n context.lineWidth = 0;\n context.fillText(options.title, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws linear gauge units\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearUnits(context, options) {\n if (!options.units) return;\n\n var _context$barDimension6 = context.barDimensions,\n isVertical = _context$barDimension6.isVertical,\n width = _context$barDimension6.width,\n length = _context$barDimension6.length,\n baseX = _context$barDimension6.baseX,\n baseY = _context$barDimension6.baseY,\n unitsMargin = _context$barDimension6.unitsMargin;\n\n var textHeight = options.fontUnitsSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + (isVertical ? length : width) + unitsMargin / 2 - textHeight / 2);\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorUnits;\n context.font = drawings.font(options, 'Units', width / 200);\n context.lineWidth = 0;\n context.fillText(options.units, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws linear gauge needles\n *\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n */\nfunction drawLinearBarNeedle(context, options) {\n if (!options.needle) return;\n\n var _context$barDimension7 = context.barDimensions,\n isVertical = _context$barDimension7.isVertical,\n width = _context$barDimension7.width,\n length = _context$barDimension7.length,\n barWidth = _context$barDimension7.barWidth,\n barOffset = _context$barDimension7.barOffset,\n barMargin = _context$barDimension7.barMargin,\n ticksLength = _context$barDimension7.ticksLength,\n X = _context$barDimension7.X,\n Y = _context$barDimension7.Y,\n ticksPadding = _context$barDimension7.ticksPadding;\n\n var hasLeft = options.needleSide !== 'right';\n var hasRight = options.needleSide !== 'left';\n var position = ticksLength * (drawings.normalizedValue(options).indented - options.minValue) / (options.maxValue - options.minValue);\n var tickWidth = (options.ticksWidth / 100 + ticksPadding) * width;\n var baseLength = barWidth / 2 + tickWidth;\n var needleLength = baseLength * (options.needleEnd / 100);\n var sX = void 0,\n eX = void 0,\n sY = void 0,\n eY = void 0;\n var draw = options.needleType.toLowerCase() === 'arrow' ? drawLinearArrowNeedle : drawLinearLineNeedle;\n var barStart = (width - barWidth) / 2;\n var needleStart = baseLength * (options.needleStart / 100);\n var nLeft = barStart - tickWidth - needleStart;\n var nRight = barStart + barWidth + tickWidth + needleStart;\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + length - barMargin - barOffset - position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nLeft);\n eX = sX + needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nRight);\n eX = sX - needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength, true);\n }\n } else {\n //noinspection JSUnresolvedFunction\n sX = round(X + barMargin + barOffset + position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nLeft);\n eY = sY + needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nRight);\n eY = sY - needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength, true);\n }\n }\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Returns needle color style\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} length\n * @param {boolean} [isRight]\n * @return {CanvasGradient|string}\n */\nfunction needleStyle(context, options, length, isRight) {\n return options.colorNeedleEnd ? drawings.linearGradient(context, isRight ? options.colorNeedleEnd : options.colorNeedle, isRight ? options.colorNeedle : options.colorNeedleEnd, length, !context.barDimensions.isVertical) : options.colorNeedle;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws line needle shape\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} sX\n * @param {number} sY\n * @param {number} eX\n * @param {number} eY\n * @param {number} length\n * @param {boolean} [isRight]\n */\nfunction drawLinearLineNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n context.lineWidth = options.needleWidth;\n context.strokeStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws arrow needle shape\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} sX\n * @param {number} sY\n * @param {number} eX\n * @param {number} eY\n * @param {number} length\n * @param {boolean} [isRight]\n */\nfunction drawLinearArrowNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n //noinspection JSUnresolvedFunction\n var peakLength = round(length * 0.4);\n var bodyLength = length - peakLength;\n var isVertical = sX === eX;\n var halfWidth = options.needleWidth / 2;\n\n context.fillStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n\n if (isVertical) {\n if (sY > eY) bodyLength *= -1;\n\n context.moveTo(sX - halfWidth, sY);\n context.lineTo(sX + halfWidth, sY);\n context.lineTo(sX + halfWidth, sY + bodyLength);\n context.lineTo(sX, eY);\n context.lineTo(sX - halfWidth, sY + bodyLength);\n context.lineTo(sX - halfWidth, sY);\n } else {\n if (sX > eX) bodyLength *= -1;\n\n context.moveTo(sX, sY - halfWidth);\n context.lineTo(sX, sY + halfWidth);\n context.lineTo(sX + bodyLength, sY + halfWidth);\n context.lineTo(eX, sY);\n context.lineTo(sX + bodyLength, sY - halfWidth);\n context.lineTo(sX, sY - halfWidth);\n }\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\n * Draws value box for linear gauge\n *\n * @access private\n * @param {Canvas2DContext} context\n * @param {LinearGaugeOptions} options\n * @param {number} value\n * @param {number} x\n * @param {number} y\n * @param {number} w\n * @param {number} h\n */\nfunction drawLinearValueBox(context, options, value, x, y, w, h) {\n // currently value box is available only for vertical linear gauge,\n // as far as by design it is hard to find a proper place for\n // horizontal ones\n var boxWidth = (parseFloat(options.fontValueSize) || 0) * w / 200;\n var dy = (0.11 * h - boxWidth) / 2;\n\n context.barDimensions.isVertical && drawings.drawValueBox(context, options, value, x + w / 2, y + h - boxWidth - dy, w);\n}\n\n/**\n * Minimalistic HTML5 Canvas Linear Gauge\n */\n\nvar LinearGauge = function (_BaseGauge2) {\n _inherits(LinearGauge, _BaseGauge2);\n\n /**\n * Fired each time before gauge plate is drawn\n *\n * @event LinearGauge#beforePlate\n */\n\n /**\n * Fired each time before gauge highlight areas are drawn\n *\n * @event LinearGauge#beforeHighlights\n */\n\n /**\n * Fired each time before gauge minor ticks are drawn\n *\n * @event LinearGauge#beforeMinorTicks\n */\n\n /**\n * Fired each time before gauge major ticks are drawn\n *\n * @event LinearGauge#beforeMajorTicks\n */\n\n /**\n * Fired each time before gauge tick numbers are drawn\n *\n * @event LinearGauge#beforeNumbers\n */\n\n /**\n * Fired each time before gauge title is drawn\n *\n * @event LinearGauge#beforeTitle\n */\n\n /**\n * Fired each time before gauge units text is drawn\n *\n * @event LinearGauge#beforeUnits\n */\n\n /**\n * Fired each time before gauge bar area is drawn\n *\n * @event LinearGauge#beforeBar\n */\n\n /**\n * Fired each time before gauge progress bar is drawn\n *\n * @event LinearGauge#beforeProgressBar\n */\n\n /**\n * Fired each time before gauge value box is drawn\n *\n * @event LinearGauge#beforeValueBox\n */\n\n /**\n * Fired each time before gauge needle is drawn\n *\n * @event LinearGauge#beforeNeedle\n */\n\n /**\n * @constructor\n * @param {LinearGaugeOptions} options\n */\n function LinearGauge(options) {\n _classCallCheck(this, LinearGauge);\n\n options = Object.assign({}, defaultLinearGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (LinearGauge.__proto__ || Object.getPrototypeOf(LinearGauge)).call(this, LinearGauge.configure(options)));\n }\n\n /**\n * Checks and updates gauge options properly\n *\n * @param {*} options\n * @return {*}\n * @access protected\n */\n\n\n _createClass(LinearGauge, [{\n key: 'draw',\n\n\n /* istanbul ignore next */\n /**\n * Triggering linear gauge render on a canvas.\n *\n * @returns {LinearGauge}\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref2 = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref2[0],\n y = _ref2[1],\n w = _ref2[2],\n h = _ref2[3];\n\n var options = this.options;\n\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n this.drawBox = drawLinearPlate(context, options, x, y, w, h);\n\n this.emit('beforeBar');\n drawLinearBar.apply(undefined, [context, options].concat(_toConsumableArray(this.drawBox)));\n\n canvas.context.barDimensions = context.barDimensions;\n\n this.emit('beforeHighlights');\n drawLinearBarHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawLinearMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawLinearMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawLinearMajorTicksNumbers(context, options);\n this.emit('beforeTitle');\n drawLinearTitle(context, options);\n this.emit('beforeUnits');\n drawLinearUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawLinearBarProgress.apply(undefined, [canvas.context, options].concat(_toConsumableArray(this.drawBox)));\n this.emit('beforeNeedle');\n drawLinearBarNeedle(canvas.context, options);\n this.emit('beforeValueBox');\n drawLinearValueBox.apply(undefined, [canvas.context, options, options.animatedValue ? this.options.value : this.value].concat(_toConsumableArray(this.drawBox)));\n\n _get(LinearGauge.prototype.__proto__ || Object.getPrototypeOf(LinearGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n /* istanbul ignore else */\n if (options.barStrokeWidth >= options.barWidth) {\n //noinspection JSUnresolvedFunction\n options.barStrokeWidth = round(options.barWidth / 2);\n }\n\n //noinspection JSUndefinedPropertyAssignment\n options.hasLeft = hasTicksBar('right', options);\n //noinspection JSUndefinedPropertyAssignment\n options.hasRight = hasTicksBar('left', options);\n\n if (options.value > options.maxValue) {\n options.value = options.maxValue;\n }\n\n if (options.value < options.minValue) {\n options.value = options.minValue;\n }\n\n return BaseGauge.configure(options);\n }\n }]);\n\n return LinearGauge;\n}(BaseGauge);\n\n/**\n * @ignore\n * @typedef {object} ns\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['LinearGauge'] = LinearGauge;\n}\n\nBaseGauge.initialize('LinearGauge', defaultLinearGaugeOptions);;typeof module !== \"undefined\" && Object.assign(ns, {Collection: Collection,GenericOptions: GenericOptions,Animation: Animation,BaseGauge: BaseGauge,drawings: drawings,SmartCanvas: SmartCanvas,DomObserver: DomObserver,vendorize: vendorize});}(typeof module !== \"undefined\" ? module.exports : window));"]} \ No newline at end of file +{"version":3,"sources":["gauge.min.js"],"names":["ns","_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_possibleConstructorReturn","self","call","ReferenceError","_inherits","subClass","superClass","TypeError","prototype","Object","create","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","_classCallCheck","instance","Constructor","vendorize","prop","window","global","vendors","s","capitalized","charAt","toUpperCase","substr","vendorProp","step","time","draw","start","rule","duration","end","anim","progress","percent","animationTransformed","isFinite","isNaN","frame","requestAnimationFrame","inProgress","Collection","apply","this","arguments","verifyError","err","DOMException","result","prepareTicks","options","majorTicks","push","drawings","formatMajorTickNumber","minValue","maxValue","tickSide","roundRect","context","x","y","w","h","r","beginPath","moveTo","lineTo","quadraticCurveTo","closePath","padValue","val","dec","valueDec","int","valueInt","strVal","n","parseFloat","Math","abs","toFixed","toString","split","round","num","right","hasDec","majorTicksDec","majorTicksInt","indexOf","join","replace","radians","degrees","PI","radialPoint","radius","angle","sin","cos","linearGradient","colorFrom","colorTo","isVertical","undefined","grad","createLinearGradient","addColorStop","drawShadow","restore","save","borderShadowWidth","shadowBlur","shadowColor","colorBorderShadow","drawNeedleShadow","needleShadow","shadowOffsetX","shadowOffsetY","colorNeedleShadowDown","font","target","baseSize","reset","strokeStyle","lineWidth","drawValueTextShadow","offset","blur","valueTextShadow","colorValueTextShadow","drawValueBox","max","valueBox","addLength","maxValueWidth","repeat","String","parseInt","concat","map","text","valueText","tunit","runit","tw","measureText","Number","width","th","fontValueSize","sw","valueBoxStroke","bmax","bw","bh","br","valueBoxBorderRadius","obw","valueBoxWidth","bx","by","gy","rect","grd","createRadialGradient","colorValueBoxRect","colorValueBoxRectEnd","stroke","colorValueBoxShadow","colorValueBoxBackground","fillStyle","fill","colorValueText","textAlign","textBaseline","fillText","normalizedValue","min","dt","normal","indented","drawRadialBorder","arc","maxRadialRadius","pxRatio","SmartCanvas","pixelRatio","maxRadius","borderOuterWidth","borderMiddleWidth","borderInnerWidth","drawRadialPlate","d0","r0","r1","r2","r3","shadowDrawn","colorBorderOuter","colorBorderOuterEnd","colorBorderMiddle","colorBorderMiddleEnd","colorBorderInner","colorBorderInnerEnd","colorPlateEnd","colorPlate","drawRadialHighlights","hlWidth","highlightsWidth","radialTicksRadius","highlights","vd","ticksAngle","hlt","rotate","HPI","startAngle","to","color","drawRadialMinorTicks","range","delta","minTicks","minorTicks","ratio","colorMinorTicks","colorStrokeTicks","exactTicks","closeStrokedPath","unit","barWidth","barStrokeWidth","drawRadialMajorTicks","colors","colorMajorTicks","radialNextAngle","strokeTicks","drawRadialNumbers","points","isAnimated","animationTarget","colorNumbers","plateValueAngle","textWidth","textHeight","fontNumbersSize","textRadius","sqrt","point","numbersMargin","drawRadialTitle","title","colorTitle","drawRadialUnits","units","colorUnits","drawRadialNeedle","needle","needleCircleSize","rIn","needleEnd","rStart","needleStart","pad1","needleWidth","pad2","isFixed","colorNeedle","colorNeedleEnd","needleType","colorNeedleShadowUp","needleCircleOuter","colorNeedleCircleOuter","colorNeedleCircleOuterEnd","needleCircleInner","colorNeedleCircleInner","colorNeedleCircleInnerEnd","drawRadialValueBox","drawRadialProgressBar","rMax","rMin","half","sa","ea","colorBarStroke","colorBar","barShadow","clip","colorBarShadow","barProgress","colorBarProgress","displayValue","gauge","animatedValue","drawRectangle","colorStart","colorEnd","drawLinearBorder","drawLinearPlate","borderRadius","w1","w2","w3","w4","h1","h2","h3","h4","x2","x3","x4","y2","y3","y4","aliasingOffset","barDimensions","hasTitle","hasUnits","hasValue","titleMargin","unitsMargin","valueMargin","strokeWidth","barBeginCircle","barLength","barMargin","x0","y0","dx","hasLeft","hasRight","ticksWidth","dy","barOffset","ticksLength","X","Y","baseX","baseY","ticksPadding","drawLinearBarShape","type","_barDimensions","fullBarLength","direction","alpha","asin","cosAlpha","sinAlpha","x1","y1","cutRadius","rx","ry","colorBarEnd","colorBarProgressEnd","drawLinearBar","hasTicksBar","notWhich","needleSide","numberSide","drawLinearBarProgress","drawLinearBarHighlights","_context$barDimension","tickOffset","interval","eX","eH","eY","hLeft","hRight","entry","eStart","eW","drawLinearTick","drawLinearTicks","ticks","minVal","maxVal","lineLength","_context$barDimension2","tickX","tickY","tickLen","tickLeft","tickRight","drawLinearMajorTicks","_drawings$prepareTick","_drawings$prepareTick2","_slicedToArray","valuePerNonExactTick","tick","_context$barDimension3","rightTicks","leftTicks","sX","sY","drawLinearTickStroke","drawLinearMinorTicks","_drawings$prepareTick3","_drawings$prepareTick4","ticksWidthMinor","drawLinearMajorTicksNumbers","_context$barDimension4","tickValues","numLeft","numRight","textX","textY","numberOffset","textMargin","drawLinearTitle","_context$barDimension5","fontTitleSize","drawLinearUnits","_context$barDimension6","fontUnitsSize","drawLinearBarNeedle","_context$barDimension7","position","tickWidth","baseLength","needleLength","toLowerCase","drawLinearArrowNeedle","drawLinearLineNeedle","barStart","nLeft","nRight","needleStyle","isRight","peakLength","bodyLength","halfWidth","drawLinearValueBox","boxWidth","sliceIterator","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","_get","get","object","property","receiver","Function","desc","getOwnPropertyDescriptor","parent","getPrototypeOf","getter","_set","set","setter","_createClass","defineProperties","props","descriptor","defineProperty","key","protoProps","staticProps","assign","firstSource","nextSource","keysArray","keys","nextIndex","len","nextKey","searchElement","fromIndex","k","O","Infinity","relativeStart","relativeEnd","final","EventEmitter","_events","addListener","on","removeListener","off","event","_len","args","_key","_len2","handlers","_key2","handler","wrapper","_handler","index","splice","callback","setTimeout","Date","getTime","rules","linear","p","quad","pow","dequad","quint","dequint","cycle","acos","decycle","bounce","debounce","a","b","elastic","delastic","Animation","_this","cancel","performance","now","id","DomObserver","element","toDashed","Type","mutationsObserved","isObservable","MutationObserver","GAUGES_NO_AUTO_INIT","domReady","traverse","bind","node","tagName","getAttribute","elements","document","getElementsByTagName","process","observe","body","childList","subtree","attributes","characterData","attributeOldValue","characterDataOldValue","records","record","attributeName","isValidNode","oldValue","addedNodes","ii","ss","_this2","JSON","parse","stringify","hasOwnProperty","toAttributeName","attributeValue","renderTo","observer","forEach","attr","disconnect","destroy","_prop","part","_options","update","test","e","camelCase","str","dashed","readyState","addEventListener","attachEvent","canvas","height","collection","init","style","elementClone","cloneNode","getContext","contextClone","drawWidth","drawHeight","drawX","drawY","minSide","initialized","translate","clearRect","onRedraw","scale","redraw","devicePixelRatio","matchMedia","GenericOptions","animateOnInit","borders","listeners","animation","animationDuration","animationRule","fontNumbers","fontTitle","fontUnits","fontValue","fontNumbersStyle","fontTitleStyle","fontUnitsStyle","fontValueStyle","fontNumbersWeight","fontTitleWeight","fontUnitsWeight","fontValueWeight","getElementById","version","gauges","BaseGauge","_EventEmitter","_this3","className","name","HTMLCanvasElement","parentNode","offsetWidth","offsetHeight","_value","configure","emit","_this4","ensureValue","fromValue","animate","newValue","toCamelCase","defaultRadialGaugeOptions","useMinPath","RadialGauge","_BaseGauge","_ref","commit","drawImage","_context","initialize","defaultLinearGaugeOptions","LinearGauge","_BaseGauge2","_ref2","drawBox","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,SAASA,GAAK,YAUf,SAASC,GAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,GAAIG,GAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAOC,EAAKD,GAAKH,EAAIG,EAAM,OAAOC,GAAe,MAAOH,OAAMK,KAAKN,GAE1L,QAASO,GAA2BC,EAAMC,GAAQ,IAAKD,EAAQ,KAAM,IAAIE,gBAAe,4DAAgE,QA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AI5BqmB,GACT5B,QASgB,KAAP3oB,IACPA,EAAgB,YAAIuqB,IAGxB5B,GAAU0B,WAAW,cAAeC,IAA8C,mBAAXK,SAA0BzpB,OAAOqd,OAAOve,GAAKyD,WAAYA,EAAW4jB,eAAgBA,GAAevF,UAAWA,GAAU6G,UAAWA,GAAUtkB,SAAUA,GAASsI,YAAaA,GAAYyV,YAAaA,GAAYtgB,UAAWA,KAAgC,mBAAX6oB,QAAyBA,OAAOC,QAAU5oB","file":"gauge.min.js","sourcesContent":["/*!\n * The MIT License (MIT)\n * \n * Copyright (c) 2016 Mykhailo Stadnyk \n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * @version 2.1.4\n */\n(function(ns) {'use strict';\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _set = function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if (\"value\" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\r\n * @external {Object.assign} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\r\n */\n/* istanbul ignore next */\nif (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function value(target, firstSource) {\n 'use strict';\n\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n var i = 1;\n\n for (; i < arguments.length; i++) {\n var nextSource = arguments[i];\n\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n var nextIndex = 0,\n len = keysArray.length;\n\n for (; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n\n return to;\n }\n });\n}\n\n/**\r\n * @external {Array.indexOf} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\r\n */\n/* istanbul ignore next */\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement, fromIndex) {\n var k;\n\n if (this === null) {\n throw new TypeError('\"this\" is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n\n if (len === 0) {\n return -1;\n }\n\n var n = +fromIndex || 0;\n\n if (Math.abs(n) === Infinity) {\n n = 0;\n }\n\n if (n >= len) {\n return -1;\n }\n\n k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\n\n while (k < len) {\n if (k in O && O[k] === searchElement) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n };\n}\n\n/**\r\n * @external {Array.fill} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill\r\n */\n/* istanbul ignore next */\nif (!Array.prototype.fill) {\n Array.prototype.fill = function (value) {\n if (this === null) {\n throw new TypeError('this is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n var start = arguments[1];\n var relativeStart = start >> 0;\n var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);\n var end = arguments[2];\n var relativeEnd = end === undefined ? len : end >> 0;\n var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);\n while (k < final) {\n O[k] = value;\n k++;\n }\n\n return O;\n };\n}\n\n/**\r\n * mocking window\r\n */\nif (typeof window === 'undefined') {\n window = typeof global === 'undefined' ? {} : global;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/**\r\n * Look-ups for a proper vendor-specific property and returns its value\r\n *\r\n * @example\r\n * var requestAnimationFrame = vendorize('requestAnimationFrame');\r\n * // it will refer properly to:\r\n * // - window.requestAnimationFrame by default or to\r\n * // - window.webkitRequestAnimationFrame or to\r\n * // - window.mozRequestAnimationFrame or to\r\n * // - window.msRequestAnimationFrame or to\r\n * // - window.oRequestAnimationFrame\r\n * // depending on the current browser vendor\r\n *\r\n * @author Mykhailo Stadnyk \r\n * @param {string} prop\r\n * @param {HTMLElement|Window|object} [from] - default is window\r\n * @returns {*}\r\n */\nfunction vendorize(prop, from) {\n /* istanbul ignore else: no reason to cover */\n if (!from) {\n from = typeof window === 'undefined' ? global : window;\n }\n\n if (typeof from[prop] !== 'undefined') {\n return from[prop];\n }\n\n var vendors = ['webkit', 'moz', 'ms', 'o'];\n var i = 0;\n var s = vendors.length;\n var capitalized = prop.charAt(0).toUpperCase() + prop.substr(1);\n\n for (; i < s; i++) {\n var vendorProp = from[vendors[i] + capitalized];\n\n /* istanbul ignore if: requires very complex environment to test (specific browser version) */\n if (typeof vendorProp !== 'undefined') {\n return vendorProp;\n }\n }\n\n return null;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Class EventEmitter - base event manager\r\n */\n\nvar EventEmitter = function () {\n /**\r\n * @constructor\r\n */\n function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this._events = {};\n\n this.addListener = this.on;\n this.removeListener = this.off;\n }\n\n /**\r\n * Returns all event listeners\r\n *\r\n * @return {object}\r\n */\n\n\n _createClass(EventEmitter, [{\n key: 'emit',\n\n\n /**\r\n * Emits given event bypassing to each registered handler given args\r\n *\r\n * @param {string} event\r\n * @param {...*} args\r\n */\n value: function emit(event) {\n if (this._events[event]) {\n var i = 0;\n var s = this._events[event].length;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n for (; i < s; i++) {\n this._events[event][i] && this._events[event][i].apply(this, args);\n }\n }\n }\n\n /**\r\n * Registers given handler for given event to be called only once when\r\n * event is emitted\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'once',\n value: function once(event) {\n for (var _len2 = arguments.length, handlers = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n handlers[_key2 - 1] = arguments[_key2];\n }\n\n var i = 0;\n var s = handlers.length;\n var self = this;\n\n var _loop = function _loop() {\n var handler = handlers[i];\n var wrapper = function wrapper() {\n self.off(event, wrapper);\n handler.apply(self, arguments);\n };\n\n handlers[i] = wrapper;\n };\n\n for (; i < s; i++) {\n _loop();\n }\n\n this.on.apply(this, [event].concat(handlers));\n }\n\n /**\r\n * Registers given handlers for a given events to be called each time event\r\n * is emitted\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'on',\n value: function on(event) {\n if (!this._events[event]) {\n this._events[event] = [];\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n this._events[event].push(arguments.length <= i + 1 ? undefined : arguments[i + 1]);\n }\n }\n\n /**\r\n * Un-registers previously registered event handlers\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'off',\n value: function off(event) {\n if (!this._events[event]) {\n return;\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n var _handler = arguments.length <= i + 1 ? undefined : arguments[i + 1];\n var index = void 0;\n\n while (~(index = this._events[event].indexOf(_handler))) {\n this._events[event].splice(index, 1);\n }\n }\n }\n\n /**\r\n * Removes all listeners for a given event\r\n *\r\n * @param {string} event\r\n */\n\n }, {\n key: 'removeAllListeners',\n value: function removeAllListeners(event) {\n delete this._events[event];\n }\n }, {\n key: 'listeners',\n get: function get() {\n return this._events;\n }\n }]);\n\n return EventEmitter;\n}();\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/* jshint -W079 */\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n\n/* istanbul ignore next */\n/**\r\n * @type {function(callback: function(time: number): number, element?: HTMLElement)}\r\n * @access private\r\n */\n\n\nvar requestAnimationFrame = vendorize('requestAnimationFrame') || function (callback) {\n return setTimeout(function () {\n return callback(new Date().getTime());\n }, 1000 / 60);\n};\n\n/**\r\n * Generic AnimationRule function interface\r\n *\r\n * @typedef {function(percent: number): number} AnimationRule\r\n */\n\n/**\r\n * Callback for animation step draw event.\r\n * It will be called each time animation step is executed, bypassing\r\n * as first argument a percent of animation completeness. It is expected\r\n * that this callback will do an actual work of animating an elements or\r\n * whatever, as far as animation engine is just calculating and executing\r\n * animation steps without any knowledge about things under animation.\r\n *\r\n * @typedef {function(percent: number): *} DrawEventCallback\r\n */\n\n/**\r\n * Callback for animation complete event.\r\n * It is called once each animation is complete.\r\n *\r\n * @typedef {function(): *} EndEventCallback\r\n */\n\n/**\r\n * Predefined known animation rules.\r\n * It's a simple collection of math for some most used animations.\r\n *\r\n * @typedef {{linear: AnimationRule, quad: AnimationRule, dequad: AnimationRule, quint: AnimationRule, dequint: AnimationRule, cycle: AnimationRule, decycle: AnimationRule, bounce: AnimationRule, debounce: AnimationRule, elastic: AnimationRule, delastic: AnimationRule}} AnimationRules\r\n */\n\n/* istanbul ignore next: no reason covering this */\nvar rules = {\n linear: function linear(p) {\n return p;\n },\n quad: function quad(p) {\n return Math.pow(p, 2);\n },\n dequad: function dequad(p) {\n return 1 - rules.quad(1 - p);\n },\n quint: function quint(p) {\n return Math.pow(p, 5);\n },\n dequint: function dequint(p) {\n return 1 - Math.pow(1 - p, 5);\n },\n cycle: function cycle(p) {\n return 1 - Math.sin(Math.acos(p));\n },\n decycle: function decycle(p) {\n return Math.sin(Math.acos(1 - p));\n },\n bounce: function bounce(p) {\n return 1 - rules.debounce(1 - p);\n },\n debounce: function debounce(p) {\n var a = 0,\n b = 1;\n for (; 1; a += b, b /= 2) {\n if (p >= (7 - 4 * a) / 11) {\n return -Math.pow((11 - 6 * a - 11 * p) / 4, 2) + Math.pow(b, 2);\n }\n }\n },\n elastic: function elastic(p) {\n return 1 - rules.delastic(1 - p);\n },\n delastic: function delastic(p) {\n var x = 1.5;\n return Math.pow(2, 10 * (p - 1)) * Math.cos(20 * Math.PI * x / 3 * p);\n }\n};\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Evaluates animation step and decides if the next step required or\r\n * stops animation calling a proper events.\r\n *\r\n * @access private\r\n * @param {number} time\r\n * @param {DrawEventCallback} draw\r\n * @param {number} start\r\n * @param {AnimationRule} rule\r\n * @param {number} duration\r\n * @param {EndEventCallback} end\r\n * @param {Animation} anim\r\n */\nfunction step(time, draw, start, rule, duration, end, anim) {\n if (typeof rule !== 'function') {\n throw new TypeError('Invalid animation rule:', rule);\n }\n\n var progress = time - start;\n var percent = progress / duration;\n var animationTransformed = 0;\n\n if (percent > 1) {\n percent = 1;\n }\n\n if (percent !== 1) {\n animationTransformed = rule(percent);\n\n // make sure we have correct number after applying animation\n // transformation\n if (isFinite(animationTransformed) && !isNaN(animationTransformed)) {\n percent = animationTransformed;\n }\n }\n\n draw && draw(percent);\n\n if (progress < duration) {\n anim.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rule, duration, end, anim);\n });\n } else {\n end && end();\n anim.inProgress = false;\n }\n}\n\n/**\r\n * Animation engine API for JavaScript-based animations.\r\n * This is simply an animation core framework which simplifies creation\r\n * of various animations for generic purposes.\r\n *\r\n * @example\r\n * // create 'linear' animation engine, 500ms duration\r\n * let linear = new Animation('linear', 500);\r\n *\r\n * // create 'elastic' animation engine\r\n * let elastic = new Animation('elastic');\r\n *\r\n * // define animation behavior\r\n * let bounced = new Animation('bounce', 500, percent => {\r\n * let value = parseInt(percent * 100, 10);\r\n *\r\n * $('div.bounced').css({\r\n * width: value + '%',\r\n * height: value + '%'\r\n * });\r\n * });\r\n *\r\n * // execute animation\r\n * bounced.animate();\r\n *\r\n * // execute animation and handle when its finished\r\n * bounced.animate(null, () => {\r\n * console.log('Animation finished!');\r\n * });\r\n */\n\nvar Animation = function () {\n\n /**\r\n * @constructor\r\n * @param {string|AnimationRule} rule\r\n * @param {number} duration\r\n * @param {DrawEventCallback} [draw]\r\n * @param {EndEventCallback} [end]\r\n */\n function Animation() {\n var rule = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'linear';\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var draw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};\n\n _classCallCheck(this, Animation);\n\n /**\r\n * Overall animation duration in milliseconds.\r\n * By default is equal to 250 ms.\r\n *\r\n * @type {number}\r\n */\n this.duration = duration;\n\n /**\r\n * Animation rule. By default is linear animation.\r\n * Animation rule is a subject to animation rules, which are\r\n * a simple object containing math-based methods for calculating\r\n * animation steps.\r\n *\r\n * @type {string|AnimationRule}\r\n */\n this.rule = rule;\n\n /**\r\n * Callback function for the animation step draw event.\r\n *\r\n * @type {DrawEventCallback}\r\n */\n this.draw = draw;\n\n /**\r\n * Callback for the animation complete event.\r\n *\r\n * @type {EndEventCallback}\r\n */\n this.end = end;\n\n if (typeof this.draw !== 'function') {\n throw new TypeError('Invalid animation draw callback:', draw);\n }\n\n if (typeof this.end !== 'function') {\n throw new TypeError('Invalid animation end callback:', end);\n }\n }\n\n /* istanbul ignore next: non-testable */\n /**\r\n * Performs animation calling each animation step draw callback and\r\n * end callback at the end of animation. Callbacks are optional to this\r\n * method call. If them are not bypassed will be used that ones which\r\n * was pre-set on constructing an Animation object or pre-set after\r\n * construction.\r\n *\r\n * @example\r\n * function draw(percent) {\r\n * $('.my-animated-divs').css({\r\n * width: parseInt(percent * 100, 10) + '%'\r\n * });\r\n * }\r\n * function done() {\r\n * console.log('Animation complete!');\r\n * }\r\n *\r\n * // Define 'draw' and 'end' callbacks on construction\r\n * var animation = new Animation('cycle', 500, draw, done);\r\n * animation.animate();\r\n *\r\n * // Define 'draw' and 'end' callbacks after construction\r\n * var animation = new Animation('cycle', 500);\r\n * animation.draw = draw;\r\n * animation.end = done;\r\n * animation.animate();\r\n *\r\n * // Define 'draw' and 'end' callbacks at animation\r\n * var animation = new Animation('cycle', 500);\r\n * animation.animate(draw, done);\r\n *\r\n * @param {DrawEventCallback} [draw]\r\n * @param {EndEventCallback} [end]\r\n */\n\n\n _createClass(Animation, [{\n key: 'animate',\n value: function animate(draw, end) {\n var _this = this;\n\n this.frame && this.cancel();\n\n // noinspection JSUnresolvedVariable\n var start = window.performance && window.performance.now ? window.performance.now() : vendorize('animationStartTime') || Date.now();\n\n draw = draw || this.draw;\n end = end || this.end;\n\n this.draw = draw;\n this.end = end;\n\n /**\r\n * Current requested animation frame identifier\r\n *\r\n * @type {number}\r\n */\n this.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rules[_this.rule] || _this.rule, _this.duration, end, _this);\n });\n }\n\n /**\r\n * Cancels current animation if any\r\n */\n\n }, {\n key: 'cancel',\n value: function cancel() {\n if (this.frame) {\n var cancelAnimationFrame = vendorize('cancelAnimationFrame') ||\n /* istanbul ignore next */\n function (id) {};\n\n cancelAnimationFrame(this.frame);\n this.frame = null;\n }\n }\n\n /**\r\n * Destroys this object properly\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n this.cancel();\n this.draw = null;\n this.end = null;\n }\n }]);\n\n return Animation;\n}();\n\n/**\r\n * Animation rules bound statically to Animation constructor.\r\n *\r\n * @type {AnimationRules}\r\n * @static\r\n */\n\n\nAnimation.rules = rules;\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/**\r\n * @typedef {{ constructor: function(options: GenericOptions): GaugeInterface, draw: function(): GaugeInterface, destroy: function, update: function(options: GenericOptions) }} GaugeInterface\r\n */\n/**\r\n * @typedef {{parse: function, stringify: function}} JSON\r\n * @external {JSON} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON\r\n */\n/**\r\n * @ignore\r\n * @typedef {{MutationObserver: function}} ns\r\n */\n\n/**\r\n * DOM Observer.\r\n * It will observe DOM document for a configured element types and\r\n * instantiate associated Types for an existing or newly added DOM elements\r\n *\r\n * @example\r\n * class ProgressBar {\r\n * constructor(options) {}\r\n * draw() {}\r\n * }\r\n *\r\n * // It will observe DOM document for elements
\r\n * // having attribute 'data-type=\"progress\"'\r\n * // and instantiate for each new instance of ProgressBar\r\n *\r\n * new DomParser({color: 'red'}, 'div', 'progress', ProgressBar);\r\n *\r\n * // assume we could have HTML like this\r\n * //
\r\n * // in this case all matching attributes names for a given options will be\r\n * // parsed and bypassed to an instance from HTML attributes\r\n */\n\nvar DomObserver = function () {\n\n /**\r\n * @constructor\r\n * @param {object} options\r\n * @param {string} element\r\n * @param {string} type\r\n */\n function DomObserver(options, element, type) {\n _classCallCheck(this, DomObserver);\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Default instantiation options for the given type\r\n *\r\n * @type {Object}\r\n */\n this.options = options;\n\n /**\r\n * Name of an element to lookup/observe\r\n *\r\n * @type {string}\r\n */\n this.element = element.toLowerCase();\n\n /**\r\n * data-type attribute value to lookup\r\n *\r\n * @type {string}\r\n */\n this.type = DomObserver.toDashed(type);\n\n /**\r\n * Actual type constructor to instantiate for each found element\r\n *\r\n * @type {Function}\r\n */\n this.Type = ns[type];\n\n /**\r\n * Signals if mutations observer for this type or not\r\n *\r\n * @type {boolean}\r\n */\n this.mutationsObserved = false;\n\n /**\r\n * Flag specifies whenever the browser supports observing\r\n * of DOM tree mutations or not\r\n *\r\n * @type {boolean}\r\n */\n this.isObservable = !!window.MutationObserver;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n if (!window.GAUGES_NO_AUTO_INIT) {\n DomObserver.domReady(this.traverse.bind(this));\n }\n }\n\n /**\r\n * Checks if given node is valid node to process\r\n *\r\n * @param {Node|HTMLElement} node\r\n * @returns {boolean}\r\n */\n\n\n _createClass(DomObserver, [{\n key: 'isValidNode',\n value: function isValidNode(node) {\n //noinspection JSUnresolvedVariable\n return !!(node.tagName && node.tagName.toLowerCase() === this.element && node.getAttribute('data-type') === this.type);\n }\n\n /**\r\n * Traverse entire current DOM tree and process matching nodes.\r\n * Usually it should be called only once on document initialization.\r\n */\n\n }, {\n key: 'traverse',\n value: function traverse() {\n var elements = document.getElementsByTagName(this.element);\n var i = 0,\n s = elements.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n this.process(elements[i]);\n }\n\n if (this.isObservable && !this.mutationsObserved) {\n new MutationObserver(this.observe.bind(this)).observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n attributeOldValue: true,\n characterDataOldValue: true\n });\n\n this.mutationsObserved = true;\n }\n }\n\n /**\r\n * Observes given mutation records for an elements to process\r\n *\r\n * @param {MutationRecord[]} records\r\n */\n\n }, {\n key: 'observe',\n value: function observe(records) {\n var i = 0;\n var s = records.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n var record = records[i];\n\n if (record.type === 'attributes' && record.attributeName === 'data-type' && this.isValidNode(record.target) && record.oldValue !== this.type) // skip false-positive mutations\n {\n setTimeout(this.process.bind(this, record.target));\n } else if (record.addedNodes && record.addedNodes.length) {\n var ii = 0;\n var ss = record.addedNodes.length;\n\n for (; ii < ss; ii++) {\n setTimeout(this.process.bind(this, record.addedNodes[ii]));\n }\n }\n }\n }\n\n /**\r\n * Parses given attribute value to a proper JavaScript value.\r\n * For example it will parse some stringified value to a proper type\r\n * value, e.g. 'true' => true, 'null' => null, '{\"prop\": 20}' => {prop: 20}\r\n *\r\n * @param {*} value\r\n * @return {*}\r\n */\n\n }, {\n key: 'process',\n\n\n /**\r\n * Processes a given node, instantiating a proper type constructor for it\r\n *\r\n * @param {Node|HTMLElement} node\r\n * @returns {GaugeInterface|null}\r\n */\n value: function process(node) {\n var _this2 = this;\n\n if (!this.isValidNode(node)) return null;\n\n var prop = void 0;\n var options = JSON.parse(JSON.stringify(this.options));\n var instance = null;\n\n for (prop in options) {\n /* istanbul ignore else: non-testable in most cases */\n if (options.hasOwnProperty(prop)) {\n var attributeName = DomObserver.toAttributeName(prop);\n var attributeValue = DomObserver.parse(node.getAttribute(attributeName));\n\n if (attributeValue !== null && attributeValue !== undefined) {\n options[prop] = attributeValue;\n }\n }\n }\n\n options.renderTo = node;\n instance = new this.Type(options);\n instance.draw && instance.draw();\n\n if (!this.isObservable) return instance;\n\n instance.observer = new MutationObserver(function (records) {\n records.forEach(function (record) {\n if (record.type === 'attributes') {\n var attr = record.attributeName.toLowerCase();\n var type = node.getAttribute(attr).toLowerCase();\n\n if (attr === 'data-type' && type && type !== _this2.type) {\n instance.observer.disconnect();\n delete instance.observer;\n instance.destroy && instance.destroy();\n } else if (attr.substr(0, 5) === 'data-') {\n var _prop = attr.substr(5).split('-').map(function (part, i) {\n return !i ? part : part.charAt(0).toUpperCase() + part.substr(1);\n }).join('');\n var _options = {};\n\n _options[_prop] = DomObserver.parse(node.getAttribute(record.attributeName));\n\n if (_prop === 'value') {\n instance && (instance.value = _options[_prop]);\n } else {\n instance.update && instance.update(_options);\n }\n }\n }\n });\n });\n\n //noinspection JSCheckFunctionSignatures\n instance.observer.observe(node, { attributes: true });\n\n return instance;\n }\n\n /**\r\n * Transforms camelCase string to dashed string\r\n *\r\n * @static\r\n * @param {string} camelCase\r\n * @return {string}\r\n */\n\n }], [{\n key: 'parse',\n value: function parse(value) {\n // parse boolean\n if (value === 'true') return true;\n if (value === 'false') return false;\n\n // parse undefined\n if (value === 'undefined') return undefined;\n\n // parse null\n if (value === 'null') return null;\n\n // Comma-separated strings to array parsing.\n // It won't match strings which contains non alphanumeric characters to\n // prevent strings like 'rgba(0,0,0,0)' or JSON-like from being parsed.\n // Typically it simply allows easily declare arrays as comma-separated\n // numbers or plain strings. If something more complicated is\n // required it can be declared using JSON format syntax\n if (/^[-+#.\\w\\d\\s]+(?:,[-+#.\\w\\d\\s]*)+$/.test(value)) {\n return value.split(',');\n }\n\n // parse JSON\n try {\n return JSON.parse(value);\n } catch (e) {}\n\n // plain value - no need to parse\n return value;\n }\n }, {\n key: 'toDashed',\n value: function toDashed(camelCase) {\n var arr = camelCase.split(/(?=[A-Z])/);\n var i = 1;\n var s = arr.length;\n var str = arr[0].toLowerCase();\n\n for (; i < s; i++) {\n str += '-' + arr[i].toLowerCase();\n }\n\n return str;\n }\n\n /**\r\n * Transforms dashed string to CamelCase representation\r\n *\r\n * @param {string} dashed\r\n * @param {boolean} [capitalized]\r\n * @return {string}\r\n */\n\n }, {\n key: 'toCamelCase',\n value: function toCamelCase(dashed) {\n var capitalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n var arr = dashed.split(/-/);\n var i = 0;\n var s = arr.length;\n var str = '';\n\n for (; i < s; i++) {\n if (!(i || capitalized)) {\n str += arr[i].toLowerCase();\n } else {\n str += arr[i][0].toUpperCase() + arr[i].substr(1).toLowerCase();\n }\n }\n\n return str;\n }\n\n /**\r\n * Transforms camel case property name to dash separated attribute name\r\n *\r\n * @static\r\n * @param {string} str\r\n * @returns {string}\r\n */\n\n }, {\n key: 'toAttributeName',\n value: function toAttributeName(str) {\n return 'data-' + DomObserver.toDashed(str);\n }\n\n /**\r\n * Cross-browser DOM ready handler\r\n *\r\n * @static\r\n * @param {Function} handler\r\n */\n\n }, {\n key: 'domReady',\n value: function domReady(handler) {\n if (/comp|inter|loaded/.test((window.document || {}).readyState + '')) return handler();\n\n if (window.addEventListener) window.addEventListener('DOMContentLoaded', handler, false);else if (window.attachEvent) window.attachEvent('onload', handler);\n }\n }]);\n\n return DomObserver;\n}();\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n\n/**\r\n * Drawings on canvas using hidden canvas as a cache for better\r\n * performance drawings during canvas animations. SmartCanvas also\r\n * adopts a canvas to\r\n */\n\n\nvar SmartCanvas = function () {\n\n /**\r\n * @constructor\r\n * @param {HTMLCanvasElement} canvas\r\n * @param {number} [width]\r\n * @param {number} [height]\r\n */\n function SmartCanvas(canvas, width, height) {\n _classCallCheck(this, SmartCanvas);\n\n SmartCanvas.collection.push(this);\n\n /**\r\n * Canvas base width\r\n *\r\n * @type {number}\r\n */\n this.width = width || 0;\n\n /**\r\n * Canvas base height\r\n *\r\n * @type {number}\r\n */\n this.height = height || 0;\n\n /**\r\n * Target drawings canvas element\r\n *\r\n * @type {HTMLCanvasElement}\r\n */\n this.element = canvas;\n\n this.init();\n }\n\n /**\r\n * Initializes canvases and contexts\r\n */\n\n\n _createClass(SmartCanvas, [{\n key: 'init',\n value: function init() {\n var pixelRatio = SmartCanvas.pixelRatio;\n\n this.element.width = this.width * pixelRatio;\n this.element.height = this.height * pixelRatio;\n\n this.element.style.width = this.width + 'px';\n this.element.style.height = this.height + 'px';\n\n /**\r\n * Canvas caching element\r\n *\r\n * @type {HTMLCanvasElement|Node}\r\n */\n this.elementClone = this.element.cloneNode(true);\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Target drawings canvas element 2D context\r\n *\r\n * @type {CanvasRenderingContext2D}\r\n */\n this.context = this.element.getContext('2d');\n\n /**\r\n * Canvas caching element 2D context\r\n *\r\n * @type {CanvasRenderingContext2D}\r\n */\n this.contextClone = this.elementClone.getContext('2d');\n\n /**\r\n * Actual drawings width\r\n *\r\n * @type {number}\r\n */\n this.drawWidth = this.element.width;\n\n /**\r\n * Actual drawings height\r\n *\r\n * @type {number}\r\n */\n this.drawHeight = this.element.height;\n\n /**\r\n * X-coordinate of drawings zero point\r\n *\r\n * @type {number}\r\n */\n this.drawX = this.drawWidth / 2;\n\n /**\r\n * Y-coordinate of drawings zero point\r\n *\r\n * @type {number}\r\n */\n this.drawY = this.drawHeight / 2;\n\n /**\r\n * Minimal side length in pixels of the drawing\r\n *\r\n * @type {number}\r\n */\n this.minSide = this.drawX < this.drawY ? this.drawX : this.drawY;\n\n this.elementClone.initialized = false;\n\n this.contextClone.translate(this.drawX, this.drawY);\n this.contextClone.save();\n\n this.context.translate(this.drawX, this.drawY);\n this.context.save();\n\n this.context.max = this.contextClone.max = this.minSide;\n this.context.maxRadius = this.contextClone.maxRadius = null;\n }\n\n /**\r\n * Destroys this object, removing the references from memory\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = SmartCanvas.collection.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n SmartCanvas.collection.splice(index, 1);\n }\n\n this.context.clearRect(-this.drawX, -this.drawY, this.drawWidth, this.drawHeight);\n\n // dereference all created elements\n this.context.max = null;\n delete this.context.max;\n\n this.context.maxRadius = null;\n delete this.context.maxRadius;\n\n this.context = null;\n this.contextClone = null;\n this.elementClone = null;\n this.element = null;\n\n /**\r\n * On canvas redraw event callback\r\n *\r\n * @type {function|null|undefined}\r\n */\n this.onRedraw = null;\n }\n\n /**\r\n * Commits the drawings\r\n */\n\n }, {\n key: 'commit',\n value: function commit() {\n var scale = SmartCanvas.pixelRatio;\n\n if (scale !== 1) {\n this.contextClone.scale(scale, scale);\n this.contextClone.save();\n }\n\n return this;\n }\n\n /**\r\n * Redraw this object\r\n */\n\n }, {\n key: 'redraw',\n value: function redraw() {\n this.init();\n\n /**\r\n * On canvas redraw event callback\r\n *\r\n * @type {function(): *}\r\n */\n this.onRedraw && this.onRedraw();\n\n return this;\n }\n\n /**\r\n * Returns current device pixel ratio\r\n *\r\n * @returns {number}\r\n */\n\n }], [{\n key: 'redraw',\n\n\n /**\r\n * Forces redraw all canvas in the current collection\r\n */\n value: function redraw() {\n var i = 0;\n var s = SmartCanvas.collection.length;\n\n for (; i < s; i++) {\n SmartCanvas.collection[i].redraw();\n }\n }\n }, {\n key: 'pixelRatio',\n get: function get() {\n /* istanbul ignore next */\n //noinspection JSUnresolvedVariable\n return window.devicePixelRatio || 1;\n }\n }]);\n\n return SmartCanvas;\n}();\n\nSmartCanvas.collection = [];\n\n/* istanbul ignore next: very browser-specific testing required to cover */\n//noinspection JSUnresolvedVariable\nif (window.matchMedia) {\n //noinspection JSUnresolvedFunction\n window.matchMedia('screen and (min-resolution: 2dppx)').addListener(SmartCanvas.redraw);\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Describes rendering target element. Can be either string identifier of\r\n * the element or the element itself.\r\n *\r\n * @typedef {HTMLElement|string} RenderTarget\r\n */\n\n/**\r\n * Highlight area definition.\r\n * It describes highlight area starting from value to value using\r\n * color. Color can be describes with hex, rgb or rgba value.\r\n *\r\n * @typedef {{ from: number, to: number, color: string}} Highlight\r\n */\n\n/**\r\n * Shared generic gauges options\r\n *\r\n * @type {{renderTo: RenderTarget, width: number, height: number, minValue: number, maxValue: number, value: number, units: string|boolean, majorTicks: number[]|string[], exactTicks: boolean, minorTicks: number, strokeTicks: boolean, animatedValue: boolean, animateOnInit: boolean, title: string|boolean, borders: boolean, valueInt: number, valueDec: number, majorTicksInt: number, majorTicksDec: number, animation: boolean, animationDuration: number, animationRule: string|AnimationRule, colorPlate: string, colorPlateEnd: string, colorMajorTicks: string, colorMinorTicks: string, colorStrokeTicks: string, colorTitle: string, colorUnits: string, colorNumbers: string, colorNeedle: string, colorNeedleEnd: string, colorValueText: string, colorValueTextShadow: string, colorBorderShadow: string, colorBorderOuter: string, colorBorderOuterEnd: string, colorBorderMiddle: string, colorBorderMiddleEnd: string, colorBorderInner: string, colorBorderInnerEnd: string, colorValueBoxRect: string, colorValueBoxRectEnd: string, colorValueBoxBackground: string, colorValueBoxShadow: string, colorNeedleShadowUp: string, colorNeedleShadowDown: string, needle: boolean, needleShadow: boolean, needleType: string, needleStart: number, needleEnd: number, needleWidth: number, borderOuterWidth: number, borderMiddleWidth: number, borderInnerWidth: number, borderShadowWidth: number, valueBox: boolean, valueBoxWidth: number, valueBoxStroke: number, valueText: string, valueTextShadow: boolean, valueBoxBorderRadius: number, highlights: Highlight[], highlightsWidth: number, fontNumbers: string, fontTitle: string, fontUnits: string, fontValue: string, fontTitleSize: number, fontValueSize: number, fontUnitsSize: number, fontNumbersSize: number, fontNumbersStyle: string, fontTitleStyle: string, fontUnitsStyle: string, fontValueStyle: string, fontNumbersWeight: string, fontTitleWeight: string, fontUnitsWeight: string, fontValueWeight: string, barWidth: number, barStrokeWidth: number, barProgress: boolean, colorBar: string, colorBarStroke: string, colorBarProgress: string, colorBarShadow: string, barShadow: number, listeners: object}} GenericOptions\r\n */\nvar GenericOptions = {\n // basic options\n renderTo: null,\n width: 0,\n height: 0,\n minValue: 0,\n maxValue: 100,\n value: 0,\n units: false,\n exactTicks: false,\n majorTicks: [0, 20, 40, 60, 80, 100],\n minorTicks: 10,\n strokeTicks: true,\n animatedValue: false,\n animateOnInit: false,\n title: false,\n borders: true,\n numbersMargin: 1,\n\n listeners: null,\n\n // number formats\n valueInt: 3,\n valueDec: 2,\n majorTicksInt: 1,\n majorTicksDec: 0,\n\n // animations\n animation: true,\n animationDuration: 500,\n animationRule: 'cycle',\n\n // colors\n colorPlate: '#fff',\n colorPlateEnd: '',\n colorMajorTicks: '#444',\n colorMinorTicks: '#666',\n colorStrokeTicks: '',\n colorTitle: '#888',\n colorUnits: '#888',\n colorNumbers: '#444',\n colorNeedle: 'rgba(240,128,128,1)',\n colorNeedleEnd: 'rgba(255,160,122,.9)',\n colorValueText: '#444',\n colorValueTextShadow: 'rgba(0,0,0,0.3)',\n colorBorderShadow: 'rgba(0,0,0,0.5)',\n colorBorderOuter: '#ddd',\n colorBorderOuterEnd: '#aaa',\n colorBorderMiddle: '#eee',\n colorBorderMiddleEnd: '#f0f0f0',\n colorBorderInner: '#fafafa',\n colorBorderInnerEnd: '#ccc',\n colorValueBoxRect: '#888',\n colorValueBoxRectEnd: '#666',\n colorValueBoxBackground: '#babab2',\n colorValueBoxShadow: 'rgba(0,0,0,1)',\n colorNeedleShadowUp: 'rgba(2,255,255,0.2)',\n colorNeedleShadowDown: 'rgba(188,143,143,0.45)',\n colorBarStroke: '#222',\n colorBar: '#ccc',\n colorBarProgress: '#888',\n colorBarShadow: '#000',\n\n fontNumbers: 'Arial',\n fontTitle: 'Arial',\n fontUnits: 'Arial',\n fontValue: 'Arial',\n\n fontNumbersSize: 20,\n fontTitleSize: 24,\n fontUnitsSize: 22,\n fontValueSize: 26,\n\n fontNumbersStyle: 'normal',\n fontTitleStyle: 'normal',\n fontUnitsStyle: 'normal',\n fontValueStyle: 'normal',\n\n fontNumbersWeight: 'normal',\n fontTitleWeight: 'normal',\n fontUnitsWeight: 'normal',\n fontValueWeight: 'normal',\n\n // needle\n needle: true,\n needleShadow: true,\n needleType: 'arrow',\n needleStart: 5,\n needleEnd: 85,\n needleWidth: 4,\n\n // borders\n borderOuterWidth: 3,\n borderMiddleWidth: 3,\n borderInnerWidth: 3,\n borderShadowWidth: 3,\n\n // value and highlights\n valueBox: true,\n valueBoxStroke: 5,\n valueBoxWidth: 0,\n valueText: '',\n valueTextShadow: true,\n valueBoxBorderRadius: 2.5,\n\n // highlights\n highlights: [{ from: 20, to: 60, color: '#eee' }, { from: 60, to: 80, color: '#ccc' }, { from: 80, to: 100, color: '#999' }],\n highlightsWidth: 15,\n\n // progress bar\n barWidth: 20, // percents\n barStrokeWidth: 0, // pixels\n barProgress: true,\n barShadow: 0\n};\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Gauge collections type.\r\n *\r\n * It is used ES5 declaration here, because babel\r\n * transpiles inheritance incorrectly in this case.\r\n *\r\n * @class Collection\r\n * @constructor\r\n */\nfunction Collection() {\n Array.prototype.constructor.apply(this, arguments);\n}\n\nCollection.prototype = Object.create(Array.prototype);\nCollection.prototype.constructor = Collection;\n\n/**\r\n * Returns gauge object by its identifier or index in the collection\r\n *\r\n * @param {string|number} id\r\n * @return {*}\r\n */\nCollection.prototype.get = function (id) {\n if (typeof id === 'string') {\n var i = 0;\n var s = this.length;\n\n for (; i < s; i++) {\n var canvas = this[i].options.renderTo.tagName ? this[i].options.renderTo :\n /* istanbul ignore next: should be tested with e2e tests */\n document.getElementById(this[i].options.renderTo || '');\n\n if (canvas.getAttribute('id') === id) {\n return this[i];\n }\n }\n } else if (typeof id === 'number') {\n return this[id];\n }\n\n return null;\n};\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\nvar version = '2.1.4';\n\nvar round = Math.round;\nvar abs = Math.abs;\n\nvar gauges = new Collection();\n\ngauges.version = version;\n\n/**\r\n * Basic abstract BaseGauge class implementing common functionality\r\n * for different type of gauges.\r\n *\r\n * It should not be instantiated directly but must be extended by a final\r\n * gauge implementation.\r\n *\r\n * @abstract\r\n * @example\r\n *\r\n * class MyCoolGauge extends BaseGauge {\r\n *\r\n * // theses methods below MUST be implemented:\r\n *\r\n * constructor(options) {\r\n * // ... do something with options\r\n * super(options);\r\n * // ... implement anything else\r\n * }\r\n *\r\n * draw() {\r\n * // ... some implementation here\r\n * return this;\r\n * }\r\n * }\r\n */\n\nvar BaseGauge = function (_EventEmitter) {\n _inherits(BaseGauge, _EventEmitter);\n\n /**\r\n * Fired each time gauge is initialized on a page\r\n *\r\n * @event BaseGauge#init\r\n */\n\n /**\r\n * Fired each time gauge scene is rendered\r\n *\r\n * @event BaseGauge#render\r\n */\n\n /**\r\n * Fired each time gauge object is destroyed\r\n *\r\n * @event BaseGauge#destroy\r\n */\n\n /**\r\n * Fired each time before animation is started on the gauge\r\n *\r\n * @event BaseGauge#animationStart\r\n */\n\n /**\r\n * Fired each time animation scene is complete\r\n *\r\n * @event BaseGauge#animate\r\n * @type {number} percent\r\n * @type {number} value\r\n */\n\n /**\r\n * Fired each time animation is complete on the gauge\r\n *\r\n * @event BaseGauge#animationEnd\r\n */\n\n /**\r\n * @event BaseGauge#value\r\n * @type {number} newValue\r\n * @type {number} oldValue\r\n */\n\n /**\r\n * @constructor\r\n * @abstract\r\n * @param {GenericOptions} options\r\n */\n function BaseGauge(options) {\n _classCallCheck(this, BaseGauge);\n\n var _this3 = _possibleConstructorReturn(this, (BaseGauge.__proto__ || Object.getPrototypeOf(BaseGauge)).call(this));\n\n var className = _this3.constructor.name;\n\n if (className === 'BaseGauge') {\n throw new TypeError('Attempt to instantiate abstract class!');\n }\n\n gauges.push(_this3);\n\n if (options.listeners) {\n Object.keys(options.listeners).forEach(function (event) {\n var handlers = options.listeners[event] instanceof Array ? options.listeners[event] : [options.listeners[event]];\n\n handlers.forEach(function (handler) {\n _this3.on(event, handler);\n });\n });\n }\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Gauges version string\r\n *\r\n * @type {string}\r\n */\n _this3.version = version;\n\n /**\r\n * Gauge type class\r\n *\r\n * @type {BaseGauge} type\r\n */\n _this3.type = ns[className] || BaseGauge;\n\n /**\r\n * True if gauge has been drawn for the first time, false otherwise.\r\n *\r\n * @type {boolean}\r\n */\n _this3.initialized = false;\n\n options.minValue = parseFloat(options.minValue);\n options.maxValue = parseFloat(options.maxValue);\n options.value = parseFloat(options.value) || 0;\n\n if (!options.borders) {\n options.borderInnerWidth = options.borderMiddleWidth = options.borderOuterWidth = 0;\n }\n\n if (!options.renderTo) {\n throw TypeError('Canvas element was not specified when creating ' + 'the Gauge object!');\n }\n\n var canvas = options.renderTo.tagName ? options.renderTo :\n /* istanbul ignore next: to be tested with e2e tests */\n document.getElementById(options.renderTo);\n\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw TypeError('Given gauge canvas element is invalid!');\n }\n\n options.width = parseFloat(options.width) || 0;\n options.height = parseFloat(options.height) || 0;\n\n if (!options.width || !options.height) {\n if (!options.width) options.width = canvas.parentNode ? canvas.parentNode.offsetWidth : canvas.offsetWidth;\n if (!options.height) options.height = canvas.parentNode ? canvas.parentNode.offsetHeight : canvas.offsetHeight;\n }\n\n /**\r\n * Gauge options\r\n *\r\n * @type {GenericOptions} options\r\n */\n _this3.options = options || {};\n\n if (_this3.options.animateOnInit) {\n _this3._value = _this3.options.value;\n _this3.options.value = _this3.options.minValue;\n }\n\n /**\r\n * @type {SmartCanvas} canvas\r\n */\n _this3.canvas = new SmartCanvas(canvas, options.width, options.height);\n _this3.canvas.onRedraw = _this3.draw.bind(_this3);\n\n /**\r\n * @type {Animation} animation\r\n */\n _this3.animation = new Animation(options.animationRule, options.animationDuration);\n return _this3;\n }\n\n /**\r\n * Sets new value for this gauge.\r\n * If gauge is animated by configuration it will trigger a proper animation.\r\n * Upsetting a value triggers gauge redraw.\r\n *\r\n * @param {number} value\r\n */\n\n\n _createClass(BaseGauge, [{\n key: 'update',\n\n\n /**\r\n * Updates gauge configuration options at runtime and redraws the gauge\r\n *\r\n * @param {RadialGaugeOptions} options\r\n * @returns {BaseGauge}\r\n */\n value: function update(options) {\n Object.assign(this.options, this.type.configure(options || {}));\n\n this.canvas.width = this.options.width;\n this.canvas.height = this.options.height;\n\n this.animation.rule = this.options.animationRule;\n this.animation.duration = this.options.animationDuration;\n\n this.canvas.redraw();\n\n return this;\n }\n\n /**\r\n * Performs destruction of this object properly\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = gauges.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n //noinspection JSUnresolvedFunction\n gauges.splice(index, 1);\n }\n\n this.canvas.destroy();\n this.canvas = null;\n\n this.animation.destroy();\n this.animation = null;\n\n this.emit('destroy');\n }\n\n /**\r\n * Returns gauges version string\r\n *\r\n * @return {string}\r\n */\n\n }, {\n key: 'draw',\n\n\n /**\r\n * Triggering gauge render on a canvas.\r\n *\r\n * @abstract\r\n * @returns {BaseGauge}\r\n */\n value: function draw() {\n if (this.options.animateOnInit && !this.initialized) {\n this.value = this._value;\n this.initialized = true;\n this.emit('init');\n }\n\n this.emit('render');\n\n return this;\n }\n\n /**\r\n * Inject given gauge object into DOM\r\n *\r\n * @param {string} type\r\n * @param {GenericOptions} options\r\n */\n\n }, {\n key: 'value',\n set: function set(value) {\n var _this4 = this;\n\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n var fromValue = this.options.value;\n\n if (value === fromValue) {\n return;\n }\n\n if (this.options.animation) {\n if (this.animation.frame) {\n // animation is already in progress -\n // forget related old animation value\n // @see https://github.com/Mikhus/canvas-gauges/issues/94\n this.options.value = this._value;\n\n // if there is no actual value change requested stop it\n if (this._value === value) {\n this.animation.cancel();\n delete this._value;\n return;\n }\n }\n\n /**\r\n * @type {number}\r\n * @access private\r\n */\n if (this._value === undefined) {\n this._value = value;\n }\n\n this.emit('animationStart');\n\n this.animation.animate(function (percent) {\n var newValue = fromValue + (value - fromValue) * percent;\n\n _this4.options.animatedValue && _this4.emit('value', newValue, _this4.value);\n\n _this4.options.value = newValue;\n\n _this4.draw();\n\n _this4.emit('animate', percent, _this4.options.value);\n }, function () {\n if (_this4._value !== undefined) {\n _this4.emit('value', _this4._value, _this4.value);\n _this4.options.value = _this4._value;\n delete _this4._value;\n }\n\n _this4.draw();\n _this4.emit('animationEnd');\n });\n } else {\n this.emit('value', value, this.value);\n this.options.value = value;\n this.draw();\n }\n }\n\n /**\r\n * Returns current value of the gauge\r\n *\r\n * @return {number}\r\n */\n ,\n get: function get() {\n return typeof this._value === 'undefined' ? this.options.value : this._value;\n }\n\n /**\r\n * Updates gauge options\r\n *\r\n * @param {*} options\r\n * @return {BaseGauge}\r\n * @access protected\r\n */\n\n }], [{\n key: 'configure',\n value: function configure(options) {\n return options;\n }\n }, {\n key: 'initialize',\n value: function initialize(type, options) {\n return new DomObserver(options, 'canvas', type);\n }\n\n /**\r\n * Initializes gauge from a given HTML element\r\n * (given element should be valid HTML canvas gauge definition)\r\n *\r\n * @param {HTMLElement} element\r\n */\n\n }, {\n key: 'fromElement',\n value: function fromElement(element) {\n var type = DomObserver.toCamelCase(element.getAttribute('data-type'));\n var attributes = element.attributes;\n var i = 0;\n var s = attributes.length;\n var options = {};\n\n if (!type) {\n return;\n }\n\n if (!/Gauge$/.test(type)) {\n type += 'Gauge';\n }\n\n for (; i < s; i++) {\n options[DomObserver.toCamelCase(attributes[i].name.replace(/^data-/, ''), false)] = DomObserver.parse(attributes[i].value);\n }\n\n new DomObserver(options, element.tagName, type).process(element);\n }\n\n /**\r\n * Ensures value is proper number\r\n *\r\n * @param {*} value\r\n * @param {number} min\r\n * @return {number}\r\n */\n\n }, {\n key: 'ensureValue',\n value: function ensureValue(value) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n value = parseFloat(value);\n\n if (isNaN(value) || !isFinite(value)) {\n value = parseFloat(min) || 0;\n }\n\n return value;\n }\n }, {\n key: 'version',\n get: function get() {\n return version;\n }\n }]);\n\n return BaseGauge;\n}(EventEmitter);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['BaseGauge'] = BaseGauge;\n ns['gauges'] = (window.document || {})['gauges'] = gauges;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * @access private\r\n * @typedef {CanvasRenderingContext2D|{max: number, maxRadius: number, barDimensions: object}} Canvas2DContext\r\n */\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Examines if a given error is something to throw or to ignore\r\n *\r\n * @param {Error} err\r\n */\nfunction verifyError(err) {\n // there is some unpredictable error in FF in some circumstances\n // which we found simply safe to ignore than to fight with it\n // noinspection JSUnresolvedVariable\n if (err instanceof DOMException && err.result === 0x8053000b) {\n return; // ignore it\n }\n\n throw err;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Prepares major ticks data\r\n *\r\n * @access private\r\n * @param {GenericOptions|{ tickSide: string }} options\r\n * @return {[boolean, boolean]}\r\n */\nfunction prepareTicks(options) {\n if (!(options.majorTicks instanceof Array)) {\n options.majorTicks = options.majorTicks ? [options.majorTicks] : [];\n }\n\n if (!options.majorTicks.length) {\n options.majorTicks.push(drawings.formatMajorTickNumber(options.minValue, options));\n options.majorTicks.push(drawings.formatMajorTickNumber(options.maxValue, options));\n }\n\n return [options.tickSide !== 'right', options.tickSide !== 'left'];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rounded corners rectangle\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @param {number} r\r\n */\nfunction roundRect(context, x, y, w, h, r) {\n context.beginPath();\n\n context.moveTo(x + r, y);\n context.lineTo(x + w - r, y);\n\n context.quadraticCurveTo(x + w, y, x + w, y + r);\n context.lineTo(x + w, y + h - r);\n\n context.quadraticCurveTo(x + w, y + h, x + w - r, y + h);\n context.lineTo(x + r, y + h);\n\n context.quadraticCurveTo(x, y + h, x, y + h - r);\n context.lineTo(x, y + r);\n\n context.quadraticCurveTo(x, y, x + r, y);\n\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Pads a given value with leading zeros using the given options\r\n *\r\n * @param {number} val\r\n * @param {RadialGaugeOptions|{valueInt: number, valueDec: number}} options\r\n * @returns {string}\r\n */\nfunction padValue(val, options) {\n var dec = options.valueDec;\n var int = options.valueInt;\n var i = 0;\n var s = void 0,\n strVal = void 0,\n n = void 0;\n\n val = parseFloat(val);\n n = val < 0;\n val = Math.abs(val);\n\n if (dec > 0) {\n strVal = val.toFixed(dec).toString().split('.');\n s = int - strVal[0].length;\n\n for (; i < s; ++i) {\n strVal[0] = '0' + strVal[0];\n }\n\n strVal = (n ? '-' : '') + strVal[0] + '.' + strVal[1];\n } else {\n strVal = Math.round(val).toString();\n s = int - strVal.length;\n\n for (; i < s; ++i) {\n strVal = '0' + strVal;\n }\n\n strVal = (n ? '-' : '') + strVal;\n }\n\n return strVal;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Formats a number for display on the dial's plate using the majorTicksFormat\r\n * config option.\r\n *\r\n * @param {number} num number to format\r\n * @param {object} options\r\n * @returns {string} formatted number\r\n */\nfunction formatMajorTickNumber(num, options) {\n var right = void 0,\n hasDec = false;\n\n // First, force the correct number of digits right of the decimal.\n if (options.majorTicksDec === 0) {\n right = Math.round(num).toString();\n } else {\n right = num.toFixed(options.majorTicksDec);\n }\n\n // Second, force the correct number of digits left of the decimal.\n if (options.majorTicksInt > 1) {\n // Does this number have a decimal?\n hasDec = ~right.indexOf('.');\n\n // Is this number a negative number?\n if (~right.indexOf('-')) {\n return '-' + [options.majorTicksInt + options.majorTicksDec + 2 + (hasDec ? 1 : 0) - right.length].join('0') + right.replace('-', '');\n } else {\n return [options.majorTicksInt + options.majorTicksDec + 1 + (hasDec ? 1 : 0) - right.length].join('0') + right;\n }\n }\n\n return right;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Transforms degrees to radians\r\n *\r\n * @param {number} degrees\r\n * @returns {number}\r\n */\nfunction radians(degrees) {\n return degrees * Math.PI / 180;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Calculates and returns radial point coordinates\r\n *\r\n * @param {number} radius\r\n * @param {number} angle\r\n * @returns {{x: number, y: number}}\r\n */\nfunction radialPoint(radius, angle) {\n return { x: -radius * Math.sin(angle), y: radius * Math.cos(angle) };\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Creates and returns linear gradient canvas object\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {string} colorFrom\r\n * @param {string} colorTo\r\n * @param {number} length\r\n * @param {boolean} [isVertical]\r\n * @param {number} [from]\r\n * @returns {CanvasGradient}\r\n */\nfunction linearGradient(context, colorFrom, colorTo, length) {\n var isVertical = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n var from = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n\n var grad = context.createLinearGradient(isVertical ? 0 : from, isVertical ? from : 0, isVertical ? 0 : length, isVertical ? length : 0);\n\n grad.addColorStop(0, colorFrom);\n grad.addColorStop(1, colorTo);\n\n return grad;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws the shadow if it was not drawn\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {GenericOptions} options\r\n * @param {boolean} shadowDrawn\r\n * @return {boolean}\r\n */\nfunction drawShadow(context, options) {\n var shadowDrawn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (shadowDrawn) {\n context.restore();\n return true;\n }\n\n context.save();\n\n var w = options.borderShadowWidth;\n\n if (w) {\n context.shadowBlur = w;\n context.shadowColor = options.colorBorderShadow;\n }\n\n return true;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge needle shadow\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawNeedleShadow(context, options) {\n if (!options.needleShadow) return;\n\n context.shadowOffsetX = 2;\n context.shadowOffsetY = 2;\n context.shadowBlur = 10;\n context.shadowColor = options.colorNeedleShadowDown;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Constructs font styles for canvas fonts\r\n *\r\n * @param {GenericOptions} options\r\n * @param {string} target\r\n * @param {number} baseSize\r\n */\nfunction font(options, target, baseSize) {\n return options['font' + target + 'Style'] + ' ' + options['font' + target + 'Weight'] + ' ' + options['font' + target + 'Size'] * baseSize + 'px ' + options['font' + target];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Resets some context settings\r\n *\r\n * @param {Canvas2DContext} context\r\n */\nfunction reset(context) {\n context.shadowOffsetX = null;\n context.shadowOffsetY = null;\n context.shadowBlur = null;\n context.shadowColor = '';\n context.strokeStyle = null;\n context.lineWidth = 0;\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Declares to drow value text shadow if configured\r\n *\r\n * @param context\r\n * @param options\r\n * @param offset\r\n * @param blur\r\n */\nfunction drawValueTextShadow(context, options, offset, blur) {\n if (options.valueTextShadow) {\n context.shadowOffsetX = offset;\n context.shadowOffsetY = offset;\n context.shadowBlur = blur;\n context.shadowColor = options.colorValueTextShadow;\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws value box at given position\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {GenericOptions} options\r\n * @param {number|string} value\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} max\r\n */\nfunction drawValueBox(context, options, value, x, y, max) {\n if (!options.valueBox) return;\n\n reset(context);\n\n var addLength = options.valueDec ? 1 + options.valueDec : 0;\n var maxValueWidth = '9'.repeat(Math.max.apply(null, [String(parseInt(value)).length + addLength].concat(options.majorTicks.map(function (val) {\n return String(parseInt(val, 10)).length + addLength;\n }))));\n var text = options.valueText || padValue(value, options);\n var tunit = max / 200;\n var runit = max / 100;\n var offset = 0.4 * runit;\n var blur = 1.2 * runit;\n\n context.font = font(options, 'Value', tunit);\n drawValueTextShadow(context, options, offset, blur);\n\n var tw = context.measureText(options.valueText ? text : '-' + padValue(Number(maxValueWidth), options)).width;\n\n reset(context);\n\n var th = parseFloat(options.fontValueSize) * tunit + offset + blur;\n var sw = runit * parseFloat(options.valueBoxStroke);\n var bmax = max * 2 - sw * 2;\n\n var bw = tw + 10 * runit;\n var bh = 1.1 * th + offset + blur;\n var br = runit * options.valueBoxBorderRadius;\n var obw = (parseFloat(options.valueBoxWidth) || 0) / 100 * bmax;\n\n obw > bw && (bw = obw);\n bw > bmax && (bw = bmax);\n\n var bx = x - bw / 2;\n var by = y - bh / 2;\n var gy = y - 5.75 * runit;\n\n context.beginPath();\n\n if (br) roundRect(context, bx, by, bw, bh, br);else context.rect(bx, by, bw, bh);\n\n if (sw) {\n var grd = context.createRadialGradient(x, gy, runit * 10, x, gy, runit * 20);\n\n grd.addColorStop(0, options.colorValueBoxRect);\n grd.addColorStop(1, options.colorValueBoxRectEnd);\n\n context.strokeStyle = grd;\n context.lineWidth = sw;\n context.stroke();\n }\n\n if (options.colorValueBoxShadow) {\n context.shadowBlur = 1.2 * runit;\n context.shadowColor = options.colorValueBoxShadow;\n }\n\n if (options.colorValueBoxBackground) {\n context.fillStyle = options.colorValueBoxBackground;\n context.fill();\n }\n\n context.closePath();\n context.restore();\n\n drawValueTextShadow(context, options, offset, blur);\n\n context.fillStyle = options.colorValueText;\n context.textAlign = 'center';\n context.textBaseline = 'alphabetic';\n context.fillText(text, bx + bw / 2, y + bh / 2 - th / 3);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns normalized value\r\n *\r\n * @param {GenericOptions} options\r\n * @return {{normal: number, indented: number}}\r\n */\nfunction normalizedValue(options) {\n var value = options.value;\n var min = options.minValue;\n var max = options.maxValue;\n var dt = (max - min) * 0.01;\n\n return {\n normal: value < min ? min : value > max ? max : value,\n indented: value < min ? min - dt : value > max ? max + dt : value\n };\n}\n\nvar drawings = {\n roundRect: roundRect,\n padValue: padValue,\n formatMajorTickNumber: formatMajorTickNumber,\n radians: radians,\n radialPoint: radialPoint,\n linearGradient: linearGradient,\n drawNeedleShadow: drawNeedleShadow,\n drawValueBox: drawValueBox,\n verifyError: verifyError,\n prepareTicks: prepareTicks,\n drawShadow: drawShadow,\n font: font,\n normalizedValue: normalizedValue\n};\n\ndrawings;\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\nvar PI = Math.PI;\nvar HPI = PI / 2;\n\n/**\r\n * Gauge configuration options\r\n *\r\n * @typedef {GenericOptions|{exactTicks: boolean, ticksAngle: number, startAngle: number, colorNeedleCircleOuter: string, colorNeedleCircleOuterEnd: string, colorNeedleCircleInner: string, colorNeedleCircleInnerEnd: string, needleCircleSize: number, needleCircleInner: boolean, needleCircleOuter: boolean, animationTarget: string, useMinPath: boolean}} RadialGaugeOptions\r\n */\n\n/**\r\n * Default gauge configuration options\r\n *\r\n * @access private\r\n * @type {RadialGaugeOptions}\r\n */\nvar defaultRadialGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n ticksAngle: 270,\n startAngle: 45,\n\n // colors\n colorNeedleCircleOuter: '#f0f0f0',\n colorNeedleCircleOuterEnd: '#ccc',\n colorNeedleCircleInner: '#e8e8e8',\n colorNeedleCircleInnerEnd: '#f5f5f5',\n\n // needle\n needleCircleSize: 10,\n needleCircleInner: true,\n needleCircleOuter: true,\n needleStart: 20,\n\n // custom animations\n animationTarget: 'needle', // 'needle' or 'plate'\n useMinPath: false,\n\n barWidth: 0\n});\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gradient-filled circle on a canvas\r\n *\r\n * @access private\r\n * @param {number} radius\r\n * @param {number} width\r\n * @param {Canvas2DContext} context\r\n * @param {string} start gradient start color\r\n * @param {string} end gradient end color\r\n */\nfunction drawRadialBorder(radius, width, context, start, end) {\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(radius), 0, PI * 2, true);\n context.lineWidth = width;\n context.strokeStyle = end ? drawings.linearGradient(context, start, end, radius) : start;\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns max radius without borders for the gauge\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n * @return {number}\r\n */\nfunction maxRadialRadius(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n\n if (!context.maxRadius) {\n context.maxRadius = context.max - options.borderShadowWidth - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio + (options.borderOuterWidth ? 0.5 : 0) + (options.borderMiddleWidth ? 0.5 : 0) + (options.borderInnerWidth ? 0.5 : 0);\n }\n\n return context.maxRadius;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge plate on the canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialPlate(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n var d0 = options.borderShadowWidth * pxRatio;\n var r0 = context.max - d0 - options.borderOuterWidth * pxRatio / 2;\n var r1 = r0 - options.borderOuterWidth * pxRatio / 2 - options.borderMiddleWidth * pxRatio / 2 + 0.5;\n var r2 = r1 - options.borderMiddleWidth * pxRatio / 2 - options.borderInnerWidth * pxRatio / 2 + 0.5;\n var r3 = maxRadialRadius(context, options);\n var grad = void 0;\n var shadowDrawn = false;\n\n context.save();\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r0, options.borderOuterWidth * pxRatio, context, options.colorBorderOuter, options.colorBorderOuterEnd);\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r1, options.borderMiddleWidth * pxRatio, context, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r2, options.borderInnerWidth * pxRatio, context, options.colorBorderInner, options.colorBorderInnerEnd);\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(r3), 0, PI * 2, true);\n\n if (options.colorPlateEnd) {\n grad = context.createRadialGradient(0, 0, r3 / 2, 0, 0, r3);\n grad.addColorStop(0, options.colorPlate);\n grad.addColorStop(1, options.colorPlateEnd);\n } else {\n grad = options.colorPlate;\n }\n\n context.fillStyle = grad;\n\n context.fill();\n context.closePath();\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge highlight areas on a canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialHighlights(context, options) {\n var hlWidth = context.max * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!hlWidth) return;\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options) - hlWidth / 2);\n var i = 0,\n s = options.highlights.length;\n var vd = (options.maxValue - options.minValue) / options.ticksAngle;\n\n context.save();\n\n for (; i < s; i++) {\n var hlt = options.highlights[i];\n\n context.beginPath();\n\n context.rotate(HPI);\n context.arc(0, 0, r, drawings.radians(options.startAngle + (hlt.from - options.minValue) / vd), drawings.radians(options.startAngle + (hlt.to - options.minValue) / vd), false);\n context.strokeStyle = hlt.color;\n context.lineWidth = hlWidth;\n context.stroke();\n context.closePath();\n\n context.restore();\n context.save();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws minor ticks bar on a canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialMinorTicks(context, options) {\n var radius = radialTicksRadius(context, options);\n var s = void 0,\n range = void 0,\n angle = void 0;\n var i = 0;\n var delta = 0;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n\n context.lineWidth = SmartCanvas.pixelRatio;\n context.strokeStyle = options.colorMinorTicks || options.colorStrokeTicks;\n\n context.save();\n\n if (options.exactTicks) {\n range = options.maxValue - options.minValue;\n s = minTicks ? range / minTicks : 0;\n delta = (options.majorTicks[0] % minTicks || 0) * ratio;\n } else {\n s = minTicks * (options.majorTicks.length - 1);\n }\n\n for (; i < s; ++i) {\n angle = options.startAngle + delta + i * (options.ticksAngle / s);\n\n context.rotate(drawings.radians(angle));\n\n context.beginPath();\n context.moveTo(0, radius);\n context.lineTo(0, radius - context.max * 0.075);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns ticks radius\r\n *\r\n * @access private\r\n * @param context\r\n * @param options\r\n * @return {number}\r\n */\nfunction radialTicksRadius(context, options) {\n var unit = context.max / 100;\n\n return maxRadialRadius(context, options) - 5 * unit - (options.barWidth ? (parseFloat(options.barStrokeWidth) || 0) * 2 + ((parseFloat(options.barWidth) || 0) + 5) * unit : 0);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge major ticks bar on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialMajorTicks(context, options) {\n drawings.prepareTicks(options);\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options));\n var i = void 0,\n colors = void 0;\n var s = options.majorTicks.length;\n var pixelRatio = SmartCanvas.pixelRatio;\n\n context.lineWidth = 2 * pixelRatio;\n context.save();\n\n colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(s).fill(options.colorStrokeTicks || options.colorMajorTicks);\n\n i = 0;\n for (; i < s; ++i) {\n context.strokeStyle = colors[i];\n context.rotate(drawings.radians(radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s)));\n\n context.beginPath();\n context.moveTo(0, r);\n context.lineTo(0, r - context.max * 0.15);\n closeStrokedPath(context);\n }\n\n if (options.strokeTicks) {\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n context.rotate(HPI);\n\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\nfunction radialNextAngle(options, i, s) {\n if (options.exactTicks) {\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n return options.startAngle + ratio * (i - options.minValue);\n }\n\n return options.startAngle + i * (options.ticksAngle / (s - 1));\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Strokes, closes path and restores previous context state\r\n *\r\n * @param {Canvas2DContext} context\r\n */\nfunction closeStrokedPath(context) {\n context.stroke();\n context.restore();\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar numbers\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialNumbers(context, options) {\n var radius = radialTicksRadius(context, options) - context.max * 0.15;\n var points = {};\n var i = 0;\n var s = options.majorTicks.length;\n var isAnimated = options.animationTarget !== 'needle';\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(s).fill(options.colorNumbers);\n\n var plateValueAngle = isAnimated ? -(options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle : 0;\n\n if (isAnimated) {\n context.save();\n context.rotate(-drawings.radians(plateValueAngle));\n }\n\n context.font = drawings.font(options, 'Numbers', context.max / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n\n for (; i < s; ++i) {\n var angle = plateValueAngle + radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s);\n var textWidth = context.measureText(options.majorTicks[i]).width;\n var textHeight = options.fontNumbersSize;\n var textRadius = Math.sqrt(textWidth * textWidth + textHeight * textHeight) / 2;\n var point = drawings.radialPoint(radius - textRadius - options.numbersMargin / 100 * context.max, drawings.radians(angle));\n\n if (angle === 360) angle = 0;\n\n if (points[angle]) {\n continue; //already drawn at this place, skipping\n }\n\n points[angle] = true;\n\n context.fillStyle = colors[i];\n context.fillText(options.majorTicks[i], point.x, point.y);\n }\n\n isAnimated && context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge title\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialTitle(context, options) {\n if (!options.title) return;\n\n context.save();\n context.font = drawings.font(options, 'Title', context.max / 200);\n context.fillStyle = options.colorTitle;\n context.textAlign = 'center';\n context.fillText(options.title, 0, -context.max / 4.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws units name on the gauge\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialUnits(context, options) {\n if (!options.units) return;\n\n context.save();\n context.font = drawings.font(options, 'Units', context.max / 200);\n context.fillStyle = options.colorUnits;\n context.textAlign = 'center';\n context.fillText(options.units, 0, context.max / 3.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge needle\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialNeedle(context, options) {\n if (!options.needle) return;\n\n var value = options.ticksAngle < 360 ? drawings.normalizedValue(options).indented : options.value;\n var max = maxRadialRadius(context, options);\n //noinspection JSUnresolvedFunction\n var r1 = abs(max / 100 * options.needleCircleSize);\n //noinspection JSUnresolvedFunction\n var r2 = abs(max / 100 * options.needleCircleSize * 0.75);\n //noinspection JSUnresolvedFunction\n var rIn = abs(max / 100 * options.needleEnd);\n //noinspection JSUnresolvedFunction\n var rStart = abs(options.needleStart ? max / 100 * options.needleStart : 0);\n //noinspection JSUnresolvedFunction\n var pad1 = max / 100 * options.needleWidth;\n var pad2 = max / 100 * options.needleWidth / 2;\n var pixelRatio = SmartCanvas.pixelRatio;\n var isFixed = options.animationTarget !== 'needle';\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n context.rotate(drawings.radians(isFixed ? options.startAngle : options.startAngle + (value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle));\n\n context.fillStyle = drawings.linearGradient(context, options.colorNeedle, options.colorNeedleEnd, rIn - rStart);\n\n if (options.needleType === 'arrow') {\n context.beginPath();\n context.moveTo(-pad2, -rStart);\n context.lineTo(-pad1, 0);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(pixelRatio, rIn);\n context.lineTo(pad1, 0);\n context.lineTo(pad2, -rStart);\n context.closePath();\n context.fill();\n\n context.beginPath();\n context.lineTo(-0.5 * pixelRatio, rIn);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(-pad1, 0);\n context.lineTo(-pad2, -rStart);\n context.lineTo(pad2 / 2 * pixelRatio - 2 * pixelRatio, -rStart);\n context.closePath();\n context.fillStyle = options.colorNeedleShadowUp;\n context.fill();\n } else {\n // simple line needle\n context.beginPath();\n context.moveTo(-pad2, rIn);\n context.lineTo(-pad2, rStart);\n context.lineTo(pad2, rStart);\n context.lineTo(pad2, rIn);\n context.closePath();\n context.fill();\n }\n\n if (options.needleCircleSize) {\n context.restore();\n\n drawings.drawNeedleShadow(context, options);\n\n if (options.needleCircleOuter) {\n context.beginPath();\n context.arc(0, 0, r1, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleOuter, options.colorNeedleCircleOuterEnd, r1);\n context.fill();\n context.closePath();\n }\n\n if (options.needleCircleInner) {\n context.beginPath();\n context.arc(0, 0, r2, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleInner, options.colorNeedleCircleInnerEnd, r2);\n context.fill();\n context.closePath();\n }\n\n context.restore();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge value box\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n * @param {number} value\r\n */\nfunction drawRadialValueBox(context, options, value) {\n drawings.drawValueBox(context, options, value, 0, context.max - context.max * 0.33, context.max);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge progress bar\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialProgressBar(context, options) {\n var unit = context.max / 100;\n var rMax = maxRadialRadius(context, options) - 5 * unit;\n var sw = parseFloat(options.barStrokeWidth) || 0;\n var w = (parseFloat(options.barWidth) || 0) * unit;\n var rMin = rMax - sw * 2 - w;\n var half = (rMax - rMin) / 2;\n var r = rMin + half;\n var delta = sw / r;\n var sa = options.startAngle;\n var ea = options.startAngle + options.ticksAngle;\n\n context.save();\n context.rotate(HPI);\n\n if (sw) {\n // draw stroke\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa) - delta, drawings.radians(ea) + delta, false);\n context.strokeStyle = options.colorBarStroke;\n context.lineWidth = half * 2;\n context.stroke();\n context.closePath();\n }\n\n if (w) {\n // draw bar\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(ea), false);\n context.strokeStyle = options.colorBar;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n\n if (options.barShadow) {\n // draw shadow\n context.beginPath();\n context.arc(0, 0, rMax, drawings.radians(sa), drawings.radians(ea), false);\n context.clip();\n\n context.beginPath();\n context.strokeStyle = options.colorBar;\n context.lineWidth = 1;\n context.shadowBlur = options.barShadow;\n context.shadowColor = options.colorBarShadow;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n context.arc(0, 0, rMax, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n context.stroke();\n context.closePath();\n\n context.restore();\n context.rotate(HPI);\n }\n\n // draw bar progress\n if (options.barProgress) {\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(sa + (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle), false);\n context.strokeStyle = options.colorBarProgress;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n }\n }\n\n context.restore();\n}\n\n/**\r\n * Find and return gauge value to display\r\n *\r\n * @param {RadialGauge} gauge\r\n */\nfunction displayValue(gauge) {\n if (gauge.options.animatedValue) {\n return gauge.options.value;\n }\n\n return gauge.value;\n}\n\n/**\r\n * Minimalistic HTML5 Canvas Gauge\r\n * @example\r\n * var gauge = new RadialGauge({\r\n * renderTo: 'gauge-id', // identifier of HTML canvas element or element itself\r\n * width: 400,\r\n * height: 400,\r\n * units: 'Km/h',\r\n * title: false,\r\n * value: 0,\r\n * minValue: 0,\r\n * maxValue: 220,\r\n * majorTicks: [\r\n * '0','20','40','60','80','100','120','140','160','180','200','220'\r\n * ],\r\n * minorTicks: 2,\r\n * strokeTicks: false,\r\n * highlights: [\r\n * { from: 0, to: 50, color: 'rgba(0,255,0,.15)' },\r\n * { from: 50, to: 100, color: 'rgba(255,255,0,.15)' },\r\n * { from: 100, to: 150, color: 'rgba(255,30,0,.25)' },\r\n * { from: 150, to: 200, color: 'rgba(255,0,225,.25)' },\r\n * { from: 200, to: 220, color: 'rgba(0,0,255,.25)' }\r\n * ],\r\n * colorPlate: '#222',\r\n * colorMajorTicks: '#f5f5f5',\r\n * colorMinorTicks: '#ddd',\r\n * colorTitle: '#fff',\r\n * colorUnits: '#ccc',\r\n * colorNumbers: '#eee',\r\n * colorNeedleStart: 'rgba(240, 128, 128, 1)',\r\n * colorNeedleEnd: 'rgba(255, 160, 122, .9)',\r\n * valueBox: true,\r\n * animationRule: 'bounce'\r\n * });\r\n * // draw initially\r\n * gauge.draw();\r\n * // animate\r\n * setInterval(() => {\r\n * gauge.value = Math.random() * -220 + 220;\r\n * }, 1000);\r\n */\n\nvar RadialGauge = function (_BaseGauge) {\n _inherits(RadialGauge, _BaseGauge);\n\n /**\r\n * Fired each time before gauge plate is drawn\r\n *\r\n * @event RadialGauge#beforePlate\r\n */\n\n /**\r\n * Fired each time before gauge highlight areas are drawn\r\n *\r\n * @event RadialGauge#beforeHighlights\r\n */\n\n /**\r\n * Fired each time before gauge minor ticks are drawn\r\n *\r\n * @event RadialGauge#beforeMinorTicks\r\n */\n\n /**\r\n * Fired each time before gauge major ticks are drawn\r\n *\r\n * @event RadialGauge#beforeMajorTicks\r\n */\n\n /**\r\n * Fired each time before gauge tick numbers are drawn\r\n *\r\n * @event RadialGauge#beforeNumbers\r\n */\n\n /**\r\n * Fired each time before gauge title is drawn\r\n *\r\n * @event RadialGauge#beforeTitle\r\n */\n\n /**\r\n * Fired each time before gauge units text is drawn\r\n *\r\n * @event RadialGauge#beforeUnits\r\n */\n\n /**\r\n * Fired each time before gauge progress bar is drawn\r\n *\r\n * @event RadialGauge#beforeProgressBar\r\n */\n\n /**\r\n * Fired each time before gauge value box is drawn\r\n *\r\n * @event RadialGauge#beforeValueBox\r\n */\n\n /**\r\n * Fired each time before gauge needle is drawn\r\n *\r\n * @event RadialGauge#beforeNeedle\r\n */\n\n /**\r\n * @constructor\r\n * @param {RadialGaugeOptions} options\r\n */\n function RadialGauge(options) {\n _classCallCheck(this, RadialGauge);\n\n options = Object.assign({}, defaultRadialGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (RadialGauge.__proto__ || Object.getPrototypeOf(RadialGauge)).call(this, RadialGauge.configure(options)));\n }\n\n /**\r\n * Checks and updates gauge options properly\r\n *\r\n * @param {*} options\r\n * @return {*}\r\n * @access protected\r\n */\n\n\n _createClass(RadialGauge, [{\n key: 'draw',\n\n\n /**\r\n * Triggering gauge render on a canvas.\r\n *\r\n * @returns {RadialGauge}\r\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref[0],\n y = _ref[1],\n w = _ref[2],\n h = _ref[3];\n\n var options = this.options;\n\n if (options.animationTarget === 'needle') {\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(context, options);\n this.emit('beforeHighlights');\n drawRadialHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(context, options);\n this.emit('beforeTitle');\n drawRadialTitle(context, options);\n this.emit('beforeUnits');\n drawRadialUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n this.emit('beforeNeedle');\n drawRadialNeedle(canvas.context, options);\n } else {\n var plateValueAngle = -drawings.radians((options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle);\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(canvas.context, options);\n\n canvas.context.rotate(plateValueAngle);\n\n // animated\n this.emit('beforeHighlights');\n drawRadialHighlights(canvas.context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(canvas.context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(canvas.context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(canvas.context, options);\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n\n // non-animated\n canvas.context.rotate(-plateValueAngle);\n canvas.context.save();\n\n if (!canvas.elementClone.initialized) {\n var _context = canvas.contextClone;\n\n // clear the cache\n _context.clearRect(x, y, w, h);\n _context.save();\n\n this.emit('beforeTitle');\n drawRadialTitle(_context, options);\n this.emit('beforeUnits');\n drawRadialUnits(_context, options);\n this.emit('beforeNeedle');\n drawRadialNeedle(_context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n }\n\n // value box animations\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n\n _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }, {\n key: 'value',\n\n\n /**\r\n * Sets the value for radial gauge\r\n *\r\n * @param {number} value\r\n */\n set: function set(value) {\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n if (this.options.animation && this.options.ticksAngle === 360 && this.options.useMinPath) {\n this._value = value;\n value = this.options.value + ((value - this.options.value) % 360 + 540) % 360 - 180;\n }\n\n _set(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', value, this);\n }\n\n /**\r\n * Returns current gauge value\r\n *\r\n * @return {number}\r\n */\n ,\n get: function get() {\n return _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', this);\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n if (options.barWidth > 50) options.barWidth = 50;\n\n /* istanbul ignore if */\n if (isNaN(options.startAngle)) options.startAngle = 45;\n /* istanbul ignore if */\n if (isNaN(options.ticksAngle)) options.ticksAngle = 270;\n\n /* istanbul ignore if */\n if (options.ticksAngle > 360) options.ticksAngle = 360;\n /* istanbul ignore if */\n if (options.ticksAngle < 0) options.ticksAngle = 0;\n\n /* istanbul ignore if */\n if (options.startAngle < 0) options.startAngle = 0;\n /* istanbul ignore if */\n if (options.startAngle > 360) options.startAngle = 360;\n\n return options;\n }\n }]);\n\n return RadialGauge;\n}(BaseGauge);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['RadialGauge'] = RadialGauge;\n}\n\nBaseGauge.initialize('RadialGauge', defaultRadialGaugeOptions);\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Linear gauge configuration options\r\n *\r\n * @typedef {GenericOptions|{borderRadius: number, barBeginCircle: number, tickSide: string, needleSide: string, numberSide: string, ticksWidth: number, ticksWidthMinor: number, ticksPadding: number, barLength: number, colorBarEnd: string, colorBarProgressEnd: string}} LinearGaugeOptions\r\n */\n\n/**\r\n * Default linear gauge configuration options\r\n *\r\n * @type {LinearGaugeOptions}\r\n */\nvar defaultLinearGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n borderRadius: 0,\n // width: 150,\n // height: 400,\n\n // bar\n barBeginCircle: 30, // percents\n colorBarEnd: '',\n colorBarProgressEnd: '',\n\n needleWidth: 6,\n\n tickSide: 'both', // available: 'left', 'right', 'both'\n needleSide: 'both', // available: 'left', 'right', 'both'\n\n numberSide: 'both', // available: 'left', 'right', 'both'\n\n ticksWidth: 10,\n ticksWidthMinor: 5,\n ticksPadding: 5,\n barLength: 85,\n fontTitleSize: 26,\n\n highlightsWidth: 10\n});\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rectangle on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\r\n * @param {number} x x-coordinate of the top-left corner\r\n * @param {number} y y-coordinate of the top-left corner\r\n * @param {number} w width of the rectangle\r\n * @param {number} h height of the rectangle\r\n * @param {string} colorStart base fill color of the rectangle\r\n * @param {string} [colorEnd] gradient color of the rectangle\r\n */\nfunction drawRectangle(context, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.fillStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, w > h ? w : h, h > w, w > h ? x : y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rectangle on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} width width of the border\r\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\r\n * @param {number} x x-coordinate of the top-left corner\r\n * @param {number} y y-coordinate of the top-left corner\r\n * @param {number} w width of the rectangle\r\n * @param {number} h height of the rectangle\r\n * @param {string} colorStart base fill color of the rectangle\r\n * @param {string} [colorEnd] gradient color of the rectangle\r\n */\nfunction drawLinearBorder(context, width, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.lineWidth = width;\n context.strokeStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, h, true, y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge plate\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearPlate(context, options, x, y, w, h) {\n var pxRatio = SmartCanvas.pixelRatio;\n context.save();\n\n var r = options.borderRadius * pxRatio;\n var w1 = w - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var w2 = w1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var w3 = w2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var w4 = w3 - options.borderInnerWidth * pxRatio;\n\n var h1 = h - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var h2 = h1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var h3 = h2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var h4 = h3 - options.borderInnerWidth * pxRatio;\n\n var x2 = x - (w2 - w1) / 2;\n var x3 = x2 - (w3 - w2) / 2;\n var x4 = x3 - (w4 - w3) / 2;\n\n var y2 = y - (h2 - h1) / 2;\n var y3 = y2 - (h3 - h2) / 2;\n var y4 = y3 - (h4 - h3) / 2;\n var aliasingOffset = 0;\n var shadowDrawn = false;\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderOuterWidth * pxRatio, r, x + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, y + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, w1, h1, options.colorBorderOuter, options.colorBorderOuterEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderMiddleWidth * pxRatio, r -= 1 + aliasingOffset * 2, x2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, y2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, w2 + aliasingOffset * 2, h2 + aliasingOffset * 2, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderInnerWidth * pxRatio, r -= 1 + aliasingOffset * 2, x3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, y3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, w3 + aliasingOffset * 2, h3 + aliasingOffset * 2, options.colorBorderInner, options.colorBorderInnerEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n drawRectangle(context, r, x4, y4, w4 + aliasingOffset * 2, h4 + aliasingOffset * 2, options.colorPlate, options.colorPlateEnd);\n\n context.restore();\n\n return [x4, y4, w4, h4];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Calculates and returns linear gauge base bar dimensions.\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions|{barStrokeWidth: number, barBeginCircle: number, barWidth: number, hasLeft: boolean, hasRight: boolean}} options\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @return {{isVertical: boolean, width: number, length: number, barWidth: number, barLength: number, strokeWidth: number, barMargin: number, radius: number, x0: number, y0: number, barOffset: number, titleMargin: number, unitsMargin: number, X: number, Y: number, baseX: number, baseY: number, ticksPadding: number}}\r\n */\nfunction barDimensions(context, options, x, y, w, h) {\n var pixelRatio = SmartCanvas.pixelRatio;\n var isVertical = h >= w;\n var width = isVertical ? w * 0.85 : h;\n var length = isVertical ? h : w;\n\n //noinspection JSUnresolvedFunction\n x = isVertical ? round(x + (w - width) / 2) : x;\n\n var hasTitle = !!options.title;\n var hasUnits = !!options.units;\n var hasValue = !!options.valueBox;\n\n var titleMargin = void 0;\n var unitsMargin = void 0;\n var valueMargin = void 0;\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n unitsMargin = round(length * 0.05);\n //noinspection JSUnresolvedFunction\n titleMargin = round(length * 0.075);\n //noinspection JSUnresolvedFunction\n valueMargin = round(length * 0.11);\n\n if (hasTitle) {\n length -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) length -= unitsMargin;\n if (hasValue) length -= valueMargin;\n } else {\n //noinspection JSUnresolvedFunction\n unitsMargin = titleMargin = round(width * 0.15);\n\n if (hasTitle) {\n width -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) width -= unitsMargin;\n }\n\n var strokeWidth = options.barStrokeWidth * 2;\n //noinspection JSUnresolvedFunction\n var radius = options.barBeginCircle ? round(width * options.barBeginCircle / 200 - strokeWidth / 2) : 0;\n //noinspection JSUnresolvedFunction\n var barWidth = round(width * options.barWidth / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barLength = round(length * options.barLength / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barMargin = round((length - barLength) / 2);\n\n // coordinates for arc of the bar if configured\n //noinspection JSUnresolvedFunction\n var x0 = round(x + (isVertical ? width / 2 : barMargin + radius));\n //noinspection JSUnresolvedFunction\n var y0 = round(y + (isVertical ? length - barMargin - radius + strokeWidth / 2 : width / 2));\n var dx = isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n var dy = !isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n\n //noinspection JSUndefinedPropertyAssignment\n context.barDimensions = {\n isVertical: isVertical,\n width: width,\n length: length,\n barWidth: barWidth,\n barLength: barLength,\n strokeWidth: strokeWidth,\n barMargin: barMargin,\n radius: radius,\n pixelRatio: pixelRatio,\n barOffset: null,\n titleMargin: hasTitle ? titleMargin : 0,\n unitsMargin: hasUnits ? unitsMargin : 0,\n get ticksLength() {\n return this.barLength - this.barOffset - this.strokeWidth;\n },\n X: x + dx,\n Y: y + dy,\n x0: x0 + dx,\n y0: y0 + dy,\n baseX: x,\n baseY: y,\n ticksPadding: options.ticksPadding / 100\n };\n\n return context.barDimensions;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws bar shape from the given options on a given canvas context\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {string} type\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearBarShape(context, options, type, x, y, w, h) {\n var _barDimensions = barDimensions(context, options, x, y, w, h),\n isVertical = _barDimensions.isVertical,\n width = _barDimensions.width,\n barWidth = _barDimensions.barWidth,\n barLength = _barDimensions.barLength,\n strokeWidth = _barDimensions.strokeWidth,\n barMargin = _barDimensions.barMargin,\n radius = _barDimensions.radius,\n x0 = _barDimensions.x0,\n y0 = _barDimensions.y0,\n X = _barDimensions.X,\n Y = _barDimensions.Y;\n\n var fullBarLength = barLength;\n\n context.save();\n context.beginPath();\n\n if (options.barBeginCircle) {\n var direction = drawings.radians(isVertical ? 270 : 0);\n var alpha = Math.asin(barWidth / 2 / radius);\n var cosAlpha = Math.cos(alpha);\n var sinAlpha = Math.sin(alpha);\n\n var x1 = x0 + (isVertical ? radius * sinAlpha : radius * cosAlpha - strokeWidth / 2);\n var y1 = isVertical ? y0 - radius * cosAlpha : y0 + radius * sinAlpha;\n //noinspection JSUnresolvedFunction\n var cutRadius = isVertical ? abs(y1 - y0) : abs(x1 - x0);\n\n //noinspection JSUnresolvedFunction\n context.barDimensions.barOffset = round(cutRadius + radius);\n\n // bottom point\n //noinspection JSUnresolvedFunction\n var x2 = isVertical ? round(x0 - radius * sinAlpha) : x1;\n //noinspection JSUnresolvedFunction\n var y2 = isVertical ? y1 : round(y0 - radius * sinAlpha);\n\n if (type === 'progress') {\n barLength = context.barDimensions.barOffset + (barLength - context.barDimensions.barOffset) * (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue);\n }\n\n // bar ends at\n //noinspection JSUnresolvedFunction\n var x3 = round(x1 + barLength - context.barDimensions.barOffset + strokeWidth / 2); // h\n //noinspection JSUnresolvedFunction\n var y3 = round(y1 - barLength + context.barDimensions.barOffset - strokeWidth / 2); // v\n\n context.arc(x0, y0, radius, direction + alpha, direction - alpha);\n\n if (isVertical) {\n context.moveTo(x1, y2);\n context.lineTo(x1, y3);\n context.lineTo(x2, y3);\n context.lineTo(x2, y2);\n } else {\n context.moveTo(x1, y2);\n context.lineTo(x3, y2);\n context.lineTo(x3, y1);\n context.lineTo(x1, y1);\n }\n } else {\n // simply rectangle\n //noinspection JSUnresolvedFunction\n var rx = round(isVertical ? X + (width - barWidth) / 2 : X + barMargin);\n //noinspection JSUnresolvedFunction\n var ry = round(isVertical ? Y + barLength + barMargin : Y + (width - barWidth) / 2);\n\n if (type === 'progress') {\n barLength *= (options.value - options.minValue) / (options.maxValue - options.minValue);\n }\n\n if (isVertical) context.rect(rx, ry, barWidth, -barLength);else context.rect(rx, ry, barLength, barWidth);\n }\n\n if (type !== 'progress' && options.barStrokeWidth) {\n context.lineWidth = strokeWidth;\n context.strokeStyle = options.colorBarStroke;\n //context.lineJoin = 'round';\n context.stroke();\n }\n\n if (type !== 'progress' && options.colorBar) {\n context.fillStyle = options.colorBarEnd ? drawings.linearGradient(context, options.colorBar, options.colorBarEnd, barLength, isVertical, isVertical ? Y : X) : options.colorBar;\n context.fill();\n } else if (type === 'progress' && options.colorBarProgress) {\n context.fillStyle = options.colorBarProgressEnd ? drawings.linearGradient(context, options.colorBarProgress, options.colorBarProgressEnd, fullBarLength, isVertical, isVertical ? Y : X) : options.colorBarProgress;\n context.fill();\n }\n\n context.closePath();\n\n // fix dimensions for further usage\n if (options.barBeginCircle) context.barDimensions.radius += strokeWidth;\n\n context.barDimensions.barWidth += strokeWidth;\n context.barDimensions.barLength += strokeWidth;\n}\n\n/**\r\n * Draws gauge bar\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x x-coordinate of the top-left corner of the gauge\r\n * @param {number} y y-coordinate of the top-left corner of the gauge\r\n * @param {number} w width of the gauge\r\n * @param {number} h height of the gauge\r\n */\nfunction drawLinearBar(context, options, x, y, w, h) {\n drawLinearBarShape(context, options, '', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Helper function to calculate bar ticks presence on the sides\r\n *\r\n * @param {string} notWhich\r\n * @param {LinearGaugeOptions} options\r\n * @return {boolean}\r\n */\nfunction hasTicksBar(notWhich, options) {\n return options.needleSide !== notWhich || options.tickSide !== notWhich || options.numberSide !== notWhich;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar progress\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x x-coordinate of the top-left corner of the gauge\r\n * @param {number} y y-coordinate of the top-left corner of the gauge\r\n * @param {number} w width of the gauge\r\n * @param {number} h height of the gauge\r\n */\nfunction drawLinearBarProgress(context, options, x, y, w, h) {\n options.barProgress && drawLinearBarShape(context, options, 'progress', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar highlighted areas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearBarHighlights(context, options) {\n var _context$barDimension = context.barDimensions,\n isVertical = _context$barDimension.isVertical,\n width = _context$barDimension.width,\n length = _context$barDimension.length,\n barWidth = _context$barDimension.barWidth,\n barOffset = _context$barDimension.barOffset,\n barMargin = _context$barDimension.barMargin,\n X = _context$barDimension.X,\n Y = _context$barDimension.Y,\n ticksLength = _context$barDimension.ticksLength,\n ticksPadding = _context$barDimension.ticksPadding;\n\n var hlWidth = width * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!options.highlights || !hlWidth) return;\n\n var hasLeft = options.tickSide !== 'right';\n var hasRight = options.tickSide !== 'left';\n var i = 0;\n var s = options.highlights.length;\n var tickOffset = (width - barWidth) / 2;\n var interval = options.maxValue - options.minValue;\n //noinspection JSUnresolvedFunction\n var eX = round(isVertical ? X + tickOffset : X + barMargin + barOffset);\n var eH = hlWidth;\n var eY = isVertical ? Y + length - barMargin - barOffset : Y + tickOffset;\n //noinspection JSUnresolvedFunction\n var hLeft = round((options.ticksWidth / 100 + ticksPadding) * width) + (hlWidth - options.ticksWidth / 100 * width);\n //noinspection JSUnresolvedFunction\n var hRight = round(barWidth + ticksPadding * width);\n\n context.save();\n\n for (; i < s; i++) {\n var entry = options.highlights[i];\n //noinspection JSUnresolvedFunction\n var eStart = ticksLength * abs(options.minValue - entry.from) / interval;\n //noinspection JSUnresolvedFunction\n var eW = ticksLength * abs((entry.to - entry.from) / interval);\n\n context.beginPath();\n context.fillStyle = entry.color;\n\n if (isVertical) {\n if (hasLeft) context.rect(eX - hLeft, eY - eStart, eH, -eW);\n\n if (hasRight) context.rect(eX + hRight, eY - eStart, eH, -eW);\n } else {\n if (hasLeft) context.rect(eX + eStart, eY - hLeft, eW, eH);\n\n if (hasRight) context.rect(eX + eStart, eY + hRight, eW, eH);\n }\n\n context.fill();\n context.closePath();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws a tick line on a linear gauge\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param x1\r\n * @param y1\r\n * @param x2\r\n * @param y2\r\n */\nfunction drawLinearTick(context, x1, y1, x2, y2) {\n context.beginPath();\n\n context.moveTo(x1, y1);\n context.lineTo(x2, y2);\n context.stroke();\n\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {string} color\r\n * @param {number[]} ticks\r\n * @param {number} minVal\r\n * @param {number} maxVal\r\n * @param {boolean} hasLeft\r\n * @param {boolean} hasRight\r\n * @param {number} lineWidth\r\n * @param {number} lineLength\r\n */\nfunction drawLinearTicks(context, color, ticks, minVal, maxVal, hasLeft, hasRight, lineWidth, lineLength) {\n var _context$barDimension2 = context.barDimensions,\n isVertical = _context$barDimension2.isVertical,\n length = _context$barDimension2.length,\n barWidth = _context$barDimension2.barWidth,\n barOffset = _context$barDimension2.barOffset,\n barMargin = _context$barDimension2.barMargin,\n pixelRatio = _context$barDimension2.pixelRatio,\n width = _context$barDimension2.width,\n X = _context$barDimension2.X,\n Y = _context$barDimension2.Y,\n ticksLength = _context$barDimension2.ticksLength,\n ticksPadding = _context$barDimension2.ticksPadding;\n\n var tickOffset = (width - barWidth) / 2;\n var tickX = void 0,\n tickY = void 0;\n var i = 0;\n var s = ticks.length;\n var val = void 0;\n var tickLen = lineLength * width;\n var tickLeft = tickOffset - ticksPadding * width;\n var tickRight = tickOffset + barWidth + tickLen + ticksPadding * width;\n var colors = color instanceof Array ? color : new Array(ticks.length).fill(color);\n\n context.lineWidth = lineWidth * pixelRatio;\n context.save();\n\n var ratio = ticksLength / (maxVal - minVal);\n for (; i < s; i++) {\n val = ticks[i];\n context.strokeStyle = colors[i];\n\n if (isVertical) {\n tickY = Y + length - barMargin - barOffset + (minVal - val) * ratio;\n\n if (hasLeft) {\n tickX = X + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n\n if (hasRight) {\n tickX = X + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n } else {\n tickX = X + barMargin + barOffset - (minVal - val) * ratio;\n\n if (hasLeft) {\n tickY = Y + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, tickX, round(tickY - tickLen));\n }\n\n if (hasRight) {\n tickY = Y + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, round(tickY), tickX, tickY - tickLen);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws major ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMajorTicks(context, options) {\n var _drawings$prepareTick = drawings.prepareTicks(options),\n _drawings$prepareTick2 = _slicedToArray(_drawings$prepareTick, 2),\n hasLeft = _drawings$prepareTick2[0],\n hasRight = _drawings$prepareTick2[1];\n\n var lineWidth = 2;\n var valuePerNonExactTick = (options.maxValue - options.minValue) / (options.majorTicks.length - 1);\n var colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(options.majorTicks.length).fill(options.colorStrokeTicks || options.colorMajorTicks);\n var ticks = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n\n drawLinearTicks(context, colors, ticks, options.minValue, options.maxValue, hasLeft, hasRight, lineWidth, options.ticksWidth / 100);\n\n if (options.strokeTicks) {\n var _context$barDimension3 = context.barDimensions,\n isVertical = _context$barDimension3.isVertical,\n length = _context$barDimension3.length,\n width = _context$barDimension3.width,\n barWidth = _context$barDimension3.barWidth,\n barMargin = _context$barDimension3.barMargin,\n barOffset = _context$barDimension3.barOffset,\n X = _context$barDimension3.X,\n Y = _context$barDimension3.Y,\n ticksLength = _context$barDimension3.ticksLength,\n pixelRatio = _context$barDimension3.pixelRatio,\n ticksPadding = _context$barDimension3.ticksPadding;\n\n var rightTicks = (width - barWidth) / 2 + barWidth + ticksPadding * width;\n var leftTicks = (width - barWidth) / 2 - ticksPadding * width;\n var sX = void 0,\n sY = void 0,\n eX = void 0,\n eY = void 0;\n\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n\n lineWidth *= pixelRatio;\n\n if (isVertical) {\n sY = Y + length - barMargin - barOffset + lineWidth / 2;\n eY = sY - ticksLength - lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n } else {\n sX = X + barMargin + barOffset - lineWidth / 2;\n eX = sX + ticksLength + lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws ticks stroke\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n */\nfunction drawLinearTickStroke(context, sX, sY, eX, eY) {\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws minor ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMinorTicks(context, options) {\n var _drawings$prepareTick3 = drawings.prepareTicks(options),\n _drawings$prepareTick4 = _slicedToArray(_drawings$prepareTick3, 2),\n hasLeft = _drawings$prepareTick4[0],\n hasRight = _drawings$prepareTick4[1];\n\n var ticks = [];\n var i = options.minValue;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var valuePerNonExactTick = minTicks ? (options.maxValue - options.minValue) / (minTicks * (options.majorTicks.length - 1)) : 0;\n\n if (minTicks) {\n if (options.exactTicks) {\n var delta = options.majorTicks[0] % minTicks || 0;\n\n for (; i < options.maxValue; i += minTicks) {\n ticks.push(delta + i);\n }\n } else {\n for (; i < options.maxValue; i += valuePerNonExactTick) {\n ticks.push(i);\n }\n }\n }\n\n drawLinearTicks(context, options.colorMinorTicks || options.colorStrokeTicks, ticks, options.minValue, options.maxValue, hasLeft, hasRight, 1, options.ticksWidthMinor / 100);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws major tick numbers\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMajorTicksNumbers(context, options) {\n var _context$barDimension4 = context.barDimensions,\n isVertical = _context$barDimension4.isVertical,\n length = _context$barDimension4.length,\n width = _context$barDimension4.width,\n barWidth = _context$barDimension4.barWidth,\n barMargin = _context$barDimension4.barMargin,\n barOffset = _context$barDimension4.barOffset,\n X = _context$barDimension4.X,\n Y = _context$barDimension4.Y,\n ticksLength = _context$barDimension4.ticksLength,\n ticksPadding = _context$barDimension4.ticksPadding;\n\n var range = options.maxValue - options.minValue;\n var valuePerNonExactTick = range / (options.majorTicks.length - 1);\n var tickValues = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n var ticks = tickValues.length;\n var hasLeft = options.numberSide !== 'right';\n var hasRight = options.numberSide !== 'left';\n var textHeight = options.fontNumbersSize * width / 200;\n var i = 0;\n var ticksWidth = (options.ticksWidth / 100 + ticksPadding * 2) * width;\n var numLeft = (width - barWidth) / 2 - ticksWidth;\n var numRight = (width - barWidth) / 2 + barWidth + ticksWidth;\n var textX = void 0,\n textY = void 0,\n textWidth = void 0,\n numberOffset = void 0,\n tick = void 0;\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(ticks).fill(options.colorNumbers);\n var textMargin = options.numbersMargin / 100 * width;\n\n context.font = drawings.font(options, 'Numbers', width / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n\n for (; i < ticks; i++) {\n context.fillStyle = colors[i];\n tick = options.majorTicks[i];\n numberOffset = options.exactTicks ? ticksLength * ((tickValues[i] - options.minValue) / range) : i * ticksLength / (ticks - 1);\n\n if (isVertical) {\n textY = Y + length - barMargin - barOffset - numberOffset + textHeight / 3;\n\n if (hasLeft) {\n context.textAlign = 'right';\n context.fillText(tick, X + numLeft - textMargin, textY);\n }\n\n if (hasRight) {\n context.textAlign = 'left';\n context.fillText(tick, X + numRight + textMargin, textY);\n }\n } else {\n textWidth = context.measureText(tick).width;\n textX = X + barMargin + barOffset + numberOffset;\n\n if (hasLeft) {\n context.fillText(tick, textX, Y + numLeft - textMargin);\n }\n\n if (hasRight) {\n context.fillText(tick, textX, Y + numRight + textHeight + textMargin);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge title\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearTitle(context, options) {\n if (!options.title) return;\n\n var _context$barDimension5 = context.barDimensions,\n isVertical = _context$barDimension5.isVertical,\n width = _context$barDimension5.width,\n length = _context$barDimension5.length,\n baseX = _context$barDimension5.baseX,\n baseY = _context$barDimension5.baseY,\n titleMargin = _context$barDimension5.titleMargin;\n\n var textHeight = options.fontTitleSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + titleMargin / 2 - (isVertical ? textHeight : textHeight / 2) - 0.025 * (isVertical ? length : width));\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorTitle;\n context.font = drawings.font(options, 'Title', width / 200);\n context.lineWidth = 0;\n context.fillText(options.title, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge units\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearUnits(context, options) {\n if (!options.units) return;\n\n var _context$barDimension6 = context.barDimensions,\n isVertical = _context$barDimension6.isVertical,\n width = _context$barDimension6.width,\n length = _context$barDimension6.length,\n baseX = _context$barDimension6.baseX,\n baseY = _context$barDimension6.baseY,\n unitsMargin = _context$barDimension6.unitsMargin;\n\n var textHeight = options.fontUnitsSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + (isVertical ? length : width) + unitsMargin / 2 - textHeight / 2);\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorUnits;\n context.font = drawings.font(options, 'Units', width / 200);\n context.lineWidth = 0;\n context.fillText(options.units, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge needles\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearBarNeedle(context, options) {\n if (!options.needle) return;\n\n var _context$barDimension7 = context.barDimensions,\n isVertical = _context$barDimension7.isVertical,\n width = _context$barDimension7.width,\n length = _context$barDimension7.length,\n barWidth = _context$barDimension7.barWidth,\n barOffset = _context$barDimension7.barOffset,\n barMargin = _context$barDimension7.barMargin,\n ticksLength = _context$barDimension7.ticksLength,\n X = _context$barDimension7.X,\n Y = _context$barDimension7.Y,\n ticksPadding = _context$barDimension7.ticksPadding;\n\n var hasLeft = options.needleSide !== 'right';\n var hasRight = options.needleSide !== 'left';\n var position = ticksLength * (drawings.normalizedValue(options).indented - options.minValue) / (options.maxValue - options.minValue);\n var tickWidth = (options.ticksWidth / 100 + ticksPadding) * width;\n var baseLength = barWidth / 2 + tickWidth;\n var needleLength = baseLength * (options.needleEnd / 100);\n var sX = void 0,\n eX = void 0,\n sY = void 0,\n eY = void 0;\n var draw = options.needleType.toLowerCase() === 'arrow' ? drawLinearArrowNeedle : drawLinearLineNeedle;\n var barStart = (width - barWidth) / 2;\n var needleStart = baseLength * (options.needleStart / 100);\n var nLeft = barStart - tickWidth - needleStart;\n var nRight = barStart + barWidth + tickWidth + needleStart;\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + length - barMargin - barOffset - position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nLeft);\n eX = sX + needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nRight);\n eX = sX - needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength, true);\n }\n } else {\n //noinspection JSUnresolvedFunction\n sX = round(X + barMargin + barOffset + position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nLeft);\n eY = sY + needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nRight);\n eY = sY - needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength, true);\n }\n }\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns needle color style\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n * @return {CanvasGradient|string}\r\n */\nfunction needleStyle(context, options, length, isRight) {\n return options.colorNeedleEnd ? drawings.linearGradient(context, isRight ? options.colorNeedleEnd : options.colorNeedle, isRight ? options.colorNeedle : options.colorNeedleEnd, length, !context.barDimensions.isVertical) : options.colorNeedle;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws line needle shape\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n */\nfunction drawLinearLineNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n context.lineWidth = options.needleWidth;\n context.strokeStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws arrow needle shape\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n */\nfunction drawLinearArrowNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n //noinspection JSUnresolvedFunction\n var peakLength = round(length * 0.4);\n var bodyLength = length - peakLength;\n var isVertical = sX === eX;\n var halfWidth = options.needleWidth / 2;\n\n context.fillStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n\n if (isVertical) {\n if (sY > eY) bodyLength *= -1;\n\n context.moveTo(sX - halfWidth, sY);\n context.lineTo(sX + halfWidth, sY);\n context.lineTo(sX + halfWidth, sY + bodyLength);\n context.lineTo(sX, eY);\n context.lineTo(sX - halfWidth, sY + bodyLength);\n context.lineTo(sX - halfWidth, sY);\n } else {\n if (sX > eX) bodyLength *= -1;\n\n context.moveTo(sX, sY - halfWidth);\n context.lineTo(sX, sY + halfWidth);\n context.lineTo(sX + bodyLength, sY + halfWidth);\n context.lineTo(eX, sY);\n context.lineTo(sX + bodyLength, sY - halfWidth);\n context.lineTo(sX, sY - halfWidth);\n }\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws value box for linear gauge\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} value\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearValueBox(context, options, value, x, y, w, h) {\n // currently value box is available only for vertical linear gauge,\n // as far as by design it is hard to find a proper place for\n // horizontal ones\n var boxWidth = (parseFloat(options.fontValueSize) || 0) * w / 200;\n var dy = (0.11 * h - boxWidth) / 2;\n\n context.barDimensions.isVertical && drawings.drawValueBox(context, options, value, x + w / 2, y + h - boxWidth - dy, w);\n}\n\n/**\r\n * Minimalistic HTML5 Canvas Linear Gauge\r\n */\n\nvar LinearGauge = function (_BaseGauge2) {\n _inherits(LinearGauge, _BaseGauge2);\n\n /**\r\n * Fired each time before gauge plate is drawn\r\n *\r\n * @event LinearGauge#beforePlate\r\n */\n\n /**\r\n * Fired each time before gauge highlight areas are drawn\r\n *\r\n * @event LinearGauge#beforeHighlights\r\n */\n\n /**\r\n * Fired each time before gauge minor ticks are drawn\r\n *\r\n * @event LinearGauge#beforeMinorTicks\r\n */\n\n /**\r\n * Fired each time before gauge major ticks are drawn\r\n *\r\n * @event LinearGauge#beforeMajorTicks\r\n */\n\n /**\r\n * Fired each time before gauge tick numbers are drawn\r\n *\r\n * @event LinearGauge#beforeNumbers\r\n */\n\n /**\r\n * Fired each time before gauge title is drawn\r\n *\r\n * @event LinearGauge#beforeTitle\r\n */\n\n /**\r\n * Fired each time before gauge units text is drawn\r\n *\r\n * @event LinearGauge#beforeUnits\r\n */\n\n /**\r\n * Fired each time before gauge bar area is drawn\r\n *\r\n * @event LinearGauge#beforeBar\r\n */\n\n /**\r\n * Fired each time before gauge progress bar is drawn\r\n *\r\n * @event LinearGauge#beforeProgressBar\r\n */\n\n /**\r\n * Fired each time before gauge value box is drawn\r\n *\r\n * @event LinearGauge#beforeValueBox\r\n */\n\n /**\r\n * Fired each time before gauge needle is drawn\r\n *\r\n * @event LinearGauge#beforeNeedle\r\n */\n\n /**\r\n * @constructor\r\n * @param {LinearGaugeOptions} options\r\n */\n function LinearGauge(options) {\n _classCallCheck(this, LinearGauge);\n\n options = Object.assign({}, defaultLinearGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (LinearGauge.__proto__ || Object.getPrototypeOf(LinearGauge)).call(this, LinearGauge.configure(options)));\n }\n\n /**\r\n * Checks and updates gauge options properly\r\n *\r\n * @param {*} options\r\n * @return {*}\r\n * @access protected\r\n */\n\n\n _createClass(LinearGauge, [{\n key: 'draw',\n\n\n /* istanbul ignore next */\n /**\r\n * Triggering linear gauge render on a canvas.\r\n *\r\n * @returns {LinearGauge}\r\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref2 = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref2[0],\n y = _ref2[1],\n w = _ref2[2],\n h = _ref2[3];\n\n var options = this.options;\n\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n this.drawBox = drawLinearPlate(context, options, x, y, w, h);\n\n this.emit('beforeBar');\n drawLinearBar.apply(undefined, [context, options].concat(_toConsumableArray(this.drawBox)));\n\n canvas.context.barDimensions = context.barDimensions;\n\n this.emit('beforeHighlights');\n drawLinearBarHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawLinearMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawLinearMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawLinearMajorTicksNumbers(context, options);\n this.emit('beforeTitle');\n drawLinearTitle(context, options);\n this.emit('beforeUnits');\n drawLinearUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawLinearBarProgress.apply(undefined, [canvas.context, options].concat(_toConsumableArray(this.drawBox)));\n this.emit('beforeNeedle');\n drawLinearBarNeedle(canvas.context, options);\n this.emit('beforeValueBox');\n drawLinearValueBox.apply(undefined, [canvas.context, options, options.animatedValue ? this.options.value : this.value].concat(_toConsumableArray(this.drawBox)));\n\n _get(LinearGauge.prototype.__proto__ || Object.getPrototypeOf(LinearGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n /* istanbul ignore else */\n if (options.barStrokeWidth >= options.barWidth) {\n //noinspection JSUnresolvedFunction\n options.barStrokeWidth = round(options.barWidth / 2);\n }\n\n //noinspection JSUndefinedPropertyAssignment\n options.hasLeft = hasTicksBar('right', options);\n //noinspection JSUndefinedPropertyAssignment\n options.hasRight = hasTicksBar('left', options);\n\n if (options.value > options.maxValue) {\n options.value = options.maxValue;\n }\n\n if (options.value < options.minValue) {\n options.value = options.minValue;\n }\n\n return BaseGauge.configure(options);\n }\n }]);\n\n return LinearGauge;\n}(BaseGauge);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['LinearGauge'] = LinearGauge;\n}\n\nBaseGauge.initialize('LinearGauge', defaultLinearGaugeOptions);;typeof module !== \"undefined\" && Object.assign(ns, {Collection: Collection,GenericOptions: GenericOptions,Animation: Animation,BaseGauge: BaseGauge,drawings: drawings,SmartCanvas: SmartCanvas,DomObserver: DomObserver,vendorize: vendorize});}(typeof module !== \"undefined\" ? module.exports : window));"]} \ No newline at end of file From 42032e730445a1c814dc34ec2e4e5151a4c70625 Mon Sep 17 00:00:00 2001 From: piglione73 Date: Thu, 15 Mar 2018 17:16:41 +0100 Subject: [PATCH 2/4] Avoid polluting Array.prototype with new enumerable properties This way, when enumerating with for(var i in array) the new "fill" and "indexOf" will not show up as array elements. --- lib/polyfill.js | 107 +++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/lib/polyfill.js b/lib/polyfill.js index 8c18aa0d..b2bdd84a 100644 --- a/lib/polyfill.js +++ b/lib/polyfill.js @@ -48,42 +48,44 @@ if (!Object.assign) { */ /* istanbul ignore next */ if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function(searchElement, fromIndex) { - var k; + Object.defineProperty(Array.prototype, "indexOf", { + value: function(searchElement, fromIndex) { + var k; - if (this === null) { - throw new TypeError('"this" is null or not defined'); - } + if (this === null) { + throw new TypeError('"this" is null or not defined'); + } - var O = Object(this); - var len = O.length >>> 0; + var O = Object(this); + var len = O.length >>> 0; - if (len === 0) { - return -1; - } + if (len === 0) { + return -1; + } - var n = +fromIndex || 0; + var n = +fromIndex || 0; - if (Math.abs(n) === Infinity) { - n = 0; - } + if (Math.abs(n) === Infinity) { + n = 0; + } - if (n >= len) { - return -1; - } + if (n >= len) { + return -1; + } - k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); - while (k < len) { - if (k in O && O[k] === searchElement) { - return k; - } + while (k < len) { + if (k in O && O[k] === searchElement) { + return k; + } - k++; - } + k++; + } - return -1; - }; + return -1; + } + }); } /** @@ -91,31 +93,34 @@ if (!Array.prototype.indexOf) { */ /* istanbul ignore next */ if (!Array.prototype.fill) { - Array.prototype.fill = function(value) { - if (this === null) { - throw new TypeError('this is null or not defined'); - } - - var O = Object(this); - var len = O.length >>> 0; - var start = arguments[1]; - var relativeStart = start >> 0; - var k = relativeStart < 0 ? - Math.max(len + relativeStart, 0) : - Math.min(relativeStart, len); - var end = arguments[2]; - var relativeEnd = end === undefined ? - len : end >> 0; - var final = relativeEnd < 0 ? - Math.max(len + relativeEnd, 0) : - Math.min(relativeEnd, len); - while (k < final) { - O[k] = value; - k++; - } - - return O; - }; + Object.defineProperty(Array.prototype, "fill", { + value: function(value) { + if (this === null) { + throw new TypeError('this is null or not defined'); + } + + var O = Object(this); + var len = O.length >>> 0; + var start = arguments[1]; + var relativeStart = start >> 0; + var k = relativeStart < 0 ? + Math.max(len + relativeStart, 0) : + Math.min(relativeStart, len); + var end = arguments[2]; + var relativeEnd = end === undefined ? + len : end >> 0; + var final = relativeEnd < 0 ? + Math.max(len + relativeEnd, 0) : + Math.min(relativeEnd, len); + while (k < final) { + O[k] = value; + k++; + } + + return O; + } + }); + } /** From 57a1397c6675a27654be9edba9d1e289f6f106a7 Mon Sep 17 00:00:00 2001 From: piglione73 Date: Thu, 15 Mar 2018 17:17:24 +0100 Subject: [PATCH 3/4] Build --- gauge.min.js | 4 ++-- gauge.min.js.map | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gauge.min.js b/gauge.min.js index 0b3788ab..4c64228a 100644 --- a/gauge.min.js +++ b/gauge.min.js @@ -23,6 +23,6 @@ * * @version 2.1.4 */ -!function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t1&&(d=1),1!==d&&(c=r(d),isFinite(c)&&!isNaN(c)&&(d=c)),t&&t(d),s0){for(a=e.toFixed(i).toString().split("."),n=r-a[0].length;o1?(r=~i.indexOf("."),~i.indexOf("-")?"-"+[t.majorTicksInt+t.majorTicksDec+2+(r?1:0)-i.length].join("0")+i.replace("-",""):[t.majorTicksInt+t.majorTicksDec+1+(r?1:0)-i.length].join("0")+i):i}function f(e){return e*Math.PI/180}function m(e,t){return{x:-e*Math.sin(t),y:e*Math.cos(t)}}function v(e,t,i,r){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=e.createLinearGradient(o?0:n,o?n:0,o?0:r,o?r:0);return a.addColorStop(0,t),a.addColorStop(1,i),a}function b(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return e.restore(),!0;e.save();var i=t.borderShadowWidth;return i&&(e.shadowBlur=i,e.shadowColor=t.colorBorderShadow),!0}function g(e,t){t.needleShadow&&(e.shadowOffsetX=2,e.shadowOffsetY=2,e.shadowBlur=10,e.shadowColor=t.colorNeedleShadowDown)}function p(e,t,i){return e["font"+t+"Style"]+" "+e["font"+t+"Weight"]+" "+e["font"+t+"Size"]*i+"px "+e["font"+t]}function w(e){e.shadowOffsetX=null,e.shadowOffsetY=null,e.shadowBlur=null,e.shadowColor="",e.strokeStyle=null,e.lineWidth=0,e.save()}function k(e,t,i,r){t.valueTextShadow&&(e.shadowOffsetX=i,e.shadowOffsetY=i,e.shadowBlur=r,e.shadowColor=t.colorValueTextShadow)}function y(e,t,i,r,o,n){if(t.valueBox){w(e);var a=t.valueDec?1+t.valueDec:0,l="9".repeat(Math.max.apply(null,[String(parseInt(i)).length+a].concat(t.majorTicks.map(function(e){return String(parseInt(e,10)).length+a})))),s=t.valueText||h(i,t),d=n/200,u=n/100,f=.4*u,m=1.2*u;e.font=p(t,"Value",d),k(e,t,f,m);var v=e.measureText(t.valueText?s:"-"+h(Number(l),t)).width;w(e);var b=parseFloat(t.fontValueSize)*d+f+m,g=u*parseFloat(t.valueBoxStroke),y=2*n-2*g,x=v+10*u,T=1.1*b+f+m,S=u*t.valueBoxBorderRadius,W=(parseFloat(t.valueBoxWidth)||0)/100*y;W>x&&(x=W),x>y&&(x=y);var O=r-x/2,V=o-T/2,P=o-5.75*u;if(e.beginPath(),S?c(e,O,V,x,T,S):e.rect(O,V,x,T),g){var M=e.createRadialGradient(r,P,10*u,r,P,20*u);M.addColorStop(0,t.colorValueBoxRect),M.addColorStop(1,t.colorValueBoxRectEnd),e.strokeStyle=M,e.lineWidth=g,e.stroke()}t.colorValueBoxShadow&&(e.shadowBlur=1.2*u,e.shadowColor=t.colorValueBoxShadow),t.colorValueBoxBackground&&(e.fillStyle=t.colorValueBoxBackground,e.fill()),e.closePath(),e.restore(),k(e,t,f,m),e.fillStyle=t.colorValueText,e.textAlign="center",e.textBaseline="alphabetic",e.fillText(s,O+x/2,o+T/2-b/3),e.restore()}}function x(e){var t=e.value,i=e.minValue,r=e.maxValue,o=.01*(r-i);return{normal:tr?r:t,indented:tr?r+o:t}}function T(e,t,i,r,o){i.beginPath(),i.arc(0,0,ke(e),0,2*Se,!0),i.lineWidth=t,i.strokeStyle=o?Te.linearGradient(i,r,o,e):r,i.stroke(),i.closePath()}function S(e,t){var i=be.pixelRatio;return e.maxRadius||(e.maxRadius=e.max-t.borderShadowWidth-t.borderOuterWidth*i-t.borderMiddleWidth*i-t.borderInnerWidth*i+(t.borderOuterWidth?.5:0)+(t.borderMiddleWidth?.5:0)+(t.borderInnerWidth?.5:0)),e.maxRadius}function W(e,t){var i=be.pixelRatio,r=t.borderShadowWidth*i,o=e.max-r-t.borderOuterWidth*i/2,n=o-t.borderOuterWidth*i/2-t.borderMiddleWidth*i/2+.5,a=n-t.borderMiddleWidth*i/2-t.borderInnerWidth*i/2+.5,l=S(e,t),s=void 0,d=!1;e.save(),t.borderOuterWidth&&(d=Te.drawShadow(e,t,d),T(o,t.borderOuterWidth*i,e,t.colorBorderOuter,t.colorBorderOuterEnd)),t.borderMiddleWidth&&(d=Te.drawShadow(e,t,d),T(n,t.borderMiddleWidth*i,e,t.colorBorderMiddle,t.colorBorderMiddleEnd)),t.borderInnerWidth&&(d=Te.drawShadow(e,t,d),T(a,t.borderInnerWidth*i,e,t.colorBorderInner,t.colorBorderInnerEnd)),Te.drawShadow(e,t,d),e.beginPath(),e.arc(0,0,ke(l),0,2*Se,!0),t.colorPlateEnd?(s=e.createRadialGradient(0,0,l/2,0,0,l),s.addColorStop(0,t.colorPlate),s.addColorStop(1,t.colorPlateEnd)):s=t.colorPlate,e.fillStyle=s,e.fill(),e.closePath(),e.restore()}function O(e,t){var i=e.max*(parseFloat(t.highlightsWidth)||0)/100;if(i){var r=ke(P(e,t)-i/2),o=0,n=t.highlights.length,a=(t.maxValue-t.minValue)/t.ticksAngle;for(e.save();on?o:n,n>o,o>n?i:r):a,t>0?Te.roundRect(e,i,r,o,n,t):e.rect(i,r,o,n),e.fill(),e.closePath()}function z(e,t,i,r,o,n,a,l,s){e.beginPath(),e.lineWidth=t,e.strokeStyle=s?Te.linearGradient(e,l,s,a,!0,o):l,i>0?Te.roundRect(e,r,o,n,a,i):e.rect(r,o,n,a),e.stroke(),e.closePath()}function L(e,t,i,r,o,n){var a=be.pixelRatio;e.save();var l=t.borderRadius*a,s=o-t.borderShadowWidth-t.borderOuterWidth*a,d=s-t.borderOuterWidth*a-t.borderMiddleWidth*a,c=d-t.borderMiddleWidth*a-t.borderInnerWidth*a,h=c-t.borderInnerWidth*a,u=n-t.borderShadowWidth-t.borderOuterWidth*a,f=u-t.borderOuterWidth*a-t.borderMiddleWidth*a,m=f-t.borderMiddleWidth*a-t.borderInnerWidth*a,v=m-t.borderInnerWidth*a,b=i-(d-s)/2,g=b-(c-d)/2,p=g-(h-c)/2,w=r-(f-u)/2,k=w-(m-f)/2,y=k-(v-m)/2,x=0,T=!1;return t.borderOuterWidth&&(T=Te.drawShadow(e,t,T),z(e,t.borderOuterWidth*a,l,i+t.borderOuterWidth*a/2-x,r+t.borderOuterWidth*a/2-x,s,u,t.colorBorderOuter,t.colorBorderOuterEnd),x+=.5*a),t.borderMiddleWidth&&(T=Te.drawShadow(e,t,T),z(e,t.borderMiddleWidth*a,l-=1+2*x,b+t.borderMiddleWidth*a/2-x,w+t.borderMiddleWidth*a/2-x,d+2*x,f+2*x,t.colorBorderMiddle,t.colorBorderMiddleEnd),x+=.5*a),t.borderInnerWidth&&(T=Te.drawShadow(e,t,T),z(e,t.borderInnerWidth*a,l-=1+2*x,g+t.borderInnerWidth*a/2-x,k+t.borderInnerWidth*a/2-x,c+2*x,m+2*x,t.colorBorderInner,t.colorBorderInnerEnd),x+=.5*a),Te.drawShadow(e,t,T),D(e,l,p,y,h+2*x,v+2*x,t.colorPlate,t.colorPlateEnd),e.restore(),[p,y,h,v]}function G(e,t,i,r,o,n){var a=be.pixelRatio,l=n>=o,s=l?.85*o:n,d=l?n:o;i=l?we(i+(o-s)/2):i;var c=!!t.title,h=!!t.units,u=!!t.valueBox,f=void 0,m=void 0,v=void 0;l?(m=we(.05*d),f=we(.075*d),v=we(.11*d),c&&(d-=f,r+=f),h&&(d-=m),u&&(d-=v)):(m=f=we(.15*s),c&&(s-=f,r+=f),h&&(s-=m));var b=2*t.barStrokeWidth,g=t.barBeginCircle?we(s*t.barBeginCircle/200-b/2):0,p=we(s*t.barWidth/100-b),w=we(d*t.barLength/100-b),k=we((d-w)/2),y=we(i+(l?s/2:k+g)),x=we(r+(l?d-k-g+b/2:s/2)),T=!l||t.hasLeft&&t.hasRight?0:(t.hasRight?-1:1)*t.ticksWidth/100*s,S=l||t.hasLeft&&t.hasRight?0:(t.hasRight?-1:1)*t.ticksWidth/100*s;return e.barDimensions={isVertical:l,width:s,length:d,barWidth:p,barLength:w,strokeWidth:b,barMargin:k,radius:g,pixelRatio:a,barOffset:null,titleMargin:c?f:0,unitsMargin:h?m:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:i+T,Y:r+S,x0:y+T,y0:x+S,baseX:i,baseY:r,ticksPadding:t.ticksPadding/100},e.barDimensions}function F(e,t,i,r,o,n,a){var l=G(e,t,r,o,n,a),s=l.isVertical,d=l.width,c=l.barWidth,h=l.barLength,u=l.strokeWidth,f=l.barMargin,m=l.radius,v=l.x0,b=l.y0,g=l.X,p=l.Y,w=h;if(e.save(),e.beginPath(),t.barBeginCircle){var k=Te.radians(s?270:0),y=Math.asin(c/2/m),x=Math.cos(y),T=Math.sin(y),S=v+(s?m*T:m*x-u/2),W=s?b-m*x:b+m*T,O=ke(s?W-b:S-v);e.barDimensions.barOffset=we(O+m);var V=s?we(v-m*T):S,P=s?W:we(b-m*T);"progress"===i&&(h=e.barDimensions.barOffset+(h-e.barDimensions.barOffset)*(Te.normalizedValue(t).normal-t.minValue)/(t.maxValue-t.minValue));var M=we(S+h-e.barDimensions.barOffset+u/2),B=we(W-h+e.barDimensions.barOffset-u/2);e.arc(v,b,m,k+y,k-y),s?(e.moveTo(S,P),e.lineTo(S,B),e.lineTo(V,B),e.lineTo(V,P)):(e.moveTo(S,P),e.lineTo(M,P),e.lineTo(M,W),e.lineTo(S,W))}else{var A=we(s?g+(d-c)/2:g+f),j=we(s?p+h+f:p+(d-c)/2);"progress"===i&&(h*=(t.value-t.minValue)/(t.maxValue-t.minValue)),s?e.rect(A,j,c,-h):e.rect(A,j,h,c)}"progress"!==i&&t.barStrokeWidth&&(e.lineWidth=u,e.strokeStyle=t.colorBarStroke,e.stroke()),"progress"!==i&&t.colorBar?(e.fillStyle=t.colorBarEnd?Te.linearGradient(e,t.colorBar,t.colorBarEnd,h,s,s?p:g):t.colorBar,e.fill()):"progress"===i&&t.colorBarProgress&&(e.fillStyle=t.colorBarProgressEnd?Te.linearGradient(e,t.colorBarProgress,t.colorBarProgressEnd,w,s,s?p:g):t.colorBarProgress,e.fill()),e.closePath(),t.barBeginCircle&&(e.barDimensions.radius+=u),e.barDimensions.barWidth+=u,e.barDimensions.barLength+=u}function X(e,t,i,r,o,n){F(e,t,"",i,r,o,n)}function Y(e,t){return t.needleSide!==e||t.tickSide!==e||t.numberSide!==e}function U(e,t,i,r,o,n){t.barProgress&&F(e,t,"progress",i,r,o,n)}function q(e,t){var i=e.barDimensions,r=i.isVertical,o=i.width,n=i.length,a=i.barWidth,l=i.barOffset,s=i.barMargin,d=i.X,c=i.Y,h=i.ticksLength,u=i.ticksPadding,f=o*(parseFloat(t.highlightsWidth)||0)/100;if(t.highlights&&f){var m="right"!==t.tickSide,v="left"!==t.tickSide,b=0,g=t.highlights.length,p=(o-a)/2,w=t.maxValue-t.minValue,k=we(r?d+p:d+s+l),y=f,x=r?c+n-s-l:c+p,T=we((t.ticksWidth/100+u)*o)+(f-t.ticksWidth/100*o),S=we(a+u*o);for(e.save();bn&&(d*=-1),e.moveTo(i-h,r),e.lineTo(i+h,r),e.lineTo(i+h,r+d),e.lineTo(i,n),e.lineTo(i-h,r+d),e.lineTo(i-h,r)):(i>o&&(d*=-1),e.moveTo(i,r-h),e.lineTo(i,r+h),e.lineTo(i+d,r+h),e.lineTo(o,r),e.lineTo(i+d,r-h),e.lineTo(i,r-h)),e.fill(),e.closePath()}function ae(e,t,i,r,o,n,a){var l=(parseFloat(t.fontValueSize)||0)*n/200,s=(.11*a-l)/2;e.barDimensions.isVertical&&Te.drawValueBox(e,t,i,r+n/2,o+a-l-s,n)}var le=function(){function e(e,t){var i=[],r=!0,o=!1,n=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(i.push(a.value),!t||i.length!==t);r=!0);}catch(e){o=!0,n=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw n}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),se=function e(t,i,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,i);if(void 0===o){var n=Object.getPrototypeOf(t);return null===n?void 0:e(n,i,r)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(r)},de=function e(t,i,r,o){var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);null!==a&&e(a,i,r,o)}else if("value"in n&&n.writable)n.value=r;else{var l=n.set;void 0!==l&&l.call(o,r)}return r},ce=function(){function e(e,t){for(var i=0;i>>0;if(0===o)return-1;var n=+t||0;if(Math.abs(n)===1/0&&(n=0),n>=o)return-1;for(i=Math.max(n>=0?n:o-Math.abs(n),0);i>>0,r=arguments[1],o=r>>0,n=o<0?Math.max(i+o,0):Math.min(o,i),a=arguments[2],l=void 0===a?i:a>>0,s=l<0?Math.max(i+l,0):Math.min(l,i);n1?r-1:0),n=1;n1?t-1:0),r=1;r=(7-4*t)/11)return-Math.pow((11-6*t-11*e)/4,2)+Math.pow(i,2)},elastic:function(e){return 1-fe.delastic(1-e)},delastic:function(e){return Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*1.5/3*e)}},me=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"linear",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};if(o(this,e),this.duration=i,this.rule=t,this.draw=r,this.end=n,"function"!=typeof this.draw)throw new TypeError("Invalid animation draw callback:",r);if("function"!=typeof this.end)throw new TypeError("Invalid animation end callback:",n)}return ce(e,[{key:"animate",value:function(e,t){var i=this;this.frame&&this.cancel();var r=window.performance&&window.performance.now?window.performance.now():n("animationStartTime")||Date.now();e=e||this.draw,t=t||this.end,this.draw=e,this.end=t,this.frame=ue(function(o){return a(o,e,r,fe[i.rule]||i.rule,i.duration,t,i)})}},{key:"cancel",value:function(){if(this.frame){(n("cancelAnimationFrame")||function(e){})(this.frame),this.frame=null}}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),e}();me.rules=fe;var ve=function(){function t(i,r,n){o(this,t),this.options=i,this.element=r.toLowerCase(),this.type=t.toDashed(n),this.Type=e[n],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||t.domReady(this.traverse.bind(this))}return ce(t,[{key:"isValidNode",value:function(e){return!(!e.tagName||e.tagName.toLowerCase()!==this.element||e.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var e=document.getElementsByTagName(this.element),t=0,i=e.length;t1&&void 0!==arguments[1])||arguments[1],i=e.split(/-/),r=0,o=i.length,n="";r1&&void 0!==arguments[1]?arguments[1]:0;return e=parseFloat(e),!isNaN(e)&&isFinite(e)||(e=parseFloat(t)||0),e}},{key:"version",get:function(){return pe}}]),n}(he);void 0!==e&&(e.BaseGauge=xe,e.gauges=(window.document||{}).gauges=ye);var Te={roundRect:c,padValue:h,formatMajorTickNumber:u,radians:f,radialPoint:m,linearGradient:v,drawNeedleShadow:g,drawValueBox:y,verifyError:s,prepareTicks:d,drawShadow:b,font:p,normalizedValue:x},Se=Math.PI,We=Se/2,Oe=Object.assign({},ge,{ticksAngle:270,startAngle:45,colorNeedleCircleOuter:"#f0f0f0",colorNeedleCircleOuterEnd:"#ccc",colorNeedleCircleInner:"#e8e8e8",colorNeedleCircleInnerEnd:"#f5f5f5",needleCircleSize:10,needleCircleInner:!0,needleCircleOuter:!0,needleStart:20,animationTarget:"needle",useMinPath:!1,barWidth:0}),Ve=function(e){function t(e){return o(this,t),e=Object.assign({},Oe,e||{}),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,t.configure(e)))}return r(t,e),ce(t,[{key:"draw",value:function(){try{var e=this.canvas,i=[-e.drawX,-e.drawY,e.drawWidth,e.drawHeight],r=i[0],o=i[1],n=i[2],a=i[3],l=this.options;if("needle"===l.animationTarget){if(!e.elementClone.initialized){var s=e.contextClone;s.clearRect(r,o,n,a),s.save(),this.emit("beforePlate"),W(s,l),this.emit("beforeHighlights"),O(s,l),this.emit("beforeMinorTicks"),V(s,l),this.emit("beforeMajorTicks"),M(s,l),this.emit("beforeNumbers"),j(s,l),this.emit("beforeTitle"),C(s,l),this.emit("beforeUnits"),N(s,l),e.elementClone.initialized=!0}this.canvas.commit(),e.context.clearRect(r,o,n,a),e.context.save(),e.context.drawImage(e.elementClone,r,o,n,a),e.context.save(),this.emit("beforeProgressBar"),R(e.context,l),this.emit("beforeValueBox"),_(e.context,l,I(this)),this.emit("beforeNeedle"),E(e.context,l)}else{var d=-Te.radians((l.value-l.minValue)/(l.maxValue-l.minValue)*l.ticksAngle);if(e.context.clearRect(r,o,n,a),e.context.save(),this.emit("beforePlate"),W(e.context,l),e.context.rotate(d),this.emit("beforeHighlights"),O(e.context,l),this.emit("beforeMinorTicks"),V(e.context,l),this.emit("beforeMajorTicks"),M(e.context,l),this.emit("beforeNumbers"),j(e.context,l),this.emit("beforeProgressBar"),R(e.context,l),e.context.rotate(-d),e.context.save(),!e.elementClone.initialized){var c=e.contextClone;c.clearRect(r,o,n,a),c.save(),this.emit("beforeTitle"),C(c,l),this.emit("beforeUnits"),N(c,l),this.emit("beforeNeedle"),E(c,l),e.elementClone.initialized=!0}e.context.drawImage(e.elementClone,r,o,n,a)}this.emit("beforeValueBox"),_(e.context,l,I(this)),se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"draw",this).call(this)}catch(e){Te.verifyError(e)}return this}},{key:"value",set:function(e){e=xe.ensureValue(e,this.options.minValue),this.options.animation&&360===this.options.ticksAngle&&this.options.useMinPath&&(this._value=e,e=this.options.value+((e-this.options.value)%360+540)%360-180),de(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",e,this)},get:function(){return se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this)}}],[{key:"configure",value:function(e){return e.barWidth>50&&(e.barWidth=50),isNaN(e.startAngle)&&(e.startAngle=45),isNaN(e.ticksAngle)&&(e.ticksAngle=270),e.ticksAngle>360&&(e.ticksAngle=360),e.ticksAngle<0&&(e.ticksAngle=0),e.startAngle<0&&(e.startAngle=0),e.startAngle>360&&(e.startAngle=360),e}}]),t}(xe);void 0!==e&&(e.RadialGauge=Ve),xe.initialize("RadialGauge",Oe);var Pe=Object.assign({},ge,{borderRadius:0,barBeginCircle:30,colorBarEnd:"",colorBarProgressEnd:"",needleWidth:6,tickSide:"both",needleSide:"both",numberSide:"both",ticksWidth:10,ticksWidthMinor:5,ticksPadding:5,barLength:85,fontTitleSize:26,highlightsWidth:10}),Me=function(e){function n(e){return o(this,n),e=Object.assign({},Pe,e||{}),i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n.configure(e)))}return r(n,e),ce(n,[{key:"draw",value:function(){try{var e=this.canvas,i=[-e.drawX,-e.drawY,e.drawWidth,e.drawHeight],r=i[0],o=i[1],a=i[2],l=i[3],s=this.options;if(!e.elementClone.initialized){var d=e.contextClone;d.clearRect(r,o,a,l),d.save(),this.emit("beforePlate"),this.drawBox=L(d,s,r,o,a,l),this.emit("beforeBar"),X.apply(void 0,[d,s].concat(t(this.drawBox))),e.context.barDimensions=d.barDimensions,this.emit("beforeHighlights"),q(d,s),this.emit("beforeMinorTicks"),K(d,s),this.emit("beforeMajorTicks"),$(d,s),this.emit("beforeNumbers"),Q(d,s),this.emit("beforeTitle"),ee(d,s),this.emit("beforeUnits"),te(d,s),e.elementClone.initialized=!0}this.canvas.commit(),e.context.clearRect(r,o,a,l),e.context.save(),e.context.drawImage(e.elementClone,r,o,a,l),e.context.save(),this.emit("beforeProgressBar"),U.apply(void 0,[e.context,s].concat(t(this.drawBox))),this.emit("beforeNeedle"),ie(e.context,s),this.emit("beforeValueBox"),ae.apply(void 0,[e.context,s,s.animatedValue?this.options.value:this.value].concat(t(this.drawBox))),se(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"draw",this).call(this)}catch(e){Te.verifyError(e)}return this}}],[{key:"configure",value:function(e){return e.barStrokeWidth>=e.barWidth&&(e.barStrokeWidth=we(e.barWidth/2)),e.hasLeft=Y("right",e),e.hasRight=Y("left",e),e.value>e.maxValue&&(e.value=e.maxValue),e.value1&&(d=1),1!==d&&(c=r(d),isFinite(c)&&!isNaN(c)&&(d=c)),t&&t(d),s0){for(a=e.toFixed(i).toString().split("."),n=r-a[0].length;o1?(r=~i.indexOf("."),~i.indexOf("-")?"-"+[t.majorTicksInt+t.majorTicksDec+2+(r?1:0)-i.length].join("0")+i.replace("-",""):[t.majorTicksInt+t.majorTicksDec+1+(r?1:0)-i.length].join("0")+i):i}function f(e){return e*Math.PI/180}function m(e,t){return{x:-e*Math.sin(t),y:e*Math.cos(t)}}function v(e,t,i,r){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=e.createLinearGradient(o?0:n,o?n:0,o?0:r,o?r:0);return a.addColorStop(0,t),a.addColorStop(1,i),a}function b(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return e.restore(),!0;e.save();var i=t.borderShadowWidth;return i&&(e.shadowBlur=i,e.shadowColor=t.colorBorderShadow),!0}function g(e,t){t.needleShadow&&(e.shadowOffsetX=2,e.shadowOffsetY=2,e.shadowBlur=10,e.shadowColor=t.colorNeedleShadowDown)}function p(e,t,i){return e["font"+t+"Style"]+" "+e["font"+t+"Weight"]+" "+e["font"+t+"Size"]*i+"px "+e["font"+t]}function w(e){e.shadowOffsetX=null,e.shadowOffsetY=null,e.shadowBlur=null,e.shadowColor="",e.strokeStyle=null,e.lineWidth=0,e.save()}function y(e,t,i,r){t.valueTextShadow&&(e.shadowOffsetX=i,e.shadowOffsetY=i,e.shadowBlur=r,e.shadowColor=t.colorValueTextShadow)}function k(e,t,i,r,o,n){if(t.valueBox){w(e);var a=t.valueDec?1+t.valueDec:0,l="9".repeat(Math.max.apply(null,[String(parseInt(i)).length+a].concat(t.majorTicks.map(function(e){return String(parseInt(e,10)).length+a})))),s=t.valueText||h(i,t),d=n/200,u=n/100,f=.4*u,m=1.2*u;e.font=p(t,"Value",d),y(e,t,f,m);var v=e.measureText(t.valueText?s:"-"+h(Number(l),t)).width;w(e);var b=parseFloat(t.fontValueSize)*d+f+m,g=u*parseFloat(t.valueBoxStroke),k=2*n-2*g,x=v+10*u,T=1.1*b+f+m,S=u*t.valueBoxBorderRadius,W=(parseFloat(t.valueBoxWidth)||0)/100*k;W>x&&(x=W),x>k&&(x=k);var O=r-x/2,V=o-T/2,P=o-5.75*u;if(e.beginPath(),S?c(e,O,V,x,T,S):e.rect(O,V,x,T),g){var M=e.createRadialGradient(r,P,10*u,r,P,20*u);M.addColorStop(0,t.colorValueBoxRect),M.addColorStop(1,t.colorValueBoxRectEnd),e.strokeStyle=M,e.lineWidth=g,e.stroke()}t.colorValueBoxShadow&&(e.shadowBlur=1.2*u,e.shadowColor=t.colorValueBoxShadow),t.colorValueBoxBackground&&(e.fillStyle=t.colorValueBoxBackground,e.fill()),e.closePath(),e.restore(),y(e,t,f,m),e.fillStyle=t.colorValueText,e.textAlign="center",e.textBaseline="alphabetic",e.fillText(s,O+x/2,o+T/2-b/3),e.restore()}}function x(e){var t=e.value,i=e.minValue,r=e.maxValue,o=.01*(r-i);return{normal:tr?r:t,indented:tr?r+o:t}}function T(e,t,i,r,o){i.beginPath(),i.arc(0,0,ye(e),0,2*Se,!0),i.lineWidth=t,i.strokeStyle=o?Te.linearGradient(i,r,o,e):r,i.stroke(),i.closePath()}function S(e,t){var i=be.pixelRatio;return e.maxRadius||(e.maxRadius=e.max-t.borderShadowWidth-t.borderOuterWidth*i-t.borderMiddleWidth*i-t.borderInnerWidth*i+(t.borderOuterWidth?.5:0)+(t.borderMiddleWidth?.5:0)+(t.borderInnerWidth?.5:0)),e.maxRadius}function W(e,t){var i=be.pixelRatio,r=t.borderShadowWidth*i,o=e.max-r-t.borderOuterWidth*i/2,n=o-t.borderOuterWidth*i/2-t.borderMiddleWidth*i/2+.5,a=n-t.borderMiddleWidth*i/2-t.borderInnerWidth*i/2+.5,l=S(e,t),s=void 0,d=!1;e.save(),t.borderOuterWidth&&(d=Te.drawShadow(e,t,d),T(o,t.borderOuterWidth*i,e,t.colorBorderOuter,t.colorBorderOuterEnd)),t.borderMiddleWidth&&(d=Te.drawShadow(e,t,d),T(n,t.borderMiddleWidth*i,e,t.colorBorderMiddle,t.colorBorderMiddleEnd)),t.borderInnerWidth&&(d=Te.drawShadow(e,t,d),T(a,t.borderInnerWidth*i,e,t.colorBorderInner,t.colorBorderInnerEnd)),Te.drawShadow(e,t,d),e.beginPath(),e.arc(0,0,ye(l),0,2*Se,!0),t.colorPlateEnd?(s=e.createRadialGradient(0,0,l/2,0,0,l),s.addColorStop(0,t.colorPlate),s.addColorStop(1,t.colorPlateEnd)):s=t.colorPlate,e.fillStyle=s,e.fill(),e.closePath(),e.restore()}function O(e,t){var i=e.max*(parseFloat(t.highlightsWidth)||0)/100;if(i){var r=ye(P(e,t)-i/2),o=0,n=t.highlights.length,a=(t.maxValue-t.minValue)/t.ticksAngle;for(e.save();on?o:n,n>o,o>n?i:r):a,t>0?Te.roundRect(e,i,r,o,n,t):e.rect(i,r,o,n),e.fill(),e.closePath()}function z(e,t,i,r,o,n,a,l,s){e.beginPath(),e.lineWidth=t,e.strokeStyle=s?Te.linearGradient(e,l,s,a,!0,o):l,i>0?Te.roundRect(e,r,o,n,a,i):e.rect(r,o,n,a),e.stroke(),e.closePath()}function L(e,t,i,r,o,n){var a=be.pixelRatio;e.save();var l=t.borderRadius*a,s=o-t.borderShadowWidth-t.borderOuterWidth*a,d=s-t.borderOuterWidth*a-t.borderMiddleWidth*a,c=d-t.borderMiddleWidth*a-t.borderInnerWidth*a,h=c-t.borderInnerWidth*a,u=n-t.borderShadowWidth-t.borderOuterWidth*a,f=u-t.borderOuterWidth*a-t.borderMiddleWidth*a,m=f-t.borderMiddleWidth*a-t.borderInnerWidth*a,v=m-t.borderInnerWidth*a,b=i-(d-s)/2,g=b-(c-d)/2,p=g-(h-c)/2,w=r-(f-u)/2,y=w-(m-f)/2,k=y-(v-m)/2,x=0,T=!1;return t.borderOuterWidth&&(T=Te.drawShadow(e,t,T),z(e,t.borderOuterWidth*a,l,i+t.borderOuterWidth*a/2-x,r+t.borderOuterWidth*a/2-x,s,u,t.colorBorderOuter,t.colorBorderOuterEnd),x+=.5*a),t.borderMiddleWidth&&(T=Te.drawShadow(e,t,T),z(e,t.borderMiddleWidth*a,l-=1+2*x,b+t.borderMiddleWidth*a/2-x,w+t.borderMiddleWidth*a/2-x,d+2*x,f+2*x,t.colorBorderMiddle,t.colorBorderMiddleEnd),x+=.5*a),t.borderInnerWidth&&(T=Te.drawShadow(e,t,T),z(e,t.borderInnerWidth*a,l-=1+2*x,g+t.borderInnerWidth*a/2-x,y+t.borderInnerWidth*a/2-x,c+2*x,m+2*x,t.colorBorderInner,t.colorBorderInnerEnd),x+=.5*a),Te.drawShadow(e,t,T),D(e,l,p,k,h+2*x,v+2*x,t.colorPlate,t.colorPlateEnd),e.restore(),[p,k,h,v]}function G(e,t,i,r,o,n){var a=be.pixelRatio,l=n>=o,s=l?.85*o:n,d=l?n:o;i=l?we(i+(o-s)/2):i;var c=!!t.title,h=!!t.units,u=!!t.valueBox,f=void 0,m=void 0,v=void 0;l?(m=we(.05*d),f=we(.075*d),v=we(.11*d),c&&(d-=f,r+=f),h&&(d-=m),u&&(d-=v)):(m=f=we(.15*s),c&&(s-=f,r+=f),h&&(s-=m));var b=2*t.barStrokeWidth,g=t.barBeginCircle?we(s*t.barBeginCircle/200-b/2):0,p=we(s*t.barWidth/100-b),w=we(d*t.barLength/100-b),y=we((d-w)/2),k=we(i+(l?s/2:y+g)),x=we(r+(l?d-y-g+b/2:s/2)),T=!l||t.hasLeft&&t.hasRight?0:(t.hasRight?-1:1)*t.ticksWidth/100*s,S=l||t.hasLeft&&t.hasRight?0:(t.hasRight?-1:1)*t.ticksWidth/100*s;return e.barDimensions={isVertical:l,width:s,length:d,barWidth:p,barLength:w,strokeWidth:b,barMargin:y,radius:g,pixelRatio:a,barOffset:null,titleMargin:c?f:0,unitsMargin:h?m:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:i+T,Y:r+S,x0:k+T,y0:x+S,baseX:i,baseY:r,ticksPadding:t.ticksPadding/100},e.barDimensions}function F(e,t,i,r,o,n,a){var l=G(e,t,r,o,n,a),s=l.isVertical,d=l.width,c=l.barWidth,h=l.barLength,u=l.strokeWidth,f=l.barMargin,m=l.radius,v=l.x0,b=l.y0,g=l.X,p=l.Y,w=h;if(e.save(),e.beginPath(),t.barBeginCircle){var y=Te.radians(s?270:0),k=Math.asin(c/2/m),x=Math.cos(k),T=Math.sin(k),S=v+(s?m*T:m*x-u/2),W=s?b-m*x:b+m*T,O=ye(s?W-b:S-v);e.barDimensions.barOffset=we(O+m);var V=s?we(v-m*T):S,P=s?W:we(b-m*T);"progress"===i&&(h=e.barDimensions.barOffset+(h-e.barDimensions.barOffset)*(Te.normalizedValue(t).normal-t.minValue)/(t.maxValue-t.minValue));var M=we(S+h-e.barDimensions.barOffset+u/2),B=we(W-h+e.barDimensions.barOffset-u/2);e.arc(v,b,m,y+k,y-k),s?(e.moveTo(S,P),e.lineTo(S,B),e.lineTo(V,B),e.lineTo(V,P)):(e.moveTo(S,P),e.lineTo(M,P),e.lineTo(M,W),e.lineTo(S,W))}else{var A=we(s?g+(d-c)/2:g+f),j=we(s?p+h+f:p+(d-c)/2);"progress"===i&&(h*=(t.value-t.minValue)/(t.maxValue-t.minValue)),s?e.rect(A,j,c,-h):e.rect(A,j,h,c)}"progress"!==i&&t.barStrokeWidth&&(e.lineWidth=u,e.strokeStyle=t.colorBarStroke,e.stroke()),"progress"!==i&&t.colorBar?(e.fillStyle=t.colorBarEnd?Te.linearGradient(e,t.colorBar,t.colorBarEnd,h,s,s?p:g):t.colorBar,e.fill()):"progress"===i&&t.colorBarProgress&&(e.fillStyle=t.colorBarProgressEnd?Te.linearGradient(e,t.colorBarProgress,t.colorBarProgressEnd,w,s,s?p:g):t.colorBarProgress,e.fill()),e.closePath(),t.barBeginCircle&&(e.barDimensions.radius+=u),e.barDimensions.barWidth+=u,e.barDimensions.barLength+=u}function X(e,t,i,r,o,n){F(e,t,"",i,r,o,n)}function Y(e,t){return t.needleSide!==e||t.tickSide!==e||t.numberSide!==e}function U(e,t,i,r,o,n){t.barProgress&&F(e,t,"progress",i,r,o,n)}function q(e,t){var i=e.barDimensions,r=i.isVertical,o=i.width,n=i.length,a=i.barWidth,l=i.barOffset,s=i.barMargin,d=i.X,c=i.Y,h=i.ticksLength,u=i.ticksPadding,f=o*(parseFloat(t.highlightsWidth)||0)/100;if(t.highlights&&f){var m="right"!==t.tickSide,v="left"!==t.tickSide,b=0,g=t.highlights.length,p=(o-a)/2,w=t.maxValue-t.minValue,y=we(r?d+p:d+s+l),k=f,x=r?c+n-s-l:c+p,T=we((t.ticksWidth/100+u)*o)+(f-t.ticksWidth/100*o),S=we(a+u*o);for(e.save();bn&&(d*=-1),e.moveTo(i-h,r),e.lineTo(i+h,r),e.lineTo(i+h,r+d),e.lineTo(i,n),e.lineTo(i-h,r+d),e.lineTo(i-h,r)):(i>o&&(d*=-1),e.moveTo(i,r-h),e.lineTo(i,r+h),e.lineTo(i+d,r+h),e.lineTo(o,r),e.lineTo(i+d,r-h),e.lineTo(i,r-h)),e.fill(),e.closePath()}function ae(e,t,i,r,o,n,a){var l=(parseFloat(t.fontValueSize)||0)*n/200,s=(.11*a-l)/2;e.barDimensions.isVertical&&Te.drawValueBox(e,t,i,r+n/2,o+a-l-s,n)}var le=function(){function e(e,t){var i=[],r=!0,o=!1,n=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(i.push(a.value),!t||i.length!==t);r=!0);}catch(e){o=!0,n=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw n}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),se=function e(t,i,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,i);if(void 0===o){var n=Object.getPrototypeOf(t);return null===n?void 0:e(n,i,r)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(r)},de=function e(t,i,r,o){var n=Object.getOwnPropertyDescriptor(t,i);if(void 0===n){var a=Object.getPrototypeOf(t);null!==a&&e(a,i,r,o)}else if("value"in n&&n.writable)n.value=r;else{var l=n.set;void 0!==l&&l.call(o,r)}return r},ce=function(){function e(e,t){for(var i=0;i>>0;if(0===o)return-1;var n=+t||0;if(Math.abs(n)===1/0&&(n=0),n>=o)return-1;for(i=Math.max(n>=0?n:o-Math.abs(n),0);i>>0,r=arguments[1],o=r>>0,n=o<0?Math.max(i+o,0):Math.min(o,i),a=arguments[2],l=void 0===a?i:a>>0,s=l<0?Math.max(i+l,0):Math.min(l,i);n1?r-1:0),n=1;n1?t-1:0),r=1;r=(7-4*t)/11)return-Math.pow((11-6*t-11*e)/4,2)+Math.pow(i,2)},elastic:function(e){return 1-fe.delastic(1-e)},delastic:function(e){return Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*1.5/3*e)}},me=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"linear",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};if(o(this,e),this.duration=i,this.rule=t,this.draw=r,this.end=n,"function"!=typeof this.draw)throw new TypeError("Invalid animation draw callback:",r);if("function"!=typeof this.end)throw new TypeError("Invalid animation end callback:",n)}return ce(e,[{key:"animate",value:function(e,t){var i=this;this.frame&&this.cancel();var r=window.performance&&window.performance.now?window.performance.now():n("animationStartTime")||Date.now();e=e||this.draw,t=t||this.end,this.draw=e,this.end=t,this.frame=ue(function(o){return a(o,e,r,fe[i.rule]||i.rule,i.duration,t,i)})}},{key:"cancel",value:function(){if(this.frame){(n("cancelAnimationFrame")||function(e){})(this.frame),this.frame=null}}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),e}();me.rules=fe;var ve=function(){function t(i,r,n){o(this,t),this.options=i,this.element=r.toLowerCase(),this.type=t.toDashed(n),this.Type=e[n],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||t.domReady(this.traverse.bind(this))}return ce(t,[{key:"isValidNode",value:function(e){return!(!e.tagName||e.tagName.toLowerCase()!==this.element||e.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var e=document.getElementsByTagName(this.element),t=0,i=e.length;t1&&void 0!==arguments[1])||arguments[1],i=e.split(/-/),r=0,o=i.length,n="";r1&&void 0!==arguments[1]?arguments[1]:0;return e=parseFloat(e),!isNaN(e)&&isFinite(e)||(e=parseFloat(t)||0),e}},{key:"version",get:function(){return pe}}]),n}(he);void 0!==e&&(e.BaseGauge=xe,e.gauges=(window.document||{}).gauges=ke);var Te={roundRect:c,padValue:h,formatMajorTickNumber:u,radians:f,radialPoint:m,linearGradient:v,drawNeedleShadow:g,drawValueBox:k,verifyError:s,prepareTicks:d,drawShadow:b,font:p,normalizedValue:x},Se=Math.PI,We=Se/2,Oe=Object.assign({},ge,{ticksAngle:270,startAngle:45,colorNeedleCircleOuter:"#f0f0f0",colorNeedleCircleOuterEnd:"#ccc",colorNeedleCircleInner:"#e8e8e8",colorNeedleCircleInnerEnd:"#f5f5f5",needleCircleSize:10,needleCircleInner:!0,needleCircleOuter:!0,needleStart:20,animationTarget:"needle",useMinPath:!1,barWidth:0}),Ve=function(e){function t(e){return o(this,t),e=Object.assign({},Oe,e||{}),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,t.configure(e)))}return r(t,e),ce(t,[{key:"draw",value:function(){try{var e=this.canvas,i=[-e.drawX,-e.drawY,e.drawWidth,e.drawHeight],r=i[0],o=i[1],n=i[2],a=i[3],l=this.options;if("needle"===l.animationTarget){if(!e.elementClone.initialized){var s=e.contextClone;s.clearRect(r,o,n,a),s.save(),this.emit("beforePlate"),W(s,l),this.emit("beforeHighlights"),O(s,l),this.emit("beforeMinorTicks"),V(s,l),this.emit("beforeMajorTicks"),M(s,l),this.emit("beforeNumbers"),j(s,l),this.emit("beforeTitle"),C(s,l),this.emit("beforeUnits"),N(s,l),e.elementClone.initialized=!0}this.canvas.commit(),e.context.clearRect(r,o,n,a),e.context.save(),e.context.drawImage(e.elementClone,r,o,n,a),e.context.save(),this.emit("beforeProgressBar"),R(e.context,l),this.emit("beforeValueBox"),_(e.context,l,I(this)),this.emit("beforeNeedle"),E(e.context,l)}else{var d=-Te.radians((l.value-l.minValue)/(l.maxValue-l.minValue)*l.ticksAngle);if(e.context.clearRect(r,o,n,a),e.context.save(),this.emit("beforePlate"),W(e.context,l),e.context.rotate(d),this.emit("beforeHighlights"),O(e.context,l),this.emit("beforeMinorTicks"),V(e.context,l),this.emit("beforeMajorTicks"),M(e.context,l),this.emit("beforeNumbers"),j(e.context,l),this.emit("beforeProgressBar"),R(e.context,l),e.context.rotate(-d),e.context.save(),!e.elementClone.initialized){var c=e.contextClone;c.clearRect(r,o,n,a),c.save(),this.emit("beforeTitle"),C(c,l),this.emit("beforeUnits"),N(c,l),this.emit("beforeNeedle"),E(c,l),e.elementClone.initialized=!0}e.context.drawImage(e.elementClone,r,o,n,a)}this.emit("beforeValueBox"),_(e.context,l,I(this)),se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"draw",this).call(this)}catch(e){Te.verifyError(e)}return this}},{key:"value",set:function(e){e=xe.ensureValue(e,this.options.minValue),this.options.animation&&360===this.options.ticksAngle&&this.options.useMinPath&&(this._value=e,e=this.options.value+((e-this.options.value)%360+540)%360-180),de(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",e,this)},get:function(){return se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this)}}],[{key:"configure",value:function(e){return e.barWidth>50&&(e.barWidth=50),isNaN(e.startAngle)&&(e.startAngle=45),isNaN(e.ticksAngle)&&(e.ticksAngle=270),e.ticksAngle>360&&(e.ticksAngle=360),e.ticksAngle<0&&(e.ticksAngle=0),e.startAngle<0&&(e.startAngle=0),e.startAngle>360&&(e.startAngle=360),e}}]),t}(xe);void 0!==e&&(e.RadialGauge=Ve),xe.initialize("RadialGauge",Oe);var Pe=Object.assign({},ge,{borderRadius:0,barBeginCircle:30,colorBarEnd:"",colorBarProgressEnd:"",needleWidth:6,tickSide:"both",needleSide:"both",numberSide:"both",ticksWidth:10,ticksWidthMinor:5,ticksPadding:5,barLength:85,fontTitleSize:26,highlightsWidth:10}),Me=function(e){function n(e){return o(this,n),e=Object.assign({},Pe,e||{}),i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n.configure(e)))}return r(n,e),ce(n,[{key:"draw",value:function(){try{var e=this.canvas,i=[-e.drawX,-e.drawY,e.drawWidth,e.drawHeight],r=i[0],o=i[1],a=i[2],l=i[3],s=this.options;if(!e.elementClone.initialized){var d=e.contextClone;d.clearRect(r,o,a,l),d.save(),this.emit("beforePlate"),this.drawBox=L(d,s,r,o,a,l),this.emit("beforeBar"),X.apply(void 0,[d,s].concat(t(this.drawBox))),e.context.barDimensions=d.barDimensions,this.emit("beforeHighlights"),q(d,s),this.emit("beforeMinorTicks"),K(d,s),this.emit("beforeMajorTicks"),$(d,s),this.emit("beforeNumbers"),Q(d,s),this.emit("beforeTitle"),ee(d,s),this.emit("beforeUnits"),te(d,s),e.elementClone.initialized=!0}this.canvas.commit(),e.context.clearRect(r,o,a,l),e.context.save(),e.context.drawImage(e.elementClone,r,o,a,l),e.context.save(),this.emit("beforeProgressBar"),U.apply(void 0,[e.context,s].concat(t(this.drawBox))),this.emit("beforeNeedle"),ie(e.context,s),this.emit("beforeValueBox"),ae.apply(void 0,[e.context,s,s.animatedValue?this.options.value:this.value].concat(t(this.drawBox))),se(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"draw",this).call(this)}catch(e){Te.verifyError(e)}return this}}],[{key:"configure",value:function(e){return e.barStrokeWidth>=e.barWidth&&(e.barStrokeWidth=we(e.barWidth/2)),e.hasLeft=Y("right",e),e.hasRight=Y("left",e),e.value>e.maxValue&&(e.value=e.maxValue),e.value\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * @version 2.1.4\n */\n(function(ns) {'use strict';\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _set = function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if (\"value\" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\r\n * @external {Object.assign} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\r\n */\n/* istanbul ignore next */\nif (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function value(target, firstSource) {\n 'use strict';\n\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n var i = 1;\n\n for (; i < arguments.length; i++) {\n var nextSource = arguments[i];\n\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n var nextIndex = 0,\n len = keysArray.length;\n\n for (; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n\n return to;\n }\n });\n}\n\n/**\r\n * @external {Array.indexOf} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\r\n */\n/* istanbul ignore next */\nif (!Array.prototype.indexOf) {\n Array.prototype.indexOf = function (searchElement, fromIndex) {\n var k;\n\n if (this === null) {\n throw new TypeError('\"this\" is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n\n if (len === 0) {\n return -1;\n }\n\n var n = +fromIndex || 0;\n\n if (Math.abs(n) === Infinity) {\n n = 0;\n }\n\n if (n >= len) {\n return -1;\n }\n\n k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\n\n while (k < len) {\n if (k in O && O[k] === searchElement) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n };\n}\n\n/**\r\n * @external {Array.fill} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill\r\n */\n/* istanbul ignore next */\nif (!Array.prototype.fill) {\n Array.prototype.fill = function (value) {\n if (this === null) {\n throw new TypeError('this is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n var start = arguments[1];\n var relativeStart = start >> 0;\n var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);\n var end = arguments[2];\n var relativeEnd = end === undefined ? len : end >> 0;\n var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);\n while (k < final) {\n O[k] = value;\n k++;\n }\n\n return O;\n };\n}\n\n/**\r\n * mocking window\r\n */\nif (typeof window === 'undefined') {\n window = typeof global === 'undefined' ? {} : global;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/**\r\n * Look-ups for a proper vendor-specific property and returns its value\r\n *\r\n * @example\r\n * var requestAnimationFrame = vendorize('requestAnimationFrame');\r\n * // it will refer properly to:\r\n * // - window.requestAnimationFrame by default or to\r\n * // - window.webkitRequestAnimationFrame or to\r\n * // - window.mozRequestAnimationFrame or to\r\n * // - window.msRequestAnimationFrame or to\r\n * // - window.oRequestAnimationFrame\r\n * // depending on the current browser vendor\r\n *\r\n * @author Mykhailo Stadnyk \r\n * @param {string} prop\r\n * @param {HTMLElement|Window|object} [from] - default is window\r\n * @returns {*}\r\n */\nfunction vendorize(prop, from) {\n /* istanbul ignore else: no reason to cover */\n if (!from) {\n from = typeof window === 'undefined' ? global : window;\n }\n\n if (typeof from[prop] !== 'undefined') {\n return from[prop];\n }\n\n var vendors = ['webkit', 'moz', 'ms', 'o'];\n var i = 0;\n var s = vendors.length;\n var capitalized = prop.charAt(0).toUpperCase() + prop.substr(1);\n\n for (; i < s; i++) {\n var vendorProp = from[vendors[i] + capitalized];\n\n /* istanbul ignore if: requires very complex environment to test (specific browser version) */\n if (typeof vendorProp !== 'undefined') {\n return vendorProp;\n }\n }\n\n return null;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Class EventEmitter - base event manager\r\n */\n\nvar EventEmitter = function () {\n /**\r\n * @constructor\r\n */\n function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this._events = {};\n\n this.addListener = this.on;\n this.removeListener = this.off;\n }\n\n /**\r\n * Returns all event listeners\r\n *\r\n * @return {object}\r\n */\n\n\n _createClass(EventEmitter, [{\n key: 'emit',\n\n\n /**\r\n * Emits given event bypassing to each registered handler given args\r\n *\r\n * @param {string} event\r\n * @param {...*} args\r\n */\n value: function emit(event) {\n if (this._events[event]) {\n var i = 0;\n var s = this._events[event].length;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n for (; i < s; i++) {\n this._events[event][i] && this._events[event][i].apply(this, args);\n }\n }\n }\n\n /**\r\n * Registers given handler for given event to be called only once when\r\n * event is emitted\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'once',\n value: function once(event) {\n for (var _len2 = arguments.length, handlers = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n handlers[_key2 - 1] = arguments[_key2];\n }\n\n var i = 0;\n var s = handlers.length;\n var self = this;\n\n var _loop = function _loop() {\n var handler = handlers[i];\n var wrapper = function wrapper() {\n self.off(event, wrapper);\n handler.apply(self, arguments);\n };\n\n handlers[i] = wrapper;\n };\n\n for (; i < s; i++) {\n _loop();\n }\n\n this.on.apply(this, [event].concat(handlers));\n }\n\n /**\r\n * Registers given handlers for a given events to be called each time event\r\n * is emitted\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'on',\n value: function on(event) {\n if (!this._events[event]) {\n this._events[event] = [];\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n this._events[event].push(arguments.length <= i + 1 ? undefined : arguments[i + 1]);\n }\n }\n\n /**\r\n * Un-registers previously registered event handlers\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'off',\n value: function off(event) {\n if (!this._events[event]) {\n return;\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n var _handler = arguments.length <= i + 1 ? undefined : arguments[i + 1];\n var index = void 0;\n\n while (~(index = this._events[event].indexOf(_handler))) {\n this._events[event].splice(index, 1);\n }\n }\n }\n\n /**\r\n * Removes all listeners for a given event\r\n *\r\n * @param {string} event\r\n */\n\n }, {\n key: 'removeAllListeners',\n value: function removeAllListeners(event) {\n delete this._events[event];\n }\n }, {\n key: 'listeners',\n get: function get() {\n return this._events;\n }\n }]);\n\n return EventEmitter;\n}();\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/* jshint -W079 */\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n\n/* istanbul ignore next */\n/**\r\n * @type {function(callback: function(time: number): number, element?: HTMLElement)}\r\n * @access private\r\n */\n\n\nvar requestAnimationFrame = vendorize('requestAnimationFrame') || function (callback) {\n return setTimeout(function () {\n return callback(new Date().getTime());\n }, 1000 / 60);\n};\n\n/**\r\n * Generic AnimationRule function interface\r\n *\r\n * @typedef {function(percent: number): number} AnimationRule\r\n */\n\n/**\r\n * Callback for animation step draw event.\r\n * It will be called each time animation step is executed, bypassing\r\n * as first argument a percent of animation completeness. It is expected\r\n * that this callback will do an actual work of animating an elements or\r\n * whatever, as far as animation engine is just calculating and executing\r\n * animation steps without any knowledge about things under animation.\r\n *\r\n * @typedef {function(percent: number): *} DrawEventCallback\r\n */\n\n/**\r\n * Callback for animation complete event.\r\n * It is called once each animation is complete.\r\n *\r\n * @typedef {function(): *} EndEventCallback\r\n */\n\n/**\r\n * Predefined known animation rules.\r\n * It's a simple collection of math for some most used animations.\r\n *\r\n * @typedef {{linear: AnimationRule, quad: AnimationRule, dequad: AnimationRule, quint: AnimationRule, dequint: AnimationRule, cycle: AnimationRule, decycle: AnimationRule, bounce: AnimationRule, debounce: AnimationRule, elastic: AnimationRule, delastic: AnimationRule}} AnimationRules\r\n */\n\n/* istanbul ignore next: no reason covering this */\nvar rules = {\n linear: function linear(p) {\n return p;\n },\n quad: function quad(p) {\n return Math.pow(p, 2);\n },\n dequad: function dequad(p) {\n return 1 - rules.quad(1 - p);\n },\n quint: function quint(p) {\n return Math.pow(p, 5);\n },\n dequint: function dequint(p) {\n return 1 - Math.pow(1 - p, 5);\n },\n cycle: function cycle(p) {\n return 1 - Math.sin(Math.acos(p));\n },\n decycle: function decycle(p) {\n return Math.sin(Math.acos(1 - p));\n },\n bounce: function bounce(p) {\n return 1 - rules.debounce(1 - p);\n },\n debounce: function debounce(p) {\n var a = 0,\n b = 1;\n for (; 1; a += b, b /= 2) {\n if (p >= (7 - 4 * a) / 11) {\n return -Math.pow((11 - 6 * a - 11 * p) / 4, 2) + Math.pow(b, 2);\n }\n }\n },\n elastic: function elastic(p) {\n return 1 - rules.delastic(1 - p);\n },\n delastic: function delastic(p) {\n var x = 1.5;\n return Math.pow(2, 10 * (p - 1)) * Math.cos(20 * Math.PI * x / 3 * p);\n }\n};\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Evaluates animation step and decides if the next step required or\r\n * stops animation calling a proper events.\r\n *\r\n * @access private\r\n * @param {number} time\r\n * @param {DrawEventCallback} draw\r\n * @param {number} start\r\n * @param {AnimationRule} rule\r\n * @param {number} duration\r\n * @param {EndEventCallback} end\r\n * @param {Animation} anim\r\n */\nfunction step(time, draw, start, rule, duration, end, anim) {\n if (typeof rule !== 'function') {\n throw new TypeError('Invalid animation rule:', rule);\n }\n\n var progress = time - start;\n var percent = progress / duration;\n var animationTransformed = 0;\n\n if (percent > 1) {\n percent = 1;\n }\n\n if (percent !== 1) {\n animationTransformed = rule(percent);\n\n // make sure we have correct number after applying animation\n // transformation\n if (isFinite(animationTransformed) && !isNaN(animationTransformed)) {\n percent = animationTransformed;\n }\n }\n\n draw && draw(percent);\n\n if (progress < duration) {\n anim.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rule, duration, end, anim);\n });\n } else {\n end && end();\n anim.inProgress = false;\n }\n}\n\n/**\r\n * Animation engine API for JavaScript-based animations.\r\n * This is simply an animation core framework which simplifies creation\r\n * of various animations for generic purposes.\r\n *\r\n * @example\r\n * // create 'linear' animation engine, 500ms duration\r\n * let linear = new Animation('linear', 500);\r\n *\r\n * // create 'elastic' animation engine\r\n * let elastic = new Animation('elastic');\r\n *\r\n * // define animation behavior\r\n * let bounced = new Animation('bounce', 500, percent => {\r\n * let value = parseInt(percent * 100, 10);\r\n *\r\n * $('div.bounced').css({\r\n * width: value + '%',\r\n * height: value + '%'\r\n * });\r\n * });\r\n *\r\n * // execute animation\r\n * bounced.animate();\r\n *\r\n * // execute animation and handle when its finished\r\n * bounced.animate(null, () => {\r\n * console.log('Animation finished!');\r\n * });\r\n */\n\nvar Animation = function () {\n\n /**\r\n * @constructor\r\n * @param {string|AnimationRule} rule\r\n * @param {number} duration\r\n * @param {DrawEventCallback} [draw]\r\n * @param {EndEventCallback} [end]\r\n */\n function Animation() {\n var rule = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'linear';\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var draw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};\n\n _classCallCheck(this, Animation);\n\n /**\r\n * Overall animation duration in milliseconds.\r\n * By default is equal to 250 ms.\r\n *\r\n * @type {number}\r\n */\n this.duration = duration;\n\n /**\r\n * Animation rule. By default is linear animation.\r\n * Animation rule is a subject to animation rules, which are\r\n * a simple object containing math-based methods for calculating\r\n * animation steps.\r\n *\r\n * @type {string|AnimationRule}\r\n */\n this.rule = rule;\n\n /**\r\n * Callback function for the animation step draw event.\r\n *\r\n * @type {DrawEventCallback}\r\n */\n this.draw = draw;\n\n /**\r\n * Callback for the animation complete event.\r\n *\r\n * @type {EndEventCallback}\r\n */\n this.end = end;\n\n if (typeof this.draw !== 'function') {\n throw new TypeError('Invalid animation draw callback:', draw);\n }\n\n if (typeof this.end !== 'function') {\n throw new TypeError('Invalid animation end callback:', end);\n }\n }\n\n /* istanbul ignore next: non-testable */\n /**\r\n * Performs animation calling each animation step draw callback and\r\n * end callback at the end of animation. Callbacks are optional to this\r\n * method call. If them are not bypassed will be used that ones which\r\n * was pre-set on constructing an Animation object or pre-set after\r\n * construction.\r\n *\r\n * @example\r\n * function draw(percent) {\r\n * $('.my-animated-divs').css({\r\n * width: parseInt(percent * 100, 10) + '%'\r\n * });\r\n * }\r\n * function done() {\r\n * console.log('Animation complete!');\r\n * }\r\n *\r\n * // Define 'draw' and 'end' callbacks on construction\r\n * var animation = new Animation('cycle', 500, draw, done);\r\n * animation.animate();\r\n *\r\n * // Define 'draw' and 'end' callbacks after construction\r\n * var animation = new Animation('cycle', 500);\r\n * animation.draw = draw;\r\n * animation.end = done;\r\n * animation.animate();\r\n *\r\n * // Define 'draw' and 'end' callbacks at animation\r\n * var animation = new Animation('cycle', 500);\r\n * animation.animate(draw, done);\r\n *\r\n * @param {DrawEventCallback} [draw]\r\n * @param {EndEventCallback} [end]\r\n */\n\n\n _createClass(Animation, [{\n key: 'animate',\n value: function animate(draw, end) {\n var _this = this;\n\n this.frame && this.cancel();\n\n // noinspection JSUnresolvedVariable\n var start = window.performance && window.performance.now ? window.performance.now() : vendorize('animationStartTime') || Date.now();\n\n draw = draw || this.draw;\n end = end || this.end;\n\n this.draw = draw;\n this.end = end;\n\n /**\r\n * Current requested animation frame identifier\r\n *\r\n * @type {number}\r\n */\n this.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rules[_this.rule] || _this.rule, _this.duration, end, _this);\n });\n }\n\n /**\r\n * Cancels current animation if any\r\n */\n\n }, {\n key: 'cancel',\n value: function cancel() {\n if (this.frame) {\n var cancelAnimationFrame = vendorize('cancelAnimationFrame') ||\n /* istanbul ignore next */\n function (id) {};\n\n cancelAnimationFrame(this.frame);\n this.frame = null;\n }\n }\n\n /**\r\n * Destroys this object properly\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n this.cancel();\n this.draw = null;\n this.end = null;\n }\n }]);\n\n return Animation;\n}();\n\n/**\r\n * Animation rules bound statically to Animation constructor.\r\n *\r\n * @type {AnimationRules}\r\n * @static\r\n */\n\n\nAnimation.rules = rules;\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/**\r\n * @typedef {{ constructor: function(options: GenericOptions): GaugeInterface, draw: function(): GaugeInterface, destroy: function, update: function(options: GenericOptions) }} GaugeInterface\r\n */\n/**\r\n * @typedef {{parse: function, stringify: function}} JSON\r\n * @external {JSON} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON\r\n */\n/**\r\n * @ignore\r\n * @typedef {{MutationObserver: function}} ns\r\n */\n\n/**\r\n * DOM Observer.\r\n * It will observe DOM document for a configured element types and\r\n * instantiate associated Types for an existing or newly added DOM elements\r\n *\r\n * @example\r\n * class ProgressBar {\r\n * constructor(options) {}\r\n * draw() {}\r\n * }\r\n *\r\n * // It will observe DOM document for elements
\r\n * // having attribute 'data-type=\"progress\"'\r\n * // and instantiate for each new instance of ProgressBar\r\n *\r\n * new DomParser({color: 'red'}, 'div', 'progress', ProgressBar);\r\n *\r\n * // assume we could have HTML like this\r\n * //
\r\n * // in this case all matching attributes names for a given options will be\r\n * // parsed and bypassed to an instance from HTML attributes\r\n */\n\nvar DomObserver = function () {\n\n /**\r\n * @constructor\r\n * @param {object} options\r\n * @param {string} element\r\n * @param {string} type\r\n */\n function DomObserver(options, element, type) {\n _classCallCheck(this, DomObserver);\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Default instantiation options for the given type\r\n *\r\n * @type {Object}\r\n */\n this.options = options;\n\n /**\r\n * Name of an element to lookup/observe\r\n *\r\n * @type {string}\r\n */\n this.element = element.toLowerCase();\n\n /**\r\n * data-type attribute value to lookup\r\n *\r\n * @type {string}\r\n */\n this.type = DomObserver.toDashed(type);\n\n /**\r\n * Actual type constructor to instantiate for each found element\r\n *\r\n * @type {Function}\r\n */\n this.Type = ns[type];\n\n /**\r\n * Signals if mutations observer for this type or not\r\n *\r\n * @type {boolean}\r\n */\n this.mutationsObserved = false;\n\n /**\r\n * Flag specifies whenever the browser supports observing\r\n * of DOM tree mutations or not\r\n *\r\n * @type {boolean}\r\n */\n this.isObservable = !!window.MutationObserver;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n if (!window.GAUGES_NO_AUTO_INIT) {\n DomObserver.domReady(this.traverse.bind(this));\n }\n }\n\n /**\r\n * Checks if given node is valid node to process\r\n *\r\n * @param {Node|HTMLElement} node\r\n * @returns {boolean}\r\n */\n\n\n _createClass(DomObserver, [{\n key: 'isValidNode',\n value: function isValidNode(node) {\n //noinspection JSUnresolvedVariable\n return !!(node.tagName && node.tagName.toLowerCase() === this.element && node.getAttribute('data-type') === this.type);\n }\n\n /**\r\n * Traverse entire current DOM tree and process matching nodes.\r\n * Usually it should be called only once on document initialization.\r\n */\n\n }, {\n key: 'traverse',\n value: function traverse() {\n var elements = document.getElementsByTagName(this.element);\n var i = 0,\n s = elements.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n this.process(elements[i]);\n }\n\n if (this.isObservable && !this.mutationsObserved) {\n new MutationObserver(this.observe.bind(this)).observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n attributeOldValue: true,\n characterDataOldValue: true\n });\n\n this.mutationsObserved = true;\n }\n }\n\n /**\r\n * Observes given mutation records for an elements to process\r\n *\r\n * @param {MutationRecord[]} records\r\n */\n\n }, {\n key: 'observe',\n value: function observe(records) {\n var i = 0;\n var s = records.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n var record = records[i];\n\n if (record.type === 'attributes' && record.attributeName === 'data-type' && this.isValidNode(record.target) && record.oldValue !== this.type) // skip false-positive mutations\n {\n setTimeout(this.process.bind(this, record.target));\n } else if (record.addedNodes && record.addedNodes.length) {\n var ii = 0;\n var ss = record.addedNodes.length;\n\n for (; ii < ss; ii++) {\n setTimeout(this.process.bind(this, record.addedNodes[ii]));\n }\n }\n }\n }\n\n /**\r\n * Parses given attribute value to a proper JavaScript value.\r\n * For example it will parse some stringified value to a proper type\r\n * value, e.g. 'true' => true, 'null' => null, '{\"prop\": 20}' => {prop: 20}\r\n *\r\n * @param {*} value\r\n * @return {*}\r\n */\n\n }, {\n key: 'process',\n\n\n /**\r\n * Processes a given node, instantiating a proper type constructor for it\r\n *\r\n * @param {Node|HTMLElement} node\r\n * @returns {GaugeInterface|null}\r\n */\n value: function process(node) {\n var _this2 = this;\n\n if (!this.isValidNode(node)) return null;\n\n var prop = void 0;\n var options = JSON.parse(JSON.stringify(this.options));\n var instance = null;\n\n for (prop in options) {\n /* istanbul ignore else: non-testable in most cases */\n if (options.hasOwnProperty(prop)) {\n var attributeName = DomObserver.toAttributeName(prop);\n var attributeValue = DomObserver.parse(node.getAttribute(attributeName));\n\n if (attributeValue !== null && attributeValue !== undefined) {\n options[prop] = attributeValue;\n }\n }\n }\n\n options.renderTo = node;\n instance = new this.Type(options);\n instance.draw && instance.draw();\n\n if (!this.isObservable) return instance;\n\n instance.observer = new MutationObserver(function (records) {\n records.forEach(function (record) {\n if (record.type === 'attributes') {\n var attr = record.attributeName.toLowerCase();\n var type = node.getAttribute(attr).toLowerCase();\n\n if (attr === 'data-type' && type && type !== _this2.type) {\n instance.observer.disconnect();\n delete instance.observer;\n instance.destroy && instance.destroy();\n } else if (attr.substr(0, 5) === 'data-') {\n var _prop = attr.substr(5).split('-').map(function (part, i) {\n return !i ? part : part.charAt(0).toUpperCase() + part.substr(1);\n }).join('');\n var _options = {};\n\n _options[_prop] = DomObserver.parse(node.getAttribute(record.attributeName));\n\n if (_prop === 'value') {\n instance && (instance.value = _options[_prop]);\n } else {\n instance.update && instance.update(_options);\n }\n }\n }\n });\n });\n\n //noinspection JSCheckFunctionSignatures\n instance.observer.observe(node, { attributes: true });\n\n return instance;\n }\n\n /**\r\n * Transforms camelCase string to dashed string\r\n *\r\n * @static\r\n * @param {string} camelCase\r\n * @return {string}\r\n */\n\n }], [{\n key: 'parse',\n value: function parse(value) {\n // parse boolean\n if (value === 'true') return true;\n if (value === 'false') return false;\n\n // parse undefined\n if (value === 'undefined') return undefined;\n\n // parse null\n if (value === 'null') return null;\n\n // Comma-separated strings to array parsing.\n // It won't match strings which contains non alphanumeric characters to\n // prevent strings like 'rgba(0,0,0,0)' or JSON-like from being parsed.\n // Typically it simply allows easily declare arrays as comma-separated\n // numbers or plain strings. If something more complicated is\n // required it can be declared using JSON format syntax\n if (/^[-+#.\\w\\d\\s]+(?:,[-+#.\\w\\d\\s]*)+$/.test(value)) {\n return value.split(',');\n }\n\n // parse JSON\n try {\n return JSON.parse(value);\n } catch (e) {}\n\n // plain value - no need to parse\n return value;\n }\n }, {\n key: 'toDashed',\n value: function toDashed(camelCase) {\n var arr = camelCase.split(/(?=[A-Z])/);\n var i = 1;\n var s = arr.length;\n var str = arr[0].toLowerCase();\n\n for (; i < s; i++) {\n str += '-' + arr[i].toLowerCase();\n }\n\n return str;\n }\n\n /**\r\n * Transforms dashed string to CamelCase representation\r\n *\r\n * @param {string} dashed\r\n * @param {boolean} [capitalized]\r\n * @return {string}\r\n */\n\n }, {\n key: 'toCamelCase',\n value: function toCamelCase(dashed) {\n var capitalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n var arr = dashed.split(/-/);\n var i = 0;\n var s = arr.length;\n var str = '';\n\n for (; i < s; i++) {\n if (!(i || capitalized)) {\n str += arr[i].toLowerCase();\n } else {\n str += arr[i][0].toUpperCase() + arr[i].substr(1).toLowerCase();\n }\n }\n\n return str;\n }\n\n /**\r\n * Transforms camel case property name to dash separated attribute name\r\n *\r\n * @static\r\n * @param {string} str\r\n * @returns {string}\r\n */\n\n }, {\n key: 'toAttributeName',\n value: function toAttributeName(str) {\n return 'data-' + DomObserver.toDashed(str);\n }\n\n /**\r\n * Cross-browser DOM ready handler\r\n *\r\n * @static\r\n * @param {Function} handler\r\n */\n\n }, {\n key: 'domReady',\n value: function domReady(handler) {\n if (/comp|inter|loaded/.test((window.document || {}).readyState + '')) return handler();\n\n if (window.addEventListener) window.addEventListener('DOMContentLoaded', handler, false);else if (window.attachEvent) window.attachEvent('onload', handler);\n }\n }]);\n\n return DomObserver;\n}();\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n\n/**\r\n * Drawings on canvas using hidden canvas as a cache for better\r\n * performance drawings during canvas animations. SmartCanvas also\r\n * adopts a canvas to\r\n */\n\n\nvar SmartCanvas = function () {\n\n /**\r\n * @constructor\r\n * @param {HTMLCanvasElement} canvas\r\n * @param {number} [width]\r\n * @param {number} [height]\r\n */\n function SmartCanvas(canvas, width, height) {\n _classCallCheck(this, SmartCanvas);\n\n SmartCanvas.collection.push(this);\n\n /**\r\n * Canvas base width\r\n *\r\n * @type {number}\r\n */\n this.width = width || 0;\n\n /**\r\n * Canvas base height\r\n *\r\n * @type {number}\r\n */\n this.height = height || 0;\n\n /**\r\n * Target drawings canvas element\r\n *\r\n * @type {HTMLCanvasElement}\r\n */\n this.element = canvas;\n\n this.init();\n }\n\n /**\r\n * Initializes canvases and contexts\r\n */\n\n\n _createClass(SmartCanvas, [{\n key: 'init',\n value: function init() {\n var pixelRatio = SmartCanvas.pixelRatio;\n\n this.element.width = this.width * pixelRatio;\n this.element.height = this.height * pixelRatio;\n\n this.element.style.width = this.width + 'px';\n this.element.style.height = this.height + 'px';\n\n /**\r\n * Canvas caching element\r\n *\r\n * @type {HTMLCanvasElement|Node}\r\n */\n this.elementClone = this.element.cloneNode(true);\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Target drawings canvas element 2D context\r\n *\r\n * @type {CanvasRenderingContext2D}\r\n */\n this.context = this.element.getContext('2d');\n\n /**\r\n * Canvas caching element 2D context\r\n *\r\n * @type {CanvasRenderingContext2D}\r\n */\n this.contextClone = this.elementClone.getContext('2d');\n\n /**\r\n * Actual drawings width\r\n *\r\n * @type {number}\r\n */\n this.drawWidth = this.element.width;\n\n /**\r\n * Actual drawings height\r\n *\r\n * @type {number}\r\n */\n this.drawHeight = this.element.height;\n\n /**\r\n * X-coordinate of drawings zero point\r\n *\r\n * @type {number}\r\n */\n this.drawX = this.drawWidth / 2;\n\n /**\r\n * Y-coordinate of drawings zero point\r\n *\r\n * @type {number}\r\n */\n this.drawY = this.drawHeight / 2;\n\n /**\r\n * Minimal side length in pixels of the drawing\r\n *\r\n * @type {number}\r\n */\n this.minSide = this.drawX < this.drawY ? this.drawX : this.drawY;\n\n this.elementClone.initialized = false;\n\n this.contextClone.translate(this.drawX, this.drawY);\n this.contextClone.save();\n\n this.context.translate(this.drawX, this.drawY);\n this.context.save();\n\n this.context.max = this.contextClone.max = this.minSide;\n this.context.maxRadius = this.contextClone.maxRadius = null;\n }\n\n /**\r\n * Destroys this object, removing the references from memory\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = SmartCanvas.collection.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n SmartCanvas.collection.splice(index, 1);\n }\n\n this.context.clearRect(-this.drawX, -this.drawY, this.drawWidth, this.drawHeight);\n\n // dereference all created elements\n this.context.max = null;\n delete this.context.max;\n\n this.context.maxRadius = null;\n delete this.context.maxRadius;\n\n this.context = null;\n this.contextClone = null;\n this.elementClone = null;\n this.element = null;\n\n /**\r\n * On canvas redraw event callback\r\n *\r\n * @type {function|null|undefined}\r\n */\n this.onRedraw = null;\n }\n\n /**\r\n * Commits the drawings\r\n */\n\n }, {\n key: 'commit',\n value: function commit() {\n var scale = SmartCanvas.pixelRatio;\n\n if (scale !== 1) {\n this.contextClone.scale(scale, scale);\n this.contextClone.save();\n }\n\n return this;\n }\n\n /**\r\n * Redraw this object\r\n */\n\n }, {\n key: 'redraw',\n value: function redraw() {\n this.init();\n\n /**\r\n * On canvas redraw event callback\r\n *\r\n * @type {function(): *}\r\n */\n this.onRedraw && this.onRedraw();\n\n return this;\n }\n\n /**\r\n * Returns current device pixel ratio\r\n *\r\n * @returns {number}\r\n */\n\n }], [{\n key: 'redraw',\n\n\n /**\r\n * Forces redraw all canvas in the current collection\r\n */\n value: function redraw() {\n var i = 0;\n var s = SmartCanvas.collection.length;\n\n for (; i < s; i++) {\n SmartCanvas.collection[i].redraw();\n }\n }\n }, {\n key: 'pixelRatio',\n get: function get() {\n /* istanbul ignore next */\n //noinspection JSUnresolvedVariable\n return window.devicePixelRatio || 1;\n }\n }]);\n\n return SmartCanvas;\n}();\n\nSmartCanvas.collection = [];\n\n/* istanbul ignore next: very browser-specific testing required to cover */\n//noinspection JSUnresolvedVariable\nif (window.matchMedia) {\n //noinspection JSUnresolvedFunction\n window.matchMedia('screen and (min-resolution: 2dppx)').addListener(SmartCanvas.redraw);\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Describes rendering target element. Can be either string identifier of\r\n * the element or the element itself.\r\n *\r\n * @typedef {HTMLElement|string} RenderTarget\r\n */\n\n/**\r\n * Highlight area definition.\r\n * It describes highlight area starting from value to value using\r\n * color. Color can be describes with hex, rgb or rgba value.\r\n *\r\n * @typedef {{ from: number, to: number, color: string}} Highlight\r\n */\n\n/**\r\n * Shared generic gauges options\r\n *\r\n * @type {{renderTo: RenderTarget, width: number, height: number, minValue: number, maxValue: number, value: number, units: string|boolean, majorTicks: number[]|string[], exactTicks: boolean, minorTicks: number, strokeTicks: boolean, animatedValue: boolean, animateOnInit: boolean, title: string|boolean, borders: boolean, valueInt: number, valueDec: number, majorTicksInt: number, majorTicksDec: number, animation: boolean, animationDuration: number, animationRule: string|AnimationRule, colorPlate: string, colorPlateEnd: string, colorMajorTicks: string, colorMinorTicks: string, colorStrokeTicks: string, colorTitle: string, colorUnits: string, colorNumbers: string, colorNeedle: string, colorNeedleEnd: string, colorValueText: string, colorValueTextShadow: string, colorBorderShadow: string, colorBorderOuter: string, colorBorderOuterEnd: string, colorBorderMiddle: string, colorBorderMiddleEnd: string, colorBorderInner: string, colorBorderInnerEnd: string, colorValueBoxRect: string, colorValueBoxRectEnd: string, colorValueBoxBackground: string, colorValueBoxShadow: string, colorNeedleShadowUp: string, colorNeedleShadowDown: string, needle: boolean, needleShadow: boolean, needleType: string, needleStart: number, needleEnd: number, needleWidth: number, borderOuterWidth: number, borderMiddleWidth: number, borderInnerWidth: number, borderShadowWidth: number, valueBox: boolean, valueBoxWidth: number, valueBoxStroke: number, valueText: string, valueTextShadow: boolean, valueBoxBorderRadius: number, highlights: Highlight[], highlightsWidth: number, fontNumbers: string, fontTitle: string, fontUnits: string, fontValue: string, fontTitleSize: number, fontValueSize: number, fontUnitsSize: number, fontNumbersSize: number, fontNumbersStyle: string, fontTitleStyle: string, fontUnitsStyle: string, fontValueStyle: string, fontNumbersWeight: string, fontTitleWeight: string, fontUnitsWeight: string, fontValueWeight: string, barWidth: number, barStrokeWidth: number, barProgress: boolean, colorBar: string, colorBarStroke: string, colorBarProgress: string, colorBarShadow: string, barShadow: number, listeners: object}} GenericOptions\r\n */\nvar GenericOptions = {\n // basic options\n renderTo: null,\n width: 0,\n height: 0,\n minValue: 0,\n maxValue: 100,\n value: 0,\n units: false,\n exactTicks: false,\n majorTicks: [0, 20, 40, 60, 80, 100],\n minorTicks: 10,\n strokeTicks: true,\n animatedValue: false,\n animateOnInit: false,\n title: false,\n borders: true,\n numbersMargin: 1,\n\n listeners: null,\n\n // number formats\n valueInt: 3,\n valueDec: 2,\n majorTicksInt: 1,\n majorTicksDec: 0,\n\n // animations\n animation: true,\n animationDuration: 500,\n animationRule: 'cycle',\n\n // colors\n colorPlate: '#fff',\n colorPlateEnd: '',\n colorMajorTicks: '#444',\n colorMinorTicks: '#666',\n colorStrokeTicks: '',\n colorTitle: '#888',\n colorUnits: '#888',\n colorNumbers: '#444',\n colorNeedle: 'rgba(240,128,128,1)',\n colorNeedleEnd: 'rgba(255,160,122,.9)',\n colorValueText: '#444',\n colorValueTextShadow: 'rgba(0,0,0,0.3)',\n colorBorderShadow: 'rgba(0,0,0,0.5)',\n colorBorderOuter: '#ddd',\n colorBorderOuterEnd: '#aaa',\n colorBorderMiddle: '#eee',\n colorBorderMiddleEnd: '#f0f0f0',\n colorBorderInner: '#fafafa',\n colorBorderInnerEnd: '#ccc',\n colorValueBoxRect: '#888',\n colorValueBoxRectEnd: '#666',\n colorValueBoxBackground: '#babab2',\n colorValueBoxShadow: 'rgba(0,0,0,1)',\n colorNeedleShadowUp: 'rgba(2,255,255,0.2)',\n colorNeedleShadowDown: 'rgba(188,143,143,0.45)',\n colorBarStroke: '#222',\n colorBar: '#ccc',\n colorBarProgress: '#888',\n colorBarShadow: '#000',\n\n fontNumbers: 'Arial',\n fontTitle: 'Arial',\n fontUnits: 'Arial',\n fontValue: 'Arial',\n\n fontNumbersSize: 20,\n fontTitleSize: 24,\n fontUnitsSize: 22,\n fontValueSize: 26,\n\n fontNumbersStyle: 'normal',\n fontTitleStyle: 'normal',\n fontUnitsStyle: 'normal',\n fontValueStyle: 'normal',\n\n fontNumbersWeight: 'normal',\n fontTitleWeight: 'normal',\n fontUnitsWeight: 'normal',\n fontValueWeight: 'normal',\n\n // needle\n needle: true,\n needleShadow: true,\n needleType: 'arrow',\n needleStart: 5,\n needleEnd: 85,\n needleWidth: 4,\n\n // borders\n borderOuterWidth: 3,\n borderMiddleWidth: 3,\n borderInnerWidth: 3,\n borderShadowWidth: 3,\n\n // value and highlights\n valueBox: true,\n valueBoxStroke: 5,\n valueBoxWidth: 0,\n valueText: '',\n valueTextShadow: true,\n valueBoxBorderRadius: 2.5,\n\n // highlights\n highlights: [{ from: 20, to: 60, color: '#eee' }, { from: 60, to: 80, color: '#ccc' }, { from: 80, to: 100, color: '#999' }],\n highlightsWidth: 15,\n\n // progress bar\n barWidth: 20, // percents\n barStrokeWidth: 0, // pixels\n barProgress: true,\n barShadow: 0\n};\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Gauge collections type.\r\n *\r\n * It is used ES5 declaration here, because babel\r\n * transpiles inheritance incorrectly in this case.\r\n *\r\n * @class Collection\r\n * @constructor\r\n */\nfunction Collection() {\n Array.prototype.constructor.apply(this, arguments);\n}\n\nCollection.prototype = Object.create(Array.prototype);\nCollection.prototype.constructor = Collection;\n\n/**\r\n * Returns gauge object by its identifier or index in the collection\r\n *\r\n * @param {string|number} id\r\n * @return {*}\r\n */\nCollection.prototype.get = function (id) {\n if (typeof id === 'string') {\n var i = 0;\n var s = this.length;\n\n for (; i < s; i++) {\n var canvas = this[i].options.renderTo.tagName ? this[i].options.renderTo :\n /* istanbul ignore next: should be tested with e2e tests */\n document.getElementById(this[i].options.renderTo || '');\n\n if (canvas.getAttribute('id') === id) {\n return this[i];\n }\n }\n } else if (typeof id === 'number') {\n return this[id];\n }\n\n return null;\n};\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\nvar version = '2.1.4';\n\nvar round = Math.round;\nvar abs = Math.abs;\n\nvar gauges = new Collection();\n\ngauges.version = version;\n\n/**\r\n * Basic abstract BaseGauge class implementing common functionality\r\n * for different type of gauges.\r\n *\r\n * It should not be instantiated directly but must be extended by a final\r\n * gauge implementation.\r\n *\r\n * @abstract\r\n * @example\r\n *\r\n * class MyCoolGauge extends BaseGauge {\r\n *\r\n * // theses methods below MUST be implemented:\r\n *\r\n * constructor(options) {\r\n * // ... do something with options\r\n * super(options);\r\n * // ... implement anything else\r\n * }\r\n *\r\n * draw() {\r\n * // ... some implementation here\r\n * return this;\r\n * }\r\n * }\r\n */\n\nvar BaseGauge = function (_EventEmitter) {\n _inherits(BaseGauge, _EventEmitter);\n\n /**\r\n * Fired each time gauge is initialized on a page\r\n *\r\n * @event BaseGauge#init\r\n */\n\n /**\r\n * Fired each time gauge scene is rendered\r\n *\r\n * @event BaseGauge#render\r\n */\n\n /**\r\n * Fired each time gauge object is destroyed\r\n *\r\n * @event BaseGauge#destroy\r\n */\n\n /**\r\n * Fired each time before animation is started on the gauge\r\n *\r\n * @event BaseGauge#animationStart\r\n */\n\n /**\r\n * Fired each time animation scene is complete\r\n *\r\n * @event BaseGauge#animate\r\n * @type {number} percent\r\n * @type {number} value\r\n */\n\n /**\r\n * Fired each time animation is complete on the gauge\r\n *\r\n * @event BaseGauge#animationEnd\r\n */\n\n /**\r\n * @event BaseGauge#value\r\n * @type {number} newValue\r\n * @type {number} oldValue\r\n */\n\n /**\r\n * @constructor\r\n * @abstract\r\n * @param {GenericOptions} options\r\n */\n function BaseGauge(options) {\n _classCallCheck(this, BaseGauge);\n\n var _this3 = _possibleConstructorReturn(this, (BaseGauge.__proto__ || Object.getPrototypeOf(BaseGauge)).call(this));\n\n var className = _this3.constructor.name;\n\n if (className === 'BaseGauge') {\n throw new TypeError('Attempt to instantiate abstract class!');\n }\n\n gauges.push(_this3);\n\n if (options.listeners) {\n Object.keys(options.listeners).forEach(function (event) {\n var handlers = options.listeners[event] instanceof Array ? options.listeners[event] : [options.listeners[event]];\n\n handlers.forEach(function (handler) {\n _this3.on(event, handler);\n });\n });\n }\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Gauges version string\r\n *\r\n * @type {string}\r\n */\n _this3.version = version;\n\n /**\r\n * Gauge type class\r\n *\r\n * @type {BaseGauge} type\r\n */\n _this3.type = ns[className] || BaseGauge;\n\n /**\r\n * True if gauge has been drawn for the first time, false otherwise.\r\n *\r\n * @type {boolean}\r\n */\n _this3.initialized = false;\n\n options.minValue = parseFloat(options.minValue);\n options.maxValue = parseFloat(options.maxValue);\n options.value = parseFloat(options.value) || 0;\n\n if (!options.borders) {\n options.borderInnerWidth = options.borderMiddleWidth = options.borderOuterWidth = 0;\n }\n\n if (!options.renderTo) {\n throw TypeError('Canvas element was not specified when creating ' + 'the Gauge object!');\n }\n\n var canvas = options.renderTo.tagName ? options.renderTo :\n /* istanbul ignore next: to be tested with e2e tests */\n document.getElementById(options.renderTo);\n\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw TypeError('Given gauge canvas element is invalid!');\n }\n\n options.width = parseFloat(options.width) || 0;\n options.height = parseFloat(options.height) || 0;\n\n if (!options.width || !options.height) {\n if (!options.width) options.width = canvas.parentNode ? canvas.parentNode.offsetWidth : canvas.offsetWidth;\n if (!options.height) options.height = canvas.parentNode ? canvas.parentNode.offsetHeight : canvas.offsetHeight;\n }\n\n /**\r\n * Gauge options\r\n *\r\n * @type {GenericOptions} options\r\n */\n _this3.options = options || {};\n\n if (_this3.options.animateOnInit) {\n _this3._value = _this3.options.value;\n _this3.options.value = _this3.options.minValue;\n }\n\n /**\r\n * @type {SmartCanvas} canvas\r\n */\n _this3.canvas = new SmartCanvas(canvas, options.width, options.height);\n _this3.canvas.onRedraw = _this3.draw.bind(_this3);\n\n /**\r\n * @type {Animation} animation\r\n */\n _this3.animation = new Animation(options.animationRule, options.animationDuration);\n return _this3;\n }\n\n /**\r\n * Sets new value for this gauge.\r\n * If gauge is animated by configuration it will trigger a proper animation.\r\n * Upsetting a value triggers gauge redraw.\r\n *\r\n * @param {number} value\r\n */\n\n\n _createClass(BaseGauge, [{\n key: 'update',\n\n\n /**\r\n * Updates gauge configuration options at runtime and redraws the gauge\r\n *\r\n * @param {RadialGaugeOptions} options\r\n * @returns {BaseGauge}\r\n */\n value: function update(options) {\n Object.assign(this.options, this.type.configure(options || {}));\n\n this.canvas.width = this.options.width;\n this.canvas.height = this.options.height;\n\n this.animation.rule = this.options.animationRule;\n this.animation.duration = this.options.animationDuration;\n\n this.canvas.redraw();\n\n return this;\n }\n\n /**\r\n * Performs destruction of this object properly\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = gauges.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n //noinspection JSUnresolvedFunction\n gauges.splice(index, 1);\n }\n\n this.canvas.destroy();\n this.canvas = null;\n\n this.animation.destroy();\n this.animation = null;\n\n this.emit('destroy');\n }\n\n /**\r\n * Returns gauges version string\r\n *\r\n * @return {string}\r\n */\n\n }, {\n key: 'draw',\n\n\n /**\r\n * Triggering gauge render on a canvas.\r\n *\r\n * @abstract\r\n * @returns {BaseGauge}\r\n */\n value: function draw() {\n if (this.options.animateOnInit && !this.initialized) {\n this.value = this._value;\n this.initialized = true;\n this.emit('init');\n }\n\n this.emit('render');\n\n return this;\n }\n\n /**\r\n * Inject given gauge object into DOM\r\n *\r\n * @param {string} type\r\n * @param {GenericOptions} options\r\n */\n\n }, {\n key: 'value',\n set: function set(value) {\n var _this4 = this;\n\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n var fromValue = this.options.value;\n\n if (value === fromValue) {\n return;\n }\n\n if (this.options.animation) {\n if (this.animation.frame) {\n // animation is already in progress -\n // forget related old animation value\n // @see https://github.com/Mikhus/canvas-gauges/issues/94\n this.options.value = this._value;\n\n // if there is no actual value change requested stop it\n if (this._value === value) {\n this.animation.cancel();\n delete this._value;\n return;\n }\n }\n\n /**\r\n * @type {number}\r\n * @access private\r\n */\n if (this._value === undefined) {\n this._value = value;\n }\n\n this.emit('animationStart');\n\n this.animation.animate(function (percent) {\n var newValue = fromValue + (value - fromValue) * percent;\n\n _this4.options.animatedValue && _this4.emit('value', newValue, _this4.value);\n\n _this4.options.value = newValue;\n\n _this4.draw();\n\n _this4.emit('animate', percent, _this4.options.value);\n }, function () {\n if (_this4._value !== undefined) {\n _this4.emit('value', _this4._value, _this4.value);\n _this4.options.value = _this4._value;\n delete _this4._value;\n }\n\n _this4.draw();\n _this4.emit('animationEnd');\n });\n } else {\n this.emit('value', value, this.value);\n this.options.value = value;\n this.draw();\n }\n }\n\n /**\r\n * Returns current value of the gauge\r\n *\r\n * @return {number}\r\n */\n ,\n get: function get() {\n return typeof this._value === 'undefined' ? this.options.value : this._value;\n }\n\n /**\r\n * Updates gauge options\r\n *\r\n * @param {*} options\r\n * @return {BaseGauge}\r\n * @access protected\r\n */\n\n }], [{\n key: 'configure',\n value: function configure(options) {\n return options;\n }\n }, {\n key: 'initialize',\n value: function initialize(type, options) {\n return new DomObserver(options, 'canvas', type);\n }\n\n /**\r\n * Initializes gauge from a given HTML element\r\n * (given element should be valid HTML canvas gauge definition)\r\n *\r\n * @param {HTMLElement} element\r\n */\n\n }, {\n key: 'fromElement',\n value: function fromElement(element) {\n var type = DomObserver.toCamelCase(element.getAttribute('data-type'));\n var attributes = element.attributes;\n var i = 0;\n var s = attributes.length;\n var options = {};\n\n if (!type) {\n return;\n }\n\n if (!/Gauge$/.test(type)) {\n type += 'Gauge';\n }\n\n for (; i < s; i++) {\n options[DomObserver.toCamelCase(attributes[i].name.replace(/^data-/, ''), false)] = DomObserver.parse(attributes[i].value);\n }\n\n new DomObserver(options, element.tagName, type).process(element);\n }\n\n /**\r\n * Ensures value is proper number\r\n *\r\n * @param {*} value\r\n * @param {number} min\r\n * @return {number}\r\n */\n\n }, {\n key: 'ensureValue',\n value: function ensureValue(value) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n value = parseFloat(value);\n\n if (isNaN(value) || !isFinite(value)) {\n value = parseFloat(min) || 0;\n }\n\n return value;\n }\n }, {\n key: 'version',\n get: function get() {\n return version;\n }\n }]);\n\n return BaseGauge;\n}(EventEmitter);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['BaseGauge'] = BaseGauge;\n ns['gauges'] = (window.document || {})['gauges'] = gauges;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * @access private\r\n * @typedef {CanvasRenderingContext2D|{max: number, maxRadius: number, barDimensions: object}} Canvas2DContext\r\n */\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Examines if a given error is something to throw or to ignore\r\n *\r\n * @param {Error} err\r\n */\nfunction verifyError(err) {\n // there is some unpredictable error in FF in some circumstances\n // which we found simply safe to ignore than to fight with it\n // noinspection JSUnresolvedVariable\n if (err instanceof DOMException && err.result === 0x8053000b) {\n return; // ignore it\n }\n\n throw err;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Prepares major ticks data\r\n *\r\n * @access private\r\n * @param {GenericOptions|{ tickSide: string }} options\r\n * @return {[boolean, boolean]}\r\n */\nfunction prepareTicks(options) {\n if (!(options.majorTicks instanceof Array)) {\n options.majorTicks = options.majorTicks ? [options.majorTicks] : [];\n }\n\n if (!options.majorTicks.length) {\n options.majorTicks.push(drawings.formatMajorTickNumber(options.minValue, options));\n options.majorTicks.push(drawings.formatMajorTickNumber(options.maxValue, options));\n }\n\n return [options.tickSide !== 'right', options.tickSide !== 'left'];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rounded corners rectangle\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @param {number} r\r\n */\nfunction roundRect(context, x, y, w, h, r) {\n context.beginPath();\n\n context.moveTo(x + r, y);\n context.lineTo(x + w - r, y);\n\n context.quadraticCurveTo(x + w, y, x + w, y + r);\n context.lineTo(x + w, y + h - r);\n\n context.quadraticCurveTo(x + w, y + h, x + w - r, y + h);\n context.lineTo(x + r, y + h);\n\n context.quadraticCurveTo(x, y + h, x, y + h - r);\n context.lineTo(x, y + r);\n\n context.quadraticCurveTo(x, y, x + r, y);\n\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Pads a given value with leading zeros using the given options\r\n *\r\n * @param {number} val\r\n * @param {RadialGaugeOptions|{valueInt: number, valueDec: number}} options\r\n * @returns {string}\r\n */\nfunction padValue(val, options) {\n var dec = options.valueDec;\n var int = options.valueInt;\n var i = 0;\n var s = void 0,\n strVal = void 0,\n n = void 0;\n\n val = parseFloat(val);\n n = val < 0;\n val = Math.abs(val);\n\n if (dec > 0) {\n strVal = val.toFixed(dec).toString().split('.');\n s = int - strVal[0].length;\n\n for (; i < s; ++i) {\n strVal[0] = '0' + strVal[0];\n }\n\n strVal = (n ? '-' : '') + strVal[0] + '.' + strVal[1];\n } else {\n strVal = Math.round(val).toString();\n s = int - strVal.length;\n\n for (; i < s; ++i) {\n strVal = '0' + strVal;\n }\n\n strVal = (n ? '-' : '') + strVal;\n }\n\n return strVal;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Formats a number for display on the dial's plate using the majorTicksFormat\r\n * config option.\r\n *\r\n * @param {number} num number to format\r\n * @param {object} options\r\n * @returns {string} formatted number\r\n */\nfunction formatMajorTickNumber(num, options) {\n var right = void 0,\n hasDec = false;\n\n // First, force the correct number of digits right of the decimal.\n if (options.majorTicksDec === 0) {\n right = Math.round(num).toString();\n } else {\n right = num.toFixed(options.majorTicksDec);\n }\n\n // Second, force the correct number of digits left of the decimal.\n if (options.majorTicksInt > 1) {\n // Does this number have a decimal?\n hasDec = ~right.indexOf('.');\n\n // Is this number a negative number?\n if (~right.indexOf('-')) {\n return '-' + [options.majorTicksInt + options.majorTicksDec + 2 + (hasDec ? 1 : 0) - right.length].join('0') + right.replace('-', '');\n } else {\n return [options.majorTicksInt + options.majorTicksDec + 1 + (hasDec ? 1 : 0) - right.length].join('0') + right;\n }\n }\n\n return right;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Transforms degrees to radians\r\n *\r\n * @param {number} degrees\r\n * @returns {number}\r\n */\nfunction radians(degrees) {\n return degrees * Math.PI / 180;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Calculates and returns radial point coordinates\r\n *\r\n * @param {number} radius\r\n * @param {number} angle\r\n * @returns {{x: number, y: number}}\r\n */\nfunction radialPoint(radius, angle) {\n return { x: -radius * Math.sin(angle), y: radius * Math.cos(angle) };\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Creates and returns linear gradient canvas object\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {string} colorFrom\r\n * @param {string} colorTo\r\n * @param {number} length\r\n * @param {boolean} [isVertical]\r\n * @param {number} [from]\r\n * @returns {CanvasGradient}\r\n */\nfunction linearGradient(context, colorFrom, colorTo, length) {\n var isVertical = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n var from = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n\n var grad = context.createLinearGradient(isVertical ? 0 : from, isVertical ? from : 0, isVertical ? 0 : length, isVertical ? length : 0);\n\n grad.addColorStop(0, colorFrom);\n grad.addColorStop(1, colorTo);\n\n return grad;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws the shadow if it was not drawn\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {GenericOptions} options\r\n * @param {boolean} shadowDrawn\r\n * @return {boolean}\r\n */\nfunction drawShadow(context, options) {\n var shadowDrawn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (shadowDrawn) {\n context.restore();\n return true;\n }\n\n context.save();\n\n var w = options.borderShadowWidth;\n\n if (w) {\n context.shadowBlur = w;\n context.shadowColor = options.colorBorderShadow;\n }\n\n return true;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge needle shadow\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawNeedleShadow(context, options) {\n if (!options.needleShadow) return;\n\n context.shadowOffsetX = 2;\n context.shadowOffsetY = 2;\n context.shadowBlur = 10;\n context.shadowColor = options.colorNeedleShadowDown;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Constructs font styles for canvas fonts\r\n *\r\n * @param {GenericOptions} options\r\n * @param {string} target\r\n * @param {number} baseSize\r\n */\nfunction font(options, target, baseSize) {\n return options['font' + target + 'Style'] + ' ' + options['font' + target + 'Weight'] + ' ' + options['font' + target + 'Size'] * baseSize + 'px ' + options['font' + target];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Resets some context settings\r\n *\r\n * @param {Canvas2DContext} context\r\n */\nfunction reset(context) {\n context.shadowOffsetX = null;\n context.shadowOffsetY = null;\n context.shadowBlur = null;\n context.shadowColor = '';\n context.strokeStyle = null;\n context.lineWidth = 0;\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Declares to drow value text shadow if configured\r\n *\r\n * @param context\r\n * @param options\r\n * @param offset\r\n * @param blur\r\n */\nfunction drawValueTextShadow(context, options, offset, blur) {\n if (options.valueTextShadow) {\n context.shadowOffsetX = offset;\n context.shadowOffsetY = offset;\n context.shadowBlur = blur;\n context.shadowColor = options.colorValueTextShadow;\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws value box at given position\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {GenericOptions} options\r\n * @param {number|string} value\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} max\r\n */\nfunction drawValueBox(context, options, value, x, y, max) {\n if (!options.valueBox) return;\n\n reset(context);\n\n var addLength = options.valueDec ? 1 + options.valueDec : 0;\n var maxValueWidth = '9'.repeat(Math.max.apply(null, [String(parseInt(value)).length + addLength].concat(options.majorTicks.map(function (val) {\n return String(parseInt(val, 10)).length + addLength;\n }))));\n var text = options.valueText || padValue(value, options);\n var tunit = max / 200;\n var runit = max / 100;\n var offset = 0.4 * runit;\n var blur = 1.2 * runit;\n\n context.font = font(options, 'Value', tunit);\n drawValueTextShadow(context, options, offset, blur);\n\n var tw = context.measureText(options.valueText ? text : '-' + padValue(Number(maxValueWidth), options)).width;\n\n reset(context);\n\n var th = parseFloat(options.fontValueSize) * tunit + offset + blur;\n var sw = runit * parseFloat(options.valueBoxStroke);\n var bmax = max * 2 - sw * 2;\n\n var bw = tw + 10 * runit;\n var bh = 1.1 * th + offset + blur;\n var br = runit * options.valueBoxBorderRadius;\n var obw = (parseFloat(options.valueBoxWidth) || 0) / 100 * bmax;\n\n obw > bw && (bw = obw);\n bw > bmax && (bw = bmax);\n\n var bx = x - bw / 2;\n var by = y - bh / 2;\n var gy = y - 5.75 * runit;\n\n context.beginPath();\n\n if (br) roundRect(context, bx, by, bw, bh, br);else context.rect(bx, by, bw, bh);\n\n if (sw) {\n var grd = context.createRadialGradient(x, gy, runit * 10, x, gy, runit * 20);\n\n grd.addColorStop(0, options.colorValueBoxRect);\n grd.addColorStop(1, options.colorValueBoxRectEnd);\n\n context.strokeStyle = grd;\n context.lineWidth = sw;\n context.stroke();\n }\n\n if (options.colorValueBoxShadow) {\n context.shadowBlur = 1.2 * runit;\n context.shadowColor = options.colorValueBoxShadow;\n }\n\n if (options.colorValueBoxBackground) {\n context.fillStyle = options.colorValueBoxBackground;\n context.fill();\n }\n\n context.closePath();\n context.restore();\n\n drawValueTextShadow(context, options, offset, blur);\n\n context.fillStyle = options.colorValueText;\n context.textAlign = 'center';\n context.textBaseline = 'alphabetic';\n context.fillText(text, bx + bw / 2, y + bh / 2 - th / 3);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns normalized value\r\n *\r\n * @param {GenericOptions} options\r\n * @return {{normal: number, indented: number}}\r\n */\nfunction normalizedValue(options) {\n var value = options.value;\n var min = options.minValue;\n var max = options.maxValue;\n var dt = (max - min) * 0.01;\n\n return {\n normal: value < min ? min : value > max ? max : value,\n indented: value < min ? min - dt : value > max ? max + dt : value\n };\n}\n\nvar drawings = {\n roundRect: roundRect,\n padValue: padValue,\n formatMajorTickNumber: formatMajorTickNumber,\n radians: radians,\n radialPoint: radialPoint,\n linearGradient: linearGradient,\n drawNeedleShadow: drawNeedleShadow,\n drawValueBox: drawValueBox,\n verifyError: verifyError,\n prepareTicks: prepareTicks,\n drawShadow: drawShadow,\n font: font,\n normalizedValue: normalizedValue\n};\n\ndrawings;\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\nvar PI = Math.PI;\nvar HPI = PI / 2;\n\n/**\r\n * Gauge configuration options\r\n *\r\n * @typedef {GenericOptions|{exactTicks: boolean, ticksAngle: number, startAngle: number, colorNeedleCircleOuter: string, colorNeedleCircleOuterEnd: string, colorNeedleCircleInner: string, colorNeedleCircleInnerEnd: string, needleCircleSize: number, needleCircleInner: boolean, needleCircleOuter: boolean, animationTarget: string, useMinPath: boolean}} RadialGaugeOptions\r\n */\n\n/**\r\n * Default gauge configuration options\r\n *\r\n * @access private\r\n * @type {RadialGaugeOptions}\r\n */\nvar defaultRadialGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n ticksAngle: 270,\n startAngle: 45,\n\n // colors\n colorNeedleCircleOuter: '#f0f0f0',\n colorNeedleCircleOuterEnd: '#ccc',\n colorNeedleCircleInner: '#e8e8e8',\n colorNeedleCircleInnerEnd: '#f5f5f5',\n\n // needle\n needleCircleSize: 10,\n needleCircleInner: true,\n needleCircleOuter: true,\n needleStart: 20,\n\n // custom animations\n animationTarget: 'needle', // 'needle' or 'plate'\n useMinPath: false,\n\n barWidth: 0\n});\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gradient-filled circle on a canvas\r\n *\r\n * @access private\r\n * @param {number} radius\r\n * @param {number} width\r\n * @param {Canvas2DContext} context\r\n * @param {string} start gradient start color\r\n * @param {string} end gradient end color\r\n */\nfunction drawRadialBorder(radius, width, context, start, end) {\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(radius), 0, PI * 2, true);\n context.lineWidth = width;\n context.strokeStyle = end ? drawings.linearGradient(context, start, end, radius) : start;\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns max radius without borders for the gauge\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n * @return {number}\r\n */\nfunction maxRadialRadius(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n\n if (!context.maxRadius) {\n context.maxRadius = context.max - options.borderShadowWidth - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio + (options.borderOuterWidth ? 0.5 : 0) + (options.borderMiddleWidth ? 0.5 : 0) + (options.borderInnerWidth ? 0.5 : 0);\n }\n\n return context.maxRadius;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge plate on the canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialPlate(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n var d0 = options.borderShadowWidth * pxRatio;\n var r0 = context.max - d0 - options.borderOuterWidth * pxRatio / 2;\n var r1 = r0 - options.borderOuterWidth * pxRatio / 2 - options.borderMiddleWidth * pxRatio / 2 + 0.5;\n var r2 = r1 - options.borderMiddleWidth * pxRatio / 2 - options.borderInnerWidth * pxRatio / 2 + 0.5;\n var r3 = maxRadialRadius(context, options);\n var grad = void 0;\n var shadowDrawn = false;\n\n context.save();\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r0, options.borderOuterWidth * pxRatio, context, options.colorBorderOuter, options.colorBorderOuterEnd);\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r1, options.borderMiddleWidth * pxRatio, context, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r2, options.borderInnerWidth * pxRatio, context, options.colorBorderInner, options.colorBorderInnerEnd);\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(r3), 0, PI * 2, true);\n\n if (options.colorPlateEnd) {\n grad = context.createRadialGradient(0, 0, r3 / 2, 0, 0, r3);\n grad.addColorStop(0, options.colorPlate);\n grad.addColorStop(1, options.colorPlateEnd);\n } else {\n grad = options.colorPlate;\n }\n\n context.fillStyle = grad;\n\n context.fill();\n context.closePath();\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge highlight areas on a canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialHighlights(context, options) {\n var hlWidth = context.max * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!hlWidth) return;\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options) - hlWidth / 2);\n var i = 0,\n s = options.highlights.length;\n var vd = (options.maxValue - options.minValue) / options.ticksAngle;\n\n context.save();\n\n for (; i < s; i++) {\n var hlt = options.highlights[i];\n\n context.beginPath();\n\n context.rotate(HPI);\n context.arc(0, 0, r, drawings.radians(options.startAngle + (hlt.from - options.minValue) / vd), drawings.radians(options.startAngle + (hlt.to - options.minValue) / vd), false);\n context.strokeStyle = hlt.color;\n context.lineWidth = hlWidth;\n context.stroke();\n context.closePath();\n\n context.restore();\n context.save();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws minor ticks bar on a canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialMinorTicks(context, options) {\n var radius = radialTicksRadius(context, options);\n var s = void 0,\n range = void 0,\n angle = void 0;\n var i = 0;\n var delta = 0;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n\n context.lineWidth = SmartCanvas.pixelRatio;\n context.strokeStyle = options.colorMinorTicks || options.colorStrokeTicks;\n\n context.save();\n\n if (options.exactTicks) {\n range = options.maxValue - options.minValue;\n s = minTicks ? range / minTicks : 0;\n delta = (options.majorTicks[0] % minTicks || 0) * ratio;\n } else {\n s = minTicks * (options.majorTicks.length - 1);\n }\n\n for (; i < s; ++i) {\n angle = options.startAngle + delta + i * (options.ticksAngle / s);\n\n context.rotate(drawings.radians(angle));\n\n context.beginPath();\n context.moveTo(0, radius);\n context.lineTo(0, radius - context.max * 0.075);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns ticks radius\r\n *\r\n * @access private\r\n * @param context\r\n * @param options\r\n * @return {number}\r\n */\nfunction radialTicksRadius(context, options) {\n var unit = context.max / 100;\n\n return maxRadialRadius(context, options) - 5 * unit - (options.barWidth ? (parseFloat(options.barStrokeWidth) || 0) * 2 + ((parseFloat(options.barWidth) || 0) + 5) * unit : 0);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge major ticks bar on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialMajorTicks(context, options) {\n drawings.prepareTicks(options);\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options));\n var i = void 0,\n colors = void 0;\n var s = options.majorTicks.length;\n var pixelRatio = SmartCanvas.pixelRatio;\n\n context.lineWidth = 2 * pixelRatio;\n context.save();\n\n colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(s).fill(options.colorStrokeTicks || options.colorMajorTicks);\n\n i = 0;\n for (; i < s; ++i) {\n context.strokeStyle = colors[i];\n context.rotate(drawings.radians(radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s)));\n\n context.beginPath();\n context.moveTo(0, r);\n context.lineTo(0, r - context.max * 0.15);\n closeStrokedPath(context);\n }\n\n if (options.strokeTicks) {\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n context.rotate(HPI);\n\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\nfunction radialNextAngle(options, i, s) {\n if (options.exactTicks) {\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n return options.startAngle + ratio * (i - options.minValue);\n }\n\n return options.startAngle + i * (options.ticksAngle / (s - 1));\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Strokes, closes path and restores previous context state\r\n *\r\n * @param {Canvas2DContext} context\r\n */\nfunction closeStrokedPath(context) {\n context.stroke();\n context.restore();\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar numbers\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialNumbers(context, options) {\n var radius = radialTicksRadius(context, options) - context.max * 0.15;\n var points = {};\n var i = 0;\n var s = options.majorTicks.length;\n var isAnimated = options.animationTarget !== 'needle';\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(s).fill(options.colorNumbers);\n\n var plateValueAngle = isAnimated ? -(options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle : 0;\n\n if (isAnimated) {\n context.save();\n context.rotate(-drawings.radians(plateValueAngle));\n }\n\n context.font = drawings.font(options, 'Numbers', context.max / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n\n for (; i < s; ++i) {\n var angle = plateValueAngle + radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s);\n var textWidth = context.measureText(options.majorTicks[i]).width;\n var textHeight = options.fontNumbersSize;\n var textRadius = Math.sqrt(textWidth * textWidth + textHeight * textHeight) / 2;\n var point = drawings.radialPoint(radius - textRadius - options.numbersMargin / 100 * context.max, drawings.radians(angle));\n\n if (angle === 360) angle = 0;\n\n if (points[angle]) {\n continue; //already drawn at this place, skipping\n }\n\n points[angle] = true;\n\n context.fillStyle = colors[i];\n context.fillText(options.majorTicks[i], point.x, point.y);\n }\n\n isAnimated && context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge title\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialTitle(context, options) {\n if (!options.title) return;\n\n context.save();\n context.font = drawings.font(options, 'Title', context.max / 200);\n context.fillStyle = options.colorTitle;\n context.textAlign = 'center';\n context.fillText(options.title, 0, -context.max / 4.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws units name on the gauge\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialUnits(context, options) {\n if (!options.units) return;\n\n context.save();\n context.font = drawings.font(options, 'Units', context.max / 200);\n context.fillStyle = options.colorUnits;\n context.textAlign = 'center';\n context.fillText(options.units, 0, context.max / 3.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge needle\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialNeedle(context, options) {\n if (!options.needle) return;\n\n var value = options.ticksAngle < 360 ? drawings.normalizedValue(options).indented : options.value;\n var max = maxRadialRadius(context, options);\n //noinspection JSUnresolvedFunction\n var r1 = abs(max / 100 * options.needleCircleSize);\n //noinspection JSUnresolvedFunction\n var r2 = abs(max / 100 * options.needleCircleSize * 0.75);\n //noinspection JSUnresolvedFunction\n var rIn = abs(max / 100 * options.needleEnd);\n //noinspection JSUnresolvedFunction\n var rStart = abs(options.needleStart ? max / 100 * options.needleStart : 0);\n //noinspection JSUnresolvedFunction\n var pad1 = max / 100 * options.needleWidth;\n var pad2 = max / 100 * options.needleWidth / 2;\n var pixelRatio = SmartCanvas.pixelRatio;\n var isFixed = options.animationTarget !== 'needle';\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n context.rotate(drawings.radians(isFixed ? options.startAngle : options.startAngle + (value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle));\n\n context.fillStyle = drawings.linearGradient(context, options.colorNeedle, options.colorNeedleEnd, rIn - rStart);\n\n if (options.needleType === 'arrow') {\n context.beginPath();\n context.moveTo(-pad2, -rStart);\n context.lineTo(-pad1, 0);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(pixelRatio, rIn);\n context.lineTo(pad1, 0);\n context.lineTo(pad2, -rStart);\n context.closePath();\n context.fill();\n\n context.beginPath();\n context.lineTo(-0.5 * pixelRatio, rIn);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(-pad1, 0);\n context.lineTo(-pad2, -rStart);\n context.lineTo(pad2 / 2 * pixelRatio - 2 * pixelRatio, -rStart);\n context.closePath();\n context.fillStyle = options.colorNeedleShadowUp;\n context.fill();\n } else {\n // simple line needle\n context.beginPath();\n context.moveTo(-pad2, rIn);\n context.lineTo(-pad2, rStart);\n context.lineTo(pad2, rStart);\n context.lineTo(pad2, rIn);\n context.closePath();\n context.fill();\n }\n\n if (options.needleCircleSize) {\n context.restore();\n\n drawings.drawNeedleShadow(context, options);\n\n if (options.needleCircleOuter) {\n context.beginPath();\n context.arc(0, 0, r1, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleOuter, options.colorNeedleCircleOuterEnd, r1);\n context.fill();\n context.closePath();\n }\n\n if (options.needleCircleInner) {\n context.beginPath();\n context.arc(0, 0, r2, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleInner, options.colorNeedleCircleInnerEnd, r2);\n context.fill();\n context.closePath();\n }\n\n context.restore();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge value box\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n * @param {number} value\r\n */\nfunction drawRadialValueBox(context, options, value) {\n drawings.drawValueBox(context, options, value, 0, context.max - context.max * 0.33, context.max);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge progress bar\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialProgressBar(context, options) {\n var unit = context.max / 100;\n var rMax = maxRadialRadius(context, options) - 5 * unit;\n var sw = parseFloat(options.barStrokeWidth) || 0;\n var w = (parseFloat(options.barWidth) || 0) * unit;\n var rMin = rMax - sw * 2 - w;\n var half = (rMax - rMin) / 2;\n var r = rMin + half;\n var delta = sw / r;\n var sa = options.startAngle;\n var ea = options.startAngle + options.ticksAngle;\n\n context.save();\n context.rotate(HPI);\n\n if (sw) {\n // draw stroke\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa) - delta, drawings.radians(ea) + delta, false);\n context.strokeStyle = options.colorBarStroke;\n context.lineWidth = half * 2;\n context.stroke();\n context.closePath();\n }\n\n if (w) {\n // draw bar\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(ea), false);\n context.strokeStyle = options.colorBar;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n\n if (options.barShadow) {\n // draw shadow\n context.beginPath();\n context.arc(0, 0, rMax, drawings.radians(sa), drawings.radians(ea), false);\n context.clip();\n\n context.beginPath();\n context.strokeStyle = options.colorBar;\n context.lineWidth = 1;\n context.shadowBlur = options.barShadow;\n context.shadowColor = options.colorBarShadow;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n context.arc(0, 0, rMax, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n context.stroke();\n context.closePath();\n\n context.restore();\n context.rotate(HPI);\n }\n\n // draw bar progress\n if (options.barProgress) {\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(sa + (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle), false);\n context.strokeStyle = options.colorBarProgress;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n }\n }\n\n context.restore();\n}\n\n/**\r\n * Find and return gauge value to display\r\n *\r\n * @param {RadialGauge} gauge\r\n */\nfunction displayValue(gauge) {\n if (gauge.options.animatedValue) {\n return gauge.options.value;\n }\n\n return gauge.value;\n}\n\n/**\r\n * Minimalistic HTML5 Canvas Gauge\r\n * @example\r\n * var gauge = new RadialGauge({\r\n * renderTo: 'gauge-id', // identifier of HTML canvas element or element itself\r\n * width: 400,\r\n * height: 400,\r\n * units: 'Km/h',\r\n * title: false,\r\n * value: 0,\r\n * minValue: 0,\r\n * maxValue: 220,\r\n * majorTicks: [\r\n * '0','20','40','60','80','100','120','140','160','180','200','220'\r\n * ],\r\n * minorTicks: 2,\r\n * strokeTicks: false,\r\n * highlights: [\r\n * { from: 0, to: 50, color: 'rgba(0,255,0,.15)' },\r\n * { from: 50, to: 100, color: 'rgba(255,255,0,.15)' },\r\n * { from: 100, to: 150, color: 'rgba(255,30,0,.25)' },\r\n * { from: 150, to: 200, color: 'rgba(255,0,225,.25)' },\r\n * { from: 200, to: 220, color: 'rgba(0,0,255,.25)' }\r\n * ],\r\n * colorPlate: '#222',\r\n * colorMajorTicks: '#f5f5f5',\r\n * colorMinorTicks: '#ddd',\r\n * colorTitle: '#fff',\r\n * colorUnits: '#ccc',\r\n * colorNumbers: '#eee',\r\n * colorNeedleStart: 'rgba(240, 128, 128, 1)',\r\n * colorNeedleEnd: 'rgba(255, 160, 122, .9)',\r\n * valueBox: true,\r\n * animationRule: 'bounce'\r\n * });\r\n * // draw initially\r\n * gauge.draw();\r\n * // animate\r\n * setInterval(() => {\r\n * gauge.value = Math.random() * -220 + 220;\r\n * }, 1000);\r\n */\n\nvar RadialGauge = function (_BaseGauge) {\n _inherits(RadialGauge, _BaseGauge);\n\n /**\r\n * Fired each time before gauge plate is drawn\r\n *\r\n * @event RadialGauge#beforePlate\r\n */\n\n /**\r\n * Fired each time before gauge highlight areas are drawn\r\n *\r\n * @event RadialGauge#beforeHighlights\r\n */\n\n /**\r\n * Fired each time before gauge minor ticks are drawn\r\n *\r\n * @event RadialGauge#beforeMinorTicks\r\n */\n\n /**\r\n * Fired each time before gauge major ticks are drawn\r\n *\r\n * @event RadialGauge#beforeMajorTicks\r\n */\n\n /**\r\n * Fired each time before gauge tick numbers are drawn\r\n *\r\n * @event RadialGauge#beforeNumbers\r\n */\n\n /**\r\n * Fired each time before gauge title is drawn\r\n *\r\n * @event RadialGauge#beforeTitle\r\n */\n\n /**\r\n * Fired each time before gauge units text is drawn\r\n *\r\n * @event RadialGauge#beforeUnits\r\n */\n\n /**\r\n * Fired each time before gauge progress bar is drawn\r\n *\r\n * @event RadialGauge#beforeProgressBar\r\n */\n\n /**\r\n * Fired each time before gauge value box is drawn\r\n *\r\n * @event RadialGauge#beforeValueBox\r\n */\n\n /**\r\n * Fired each time before gauge needle is drawn\r\n *\r\n * @event RadialGauge#beforeNeedle\r\n */\n\n /**\r\n * @constructor\r\n * @param {RadialGaugeOptions} options\r\n */\n function RadialGauge(options) {\n _classCallCheck(this, RadialGauge);\n\n options = Object.assign({}, defaultRadialGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (RadialGauge.__proto__ || Object.getPrototypeOf(RadialGauge)).call(this, RadialGauge.configure(options)));\n }\n\n /**\r\n * Checks and updates gauge options properly\r\n *\r\n * @param {*} options\r\n * @return {*}\r\n * @access protected\r\n */\n\n\n _createClass(RadialGauge, [{\n key: 'draw',\n\n\n /**\r\n * Triggering gauge render on a canvas.\r\n *\r\n * @returns {RadialGauge}\r\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref[0],\n y = _ref[1],\n w = _ref[2],\n h = _ref[3];\n\n var options = this.options;\n\n if (options.animationTarget === 'needle') {\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(context, options);\n this.emit('beforeHighlights');\n drawRadialHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(context, options);\n this.emit('beforeTitle');\n drawRadialTitle(context, options);\n this.emit('beforeUnits');\n drawRadialUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n this.emit('beforeNeedle');\n drawRadialNeedle(canvas.context, options);\n } else {\n var plateValueAngle = -drawings.radians((options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle);\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(canvas.context, options);\n\n canvas.context.rotate(plateValueAngle);\n\n // animated\n this.emit('beforeHighlights');\n drawRadialHighlights(canvas.context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(canvas.context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(canvas.context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(canvas.context, options);\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n\n // non-animated\n canvas.context.rotate(-plateValueAngle);\n canvas.context.save();\n\n if (!canvas.elementClone.initialized) {\n var _context = canvas.contextClone;\n\n // clear the cache\n _context.clearRect(x, y, w, h);\n _context.save();\n\n this.emit('beforeTitle');\n drawRadialTitle(_context, options);\n this.emit('beforeUnits');\n drawRadialUnits(_context, options);\n this.emit('beforeNeedle');\n drawRadialNeedle(_context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n }\n\n // value box animations\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n\n _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }, {\n key: 'value',\n\n\n /**\r\n * Sets the value for radial gauge\r\n *\r\n * @param {number} value\r\n */\n set: function set(value) {\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n if (this.options.animation && this.options.ticksAngle === 360 && this.options.useMinPath) {\n this._value = value;\n value = this.options.value + ((value - this.options.value) % 360 + 540) % 360 - 180;\n }\n\n _set(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', value, this);\n }\n\n /**\r\n * Returns current gauge value\r\n *\r\n * @return {number}\r\n */\n ,\n get: function get() {\n return _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', this);\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n if (options.barWidth > 50) options.barWidth = 50;\n\n /* istanbul ignore if */\n if (isNaN(options.startAngle)) options.startAngle = 45;\n /* istanbul ignore if */\n if (isNaN(options.ticksAngle)) options.ticksAngle = 270;\n\n /* istanbul ignore if */\n if (options.ticksAngle > 360) options.ticksAngle = 360;\n /* istanbul ignore if */\n if (options.ticksAngle < 0) options.ticksAngle = 0;\n\n /* istanbul ignore if */\n if (options.startAngle < 0) options.startAngle = 0;\n /* istanbul ignore if */\n if (options.startAngle > 360) options.startAngle = 360;\n\n return options;\n }\n }]);\n\n return RadialGauge;\n}(BaseGauge);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['RadialGauge'] = RadialGauge;\n}\n\nBaseGauge.initialize('RadialGauge', defaultRadialGaugeOptions);\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Linear gauge configuration options\r\n *\r\n * @typedef {GenericOptions|{borderRadius: number, barBeginCircle: number, tickSide: string, needleSide: string, numberSide: string, ticksWidth: number, ticksWidthMinor: number, ticksPadding: number, barLength: number, colorBarEnd: string, colorBarProgressEnd: string}} LinearGaugeOptions\r\n */\n\n/**\r\n * Default linear gauge configuration options\r\n *\r\n * @type {LinearGaugeOptions}\r\n */\nvar defaultLinearGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n borderRadius: 0,\n // width: 150,\n // height: 400,\n\n // bar\n barBeginCircle: 30, // percents\n colorBarEnd: '',\n colorBarProgressEnd: '',\n\n needleWidth: 6,\n\n tickSide: 'both', // available: 'left', 'right', 'both'\n needleSide: 'both', // available: 'left', 'right', 'both'\n\n numberSide: 'both', // available: 'left', 'right', 'both'\n\n ticksWidth: 10,\n ticksWidthMinor: 5,\n ticksPadding: 5,\n barLength: 85,\n fontTitleSize: 26,\n\n highlightsWidth: 10\n});\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rectangle on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\r\n * @param {number} x x-coordinate of the top-left corner\r\n * @param {number} y y-coordinate of the top-left corner\r\n * @param {number} w width of the rectangle\r\n * @param {number} h height of the rectangle\r\n * @param {string} colorStart base fill color of the rectangle\r\n * @param {string} [colorEnd] gradient color of the rectangle\r\n */\nfunction drawRectangle(context, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.fillStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, w > h ? w : h, h > w, w > h ? x : y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rectangle on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} width width of the border\r\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\r\n * @param {number} x x-coordinate of the top-left corner\r\n * @param {number} y y-coordinate of the top-left corner\r\n * @param {number} w width of the rectangle\r\n * @param {number} h height of the rectangle\r\n * @param {string} colorStart base fill color of the rectangle\r\n * @param {string} [colorEnd] gradient color of the rectangle\r\n */\nfunction drawLinearBorder(context, width, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.lineWidth = width;\n context.strokeStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, h, true, y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge plate\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearPlate(context, options, x, y, w, h) {\n var pxRatio = SmartCanvas.pixelRatio;\n context.save();\n\n var r = options.borderRadius * pxRatio;\n var w1 = w - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var w2 = w1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var w3 = w2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var w4 = w3 - options.borderInnerWidth * pxRatio;\n\n var h1 = h - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var h2 = h1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var h3 = h2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var h4 = h3 - options.borderInnerWidth * pxRatio;\n\n var x2 = x - (w2 - w1) / 2;\n var x3 = x2 - (w3 - w2) / 2;\n var x4 = x3 - (w4 - w3) / 2;\n\n var y2 = y - (h2 - h1) / 2;\n var y3 = y2 - (h3 - h2) / 2;\n var y4 = y3 - (h4 - h3) / 2;\n var aliasingOffset = 0;\n var shadowDrawn = false;\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderOuterWidth * pxRatio, r, x + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, y + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, w1, h1, options.colorBorderOuter, options.colorBorderOuterEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderMiddleWidth * pxRatio, r -= 1 + aliasingOffset * 2, x2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, y2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, w2 + aliasingOffset * 2, h2 + aliasingOffset * 2, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderInnerWidth * pxRatio, r -= 1 + aliasingOffset * 2, x3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, y3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, w3 + aliasingOffset * 2, h3 + aliasingOffset * 2, options.colorBorderInner, options.colorBorderInnerEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n drawRectangle(context, r, x4, y4, w4 + aliasingOffset * 2, h4 + aliasingOffset * 2, options.colorPlate, options.colorPlateEnd);\n\n context.restore();\n\n return [x4, y4, w4, h4];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Calculates and returns linear gauge base bar dimensions.\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions|{barStrokeWidth: number, barBeginCircle: number, barWidth: number, hasLeft: boolean, hasRight: boolean}} options\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @return {{isVertical: boolean, width: number, length: number, barWidth: number, barLength: number, strokeWidth: number, barMargin: number, radius: number, x0: number, y0: number, barOffset: number, titleMargin: number, unitsMargin: number, X: number, Y: number, baseX: number, baseY: number, ticksPadding: number}}\r\n */\nfunction barDimensions(context, options, x, y, w, h) {\n var pixelRatio = SmartCanvas.pixelRatio;\n var isVertical = h >= w;\n var width = isVertical ? w * 0.85 : h;\n var length = isVertical ? h : w;\n\n //noinspection JSUnresolvedFunction\n x = isVertical ? round(x + (w - width) / 2) : x;\n\n var hasTitle = !!options.title;\n var hasUnits = !!options.units;\n var hasValue = !!options.valueBox;\n\n var titleMargin = void 0;\n var unitsMargin = void 0;\n var valueMargin = void 0;\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n unitsMargin = round(length * 0.05);\n //noinspection JSUnresolvedFunction\n titleMargin = round(length * 0.075);\n //noinspection JSUnresolvedFunction\n valueMargin = round(length * 0.11);\n\n if (hasTitle) {\n length -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) length -= unitsMargin;\n if (hasValue) length -= valueMargin;\n } else {\n //noinspection JSUnresolvedFunction\n unitsMargin = titleMargin = round(width * 0.15);\n\n if (hasTitle) {\n width -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) width -= unitsMargin;\n }\n\n var strokeWidth = options.barStrokeWidth * 2;\n //noinspection JSUnresolvedFunction\n var radius = options.barBeginCircle ? round(width * options.barBeginCircle / 200 - strokeWidth / 2) : 0;\n //noinspection JSUnresolvedFunction\n var barWidth = round(width * options.barWidth / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barLength = round(length * options.barLength / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barMargin = round((length - barLength) / 2);\n\n // coordinates for arc of the bar if configured\n //noinspection JSUnresolvedFunction\n var x0 = round(x + (isVertical ? width / 2 : barMargin + radius));\n //noinspection JSUnresolvedFunction\n var y0 = round(y + (isVertical ? length - barMargin - radius + strokeWidth / 2 : width / 2));\n var dx = isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n var dy = !isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n\n //noinspection JSUndefinedPropertyAssignment\n context.barDimensions = {\n isVertical: isVertical,\n width: width,\n length: length,\n barWidth: barWidth,\n barLength: barLength,\n strokeWidth: strokeWidth,\n barMargin: barMargin,\n radius: radius,\n pixelRatio: pixelRatio,\n barOffset: null,\n titleMargin: hasTitle ? titleMargin : 0,\n unitsMargin: hasUnits ? unitsMargin : 0,\n get ticksLength() {\n return this.barLength - this.barOffset - this.strokeWidth;\n },\n X: x + dx,\n Y: y + dy,\n x0: x0 + dx,\n y0: y0 + dy,\n baseX: x,\n baseY: y,\n ticksPadding: options.ticksPadding / 100\n };\n\n return context.barDimensions;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws bar shape from the given options on a given canvas context\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {string} type\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearBarShape(context, options, type, x, y, w, h) {\n var _barDimensions = barDimensions(context, options, x, y, w, h),\n isVertical = _barDimensions.isVertical,\n width = _barDimensions.width,\n barWidth = _barDimensions.barWidth,\n barLength = _barDimensions.barLength,\n strokeWidth = _barDimensions.strokeWidth,\n barMargin = _barDimensions.barMargin,\n radius = _barDimensions.radius,\n x0 = _barDimensions.x0,\n y0 = _barDimensions.y0,\n X = _barDimensions.X,\n Y = _barDimensions.Y;\n\n var fullBarLength = barLength;\n\n context.save();\n context.beginPath();\n\n if (options.barBeginCircle) {\n var direction = drawings.radians(isVertical ? 270 : 0);\n var alpha = Math.asin(barWidth / 2 / radius);\n var cosAlpha = Math.cos(alpha);\n var sinAlpha = Math.sin(alpha);\n\n var x1 = x0 + (isVertical ? radius * sinAlpha : radius * cosAlpha - strokeWidth / 2);\n var y1 = isVertical ? y0 - radius * cosAlpha : y0 + radius * sinAlpha;\n //noinspection JSUnresolvedFunction\n var cutRadius = isVertical ? abs(y1 - y0) : abs(x1 - x0);\n\n //noinspection JSUnresolvedFunction\n context.barDimensions.barOffset = round(cutRadius + radius);\n\n // bottom point\n //noinspection JSUnresolvedFunction\n var x2 = isVertical ? round(x0 - radius * sinAlpha) : x1;\n //noinspection JSUnresolvedFunction\n var y2 = isVertical ? y1 : round(y0 - radius * sinAlpha);\n\n if (type === 'progress') {\n barLength = context.barDimensions.barOffset + (barLength - context.barDimensions.barOffset) * (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue);\n }\n\n // bar ends at\n //noinspection JSUnresolvedFunction\n var x3 = round(x1 + barLength - context.barDimensions.barOffset + strokeWidth / 2); // h\n //noinspection JSUnresolvedFunction\n var y3 = round(y1 - barLength + context.barDimensions.barOffset - strokeWidth / 2); // v\n\n context.arc(x0, y0, radius, direction + alpha, direction - alpha);\n\n if (isVertical) {\n context.moveTo(x1, y2);\n context.lineTo(x1, y3);\n context.lineTo(x2, y3);\n context.lineTo(x2, y2);\n } else {\n context.moveTo(x1, y2);\n context.lineTo(x3, y2);\n context.lineTo(x3, y1);\n context.lineTo(x1, y1);\n }\n } else {\n // simply rectangle\n //noinspection JSUnresolvedFunction\n var rx = round(isVertical ? X + (width - barWidth) / 2 : X + barMargin);\n //noinspection JSUnresolvedFunction\n var ry = round(isVertical ? Y + barLength + barMargin : Y + (width - barWidth) / 2);\n\n if (type === 'progress') {\n barLength *= (options.value - options.minValue) / (options.maxValue - options.minValue);\n }\n\n if (isVertical) context.rect(rx, ry, barWidth, -barLength);else context.rect(rx, ry, barLength, barWidth);\n }\n\n if (type !== 'progress' && options.barStrokeWidth) {\n context.lineWidth = strokeWidth;\n context.strokeStyle = options.colorBarStroke;\n //context.lineJoin = 'round';\n context.stroke();\n }\n\n if (type !== 'progress' && options.colorBar) {\n context.fillStyle = options.colorBarEnd ? drawings.linearGradient(context, options.colorBar, options.colorBarEnd, barLength, isVertical, isVertical ? Y : X) : options.colorBar;\n context.fill();\n } else if (type === 'progress' && options.colorBarProgress) {\n context.fillStyle = options.colorBarProgressEnd ? drawings.linearGradient(context, options.colorBarProgress, options.colorBarProgressEnd, fullBarLength, isVertical, isVertical ? Y : X) : options.colorBarProgress;\n context.fill();\n }\n\n context.closePath();\n\n // fix dimensions for further usage\n if (options.barBeginCircle) context.barDimensions.radius += strokeWidth;\n\n context.barDimensions.barWidth += strokeWidth;\n context.barDimensions.barLength += strokeWidth;\n}\n\n/**\r\n * Draws gauge bar\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x x-coordinate of the top-left corner of the gauge\r\n * @param {number} y y-coordinate of the top-left corner of the gauge\r\n * @param {number} w width of the gauge\r\n * @param {number} h height of the gauge\r\n */\nfunction drawLinearBar(context, options, x, y, w, h) {\n drawLinearBarShape(context, options, '', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Helper function to calculate bar ticks presence on the sides\r\n *\r\n * @param {string} notWhich\r\n * @param {LinearGaugeOptions} options\r\n * @return {boolean}\r\n */\nfunction hasTicksBar(notWhich, options) {\n return options.needleSide !== notWhich || options.tickSide !== notWhich || options.numberSide !== notWhich;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar progress\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x x-coordinate of the top-left corner of the gauge\r\n * @param {number} y y-coordinate of the top-left corner of the gauge\r\n * @param {number} w width of the gauge\r\n * @param {number} h height of the gauge\r\n */\nfunction drawLinearBarProgress(context, options, x, y, w, h) {\n options.barProgress && drawLinearBarShape(context, options, 'progress', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar highlighted areas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearBarHighlights(context, options) {\n var _context$barDimension = context.barDimensions,\n isVertical = _context$barDimension.isVertical,\n width = _context$barDimension.width,\n length = _context$barDimension.length,\n barWidth = _context$barDimension.barWidth,\n barOffset = _context$barDimension.barOffset,\n barMargin = _context$barDimension.barMargin,\n X = _context$barDimension.X,\n Y = _context$barDimension.Y,\n ticksLength = _context$barDimension.ticksLength,\n ticksPadding = _context$barDimension.ticksPadding;\n\n var hlWidth = width * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!options.highlights || !hlWidth) return;\n\n var hasLeft = options.tickSide !== 'right';\n var hasRight = options.tickSide !== 'left';\n var i = 0;\n var s = options.highlights.length;\n var tickOffset = (width - barWidth) / 2;\n var interval = options.maxValue - options.minValue;\n //noinspection JSUnresolvedFunction\n var eX = round(isVertical ? X + tickOffset : X + barMargin + barOffset);\n var eH = hlWidth;\n var eY = isVertical ? Y + length - barMargin - barOffset : Y + tickOffset;\n //noinspection JSUnresolvedFunction\n var hLeft = round((options.ticksWidth / 100 + ticksPadding) * width) + (hlWidth - options.ticksWidth / 100 * width);\n //noinspection JSUnresolvedFunction\n var hRight = round(barWidth + ticksPadding * width);\n\n context.save();\n\n for (; i < s; i++) {\n var entry = options.highlights[i];\n //noinspection JSUnresolvedFunction\n var eStart = ticksLength * abs(options.minValue - entry.from) / interval;\n //noinspection JSUnresolvedFunction\n var eW = ticksLength * abs((entry.to - entry.from) / interval);\n\n context.beginPath();\n context.fillStyle = entry.color;\n\n if (isVertical) {\n if (hasLeft) context.rect(eX - hLeft, eY - eStart, eH, -eW);\n\n if (hasRight) context.rect(eX + hRight, eY - eStart, eH, -eW);\n } else {\n if (hasLeft) context.rect(eX + eStart, eY - hLeft, eW, eH);\n\n if (hasRight) context.rect(eX + eStart, eY + hRight, eW, eH);\n }\n\n context.fill();\n context.closePath();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws a tick line on a linear gauge\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param x1\r\n * @param y1\r\n * @param x2\r\n * @param y2\r\n */\nfunction drawLinearTick(context, x1, y1, x2, y2) {\n context.beginPath();\n\n context.moveTo(x1, y1);\n context.lineTo(x2, y2);\n context.stroke();\n\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {string} color\r\n * @param {number[]} ticks\r\n * @param {number} minVal\r\n * @param {number} maxVal\r\n * @param {boolean} hasLeft\r\n * @param {boolean} hasRight\r\n * @param {number} lineWidth\r\n * @param {number} lineLength\r\n */\nfunction drawLinearTicks(context, color, ticks, minVal, maxVal, hasLeft, hasRight, lineWidth, lineLength) {\n var _context$barDimension2 = context.barDimensions,\n isVertical = _context$barDimension2.isVertical,\n length = _context$barDimension2.length,\n barWidth = _context$barDimension2.barWidth,\n barOffset = _context$barDimension2.barOffset,\n barMargin = _context$barDimension2.barMargin,\n pixelRatio = _context$barDimension2.pixelRatio,\n width = _context$barDimension2.width,\n X = _context$barDimension2.X,\n Y = _context$barDimension2.Y,\n ticksLength = _context$barDimension2.ticksLength,\n ticksPadding = _context$barDimension2.ticksPadding;\n\n var tickOffset = (width - barWidth) / 2;\n var tickX = void 0,\n tickY = void 0;\n var i = 0;\n var s = ticks.length;\n var val = void 0;\n var tickLen = lineLength * width;\n var tickLeft = tickOffset - ticksPadding * width;\n var tickRight = tickOffset + barWidth + tickLen + ticksPadding * width;\n var colors = color instanceof Array ? color : new Array(ticks.length).fill(color);\n\n context.lineWidth = lineWidth * pixelRatio;\n context.save();\n\n var ratio = ticksLength / (maxVal - minVal);\n for (; i < s; i++) {\n val = ticks[i];\n context.strokeStyle = colors[i];\n\n if (isVertical) {\n tickY = Y + length - barMargin - barOffset + (minVal - val) * ratio;\n\n if (hasLeft) {\n tickX = X + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n\n if (hasRight) {\n tickX = X + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n } else {\n tickX = X + barMargin + barOffset - (minVal - val) * ratio;\n\n if (hasLeft) {\n tickY = Y + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, tickX, round(tickY - tickLen));\n }\n\n if (hasRight) {\n tickY = Y + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, round(tickY), tickX, tickY - tickLen);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws major ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMajorTicks(context, options) {\n var _drawings$prepareTick = drawings.prepareTicks(options),\n _drawings$prepareTick2 = _slicedToArray(_drawings$prepareTick, 2),\n hasLeft = _drawings$prepareTick2[0],\n hasRight = _drawings$prepareTick2[1];\n\n var lineWidth = 2;\n var valuePerNonExactTick = (options.maxValue - options.minValue) / (options.majorTicks.length - 1);\n var colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(options.majorTicks.length).fill(options.colorStrokeTicks || options.colorMajorTicks);\n var ticks = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n\n drawLinearTicks(context, colors, ticks, options.minValue, options.maxValue, hasLeft, hasRight, lineWidth, options.ticksWidth / 100);\n\n if (options.strokeTicks) {\n var _context$barDimension3 = context.barDimensions,\n isVertical = _context$barDimension3.isVertical,\n length = _context$barDimension3.length,\n width = _context$barDimension3.width,\n barWidth = _context$barDimension3.barWidth,\n barMargin = _context$barDimension3.barMargin,\n barOffset = _context$barDimension3.barOffset,\n X = _context$barDimension3.X,\n Y = _context$barDimension3.Y,\n ticksLength = _context$barDimension3.ticksLength,\n pixelRatio = _context$barDimension3.pixelRatio,\n ticksPadding = _context$barDimension3.ticksPadding;\n\n var rightTicks = (width - barWidth) / 2 + barWidth + ticksPadding * width;\n var leftTicks = (width - barWidth) / 2 - ticksPadding * width;\n var sX = void 0,\n sY = void 0,\n eX = void 0,\n eY = void 0;\n\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n\n lineWidth *= pixelRatio;\n\n if (isVertical) {\n sY = Y + length - barMargin - barOffset + lineWidth / 2;\n eY = sY - ticksLength - lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n } else {\n sX = X + barMargin + barOffset - lineWidth / 2;\n eX = sX + ticksLength + lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws ticks stroke\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n */\nfunction drawLinearTickStroke(context, sX, sY, eX, eY) {\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws minor ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMinorTicks(context, options) {\n var _drawings$prepareTick3 = drawings.prepareTicks(options),\n _drawings$prepareTick4 = _slicedToArray(_drawings$prepareTick3, 2),\n hasLeft = _drawings$prepareTick4[0],\n hasRight = _drawings$prepareTick4[1];\n\n var ticks = [];\n var i = options.minValue;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var valuePerNonExactTick = minTicks ? (options.maxValue - options.minValue) / (minTicks * (options.majorTicks.length - 1)) : 0;\n\n if (minTicks) {\n if (options.exactTicks) {\n var delta = options.majorTicks[0] % minTicks || 0;\n\n for (; i < options.maxValue; i += minTicks) {\n ticks.push(delta + i);\n }\n } else {\n for (; i < options.maxValue; i += valuePerNonExactTick) {\n ticks.push(i);\n }\n }\n }\n\n drawLinearTicks(context, options.colorMinorTicks || options.colorStrokeTicks, ticks, options.minValue, options.maxValue, hasLeft, hasRight, 1, options.ticksWidthMinor / 100);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws major tick numbers\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMajorTicksNumbers(context, options) {\n var _context$barDimension4 = context.barDimensions,\n isVertical = _context$barDimension4.isVertical,\n length = _context$barDimension4.length,\n width = _context$barDimension4.width,\n barWidth = _context$barDimension4.barWidth,\n barMargin = _context$barDimension4.barMargin,\n barOffset = _context$barDimension4.barOffset,\n X = _context$barDimension4.X,\n Y = _context$barDimension4.Y,\n ticksLength = _context$barDimension4.ticksLength,\n ticksPadding = _context$barDimension4.ticksPadding;\n\n var range = options.maxValue - options.minValue;\n var valuePerNonExactTick = range / (options.majorTicks.length - 1);\n var tickValues = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n var ticks = tickValues.length;\n var hasLeft = options.numberSide !== 'right';\n var hasRight = options.numberSide !== 'left';\n var textHeight = options.fontNumbersSize * width / 200;\n var i = 0;\n var ticksWidth = (options.ticksWidth / 100 + ticksPadding * 2) * width;\n var numLeft = (width - barWidth) / 2 - ticksWidth;\n var numRight = (width - barWidth) / 2 + barWidth + ticksWidth;\n var textX = void 0,\n textY = void 0,\n textWidth = void 0,\n numberOffset = void 0,\n tick = void 0;\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(ticks).fill(options.colorNumbers);\n var textMargin = options.numbersMargin / 100 * width;\n\n context.font = drawings.font(options, 'Numbers', width / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n\n for (; i < ticks; i++) {\n context.fillStyle = colors[i];\n tick = options.majorTicks[i];\n numberOffset = options.exactTicks ? ticksLength * ((tickValues[i] - options.minValue) / range) : i * ticksLength / (ticks - 1);\n\n if (isVertical) {\n textY = Y + length - barMargin - barOffset - numberOffset + textHeight / 3;\n\n if (hasLeft) {\n context.textAlign = 'right';\n context.fillText(tick, X + numLeft - textMargin, textY);\n }\n\n if (hasRight) {\n context.textAlign = 'left';\n context.fillText(tick, X + numRight + textMargin, textY);\n }\n } else {\n textWidth = context.measureText(tick).width;\n textX = X + barMargin + barOffset + numberOffset;\n\n if (hasLeft) {\n context.fillText(tick, textX, Y + numLeft - textMargin);\n }\n\n if (hasRight) {\n context.fillText(tick, textX, Y + numRight + textHeight + textMargin);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge title\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearTitle(context, options) {\n if (!options.title) return;\n\n var _context$barDimension5 = context.barDimensions,\n isVertical = _context$barDimension5.isVertical,\n width = _context$barDimension5.width,\n length = _context$barDimension5.length,\n baseX = _context$barDimension5.baseX,\n baseY = _context$barDimension5.baseY,\n titleMargin = _context$barDimension5.titleMargin;\n\n var textHeight = options.fontTitleSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + titleMargin / 2 - (isVertical ? textHeight : textHeight / 2) - 0.025 * (isVertical ? length : width));\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorTitle;\n context.font = drawings.font(options, 'Title', width / 200);\n context.lineWidth = 0;\n context.fillText(options.title, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge units\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearUnits(context, options) {\n if (!options.units) return;\n\n var _context$barDimension6 = context.barDimensions,\n isVertical = _context$barDimension6.isVertical,\n width = _context$barDimension6.width,\n length = _context$barDimension6.length,\n baseX = _context$barDimension6.baseX,\n baseY = _context$barDimension6.baseY,\n unitsMargin = _context$barDimension6.unitsMargin;\n\n var textHeight = options.fontUnitsSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + (isVertical ? length : width) + unitsMargin / 2 - textHeight / 2);\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorUnits;\n context.font = drawings.font(options, 'Units', width / 200);\n context.lineWidth = 0;\n context.fillText(options.units, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge needles\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearBarNeedle(context, options) {\n if (!options.needle) return;\n\n var _context$barDimension7 = context.barDimensions,\n isVertical = _context$barDimension7.isVertical,\n width = _context$barDimension7.width,\n length = _context$barDimension7.length,\n barWidth = _context$barDimension7.barWidth,\n barOffset = _context$barDimension7.barOffset,\n barMargin = _context$barDimension7.barMargin,\n ticksLength = _context$barDimension7.ticksLength,\n X = _context$barDimension7.X,\n Y = _context$barDimension7.Y,\n ticksPadding = _context$barDimension7.ticksPadding;\n\n var hasLeft = options.needleSide !== 'right';\n var hasRight = options.needleSide !== 'left';\n var position = ticksLength * (drawings.normalizedValue(options).indented - options.minValue) / (options.maxValue - options.minValue);\n var tickWidth = (options.ticksWidth / 100 + ticksPadding) * width;\n var baseLength = barWidth / 2 + tickWidth;\n var needleLength = baseLength * (options.needleEnd / 100);\n var sX = void 0,\n eX = void 0,\n sY = void 0,\n eY = void 0;\n var draw = options.needleType.toLowerCase() === 'arrow' ? drawLinearArrowNeedle : drawLinearLineNeedle;\n var barStart = (width - barWidth) / 2;\n var needleStart = baseLength * (options.needleStart / 100);\n var nLeft = barStart - tickWidth - needleStart;\n var nRight = barStart + barWidth + tickWidth + needleStart;\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + length - barMargin - barOffset - position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nLeft);\n eX = sX + needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nRight);\n eX = sX - needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength, true);\n }\n } else {\n //noinspection JSUnresolvedFunction\n sX = round(X + barMargin + barOffset + position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nLeft);\n eY = sY + needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nRight);\n eY = sY - needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength, true);\n }\n }\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns needle color style\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n * @return {CanvasGradient|string}\r\n */\nfunction needleStyle(context, options, length, isRight) {\n return options.colorNeedleEnd ? drawings.linearGradient(context, isRight ? options.colorNeedleEnd : options.colorNeedle, isRight ? options.colorNeedle : options.colorNeedleEnd, length, !context.barDimensions.isVertical) : options.colorNeedle;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws line needle shape\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n */\nfunction drawLinearLineNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n context.lineWidth = options.needleWidth;\n context.strokeStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws arrow needle shape\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n */\nfunction drawLinearArrowNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n //noinspection JSUnresolvedFunction\n var peakLength = round(length * 0.4);\n var bodyLength = length - peakLength;\n var isVertical = sX === eX;\n var halfWidth = options.needleWidth / 2;\n\n context.fillStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n\n if (isVertical) {\n if (sY > eY) bodyLength *= -1;\n\n context.moveTo(sX - halfWidth, sY);\n context.lineTo(sX + halfWidth, sY);\n context.lineTo(sX + halfWidth, sY + bodyLength);\n context.lineTo(sX, eY);\n context.lineTo(sX - halfWidth, sY + bodyLength);\n context.lineTo(sX - halfWidth, sY);\n } else {\n if (sX > eX) bodyLength *= -1;\n\n context.moveTo(sX, sY - halfWidth);\n context.lineTo(sX, sY + halfWidth);\n context.lineTo(sX + bodyLength, sY + halfWidth);\n context.lineTo(eX, sY);\n context.lineTo(sX + bodyLength, sY - halfWidth);\n context.lineTo(sX, sY - halfWidth);\n }\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws value box for linear gauge\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} value\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearValueBox(context, options, value, x, y, w, h) {\n // currently value box is available only for vertical linear gauge,\n // as far as by design it is hard to find a proper place for\n // horizontal ones\n var boxWidth = (parseFloat(options.fontValueSize) || 0) * w / 200;\n var dy = (0.11 * h - boxWidth) / 2;\n\n context.barDimensions.isVertical && drawings.drawValueBox(context, options, value, x + w / 2, y + h - boxWidth - dy, w);\n}\n\n/**\r\n * Minimalistic HTML5 Canvas Linear Gauge\r\n */\n\nvar LinearGauge = function (_BaseGauge2) {\n _inherits(LinearGauge, _BaseGauge2);\n\n /**\r\n * Fired each time before gauge plate is drawn\r\n *\r\n * @event LinearGauge#beforePlate\r\n */\n\n /**\r\n * Fired each time before gauge highlight areas are drawn\r\n *\r\n * @event LinearGauge#beforeHighlights\r\n */\n\n /**\r\n * Fired each time before gauge minor ticks are drawn\r\n *\r\n * @event LinearGauge#beforeMinorTicks\r\n */\n\n /**\r\n * Fired each time before gauge major ticks are drawn\r\n *\r\n * @event LinearGauge#beforeMajorTicks\r\n */\n\n /**\r\n * Fired each time before gauge tick numbers are drawn\r\n *\r\n * @event LinearGauge#beforeNumbers\r\n */\n\n /**\r\n * Fired each time before gauge title is drawn\r\n *\r\n * @event LinearGauge#beforeTitle\r\n */\n\n /**\r\n * Fired each time before gauge units text is drawn\r\n *\r\n * @event LinearGauge#beforeUnits\r\n */\n\n /**\r\n * Fired each time before gauge bar area is drawn\r\n *\r\n * @event LinearGauge#beforeBar\r\n */\n\n /**\r\n * Fired each time before gauge progress bar is drawn\r\n *\r\n * @event LinearGauge#beforeProgressBar\r\n */\n\n /**\r\n * Fired each time before gauge value box is drawn\r\n *\r\n * @event LinearGauge#beforeValueBox\r\n */\n\n /**\r\n * Fired each time before gauge needle is drawn\r\n *\r\n * @event LinearGauge#beforeNeedle\r\n */\n\n /**\r\n * @constructor\r\n * @param {LinearGaugeOptions} options\r\n */\n function LinearGauge(options) {\n _classCallCheck(this, LinearGauge);\n\n options = Object.assign({}, defaultLinearGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (LinearGauge.__proto__ || Object.getPrototypeOf(LinearGauge)).call(this, LinearGauge.configure(options)));\n }\n\n /**\r\n * Checks and updates gauge options properly\r\n *\r\n * @param {*} options\r\n * @return {*}\r\n * @access protected\r\n */\n\n\n _createClass(LinearGauge, [{\n key: 'draw',\n\n\n /* istanbul ignore next */\n /**\r\n * Triggering linear gauge render on a canvas.\r\n *\r\n * @returns {LinearGauge}\r\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref2 = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref2[0],\n y = _ref2[1],\n w = _ref2[2],\n h = _ref2[3];\n\n var options = this.options;\n\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n this.drawBox = drawLinearPlate(context, options, x, y, w, h);\n\n this.emit('beforeBar');\n drawLinearBar.apply(undefined, [context, options].concat(_toConsumableArray(this.drawBox)));\n\n canvas.context.barDimensions = context.barDimensions;\n\n this.emit('beforeHighlights');\n drawLinearBarHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawLinearMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawLinearMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawLinearMajorTicksNumbers(context, options);\n this.emit('beforeTitle');\n drawLinearTitle(context, options);\n this.emit('beforeUnits');\n drawLinearUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawLinearBarProgress.apply(undefined, [canvas.context, options].concat(_toConsumableArray(this.drawBox)));\n this.emit('beforeNeedle');\n drawLinearBarNeedle(canvas.context, options);\n this.emit('beforeValueBox');\n drawLinearValueBox.apply(undefined, [canvas.context, options, options.animatedValue ? this.options.value : this.value].concat(_toConsumableArray(this.drawBox)));\n\n _get(LinearGauge.prototype.__proto__ || Object.getPrototypeOf(LinearGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n /* istanbul ignore else */\n if (options.barStrokeWidth >= options.barWidth) {\n //noinspection JSUnresolvedFunction\n options.barStrokeWidth = round(options.barWidth / 2);\n }\n\n //noinspection JSUndefinedPropertyAssignment\n options.hasLeft = hasTicksBar('right', options);\n //noinspection JSUndefinedPropertyAssignment\n options.hasRight = hasTicksBar('left', options);\n\n if (options.value > options.maxValue) {\n options.value = options.maxValue;\n }\n\n if (options.value < options.minValue) {\n options.value = options.minValue;\n }\n\n return BaseGauge.configure(options);\n }\n }]);\n\n return LinearGauge;\n}(BaseGauge);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['LinearGauge'] = LinearGauge;\n}\n\nBaseGauge.initialize('LinearGauge', defaultLinearGaugeOptions);;typeof module !== \"undefined\" && Object.assign(ns, {Collection: Collection,GenericOptions: GenericOptions,Animation: Animation,BaseGauge: BaseGauge,drawings: drawings,SmartCanvas: SmartCanvas,DomObserver: DomObserver,vendorize: vendorize});}(typeof module !== \"undefined\" ? module.exports : window));"]} \ No newline at end of file +{"version":3,"sources":["gauge.min.js"],"names":["ns","_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_possibleConstructorReturn","self","call","ReferenceError","_inherits","subClass","superClass","TypeError","prototype","Object","create","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","_classCallCheck","instance","Constructor","vendorize","prop","window","global","vendors","s","capitalized","charAt","toUpperCase","substr","vendorProp","step","time","draw","start","rule","duration","end","anim","progress","percent","animationTransformed","isFinite","isNaN","frame","requestAnimationFrame","inProgress","Collection","apply","this","arguments","verifyError","err","DOMException","result","prepareTicks","options","majorTicks","push","drawings","formatMajorTickNumber","minValue","maxValue","tickSide","roundRect","context","x","y","w","h","r","beginPath","moveTo","lineTo","quadraticCurveTo","closePath","padValue","val","dec","valueDec","int","valueInt","strVal","n","parseFloat","Math","abs","toFixed","toString","split","round","num","right","hasDec","majorTicksDec","majorTicksInt","indexOf","join","replace","radians","degrees","PI","radialPoint","radius","angle","sin","cos","linearGradient","colorFrom","colorTo","isVertical","undefined","grad","createLinearGradient","addColorStop","drawShadow","restore","save","borderShadowWidth","shadowBlur","shadowColor","colorBorderShadow","drawNeedleShadow","needleShadow","shadowOffsetX","shadowOffsetY","colorNeedleShadowDown","font","target","baseSize","reset","strokeStyle","lineWidth","drawValueTextShadow","offset","blur","valueTextShadow","colorValueTextShadow","drawValueBox","max","valueBox","addLength","maxValueWidth","repeat","String","parseInt","concat","map","text","valueText","tunit","runit","tw","measureText","Number","width","th","fontValueSize","sw","valueBoxStroke","bmax","bw","bh","br","valueBoxBorderRadius","obw","valueBoxWidth","bx","by","gy","rect","grd","createRadialGradient","colorValueBoxRect","colorValueBoxRectEnd","stroke","colorValueBoxShadow","colorValueBoxBackground","fillStyle","fill","colorValueText","textAlign","textBaseline","fillText","normalizedValue","min","dt","normal","indented","drawRadialBorder","arc","maxRadialRadius","pxRatio","SmartCanvas","pixelRatio","maxRadius","borderOuterWidth","borderMiddleWidth","borderInnerWidth","drawRadialPlate","d0","r0","r1","r2","r3","shadowDrawn","colorBorderOuter","colorBorderOuterEnd","colorBorderMiddle","colorBorderMiddleEnd","colorBorderInner","colorBorderInnerEnd","colorPlateEnd","colorPlate","drawRadialHighlights","hlWidth","highlightsWidth","radialTicksRadius","highlights","vd","ticksAngle","hlt","rotate","HPI","startAngle","to","color","drawRadialMinorTicks","range","delta","minTicks","minorTicks","ratio","colorMinorTicks","colorStrokeTicks","exactTicks","closeStrokedPath","unit","barWidth","barStrokeWidth","drawRadialMajorTicks","colors","colorMajorTicks","radialNextAngle","strokeTicks","drawRadialNumbers","points","isAnimated","animationTarget","colorNumbers","plateValueAngle","textWidth","textHeight","fontNumbersSize","textRadius","sqrt","point","numbersMargin","drawRadialTitle","title","colorTitle","drawRadialUnits","units","colorUnits","drawRadialNeedle","needle","needleCircleSize","rIn","needleEnd","rStart","needleStart","pad1","needleWidth","pad2","isFixed","colorNeedle","colorNeedleEnd","needleType","colorNeedleShadowUp","needleCircleOuter","colorNeedleCircleOuter","colorNeedleCircleOuterEnd","needleCircleInner","colorNeedleCircleInner","colorNeedleCircleInnerEnd","drawRadialValueBox","drawRadialProgressBar","rMax","rMin","half","sa","ea","colorBarStroke","colorBar","barShadow","clip","colorBarShadow","barProgress","colorBarProgress","displayValue","gauge","animatedValue","drawRectangle","colorStart","colorEnd","drawLinearBorder","drawLinearPlate","borderRadius","w1","w2","w3","w4","h1","h2","h3","h4","x2","x3","x4","y2","y3","y4","aliasingOffset","barDimensions","hasTitle","hasUnits","hasValue","titleMargin","unitsMargin","valueMargin","strokeWidth","barBeginCircle","barLength","barMargin","x0","y0","dx","hasLeft","hasRight","ticksWidth","dy","barOffset","ticksLength","X","Y","baseX","baseY","ticksPadding","drawLinearBarShape","type","_barDimensions","fullBarLength","direction","alpha","asin","cosAlpha","sinAlpha","x1","y1","cutRadius","rx","ry","colorBarEnd","colorBarProgressEnd","drawLinearBar","hasTicksBar","notWhich","needleSide","numberSide","drawLinearBarProgress","drawLinearBarHighlights","_context$barDimension","tickOffset","interval","eX","eH","eY","hLeft","hRight","entry","eStart","eW","drawLinearTick","drawLinearTicks","ticks","minVal","maxVal","lineLength","_context$barDimension2","tickX","tickY","tickLen","tickLeft","tickRight","drawLinearMajorTicks","_drawings$prepareTick","_drawings$prepareTick2","_slicedToArray","valuePerNonExactTick","tick","_context$barDimension3","rightTicks","leftTicks","sX","sY","drawLinearTickStroke","drawLinearMinorTicks","_drawings$prepareTick3","_drawings$prepareTick4","ticksWidthMinor","drawLinearMajorTicksNumbers","_context$barDimension4","tickValues","numLeft","numRight","textX","textY","numberOffset","textMargin","drawLinearTitle","_context$barDimension5","fontTitleSize","drawLinearUnits","_context$barDimension6","fontUnitsSize","drawLinearBarNeedle","_context$barDimension7","position","tickWidth","baseLength","needleLength","toLowerCase","drawLinearArrowNeedle","drawLinearLineNeedle","barStart","nLeft","nRight","needleStyle","isRight","peakLength","bodyLength","halfWidth","drawLinearValueBox","boxWidth","sliceIterator","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","_get","get","object","property","receiver","Function","desc","getOwnPropertyDescriptor","parent","getPrototypeOf","getter","_set","set","setter","_createClass","defineProperties","props","descriptor","defineProperty","key","protoProps","staticProps","assign","firstSource","nextSource","keysArray","keys","nextIndex","len","nextKey","searchElement","fromIndex","k","O","Infinity","_value","relativeStart","relativeEnd","final","EventEmitter","_events","addListener","on","removeListener","off","event","_len","args","_key","_len2","handlers","_key2","handler","wrapper","_handler","index","splice","callback","setTimeout","Date","getTime","rules","linear","p","quad","pow","dequad","quint","dequint","cycle","acos","decycle","bounce","debounce","a","b","elastic","delastic","Animation","_this","cancel","performance","now","id","DomObserver","element","toDashed","Type","mutationsObserved","isObservable","MutationObserver","GAUGES_NO_AUTO_INIT","domReady","traverse","bind","node","tagName","getAttribute","elements","document","getElementsByTagName","process","observe","body","childList","subtree","attributes","characterData","attributeOldValue","characterDataOldValue","records","record","attributeName","isValidNode","oldValue","addedNodes","ii","ss","_this2","JSON","parse","stringify","hasOwnProperty","toAttributeName","attributeValue","renderTo","observer","forEach","attr","disconnect","destroy","_prop","part","_options","update","test","e","camelCase","str","dashed","readyState","addEventListener","attachEvent","canvas","height","collection","init","style","elementClone","cloneNode","getContext","contextClone","drawWidth","drawHeight","drawX","drawY","minSide","initialized","translate","clearRect","onRedraw","scale","redraw","devicePixelRatio","matchMedia","GenericOptions","animateOnInit","borders","listeners","animation","animationDuration","animationRule","fontNumbers","fontTitle","fontUnits","fontValue","fontNumbersStyle","fontTitleStyle","fontUnitsStyle","fontValueStyle","fontNumbersWeight","fontTitleWeight","fontUnitsWeight","fontValueWeight","getElementById","version","gauges","BaseGauge","_EventEmitter","_this3","className","name","HTMLCanvasElement","parentNode","offsetWidth","offsetHeight","configure","emit","_this4","ensureValue","fromValue","animate","newValue","toCamelCase","defaultRadialGaugeOptions","useMinPath","RadialGauge","_BaseGauge","_ref","commit","drawImage","_context","initialize","defaultLinearGaugeOptions","LinearGauge","_BaseGauge2","_ref2","drawBox","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,SAASA,GAAK,YAUf,SAASC,GAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,GAAIG,GAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAOC,EAAKD,GAAKH,EAAIG,EAAM,OAAOC,GAAe,MAAOH,OAAMK,KAAKN,GAE1L,QAASO,GAA2BC,EAAMC,GAAQ,IAAKD,EAAQ,KAAM,IAAIE,gBAAe,4DAAgE,QAAOD,GAAyB,gBAATA,IAAqC,kBAATA,GAA8BD,EAAPC,EAElO,QAASE,GAAUC,EAAUC,GAAc,GAA0B,kBAAfA,IAA4C,OAAfA,EAAuB,KAAM,IAAIC,WAAU,iEAAoED,GAAeD,GAASG,UAAYC,OAAOC,OAAOJ,GAAcA,EAAWE,WAAaG,aAAeC,MAAOP,EAAUQ,YAAY,EAAOC,UAAU,EAAMC,cAAc,KAAeT,IAAYG,OAAOO,eAAiBP,OAAOO,eAAeX,EAAUC,GAAcD,EAASY,UAAYX,GAEje,QAASY,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB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)\n * \n * Copyright (c) 2016 Mykhailo Stadnyk \n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * @version 2.1.4\n */\n(function(ns) {'use strict';\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _set = function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if (\"value\" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\r\n * @external {Object.assign} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\r\n */\n/* istanbul ignore next */\nif (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function value(target, firstSource) {\n 'use strict';\n\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n var i = 1;\n\n for (; i < arguments.length; i++) {\n var nextSource = arguments[i];\n\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n var nextIndex = 0,\n len = keysArray.length;\n\n for (; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n\n return to;\n }\n });\n}\n\n/**\r\n * @external {Array.indexOf} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\r\n */\n/* istanbul ignore next */\nif (!Array.prototype.indexOf) {\n Object.defineProperty(Array.prototype, \"indexOf\", {\n value: function value(searchElement, fromIndex) {\n var k;\n\n if (this === null) {\n throw new TypeError('\"this\" is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n\n if (len === 0) {\n return -1;\n }\n\n var n = +fromIndex || 0;\n\n if (Math.abs(n) === Infinity) {\n n = 0;\n }\n\n if (n >= len) {\n return -1;\n }\n\n k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\n\n while (k < len) {\n if (k in O && O[k] === searchElement) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n }\n });\n}\n\n/**\r\n * @external {Array.fill} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill\r\n */\n/* istanbul ignore next */\nif (!Array.prototype.fill) {\n Object.defineProperty(Array.prototype, \"fill\", {\n value: function value(_value) {\n if (this === null) {\n throw new TypeError('this is null or not defined');\n }\n\n var O = Object(this);\n var len = O.length >>> 0;\n var start = arguments[1];\n var relativeStart = start >> 0;\n var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);\n var end = arguments[2];\n var relativeEnd = end === undefined ? len : end >> 0;\n var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);\n while (k < final) {\n O[k] = _value;\n k++;\n }\n\n return O;\n }\n });\n}\n\n/**\r\n * mocking window\r\n */\nif (typeof window === 'undefined') {\n window = typeof global === 'undefined' ? {} : global;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/**\r\n * Look-ups for a proper vendor-specific property and returns its value\r\n *\r\n * @example\r\n * var requestAnimationFrame = vendorize('requestAnimationFrame');\r\n * // it will refer properly to:\r\n * // - window.requestAnimationFrame by default or to\r\n * // - window.webkitRequestAnimationFrame or to\r\n * // - window.mozRequestAnimationFrame or to\r\n * // - window.msRequestAnimationFrame or to\r\n * // - window.oRequestAnimationFrame\r\n * // depending on the current browser vendor\r\n *\r\n * @author Mykhailo Stadnyk \r\n * @param {string} prop\r\n * @param {HTMLElement|Window|object} [from] - default is window\r\n * @returns {*}\r\n */\nfunction vendorize(prop, from) {\n /* istanbul ignore else: no reason to cover */\n if (!from) {\n from = typeof window === 'undefined' ? global : window;\n }\n\n if (typeof from[prop] !== 'undefined') {\n return from[prop];\n }\n\n var vendors = ['webkit', 'moz', 'ms', 'o'];\n var i = 0;\n var s = vendors.length;\n var capitalized = prop.charAt(0).toUpperCase() + prop.substr(1);\n\n for (; i < s; i++) {\n var vendorProp = from[vendors[i] + capitalized];\n\n /* istanbul ignore if: requires very complex environment to test (specific browser version) */\n if (typeof vendorProp !== 'undefined') {\n return vendorProp;\n }\n }\n\n return null;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Class EventEmitter - base event manager\r\n */\n\nvar EventEmitter = function () {\n /**\r\n * @constructor\r\n */\n function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this._events = {};\n\n this.addListener = this.on;\n this.removeListener = this.off;\n }\n\n /**\r\n * Returns all event listeners\r\n *\r\n * @return {object}\r\n */\n\n\n _createClass(EventEmitter, [{\n key: 'emit',\n\n\n /**\r\n * Emits given event bypassing to each registered handler given args\r\n *\r\n * @param {string} event\r\n * @param {...*} args\r\n */\n value: function emit(event) {\n if (this._events[event]) {\n var i = 0;\n var s = this._events[event].length;\n\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n for (; i < s; i++) {\n this._events[event][i] && this._events[event][i].apply(this, args);\n }\n }\n }\n\n /**\r\n * Registers given handler for given event to be called only once when\r\n * event is emitted\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'once',\n value: function once(event) {\n for (var _len2 = arguments.length, handlers = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n handlers[_key2 - 1] = arguments[_key2];\n }\n\n var i = 0;\n var s = handlers.length;\n var self = this;\n\n var _loop = function _loop() {\n var handler = handlers[i];\n var wrapper = function wrapper() {\n self.off(event, wrapper);\n handler.apply(self, arguments);\n };\n\n handlers[i] = wrapper;\n };\n\n for (; i < s; i++) {\n _loop();\n }\n\n this.on.apply(this, [event].concat(handlers));\n }\n\n /**\r\n * Registers given handlers for a given events to be called each time event\r\n * is emitted\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'on',\n value: function on(event) {\n if (!this._events[event]) {\n this._events[event] = [];\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n this._events[event].push(arguments.length <= i + 1 ? undefined : arguments[i + 1]);\n }\n }\n\n /**\r\n * Un-registers previously registered event handlers\r\n *\r\n * @param {string} event\r\n * @param {...function} handlers\r\n */\n\n }, {\n key: 'off',\n value: function off(event) {\n if (!this._events[event]) {\n return;\n }\n\n var i = 0;\n var s = arguments.length <= 1 ? 0 : arguments.length - 1;\n\n for (; i < s; i++) {\n var _handler = arguments.length <= i + 1 ? undefined : arguments[i + 1];\n var index = void 0;\n\n while (~(index = this._events[event].indexOf(_handler))) {\n this._events[event].splice(index, 1);\n }\n }\n }\n\n /**\r\n * Removes all listeners for a given event\r\n *\r\n * @param {string} event\r\n */\n\n }, {\n key: 'removeAllListeners',\n value: function removeAllListeners(event) {\n delete this._events[event];\n }\n }, {\n key: 'listeners',\n get: function get() {\n return this._events;\n }\n }]);\n\n return EventEmitter;\n}();\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/* jshint -W079 */\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n\n/* istanbul ignore next */\n/**\r\n * @type {function(callback: function(time: number): number, element?: HTMLElement)}\r\n * @access private\r\n */\n\n\nvar requestAnimationFrame = vendorize('requestAnimationFrame') || function (callback) {\n return setTimeout(function () {\n return callback(new Date().getTime());\n }, 1000 / 60);\n};\n\n/**\r\n * Generic AnimationRule function interface\r\n *\r\n * @typedef {function(percent: number): number} AnimationRule\r\n */\n\n/**\r\n * Callback for animation step draw event.\r\n * It will be called each time animation step is executed, bypassing\r\n * as first argument a percent of animation completeness. It is expected\r\n * that this callback will do an actual work of animating an elements or\r\n * whatever, as far as animation engine is just calculating and executing\r\n * animation steps without any knowledge about things under animation.\r\n *\r\n * @typedef {function(percent: number): *} DrawEventCallback\r\n */\n\n/**\r\n * Callback for animation complete event.\r\n * It is called once each animation is complete.\r\n *\r\n * @typedef {function(): *} EndEventCallback\r\n */\n\n/**\r\n * Predefined known animation rules.\r\n * It's a simple collection of math for some most used animations.\r\n *\r\n * @typedef {{linear: AnimationRule, quad: AnimationRule, dequad: AnimationRule, quint: AnimationRule, dequint: AnimationRule, cycle: AnimationRule, decycle: AnimationRule, bounce: AnimationRule, debounce: AnimationRule, elastic: AnimationRule, delastic: AnimationRule}} AnimationRules\r\n */\n\n/* istanbul ignore next: no reason covering this */\nvar rules = {\n linear: function linear(p) {\n return p;\n },\n quad: function quad(p) {\n return Math.pow(p, 2);\n },\n dequad: function dequad(p) {\n return 1 - rules.quad(1 - p);\n },\n quint: function quint(p) {\n return Math.pow(p, 5);\n },\n dequint: function dequint(p) {\n return 1 - Math.pow(1 - p, 5);\n },\n cycle: function cycle(p) {\n return 1 - Math.sin(Math.acos(p));\n },\n decycle: function decycle(p) {\n return Math.sin(Math.acos(1 - p));\n },\n bounce: function bounce(p) {\n return 1 - rules.debounce(1 - p);\n },\n debounce: function debounce(p) {\n var a = 0,\n b = 1;\n for (; 1; a += b, b /= 2) {\n if (p >= (7 - 4 * a) / 11) {\n return -Math.pow((11 - 6 * a - 11 * p) / 4, 2) + Math.pow(b, 2);\n }\n }\n },\n elastic: function elastic(p) {\n return 1 - rules.delastic(1 - p);\n },\n delastic: function delastic(p) {\n var x = 1.5;\n return Math.pow(2, 10 * (p - 1)) * Math.cos(20 * Math.PI * x / 3 * p);\n }\n};\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Evaluates animation step and decides if the next step required or\r\n * stops animation calling a proper events.\r\n *\r\n * @access private\r\n * @param {number} time\r\n * @param {DrawEventCallback} draw\r\n * @param {number} start\r\n * @param {AnimationRule} rule\r\n * @param {number} duration\r\n * @param {EndEventCallback} end\r\n * @param {Animation} anim\r\n */\nfunction step(time, draw, start, rule, duration, end, anim) {\n if (typeof rule !== 'function') {\n throw new TypeError('Invalid animation rule:', rule);\n }\n\n var progress = time - start;\n var percent = progress / duration;\n var animationTransformed = 0;\n\n if (percent > 1) {\n percent = 1;\n }\n\n if (percent !== 1) {\n animationTransformed = rule(percent);\n\n // make sure we have correct number after applying animation\n // transformation\n if (isFinite(animationTransformed) && !isNaN(animationTransformed)) {\n percent = animationTransformed;\n }\n }\n\n draw && draw(percent);\n\n if (progress < duration) {\n anim.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rule, duration, end, anim);\n });\n } else {\n end && end();\n anim.inProgress = false;\n }\n}\n\n/**\r\n * Animation engine API for JavaScript-based animations.\r\n * This is simply an animation core framework which simplifies creation\r\n * of various animations for generic purposes.\r\n *\r\n * @example\r\n * // create 'linear' animation engine, 500ms duration\r\n * let linear = new Animation('linear', 500);\r\n *\r\n * // create 'elastic' animation engine\r\n * let elastic = new Animation('elastic');\r\n *\r\n * // define animation behavior\r\n * let bounced = new Animation('bounce', 500, percent => {\r\n * let value = parseInt(percent * 100, 10);\r\n *\r\n * $('div.bounced').css({\r\n * width: value + '%',\r\n * height: value + '%'\r\n * });\r\n * });\r\n *\r\n * // execute animation\r\n * bounced.animate();\r\n *\r\n * // execute animation and handle when its finished\r\n * bounced.animate(null, () => {\r\n * console.log('Animation finished!');\r\n * });\r\n */\n\nvar Animation = function () {\n\n /**\r\n * @constructor\r\n * @param {string|AnimationRule} rule\r\n * @param {number} duration\r\n * @param {DrawEventCallback} [draw]\r\n * @param {EndEventCallback} [end]\r\n */\n function Animation() {\n var rule = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'linear';\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var draw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};\n\n _classCallCheck(this, Animation);\n\n /**\r\n * Overall animation duration in milliseconds.\r\n * By default is equal to 250 ms.\r\n *\r\n * @type {number}\r\n */\n this.duration = duration;\n\n /**\r\n * Animation rule. By default is linear animation.\r\n * Animation rule is a subject to animation rules, which are\r\n * a simple object containing math-based methods for calculating\r\n * animation steps.\r\n *\r\n * @type {string|AnimationRule}\r\n */\n this.rule = rule;\n\n /**\r\n * Callback function for the animation step draw event.\r\n *\r\n * @type {DrawEventCallback}\r\n */\n this.draw = draw;\n\n /**\r\n * Callback for the animation complete event.\r\n *\r\n * @type {EndEventCallback}\r\n */\n this.end = end;\n\n if (typeof this.draw !== 'function') {\n throw new TypeError('Invalid animation draw callback:', draw);\n }\n\n if (typeof this.end !== 'function') {\n throw new TypeError('Invalid animation end callback:', end);\n }\n }\n\n /* istanbul ignore next: non-testable */\n /**\r\n * Performs animation calling each animation step draw callback and\r\n * end callback at the end of animation. Callbacks are optional to this\r\n * method call. If them are not bypassed will be used that ones which\r\n * was pre-set on constructing an Animation object or pre-set after\r\n * construction.\r\n *\r\n * @example\r\n * function draw(percent) {\r\n * $('.my-animated-divs').css({\r\n * width: parseInt(percent * 100, 10) + '%'\r\n * });\r\n * }\r\n * function done() {\r\n * console.log('Animation complete!');\r\n * }\r\n *\r\n * // Define 'draw' and 'end' callbacks on construction\r\n * var animation = new Animation('cycle', 500, draw, done);\r\n * animation.animate();\r\n *\r\n * // Define 'draw' and 'end' callbacks after construction\r\n * var animation = new Animation('cycle', 500);\r\n * animation.draw = draw;\r\n * animation.end = done;\r\n * animation.animate();\r\n *\r\n * // Define 'draw' and 'end' callbacks at animation\r\n * var animation = new Animation('cycle', 500);\r\n * animation.animate(draw, done);\r\n *\r\n * @param {DrawEventCallback} [draw]\r\n * @param {EndEventCallback} [end]\r\n */\n\n\n _createClass(Animation, [{\n key: 'animate',\n value: function animate(draw, end) {\n var _this = this;\n\n this.frame && this.cancel();\n\n // noinspection JSUnresolvedVariable\n var start = window.performance && window.performance.now ? window.performance.now() : vendorize('animationStartTime') || Date.now();\n\n draw = draw || this.draw;\n end = end || this.end;\n\n this.draw = draw;\n this.end = end;\n\n /**\r\n * Current requested animation frame identifier\r\n *\r\n * @type {number}\r\n */\n this.frame = requestAnimationFrame(function (time) {\n return step(time, draw, start, rules[_this.rule] || _this.rule, _this.duration, end, _this);\n });\n }\n\n /**\r\n * Cancels current animation if any\r\n */\n\n }, {\n key: 'cancel',\n value: function cancel() {\n if (this.frame) {\n var cancelAnimationFrame = vendorize('cancelAnimationFrame') ||\n /* istanbul ignore next */\n function (id) {};\n\n cancelAnimationFrame(this.frame);\n this.frame = null;\n }\n }\n\n /**\r\n * Destroys this object properly\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n this.cancel();\n this.draw = null;\n this.end = null;\n }\n }]);\n\n return Animation;\n}();\n\n/**\r\n * Animation rules bound statically to Animation constructor.\r\n *\r\n * @type {AnimationRules}\r\n * @static\r\n */\n\n\nAnimation.rules = rules;\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n/**\r\n * @typedef {{ constructor: function(options: GenericOptions): GaugeInterface, draw: function(): GaugeInterface, destroy: function, update: function(options: GenericOptions) }} GaugeInterface\r\n */\n/**\r\n * @typedef {{parse: function, stringify: function}} JSON\r\n * @external {JSON} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON\r\n */\n/**\r\n * @ignore\r\n * @typedef {{MutationObserver: function}} ns\r\n */\n\n/**\r\n * DOM Observer.\r\n * It will observe DOM document for a configured element types and\r\n * instantiate associated Types for an existing or newly added DOM elements\r\n *\r\n * @example\r\n * class ProgressBar {\r\n * constructor(options) {}\r\n * draw() {}\r\n * }\r\n *\r\n * // It will observe DOM document for elements
\r\n * // having attribute 'data-type=\"progress\"'\r\n * // and instantiate for each new instance of ProgressBar\r\n *\r\n * new DomParser({color: 'red'}, 'div', 'progress', ProgressBar);\r\n *\r\n * // assume we could have HTML like this\r\n * //
\r\n * // in this case all matching attributes names for a given options will be\r\n * // parsed and bypassed to an instance from HTML attributes\r\n */\n\nvar DomObserver = function () {\n\n /**\r\n * @constructor\r\n * @param {object} options\r\n * @param {string} element\r\n * @param {string} type\r\n */\n function DomObserver(options, element, type) {\n _classCallCheck(this, DomObserver);\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Default instantiation options for the given type\r\n *\r\n * @type {Object}\r\n */\n this.options = options;\n\n /**\r\n * Name of an element to lookup/observe\r\n *\r\n * @type {string}\r\n */\n this.element = element.toLowerCase();\n\n /**\r\n * data-type attribute value to lookup\r\n *\r\n * @type {string}\r\n */\n this.type = DomObserver.toDashed(type);\n\n /**\r\n * Actual type constructor to instantiate for each found element\r\n *\r\n * @type {Function}\r\n */\n this.Type = ns[type];\n\n /**\r\n * Signals if mutations observer for this type or not\r\n *\r\n * @type {boolean}\r\n */\n this.mutationsObserved = false;\n\n /**\r\n * Flag specifies whenever the browser supports observing\r\n * of DOM tree mutations or not\r\n *\r\n * @type {boolean}\r\n */\n this.isObservable = !!window.MutationObserver;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n if (!window.GAUGES_NO_AUTO_INIT) {\n DomObserver.domReady(this.traverse.bind(this));\n }\n }\n\n /**\r\n * Checks if given node is valid node to process\r\n *\r\n * @param {Node|HTMLElement} node\r\n * @returns {boolean}\r\n */\n\n\n _createClass(DomObserver, [{\n key: 'isValidNode',\n value: function isValidNode(node) {\n //noinspection JSUnresolvedVariable\n return !!(node.tagName && node.tagName.toLowerCase() === this.element && node.getAttribute('data-type') === this.type);\n }\n\n /**\r\n * Traverse entire current DOM tree and process matching nodes.\r\n * Usually it should be called only once on document initialization.\r\n */\n\n }, {\n key: 'traverse',\n value: function traverse() {\n var elements = document.getElementsByTagName(this.element);\n var i = 0,\n s = elements.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n this.process(elements[i]);\n }\n\n if (this.isObservable && !this.mutationsObserved) {\n new MutationObserver(this.observe.bind(this)).observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n attributeOldValue: true,\n characterDataOldValue: true\n });\n\n this.mutationsObserved = true;\n }\n }\n\n /**\r\n * Observes given mutation records for an elements to process\r\n *\r\n * @param {MutationRecord[]} records\r\n */\n\n }, {\n key: 'observe',\n value: function observe(records) {\n var i = 0;\n var s = records.length;\n\n /* istanbul ignore next: this should be tested with end-to-end tests */\n for (; i < s; i++) {\n var record = records[i];\n\n if (record.type === 'attributes' && record.attributeName === 'data-type' && this.isValidNode(record.target) && record.oldValue !== this.type) // skip false-positive mutations\n {\n setTimeout(this.process.bind(this, record.target));\n } else if (record.addedNodes && record.addedNodes.length) {\n var ii = 0;\n var ss = record.addedNodes.length;\n\n for (; ii < ss; ii++) {\n setTimeout(this.process.bind(this, record.addedNodes[ii]));\n }\n }\n }\n }\n\n /**\r\n * Parses given attribute value to a proper JavaScript value.\r\n * For example it will parse some stringified value to a proper type\r\n * value, e.g. 'true' => true, 'null' => null, '{\"prop\": 20}' => {prop: 20}\r\n *\r\n * @param {*} value\r\n * @return {*}\r\n */\n\n }, {\n key: 'process',\n\n\n /**\r\n * Processes a given node, instantiating a proper type constructor for it\r\n *\r\n * @param {Node|HTMLElement} node\r\n * @returns {GaugeInterface|null}\r\n */\n value: function process(node) {\n var _this2 = this;\n\n if (!this.isValidNode(node)) return null;\n\n var prop = void 0;\n var options = JSON.parse(JSON.stringify(this.options));\n var instance = null;\n\n for (prop in options) {\n /* istanbul ignore else: non-testable in most cases */\n if (options.hasOwnProperty(prop)) {\n var attributeName = DomObserver.toAttributeName(prop);\n var attributeValue = DomObserver.parse(node.getAttribute(attributeName));\n\n if (attributeValue !== null && attributeValue !== undefined) {\n options[prop] = attributeValue;\n }\n }\n }\n\n options.renderTo = node;\n instance = new this.Type(options);\n instance.draw && instance.draw();\n\n if (!this.isObservable) return instance;\n\n instance.observer = new MutationObserver(function (records) {\n records.forEach(function (record) {\n if (record.type === 'attributes') {\n var attr = record.attributeName.toLowerCase();\n var type = node.getAttribute(attr).toLowerCase();\n\n if (attr === 'data-type' && type && type !== _this2.type) {\n instance.observer.disconnect();\n delete instance.observer;\n instance.destroy && instance.destroy();\n } else if (attr.substr(0, 5) === 'data-') {\n var _prop = attr.substr(5).split('-').map(function (part, i) {\n return !i ? part : part.charAt(0).toUpperCase() + part.substr(1);\n }).join('');\n var _options = {};\n\n _options[_prop] = DomObserver.parse(node.getAttribute(record.attributeName));\n\n if (_prop === 'value') {\n instance && (instance.value = _options[_prop]);\n } else {\n instance.update && instance.update(_options);\n }\n }\n }\n });\n });\n\n //noinspection JSCheckFunctionSignatures\n instance.observer.observe(node, { attributes: true });\n\n return instance;\n }\n\n /**\r\n * Transforms camelCase string to dashed string\r\n *\r\n * @static\r\n * @param {string} camelCase\r\n * @return {string}\r\n */\n\n }], [{\n key: 'parse',\n value: function parse(value) {\n // parse boolean\n if (value === 'true') return true;\n if (value === 'false') return false;\n\n // parse undefined\n if (value === 'undefined') return undefined;\n\n // parse null\n if (value === 'null') return null;\n\n // Comma-separated strings to array parsing.\n // It won't match strings which contains non alphanumeric characters to\n // prevent strings like 'rgba(0,0,0,0)' or JSON-like from being parsed.\n // Typically it simply allows easily declare arrays as comma-separated\n // numbers or plain strings. If something more complicated is\n // required it can be declared using JSON format syntax\n if (/^[-+#.\\w\\d\\s]+(?:,[-+#.\\w\\d\\s]*)+$/.test(value)) {\n return value.split(',');\n }\n\n // parse JSON\n try {\n return JSON.parse(value);\n } catch (e) {}\n\n // plain value - no need to parse\n return value;\n }\n }, {\n key: 'toDashed',\n value: function toDashed(camelCase) {\n var arr = camelCase.split(/(?=[A-Z])/);\n var i = 1;\n var s = arr.length;\n var str = arr[0].toLowerCase();\n\n for (; i < s; i++) {\n str += '-' + arr[i].toLowerCase();\n }\n\n return str;\n }\n\n /**\r\n * Transforms dashed string to CamelCase representation\r\n *\r\n * @param {string} dashed\r\n * @param {boolean} [capitalized]\r\n * @return {string}\r\n */\n\n }, {\n key: 'toCamelCase',\n value: function toCamelCase(dashed) {\n var capitalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n var arr = dashed.split(/-/);\n var i = 0;\n var s = arr.length;\n var str = '';\n\n for (; i < s; i++) {\n if (!(i || capitalized)) {\n str += arr[i].toLowerCase();\n } else {\n str += arr[i][0].toUpperCase() + arr[i].substr(1).toLowerCase();\n }\n }\n\n return str;\n }\n\n /**\r\n * Transforms camel case property name to dash separated attribute name\r\n *\r\n * @static\r\n * @param {string} str\r\n * @returns {string}\r\n */\n\n }, {\n key: 'toAttributeName',\n value: function toAttributeName(str) {\n return 'data-' + DomObserver.toDashed(str);\n }\n\n /**\r\n * Cross-browser DOM ready handler\r\n *\r\n * @static\r\n * @param {Function} handler\r\n */\n\n }, {\n key: 'domReady',\n value: function domReady(handler) {\n if (/comp|inter|loaded/.test((window.document || {}).readyState + '')) return handler();\n\n if (window.addEventListener) window.addEventListener('DOMContentLoaded', handler, false);else if (window.attachEvent) window.attachEvent('onload', handler);\n }\n }]);\n\n return DomObserver;\n}();\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n\n/**\r\n * Drawings on canvas using hidden canvas as a cache for better\r\n * performance drawings during canvas animations. SmartCanvas also\r\n * adopts a canvas to\r\n */\n\n\nvar SmartCanvas = function () {\n\n /**\r\n * @constructor\r\n * @param {HTMLCanvasElement} canvas\r\n * @param {number} [width]\r\n * @param {number} [height]\r\n */\n function SmartCanvas(canvas, width, height) {\n _classCallCheck(this, SmartCanvas);\n\n SmartCanvas.collection.push(this);\n\n /**\r\n * Canvas base width\r\n *\r\n * @type {number}\r\n */\n this.width = width || 0;\n\n /**\r\n * Canvas base height\r\n *\r\n * @type {number}\r\n */\n this.height = height || 0;\n\n /**\r\n * Target drawings canvas element\r\n *\r\n * @type {HTMLCanvasElement}\r\n */\n this.element = canvas;\n\n this.init();\n }\n\n /**\r\n * Initializes canvases and contexts\r\n */\n\n\n _createClass(SmartCanvas, [{\n key: 'init',\n value: function init() {\n var pixelRatio = SmartCanvas.pixelRatio;\n\n this.element.width = this.width * pixelRatio;\n this.element.height = this.height * pixelRatio;\n\n this.element.style.width = this.width + 'px';\n this.element.style.height = this.height + 'px';\n\n /**\r\n * Canvas caching element\r\n *\r\n * @type {HTMLCanvasElement|Node}\r\n */\n this.elementClone = this.element.cloneNode(true);\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Target drawings canvas element 2D context\r\n *\r\n * @type {CanvasRenderingContext2D}\r\n */\n this.context = this.element.getContext('2d');\n\n /**\r\n * Canvas caching element 2D context\r\n *\r\n * @type {CanvasRenderingContext2D}\r\n */\n this.contextClone = this.elementClone.getContext('2d');\n\n /**\r\n * Actual drawings width\r\n *\r\n * @type {number}\r\n */\n this.drawWidth = this.element.width;\n\n /**\r\n * Actual drawings height\r\n *\r\n * @type {number}\r\n */\n this.drawHeight = this.element.height;\n\n /**\r\n * X-coordinate of drawings zero point\r\n *\r\n * @type {number}\r\n */\n this.drawX = this.drawWidth / 2;\n\n /**\r\n * Y-coordinate of drawings zero point\r\n *\r\n * @type {number}\r\n */\n this.drawY = this.drawHeight / 2;\n\n /**\r\n * Minimal side length in pixels of the drawing\r\n *\r\n * @type {number}\r\n */\n this.minSide = this.drawX < this.drawY ? this.drawX : this.drawY;\n\n this.elementClone.initialized = false;\n\n this.contextClone.translate(this.drawX, this.drawY);\n this.contextClone.save();\n\n this.context.translate(this.drawX, this.drawY);\n this.context.save();\n\n this.context.max = this.contextClone.max = this.minSide;\n this.context.maxRadius = this.contextClone.maxRadius = null;\n }\n\n /**\r\n * Destroys this object, removing the references from memory\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = SmartCanvas.collection.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n SmartCanvas.collection.splice(index, 1);\n }\n\n this.context.clearRect(-this.drawX, -this.drawY, this.drawWidth, this.drawHeight);\n\n // dereference all created elements\n this.context.max = null;\n delete this.context.max;\n\n this.context.maxRadius = null;\n delete this.context.maxRadius;\n\n this.context = null;\n this.contextClone = null;\n this.elementClone = null;\n this.element = null;\n\n /**\r\n * On canvas redraw event callback\r\n *\r\n * @type {function|null|undefined}\r\n */\n this.onRedraw = null;\n }\n\n /**\r\n * Commits the drawings\r\n */\n\n }, {\n key: 'commit',\n value: function commit() {\n var scale = SmartCanvas.pixelRatio;\n\n if (scale !== 1) {\n this.contextClone.scale(scale, scale);\n this.contextClone.save();\n }\n\n return this;\n }\n\n /**\r\n * Redraw this object\r\n */\n\n }, {\n key: 'redraw',\n value: function redraw() {\n this.init();\n\n /**\r\n * On canvas redraw event callback\r\n *\r\n * @type {function(): *}\r\n */\n this.onRedraw && this.onRedraw();\n\n return this;\n }\n\n /**\r\n * Returns current device pixel ratio\r\n *\r\n * @returns {number}\r\n */\n\n }], [{\n key: 'redraw',\n\n\n /**\r\n * Forces redraw all canvas in the current collection\r\n */\n value: function redraw() {\n var i = 0;\n var s = SmartCanvas.collection.length;\n\n for (; i < s; i++) {\n SmartCanvas.collection[i].redraw();\n }\n }\n }, {\n key: 'pixelRatio',\n get: function get() {\n /* istanbul ignore next */\n //noinspection JSUnresolvedVariable\n return window.devicePixelRatio || 1;\n }\n }]);\n\n return SmartCanvas;\n}();\n\nSmartCanvas.collection = [];\n\n/* istanbul ignore next: very browser-specific testing required to cover */\n//noinspection JSUnresolvedVariable\nif (window.matchMedia) {\n //noinspection JSUnresolvedFunction\n window.matchMedia('screen and (min-resolution: 2dppx)').addListener(SmartCanvas.redraw);\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Describes rendering target element. Can be either string identifier of\r\n * the element or the element itself.\r\n *\r\n * @typedef {HTMLElement|string} RenderTarget\r\n */\n\n/**\r\n * Highlight area definition.\r\n * It describes highlight area starting from value to value using\r\n * color. Color can be describes with hex, rgb or rgba value.\r\n *\r\n * @typedef {{ from: number, to: number, color: string}} Highlight\r\n */\n\n/**\r\n * Shared generic gauges options\r\n *\r\n * @type {{renderTo: RenderTarget, width: number, height: number, minValue: number, maxValue: number, value: number, units: string|boolean, majorTicks: number[]|string[], exactTicks: boolean, minorTicks: number, strokeTicks: boolean, animatedValue: boolean, animateOnInit: boolean, title: string|boolean, borders: boolean, valueInt: number, valueDec: number, majorTicksInt: number, majorTicksDec: number, animation: boolean, animationDuration: number, animationRule: string|AnimationRule, colorPlate: string, colorPlateEnd: string, colorMajorTicks: string, colorMinorTicks: string, colorStrokeTicks: string, colorTitle: string, colorUnits: string, colorNumbers: string, colorNeedle: string, colorNeedleEnd: string, colorValueText: string, colorValueTextShadow: string, colorBorderShadow: string, colorBorderOuter: string, colorBorderOuterEnd: string, colorBorderMiddle: string, colorBorderMiddleEnd: string, colorBorderInner: string, colorBorderInnerEnd: string, colorValueBoxRect: string, colorValueBoxRectEnd: string, colorValueBoxBackground: string, colorValueBoxShadow: string, colorNeedleShadowUp: string, colorNeedleShadowDown: string, needle: boolean, needleShadow: boolean, needleType: string, needleStart: number, needleEnd: number, needleWidth: number, borderOuterWidth: number, borderMiddleWidth: number, borderInnerWidth: number, borderShadowWidth: number, valueBox: boolean, valueBoxWidth: number, valueBoxStroke: number, valueText: string, valueTextShadow: boolean, valueBoxBorderRadius: number, highlights: Highlight[], highlightsWidth: number, fontNumbers: string, fontTitle: string, fontUnits: string, fontValue: string, fontTitleSize: number, fontValueSize: number, fontUnitsSize: number, fontNumbersSize: number, fontNumbersStyle: string, fontTitleStyle: string, fontUnitsStyle: string, fontValueStyle: string, fontNumbersWeight: string, fontTitleWeight: string, fontUnitsWeight: string, fontValueWeight: string, barWidth: number, barStrokeWidth: number, barProgress: boolean, colorBar: string, colorBarStroke: string, colorBarProgress: string, colorBarShadow: string, barShadow: number, listeners: object}} GenericOptions\r\n */\nvar GenericOptions = {\n // basic options\n renderTo: null,\n width: 0,\n height: 0,\n minValue: 0,\n maxValue: 100,\n value: 0,\n units: false,\n exactTicks: false,\n majorTicks: [0, 20, 40, 60, 80, 100],\n minorTicks: 10,\n strokeTicks: true,\n animatedValue: false,\n animateOnInit: false,\n title: false,\n borders: true,\n numbersMargin: 1,\n\n listeners: null,\n\n // number formats\n valueInt: 3,\n valueDec: 2,\n majorTicksInt: 1,\n majorTicksDec: 0,\n\n // animations\n animation: true,\n animationDuration: 500,\n animationRule: 'cycle',\n\n // colors\n colorPlate: '#fff',\n colorPlateEnd: '',\n colorMajorTicks: '#444',\n colorMinorTicks: '#666',\n colorStrokeTicks: '',\n colorTitle: '#888',\n colorUnits: '#888',\n colorNumbers: '#444',\n colorNeedle: 'rgba(240,128,128,1)',\n colorNeedleEnd: 'rgba(255,160,122,.9)',\n colorValueText: '#444',\n colorValueTextShadow: 'rgba(0,0,0,0.3)',\n colorBorderShadow: 'rgba(0,0,0,0.5)',\n colorBorderOuter: '#ddd',\n colorBorderOuterEnd: '#aaa',\n colorBorderMiddle: '#eee',\n colorBorderMiddleEnd: '#f0f0f0',\n colorBorderInner: '#fafafa',\n colorBorderInnerEnd: '#ccc',\n colorValueBoxRect: '#888',\n colorValueBoxRectEnd: '#666',\n colorValueBoxBackground: '#babab2',\n colorValueBoxShadow: 'rgba(0,0,0,1)',\n colorNeedleShadowUp: 'rgba(2,255,255,0.2)',\n colorNeedleShadowDown: 'rgba(188,143,143,0.45)',\n colorBarStroke: '#222',\n colorBar: '#ccc',\n colorBarProgress: '#888',\n colorBarShadow: '#000',\n\n fontNumbers: 'Arial',\n fontTitle: 'Arial',\n fontUnits: 'Arial',\n fontValue: 'Arial',\n\n fontNumbersSize: 20,\n fontTitleSize: 24,\n fontUnitsSize: 22,\n fontValueSize: 26,\n\n fontNumbersStyle: 'normal',\n fontTitleStyle: 'normal',\n fontUnitsStyle: 'normal',\n fontValueStyle: 'normal',\n\n fontNumbersWeight: 'normal',\n fontTitleWeight: 'normal',\n fontUnitsWeight: 'normal',\n fontValueWeight: 'normal',\n\n // needle\n needle: true,\n needleShadow: true,\n needleType: 'arrow',\n needleStart: 5,\n needleEnd: 85,\n needleWidth: 4,\n\n // borders\n borderOuterWidth: 3,\n borderMiddleWidth: 3,\n borderInnerWidth: 3,\n borderShadowWidth: 3,\n\n // value and highlights\n valueBox: true,\n valueBoxStroke: 5,\n valueBoxWidth: 0,\n valueText: '',\n valueTextShadow: true,\n valueBoxBorderRadius: 2.5,\n\n // highlights\n highlights: [{ from: 20, to: 60, color: '#eee' }, { from: 60, to: 80, color: '#ccc' }, { from: 80, to: 100, color: '#999' }],\n highlightsWidth: 15,\n\n // progress bar\n barWidth: 20, // percents\n barStrokeWidth: 0, // pixels\n barProgress: true,\n barShadow: 0\n};\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Gauge collections type.\r\n *\r\n * It is used ES5 declaration here, because babel\r\n * transpiles inheritance incorrectly in this case.\r\n *\r\n * @class Collection\r\n * @constructor\r\n */\nfunction Collection() {\n Array.prototype.constructor.apply(this, arguments);\n}\n\nCollection.prototype = Object.create(Array.prototype);\nCollection.prototype.constructor = Collection;\n\n/**\r\n * Returns gauge object by its identifier or index in the collection\r\n *\r\n * @param {string|number} id\r\n * @return {*}\r\n */\nCollection.prototype.get = function (id) {\n if (typeof id === 'string') {\n var i = 0;\n var s = this.length;\n\n for (; i < s; i++) {\n var canvas = this[i].options.renderTo.tagName ? this[i].options.renderTo :\n /* istanbul ignore next: should be tested with e2e tests */\n document.getElementById(this[i].options.renderTo || '');\n\n if (canvas.getAttribute('id') === id) {\n return this[i];\n }\n }\n } else if (typeof id === 'number') {\n return this[id];\n }\n\n return null;\n};\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\nvar version = '2.1.4';\n\nvar round = Math.round;\nvar abs = Math.abs;\n\nvar gauges = new Collection();\n\ngauges.version = version;\n\n/**\r\n * Basic abstract BaseGauge class implementing common functionality\r\n * for different type of gauges.\r\n *\r\n * It should not be instantiated directly but must be extended by a final\r\n * gauge implementation.\r\n *\r\n * @abstract\r\n * @example\r\n *\r\n * class MyCoolGauge extends BaseGauge {\r\n *\r\n * // theses methods below MUST be implemented:\r\n *\r\n * constructor(options) {\r\n * // ... do something with options\r\n * super(options);\r\n * // ... implement anything else\r\n * }\r\n *\r\n * draw() {\r\n * // ... some implementation here\r\n * return this;\r\n * }\r\n * }\r\n */\n\nvar BaseGauge = function (_EventEmitter) {\n _inherits(BaseGauge, _EventEmitter);\n\n /**\r\n * Fired each time gauge is initialized on a page\r\n *\r\n * @event BaseGauge#init\r\n */\n\n /**\r\n * Fired each time gauge scene is rendered\r\n *\r\n * @event BaseGauge#render\r\n */\n\n /**\r\n * Fired each time gauge object is destroyed\r\n *\r\n * @event BaseGauge#destroy\r\n */\n\n /**\r\n * Fired each time before animation is started on the gauge\r\n *\r\n * @event BaseGauge#animationStart\r\n */\n\n /**\r\n * Fired each time animation scene is complete\r\n *\r\n * @event BaseGauge#animate\r\n * @type {number} percent\r\n * @type {number} value\r\n */\n\n /**\r\n * Fired each time animation is complete on the gauge\r\n *\r\n * @event BaseGauge#animationEnd\r\n */\n\n /**\r\n * @event BaseGauge#value\r\n * @type {number} newValue\r\n * @type {number} oldValue\r\n */\n\n /**\r\n * @constructor\r\n * @abstract\r\n * @param {GenericOptions} options\r\n */\n function BaseGauge(options) {\n _classCallCheck(this, BaseGauge);\n\n var _this3 = _possibleConstructorReturn(this, (BaseGauge.__proto__ || Object.getPrototypeOf(BaseGauge)).call(this));\n\n var className = _this3.constructor.name;\n\n if (className === 'BaseGauge') {\n throw new TypeError('Attempt to instantiate abstract class!');\n }\n\n gauges.push(_this3);\n\n if (options.listeners) {\n Object.keys(options.listeners).forEach(function (event) {\n var handlers = options.listeners[event] instanceof Array ? options.listeners[event] : [options.listeners[event]];\n\n handlers.forEach(function (handler) {\n _this3.on(event, handler);\n });\n });\n }\n\n //noinspection JSUnresolvedVariable\n /**\r\n * Gauges version string\r\n *\r\n * @type {string}\r\n */\n _this3.version = version;\n\n /**\r\n * Gauge type class\r\n *\r\n * @type {BaseGauge} type\r\n */\n _this3.type = ns[className] || BaseGauge;\n\n /**\r\n * True if gauge has been drawn for the first time, false otherwise.\r\n *\r\n * @type {boolean}\r\n */\n _this3.initialized = false;\n\n options.minValue = parseFloat(options.minValue);\n options.maxValue = parseFloat(options.maxValue);\n options.value = parseFloat(options.value) || 0;\n\n if (!options.borders) {\n options.borderInnerWidth = options.borderMiddleWidth = options.borderOuterWidth = 0;\n }\n\n if (!options.renderTo) {\n throw TypeError('Canvas element was not specified when creating ' + 'the Gauge object!');\n }\n\n var canvas = options.renderTo.tagName ? options.renderTo :\n /* istanbul ignore next: to be tested with e2e tests */\n document.getElementById(options.renderTo);\n\n if (!(canvas instanceof HTMLCanvasElement)) {\n throw TypeError('Given gauge canvas element is invalid!');\n }\n\n options.width = parseFloat(options.width) || 0;\n options.height = parseFloat(options.height) || 0;\n\n if (!options.width || !options.height) {\n if (!options.width) options.width = canvas.parentNode ? canvas.parentNode.offsetWidth : canvas.offsetWidth;\n if (!options.height) options.height = canvas.parentNode ? canvas.parentNode.offsetHeight : canvas.offsetHeight;\n }\n\n /**\r\n * Gauge options\r\n *\r\n * @type {GenericOptions} options\r\n */\n _this3.options = options || {};\n\n if (_this3.options.animateOnInit) {\n _this3._value = _this3.options.value;\n _this3.options.value = _this3.options.minValue;\n }\n\n /**\r\n * @type {SmartCanvas} canvas\r\n */\n _this3.canvas = new SmartCanvas(canvas, options.width, options.height);\n _this3.canvas.onRedraw = _this3.draw.bind(_this3);\n\n /**\r\n * @type {Animation} animation\r\n */\n _this3.animation = new Animation(options.animationRule, options.animationDuration);\n return _this3;\n }\n\n /**\r\n * Sets new value for this gauge.\r\n * If gauge is animated by configuration it will trigger a proper animation.\r\n * Upsetting a value triggers gauge redraw.\r\n *\r\n * @param {number} value\r\n */\n\n\n _createClass(BaseGauge, [{\n key: 'update',\n\n\n /**\r\n * Updates gauge configuration options at runtime and redraws the gauge\r\n *\r\n * @param {RadialGaugeOptions} options\r\n * @returns {BaseGauge}\r\n */\n value: function update(options) {\n Object.assign(this.options, this.type.configure(options || {}));\n\n this.canvas.width = this.options.width;\n this.canvas.height = this.options.height;\n\n this.animation.rule = this.options.animationRule;\n this.animation.duration = this.options.animationDuration;\n\n this.canvas.redraw();\n\n return this;\n }\n\n /**\r\n * Performs destruction of this object properly\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n var index = gauges.indexOf(this);\n\n /* istanbul ignore else */\n if (~index) {\n //noinspection JSUnresolvedFunction\n gauges.splice(index, 1);\n }\n\n this.canvas.destroy();\n this.canvas = null;\n\n this.animation.destroy();\n this.animation = null;\n\n this.emit('destroy');\n }\n\n /**\r\n * Returns gauges version string\r\n *\r\n * @return {string}\r\n */\n\n }, {\n key: 'draw',\n\n\n /**\r\n * Triggering gauge render on a canvas.\r\n *\r\n * @abstract\r\n * @returns {BaseGauge}\r\n */\n value: function draw() {\n if (this.options.animateOnInit && !this.initialized) {\n this.value = this._value;\n this.initialized = true;\n this.emit('init');\n }\n\n this.emit('render');\n\n return this;\n }\n\n /**\r\n * Inject given gauge object into DOM\r\n *\r\n * @param {string} type\r\n * @param {GenericOptions} options\r\n */\n\n }, {\n key: 'value',\n set: function set(value) {\n var _this4 = this;\n\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n var fromValue = this.options.value;\n\n if (value === fromValue) {\n return;\n }\n\n if (this.options.animation) {\n if (this.animation.frame) {\n // animation is already in progress -\n // forget related old animation value\n // @see https://github.com/Mikhus/canvas-gauges/issues/94\n this.options.value = this._value;\n\n // if there is no actual value change requested stop it\n if (this._value === value) {\n this.animation.cancel();\n delete this._value;\n return;\n }\n }\n\n /**\r\n * @type {number}\r\n * @access private\r\n */\n if (this._value === undefined) {\n this._value = value;\n }\n\n this.emit('animationStart');\n\n this.animation.animate(function (percent) {\n var newValue = fromValue + (value - fromValue) * percent;\n\n _this4.options.animatedValue && _this4.emit('value', newValue, _this4.value);\n\n _this4.options.value = newValue;\n\n _this4.draw();\n\n _this4.emit('animate', percent, _this4.options.value);\n }, function () {\n if (_this4._value !== undefined) {\n _this4.emit('value', _this4._value, _this4.value);\n _this4.options.value = _this4._value;\n delete _this4._value;\n }\n\n _this4.draw();\n _this4.emit('animationEnd');\n });\n } else {\n this.emit('value', value, this.value);\n this.options.value = value;\n this.draw();\n }\n }\n\n /**\r\n * Returns current value of the gauge\r\n *\r\n * @return {number}\r\n */\n ,\n get: function get() {\n return typeof this._value === 'undefined' ? this.options.value : this._value;\n }\n\n /**\r\n * Updates gauge options\r\n *\r\n * @param {*} options\r\n * @return {BaseGauge}\r\n * @access protected\r\n */\n\n }], [{\n key: 'configure',\n value: function configure(options) {\n return options;\n }\n }, {\n key: 'initialize',\n value: function initialize(type, options) {\n return new DomObserver(options, 'canvas', type);\n }\n\n /**\r\n * Initializes gauge from a given HTML element\r\n * (given element should be valid HTML canvas gauge definition)\r\n *\r\n * @param {HTMLElement} element\r\n */\n\n }, {\n key: 'fromElement',\n value: function fromElement(element) {\n var type = DomObserver.toCamelCase(element.getAttribute('data-type'));\n var attributes = element.attributes;\n var i = 0;\n var s = attributes.length;\n var options = {};\n\n if (!type) {\n return;\n }\n\n if (!/Gauge$/.test(type)) {\n type += 'Gauge';\n }\n\n for (; i < s; i++) {\n options[DomObserver.toCamelCase(attributes[i].name.replace(/^data-/, ''), false)] = DomObserver.parse(attributes[i].value);\n }\n\n new DomObserver(options, element.tagName, type).process(element);\n }\n\n /**\r\n * Ensures value is proper number\r\n *\r\n * @param {*} value\r\n * @param {number} min\r\n * @return {number}\r\n */\n\n }, {\n key: 'ensureValue',\n value: function ensureValue(value) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n value = parseFloat(value);\n\n if (isNaN(value) || !isFinite(value)) {\n value = parseFloat(min) || 0;\n }\n\n return value;\n }\n }, {\n key: 'version',\n get: function get() {\n return version;\n }\n }]);\n\n return BaseGauge;\n}(EventEmitter);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['BaseGauge'] = BaseGauge;\n ns['gauges'] = (window.document || {})['gauges'] = gauges;\n}\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * @access private\r\n * @typedef {CanvasRenderingContext2D|{max: number, maxRadius: number, barDimensions: object}} Canvas2DContext\r\n */\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Examines if a given error is something to throw or to ignore\r\n *\r\n * @param {Error} err\r\n */\nfunction verifyError(err) {\n // there is some unpredictable error in FF in some circumstances\n // which we found simply safe to ignore than to fight with it\n // noinspection JSUnresolvedVariable\n if (err instanceof DOMException && err.result === 0x8053000b) {\n return; // ignore it\n }\n\n throw err;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Prepares major ticks data\r\n *\r\n * @access private\r\n * @param {GenericOptions|{ tickSide: string }} options\r\n * @return {[boolean, boolean]}\r\n */\nfunction prepareTicks(options) {\n if (!(options.majorTicks instanceof Array)) {\n options.majorTicks = options.majorTicks ? [options.majorTicks] : [];\n }\n\n if (!options.majorTicks.length) {\n options.majorTicks.push(drawings.formatMajorTickNumber(options.minValue, options));\n options.majorTicks.push(drawings.formatMajorTickNumber(options.maxValue, options));\n }\n\n return [options.tickSide !== 'right', options.tickSide !== 'left'];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rounded corners rectangle\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @param {number} r\r\n */\nfunction roundRect(context, x, y, w, h, r) {\n context.beginPath();\n\n context.moveTo(x + r, y);\n context.lineTo(x + w - r, y);\n\n context.quadraticCurveTo(x + w, y, x + w, y + r);\n context.lineTo(x + w, y + h - r);\n\n context.quadraticCurveTo(x + w, y + h, x + w - r, y + h);\n context.lineTo(x + r, y + h);\n\n context.quadraticCurveTo(x, y + h, x, y + h - r);\n context.lineTo(x, y + r);\n\n context.quadraticCurveTo(x, y, x + r, y);\n\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Pads a given value with leading zeros using the given options\r\n *\r\n * @param {number} val\r\n * @param {RadialGaugeOptions|{valueInt: number, valueDec: number}} options\r\n * @returns {string}\r\n */\nfunction padValue(val, options) {\n var dec = options.valueDec;\n var int = options.valueInt;\n var i = 0;\n var s = void 0,\n strVal = void 0,\n n = void 0;\n\n val = parseFloat(val);\n n = val < 0;\n val = Math.abs(val);\n\n if (dec > 0) {\n strVal = val.toFixed(dec).toString().split('.');\n s = int - strVal[0].length;\n\n for (; i < s; ++i) {\n strVal[0] = '0' + strVal[0];\n }\n\n strVal = (n ? '-' : '') + strVal[0] + '.' + strVal[1];\n } else {\n strVal = Math.round(val).toString();\n s = int - strVal.length;\n\n for (; i < s; ++i) {\n strVal = '0' + strVal;\n }\n\n strVal = (n ? '-' : '') + strVal;\n }\n\n return strVal;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Formats a number for display on the dial's plate using the majorTicksFormat\r\n * config option.\r\n *\r\n * @param {number} num number to format\r\n * @param {object} options\r\n * @returns {string} formatted number\r\n */\nfunction formatMajorTickNumber(num, options) {\n var right = void 0,\n hasDec = false;\n\n // First, force the correct number of digits right of the decimal.\n if (options.majorTicksDec === 0) {\n right = Math.round(num).toString();\n } else {\n right = num.toFixed(options.majorTicksDec);\n }\n\n // Second, force the correct number of digits left of the decimal.\n if (options.majorTicksInt > 1) {\n // Does this number have a decimal?\n hasDec = ~right.indexOf('.');\n\n // Is this number a negative number?\n if (~right.indexOf('-')) {\n return '-' + [options.majorTicksInt + options.majorTicksDec + 2 + (hasDec ? 1 : 0) - right.length].join('0') + right.replace('-', '');\n } else {\n return [options.majorTicksInt + options.majorTicksDec + 1 + (hasDec ? 1 : 0) - right.length].join('0') + right;\n }\n }\n\n return right;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Transforms degrees to radians\r\n *\r\n * @param {number} degrees\r\n * @returns {number}\r\n */\nfunction radians(degrees) {\n return degrees * Math.PI / 180;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Calculates and returns radial point coordinates\r\n *\r\n * @param {number} radius\r\n * @param {number} angle\r\n * @returns {{x: number, y: number}}\r\n */\nfunction radialPoint(radius, angle) {\n return { x: -radius * Math.sin(angle), y: radius * Math.cos(angle) };\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Creates and returns linear gradient canvas object\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {string} colorFrom\r\n * @param {string} colorTo\r\n * @param {number} length\r\n * @param {boolean} [isVertical]\r\n * @param {number} [from]\r\n * @returns {CanvasGradient}\r\n */\nfunction linearGradient(context, colorFrom, colorTo, length) {\n var isVertical = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n var from = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n\n var grad = context.createLinearGradient(isVertical ? 0 : from, isVertical ? from : 0, isVertical ? 0 : length, isVertical ? length : 0);\n\n grad.addColorStop(0, colorFrom);\n grad.addColorStop(1, colorTo);\n\n return grad;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws the shadow if it was not drawn\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {GenericOptions} options\r\n * @param {boolean} shadowDrawn\r\n * @return {boolean}\r\n */\nfunction drawShadow(context, options) {\n var shadowDrawn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (shadowDrawn) {\n context.restore();\n return true;\n }\n\n context.save();\n\n var w = options.borderShadowWidth;\n\n if (w) {\n context.shadowBlur = w;\n context.shadowColor = options.colorBorderShadow;\n }\n\n return true;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge needle shadow\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawNeedleShadow(context, options) {\n if (!options.needleShadow) return;\n\n context.shadowOffsetX = 2;\n context.shadowOffsetY = 2;\n context.shadowBlur = 10;\n context.shadowColor = options.colorNeedleShadowDown;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Constructs font styles for canvas fonts\r\n *\r\n * @param {GenericOptions} options\r\n * @param {string} target\r\n * @param {number} baseSize\r\n */\nfunction font(options, target, baseSize) {\n return options['font' + target + 'Style'] + ' ' + options['font' + target + 'Weight'] + ' ' + options['font' + target + 'Size'] * baseSize + 'px ' + options['font' + target];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Resets some context settings\r\n *\r\n * @param {Canvas2DContext} context\r\n */\nfunction reset(context) {\n context.shadowOffsetX = null;\n context.shadowOffsetY = null;\n context.shadowBlur = null;\n context.shadowColor = '';\n context.strokeStyle = null;\n context.lineWidth = 0;\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Declares to drow value text shadow if configured\r\n *\r\n * @param context\r\n * @param options\r\n * @param offset\r\n * @param blur\r\n */\nfunction drawValueTextShadow(context, options, offset, blur) {\n if (options.valueTextShadow) {\n context.shadowOffsetX = offset;\n context.shadowOffsetY = offset;\n context.shadowBlur = blur;\n context.shadowColor = options.colorValueTextShadow;\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws value box at given position\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {GenericOptions} options\r\n * @param {number|string} value\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} max\r\n */\nfunction drawValueBox(context, options, value, x, y, max) {\n if (!options.valueBox) return;\n\n reset(context);\n\n var addLength = options.valueDec ? 1 + options.valueDec : 0;\n var maxValueWidth = '9'.repeat(Math.max.apply(null, [String(parseInt(value)).length + addLength].concat(options.majorTicks.map(function (val) {\n return String(parseInt(val, 10)).length + addLength;\n }))));\n var text = options.valueText || padValue(value, options);\n var tunit = max / 200;\n var runit = max / 100;\n var offset = 0.4 * runit;\n var blur = 1.2 * runit;\n\n context.font = font(options, 'Value', tunit);\n drawValueTextShadow(context, options, offset, blur);\n\n var tw = context.measureText(options.valueText ? text : '-' + padValue(Number(maxValueWidth), options)).width;\n\n reset(context);\n\n var th = parseFloat(options.fontValueSize) * tunit + offset + blur;\n var sw = runit * parseFloat(options.valueBoxStroke);\n var bmax = max * 2 - sw * 2;\n\n var bw = tw + 10 * runit;\n var bh = 1.1 * th + offset + blur;\n var br = runit * options.valueBoxBorderRadius;\n var obw = (parseFloat(options.valueBoxWidth) || 0) / 100 * bmax;\n\n obw > bw && (bw = obw);\n bw > bmax && (bw = bmax);\n\n var bx = x - bw / 2;\n var by = y - bh / 2;\n var gy = y - 5.75 * runit;\n\n context.beginPath();\n\n if (br) roundRect(context, bx, by, bw, bh, br);else context.rect(bx, by, bw, bh);\n\n if (sw) {\n var grd = context.createRadialGradient(x, gy, runit * 10, x, gy, runit * 20);\n\n grd.addColorStop(0, options.colorValueBoxRect);\n grd.addColorStop(1, options.colorValueBoxRectEnd);\n\n context.strokeStyle = grd;\n context.lineWidth = sw;\n context.stroke();\n }\n\n if (options.colorValueBoxShadow) {\n context.shadowBlur = 1.2 * runit;\n context.shadowColor = options.colorValueBoxShadow;\n }\n\n if (options.colorValueBoxBackground) {\n context.fillStyle = options.colorValueBoxBackground;\n context.fill();\n }\n\n context.closePath();\n context.restore();\n\n drawValueTextShadow(context, options, offset, blur);\n\n context.fillStyle = options.colorValueText;\n context.textAlign = 'center';\n context.textBaseline = 'alphabetic';\n context.fillText(text, bx + bw / 2, y + bh / 2 - th / 3);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns normalized value\r\n *\r\n * @param {GenericOptions} options\r\n * @return {{normal: number, indented: number}}\r\n */\nfunction normalizedValue(options) {\n var value = options.value;\n var min = options.minValue;\n var max = options.maxValue;\n var dt = (max - min) * 0.01;\n\n return {\n normal: value < min ? min : value > max ? max : value,\n indented: value < min ? min - dt : value > max ? max + dt : value\n };\n}\n\nvar drawings = {\n roundRect: roundRect,\n padValue: padValue,\n formatMajorTickNumber: formatMajorTickNumber,\n radians: radians,\n radialPoint: radialPoint,\n linearGradient: linearGradient,\n drawNeedleShadow: drawNeedleShadow,\n drawValueBox: drawValueBox,\n verifyError: verifyError,\n prepareTicks: prepareTicks,\n drawShadow: drawShadow,\n font: font,\n normalizedValue: normalizedValue\n};\n\ndrawings;\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\nvar PI = Math.PI;\nvar HPI = PI / 2;\n\n/**\r\n * Gauge configuration options\r\n *\r\n * @typedef {GenericOptions|{exactTicks: boolean, ticksAngle: number, startAngle: number, colorNeedleCircleOuter: string, colorNeedleCircleOuterEnd: string, colorNeedleCircleInner: string, colorNeedleCircleInnerEnd: string, needleCircleSize: number, needleCircleInner: boolean, needleCircleOuter: boolean, animationTarget: string, useMinPath: boolean}} RadialGaugeOptions\r\n */\n\n/**\r\n * Default gauge configuration options\r\n *\r\n * @access private\r\n * @type {RadialGaugeOptions}\r\n */\nvar defaultRadialGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n ticksAngle: 270,\n startAngle: 45,\n\n // colors\n colorNeedleCircleOuter: '#f0f0f0',\n colorNeedleCircleOuterEnd: '#ccc',\n colorNeedleCircleInner: '#e8e8e8',\n colorNeedleCircleInnerEnd: '#f5f5f5',\n\n // needle\n needleCircleSize: 10,\n needleCircleInner: true,\n needleCircleOuter: true,\n needleStart: 20,\n\n // custom animations\n animationTarget: 'needle', // 'needle' or 'plate'\n useMinPath: false,\n\n barWidth: 0\n});\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gradient-filled circle on a canvas\r\n *\r\n * @access private\r\n * @param {number} radius\r\n * @param {number} width\r\n * @param {Canvas2DContext} context\r\n * @param {string} start gradient start color\r\n * @param {string} end gradient end color\r\n */\nfunction drawRadialBorder(radius, width, context, start, end) {\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(radius), 0, PI * 2, true);\n context.lineWidth = width;\n context.strokeStyle = end ? drawings.linearGradient(context, start, end, radius) : start;\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns max radius without borders for the gauge\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n * @return {number}\r\n */\nfunction maxRadialRadius(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n\n if (!context.maxRadius) {\n context.maxRadius = context.max - options.borderShadowWidth - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio + (options.borderOuterWidth ? 0.5 : 0) + (options.borderMiddleWidth ? 0.5 : 0) + (options.borderInnerWidth ? 0.5 : 0);\n }\n\n return context.maxRadius;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge plate on the canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialPlate(context, options) {\n var pxRatio = SmartCanvas.pixelRatio;\n var d0 = options.borderShadowWidth * pxRatio;\n var r0 = context.max - d0 - options.borderOuterWidth * pxRatio / 2;\n var r1 = r0 - options.borderOuterWidth * pxRatio / 2 - options.borderMiddleWidth * pxRatio / 2 + 0.5;\n var r2 = r1 - options.borderMiddleWidth * pxRatio / 2 - options.borderInnerWidth * pxRatio / 2 + 0.5;\n var r3 = maxRadialRadius(context, options);\n var grad = void 0;\n var shadowDrawn = false;\n\n context.save();\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r0, options.borderOuterWidth * pxRatio, context, options.colorBorderOuter, options.colorBorderOuterEnd);\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r1, options.borderMiddleWidth * pxRatio, context, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawRadialBorder(r2, options.borderInnerWidth * pxRatio, context, options.colorBorderInner, options.colorBorderInnerEnd);\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n context.beginPath();\n //noinspection JSUnresolvedFunction\n context.arc(0, 0, abs(r3), 0, PI * 2, true);\n\n if (options.colorPlateEnd) {\n grad = context.createRadialGradient(0, 0, r3 / 2, 0, 0, r3);\n grad.addColorStop(0, options.colorPlate);\n grad.addColorStop(1, options.colorPlateEnd);\n } else {\n grad = options.colorPlate;\n }\n\n context.fillStyle = grad;\n\n context.fill();\n context.closePath();\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge highlight areas on a canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialHighlights(context, options) {\n var hlWidth = context.max * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!hlWidth) return;\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options) - hlWidth / 2);\n var i = 0,\n s = options.highlights.length;\n var vd = (options.maxValue - options.minValue) / options.ticksAngle;\n\n context.save();\n\n for (; i < s; i++) {\n var hlt = options.highlights[i];\n\n context.beginPath();\n\n context.rotate(HPI);\n context.arc(0, 0, r, drawings.radians(options.startAngle + (hlt.from - options.minValue) / vd), drawings.radians(options.startAngle + (hlt.to - options.minValue) / vd), false);\n context.strokeStyle = hlt.color;\n context.lineWidth = hlWidth;\n context.stroke();\n context.closePath();\n\n context.restore();\n context.save();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws minor ticks bar on a canvas\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialMinorTicks(context, options) {\n var radius = radialTicksRadius(context, options);\n var s = void 0,\n range = void 0,\n angle = void 0;\n var i = 0;\n var delta = 0;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n\n context.lineWidth = SmartCanvas.pixelRatio;\n context.strokeStyle = options.colorMinorTicks || options.colorStrokeTicks;\n\n context.save();\n\n if (options.exactTicks) {\n range = options.maxValue - options.minValue;\n s = minTicks ? range / minTicks : 0;\n delta = (options.majorTicks[0] % minTicks || 0) * ratio;\n } else {\n s = minTicks * (options.majorTicks.length - 1);\n }\n\n for (; i < s; ++i) {\n angle = options.startAngle + delta + i * (options.ticksAngle / s);\n\n context.rotate(drawings.radians(angle));\n\n context.beginPath();\n context.moveTo(0, radius);\n context.lineTo(0, radius - context.max * 0.075);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns ticks radius\r\n *\r\n * @access private\r\n * @param context\r\n * @param options\r\n * @return {number}\r\n */\nfunction radialTicksRadius(context, options) {\n var unit = context.max / 100;\n\n return maxRadialRadius(context, options) - 5 * unit - (options.barWidth ? (parseFloat(options.barStrokeWidth) || 0) * 2 + ((parseFloat(options.barWidth) || 0) + 5) * unit : 0);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge major ticks bar on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialMajorTicks(context, options) {\n drawings.prepareTicks(options);\n\n //noinspection JSUnresolvedFunction\n var r = abs(radialTicksRadius(context, options));\n var i = void 0,\n colors = void 0;\n var s = options.majorTicks.length;\n var pixelRatio = SmartCanvas.pixelRatio;\n\n context.lineWidth = 2 * pixelRatio;\n context.save();\n\n colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(s).fill(options.colorStrokeTicks || options.colorMajorTicks);\n\n i = 0;\n for (; i < s; ++i) {\n context.strokeStyle = colors[i];\n context.rotate(drawings.radians(radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s)));\n\n context.beginPath();\n context.moveTo(0, r);\n context.lineTo(0, r - context.max * 0.15);\n closeStrokedPath(context);\n }\n\n if (options.strokeTicks) {\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n context.rotate(HPI);\n\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n closeStrokedPath(context);\n }\n}\n\n/* istanbul ignore next: private, not testable */\nfunction radialNextAngle(options, i, s) {\n if (options.exactTicks) {\n var ratio = options.ticksAngle / (options.maxValue - options.minValue);\n return options.startAngle + ratio * (i - options.minValue);\n }\n\n return options.startAngle + i * (options.ticksAngle / (s - 1));\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Strokes, closes path and restores previous context state\r\n *\r\n * @param {Canvas2DContext} context\r\n */\nfunction closeStrokedPath(context) {\n context.stroke();\n context.restore();\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar numbers\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialNumbers(context, options) {\n var radius = radialTicksRadius(context, options) - context.max * 0.15;\n var points = {};\n var i = 0;\n var s = options.majorTicks.length;\n var isAnimated = options.animationTarget !== 'needle';\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(s).fill(options.colorNumbers);\n\n var plateValueAngle = isAnimated ? -(options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle : 0;\n\n if (isAnimated) {\n context.save();\n context.rotate(-drawings.radians(plateValueAngle));\n }\n\n context.font = drawings.font(options, 'Numbers', context.max / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n\n for (; i < s; ++i) {\n var angle = plateValueAngle + radialNextAngle(options, options.exactTicks ? options.majorTicks[i] : i, s);\n var textWidth = context.measureText(options.majorTicks[i]).width;\n var textHeight = options.fontNumbersSize;\n var textRadius = Math.sqrt(textWidth * textWidth + textHeight * textHeight) / 2;\n var point = drawings.radialPoint(radius - textRadius - options.numbersMargin / 100 * context.max, drawings.radians(angle));\n\n if (angle === 360) angle = 0;\n\n if (points[angle]) {\n continue; //already drawn at this place, skipping\n }\n\n points[angle] = true;\n\n context.fillStyle = colors[i];\n context.fillText(options.majorTicks[i], point.x, point.y);\n }\n\n isAnimated && context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge title\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialTitle(context, options) {\n if (!options.title) return;\n\n context.save();\n context.font = drawings.font(options, 'Title', context.max / 200);\n context.fillStyle = options.colorTitle;\n context.textAlign = 'center';\n context.fillText(options.title, 0, -context.max / 4.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws units name on the gauge\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialUnits(context, options) {\n if (!options.units) return;\n\n context.save();\n context.font = drawings.font(options, 'Units', context.max / 200);\n context.fillStyle = options.colorUnits;\n context.textAlign = 'center';\n context.fillText(options.units, 0, context.max / 3.25, context.max * 0.8);\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge needle\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialNeedle(context, options) {\n if (!options.needle) return;\n\n var value = options.ticksAngle < 360 ? drawings.normalizedValue(options).indented : options.value;\n var max = maxRadialRadius(context, options);\n //noinspection JSUnresolvedFunction\n var r1 = abs(max / 100 * options.needleCircleSize);\n //noinspection JSUnresolvedFunction\n var r2 = abs(max / 100 * options.needleCircleSize * 0.75);\n //noinspection JSUnresolvedFunction\n var rIn = abs(max / 100 * options.needleEnd);\n //noinspection JSUnresolvedFunction\n var rStart = abs(options.needleStart ? max / 100 * options.needleStart : 0);\n //noinspection JSUnresolvedFunction\n var pad1 = max / 100 * options.needleWidth;\n var pad2 = max / 100 * options.needleWidth / 2;\n var pixelRatio = SmartCanvas.pixelRatio;\n var isFixed = options.animationTarget !== 'needle';\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n context.rotate(drawings.radians(isFixed ? options.startAngle : options.startAngle + (value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle));\n\n context.fillStyle = drawings.linearGradient(context, options.colorNeedle, options.colorNeedleEnd, rIn - rStart);\n\n if (options.needleType === 'arrow') {\n context.beginPath();\n context.moveTo(-pad2, -rStart);\n context.lineTo(-pad1, 0);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(pixelRatio, rIn);\n context.lineTo(pad1, 0);\n context.lineTo(pad2, -rStart);\n context.closePath();\n context.fill();\n\n context.beginPath();\n context.lineTo(-0.5 * pixelRatio, rIn);\n context.lineTo(-1 * pixelRatio, rIn);\n context.lineTo(-pad1, 0);\n context.lineTo(-pad2, -rStart);\n context.lineTo(pad2 / 2 * pixelRatio - 2 * pixelRatio, -rStart);\n context.closePath();\n context.fillStyle = options.colorNeedleShadowUp;\n context.fill();\n } else {\n // simple line needle\n context.beginPath();\n context.moveTo(-pad2, rIn);\n context.lineTo(-pad2, rStart);\n context.lineTo(pad2, rStart);\n context.lineTo(pad2, rIn);\n context.closePath();\n context.fill();\n }\n\n if (options.needleCircleSize) {\n context.restore();\n\n drawings.drawNeedleShadow(context, options);\n\n if (options.needleCircleOuter) {\n context.beginPath();\n context.arc(0, 0, r1, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleOuter, options.colorNeedleCircleOuterEnd, r1);\n context.fill();\n context.closePath();\n }\n\n if (options.needleCircleInner) {\n context.beginPath();\n context.arc(0, 0, r2, 0, PI * 2, true);\n context.fillStyle = drawings.linearGradient(context, options.colorNeedleCircleInner, options.colorNeedleCircleInnerEnd, r2);\n context.fill();\n context.closePath();\n }\n\n context.restore();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge value box\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n * @param {number} value\r\n */\nfunction drawRadialValueBox(context, options, value) {\n drawings.drawValueBox(context, options, value, 0, context.max - context.max * 0.33, context.max);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge progress bar\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {RadialGaugeOptions} options\r\n */\nfunction drawRadialProgressBar(context, options) {\n var unit = context.max / 100;\n var rMax = maxRadialRadius(context, options) - 5 * unit;\n var sw = parseFloat(options.barStrokeWidth) || 0;\n var w = (parseFloat(options.barWidth) || 0) * unit;\n var rMin = rMax - sw * 2 - w;\n var half = (rMax - rMin) / 2;\n var r = rMin + half;\n var delta = sw / r;\n var sa = options.startAngle;\n var ea = options.startAngle + options.ticksAngle;\n\n context.save();\n context.rotate(HPI);\n\n if (sw) {\n // draw stroke\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa) - delta, drawings.radians(ea) + delta, false);\n context.strokeStyle = options.colorBarStroke;\n context.lineWidth = half * 2;\n context.stroke();\n context.closePath();\n }\n\n if (w) {\n // draw bar\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(ea), false);\n context.strokeStyle = options.colorBar;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n\n if (options.barShadow) {\n // draw shadow\n context.beginPath();\n context.arc(0, 0, rMax, drawings.radians(sa), drawings.radians(ea), false);\n context.clip();\n\n context.beginPath();\n context.strokeStyle = options.colorBar;\n context.lineWidth = 1;\n context.shadowBlur = options.barShadow;\n context.shadowColor = options.colorBarShadow;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n context.arc(0, 0, rMax, drawings.radians(options.startAngle), drawings.radians(options.startAngle + options.ticksAngle), false);\n context.stroke();\n context.closePath();\n\n context.restore();\n context.rotate(HPI);\n }\n\n // draw bar progress\n if (options.barProgress) {\n context.beginPath();\n context.arc(0, 0, r, drawings.radians(sa), drawings.radians(sa + (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle), false);\n context.strokeStyle = options.colorBarProgress;\n context.lineWidth = w;\n context.stroke();\n context.closePath();\n }\n }\n\n context.restore();\n}\n\n/**\r\n * Find and return gauge value to display\r\n *\r\n * @param {RadialGauge} gauge\r\n */\nfunction displayValue(gauge) {\n if (gauge.options.animatedValue) {\n return gauge.options.value;\n }\n\n return gauge.value;\n}\n\n/**\r\n * Minimalistic HTML5 Canvas Gauge\r\n * @example\r\n * var gauge = new RadialGauge({\r\n * renderTo: 'gauge-id', // identifier of HTML canvas element or element itself\r\n * width: 400,\r\n * height: 400,\r\n * units: 'Km/h',\r\n * title: false,\r\n * value: 0,\r\n * minValue: 0,\r\n * maxValue: 220,\r\n * majorTicks: [\r\n * '0','20','40','60','80','100','120','140','160','180','200','220'\r\n * ],\r\n * minorTicks: 2,\r\n * strokeTicks: false,\r\n * highlights: [\r\n * { from: 0, to: 50, color: 'rgba(0,255,0,.15)' },\r\n * { from: 50, to: 100, color: 'rgba(255,255,0,.15)' },\r\n * { from: 100, to: 150, color: 'rgba(255,30,0,.25)' },\r\n * { from: 150, to: 200, color: 'rgba(255,0,225,.25)' },\r\n * { from: 200, to: 220, color: 'rgba(0,0,255,.25)' }\r\n * ],\r\n * colorPlate: '#222',\r\n * colorMajorTicks: '#f5f5f5',\r\n * colorMinorTicks: '#ddd',\r\n * colorTitle: '#fff',\r\n * colorUnits: '#ccc',\r\n * colorNumbers: '#eee',\r\n * colorNeedleStart: 'rgba(240, 128, 128, 1)',\r\n * colorNeedleEnd: 'rgba(255, 160, 122, .9)',\r\n * valueBox: true,\r\n * animationRule: 'bounce'\r\n * });\r\n * // draw initially\r\n * gauge.draw();\r\n * // animate\r\n * setInterval(() => {\r\n * gauge.value = Math.random() * -220 + 220;\r\n * }, 1000);\r\n */\n\nvar RadialGauge = function (_BaseGauge) {\n _inherits(RadialGauge, _BaseGauge);\n\n /**\r\n * Fired each time before gauge plate is drawn\r\n *\r\n * @event RadialGauge#beforePlate\r\n */\n\n /**\r\n * Fired each time before gauge highlight areas are drawn\r\n *\r\n * @event RadialGauge#beforeHighlights\r\n */\n\n /**\r\n * Fired each time before gauge minor ticks are drawn\r\n *\r\n * @event RadialGauge#beforeMinorTicks\r\n */\n\n /**\r\n * Fired each time before gauge major ticks are drawn\r\n *\r\n * @event RadialGauge#beforeMajorTicks\r\n */\n\n /**\r\n * Fired each time before gauge tick numbers are drawn\r\n *\r\n * @event RadialGauge#beforeNumbers\r\n */\n\n /**\r\n * Fired each time before gauge title is drawn\r\n *\r\n * @event RadialGauge#beforeTitle\r\n */\n\n /**\r\n * Fired each time before gauge units text is drawn\r\n *\r\n * @event RadialGauge#beforeUnits\r\n */\n\n /**\r\n * Fired each time before gauge progress bar is drawn\r\n *\r\n * @event RadialGauge#beforeProgressBar\r\n */\n\n /**\r\n * Fired each time before gauge value box is drawn\r\n *\r\n * @event RadialGauge#beforeValueBox\r\n */\n\n /**\r\n * Fired each time before gauge needle is drawn\r\n *\r\n * @event RadialGauge#beforeNeedle\r\n */\n\n /**\r\n * @constructor\r\n * @param {RadialGaugeOptions} options\r\n */\n function RadialGauge(options) {\n _classCallCheck(this, RadialGauge);\n\n options = Object.assign({}, defaultRadialGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (RadialGauge.__proto__ || Object.getPrototypeOf(RadialGauge)).call(this, RadialGauge.configure(options)));\n }\n\n /**\r\n * Checks and updates gauge options properly\r\n *\r\n * @param {*} options\r\n * @return {*}\r\n * @access protected\r\n */\n\n\n _createClass(RadialGauge, [{\n key: 'draw',\n\n\n /**\r\n * Triggering gauge render on a canvas.\r\n *\r\n * @returns {RadialGauge}\r\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref[0],\n y = _ref[1],\n w = _ref[2],\n h = _ref[3];\n\n var options = this.options;\n\n if (options.animationTarget === 'needle') {\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(context, options);\n this.emit('beforeHighlights');\n drawRadialHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(context, options);\n this.emit('beforeTitle');\n drawRadialTitle(context, options);\n this.emit('beforeUnits');\n drawRadialUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n this.emit('beforeNeedle');\n drawRadialNeedle(canvas.context, options);\n } else {\n var plateValueAngle = -drawings.radians((options.value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle);\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n this.emit('beforePlate');\n drawRadialPlate(canvas.context, options);\n\n canvas.context.rotate(plateValueAngle);\n\n // animated\n this.emit('beforeHighlights');\n drawRadialHighlights(canvas.context, options);\n this.emit('beforeMinorTicks');\n drawRadialMinorTicks(canvas.context, options);\n this.emit('beforeMajorTicks');\n drawRadialMajorTicks(canvas.context, options);\n this.emit('beforeNumbers');\n drawRadialNumbers(canvas.context, options);\n this.emit('beforeProgressBar');\n drawRadialProgressBar(canvas.context, options);\n\n // non-animated\n canvas.context.rotate(-plateValueAngle);\n canvas.context.save();\n\n if (!canvas.elementClone.initialized) {\n var _context = canvas.contextClone;\n\n // clear the cache\n _context.clearRect(x, y, w, h);\n _context.save();\n\n this.emit('beforeTitle');\n drawRadialTitle(_context, options);\n this.emit('beforeUnits');\n drawRadialUnits(_context, options);\n this.emit('beforeNeedle');\n drawRadialNeedle(_context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n }\n\n // value box animations\n this.emit('beforeValueBox');\n drawRadialValueBox(canvas.context, options, displayValue(this));\n\n _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }, {\n key: 'value',\n\n\n /**\r\n * Sets the value for radial gauge\r\n *\r\n * @param {number} value\r\n */\n set: function set(value) {\n value = BaseGauge.ensureValue(value, this.options.minValue);\n\n if (this.options.animation && this.options.ticksAngle === 360 && this.options.useMinPath) {\n this._value = value;\n value = this.options.value + ((value - this.options.value) % 360 + 540) % 360 - 180;\n }\n\n _set(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', value, this);\n }\n\n /**\r\n * Returns current gauge value\r\n *\r\n * @return {number}\r\n */\n ,\n get: function get() {\n return _get(RadialGauge.prototype.__proto__ || Object.getPrototypeOf(RadialGauge.prototype), 'value', this);\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n if (options.barWidth > 50) options.barWidth = 50;\n\n /* istanbul ignore if */\n if (isNaN(options.startAngle)) options.startAngle = 45;\n /* istanbul ignore if */\n if (isNaN(options.ticksAngle)) options.ticksAngle = 270;\n\n /* istanbul ignore if */\n if (options.ticksAngle > 360) options.ticksAngle = 360;\n /* istanbul ignore if */\n if (options.ticksAngle < 0) options.ticksAngle = 0;\n\n /* istanbul ignore if */\n if (options.startAngle < 0) options.startAngle = 0;\n /* istanbul ignore if */\n if (options.startAngle > 360) options.startAngle = 360;\n\n return options;\n }\n }]);\n\n return RadialGauge;\n}(BaseGauge);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['RadialGauge'] = RadialGauge;\n}\n\nBaseGauge.initialize('RadialGauge', defaultRadialGaugeOptions);\n\n/*!\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2016 Mykhailo Stadnyk \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\n\n/**\r\n * Linear gauge configuration options\r\n *\r\n * @typedef {GenericOptions|{borderRadius: number, barBeginCircle: number, tickSide: string, needleSide: string, numberSide: string, ticksWidth: number, ticksWidthMinor: number, ticksPadding: number, barLength: number, colorBarEnd: string, colorBarProgressEnd: string}} LinearGaugeOptions\r\n */\n\n/**\r\n * Default linear gauge configuration options\r\n *\r\n * @type {LinearGaugeOptions}\r\n */\nvar defaultLinearGaugeOptions = Object.assign({}, GenericOptions, {\n // basic options\n borderRadius: 0,\n // width: 150,\n // height: 400,\n\n // bar\n barBeginCircle: 30, // percents\n colorBarEnd: '',\n colorBarProgressEnd: '',\n\n needleWidth: 6,\n\n tickSide: 'both', // available: 'left', 'right', 'both'\n needleSide: 'both', // available: 'left', 'right', 'both'\n\n numberSide: 'both', // available: 'left', 'right', 'both'\n\n ticksWidth: 10,\n ticksWidthMinor: 5,\n ticksPadding: 5,\n barLength: 85,\n fontTitleSize: 26,\n\n highlightsWidth: 10\n});\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rectangle on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\r\n * @param {number} x x-coordinate of the top-left corner\r\n * @param {number} y y-coordinate of the top-left corner\r\n * @param {number} w width of the rectangle\r\n * @param {number} h height of the rectangle\r\n * @param {string} colorStart base fill color of the rectangle\r\n * @param {string} [colorEnd] gradient color of the rectangle\r\n */\nfunction drawRectangle(context, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.fillStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, w > h ? w : h, h > w, w > h ? x : y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws rectangle on a canvas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} width width of the border\r\n * @param {number} r radius for founded corner rectangle if 0 or less won't be drawn\r\n * @param {number} x x-coordinate of the top-left corner\r\n * @param {number} y y-coordinate of the top-left corner\r\n * @param {number} w width of the rectangle\r\n * @param {number} h height of the rectangle\r\n * @param {string} colorStart base fill color of the rectangle\r\n * @param {string} [colorEnd] gradient color of the rectangle\r\n */\nfunction drawLinearBorder(context, width, r, x, y, w, h, colorStart, colorEnd) {\n context.beginPath();\n context.lineWidth = width;\n context.strokeStyle = colorEnd ? drawings.linearGradient(context, colorStart, colorEnd, h, true, y) : colorStart;\n\n r > 0 ? drawings.roundRect(context, x, y, w, h, r) : context.rect(x, y, w, h);\n\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge plate\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearPlate(context, options, x, y, w, h) {\n var pxRatio = SmartCanvas.pixelRatio;\n context.save();\n\n var r = options.borderRadius * pxRatio;\n var w1 = w - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var w2 = w1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var w3 = w2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var w4 = w3 - options.borderInnerWidth * pxRatio;\n\n var h1 = h - options.borderShadowWidth - options.borderOuterWidth * pxRatio;\n var h2 = h1 - options.borderOuterWidth * pxRatio - options.borderMiddleWidth * pxRatio;\n var h3 = h2 - options.borderMiddleWidth * pxRatio - options.borderInnerWidth * pxRatio;\n var h4 = h3 - options.borderInnerWidth * pxRatio;\n\n var x2 = x - (w2 - w1) / 2;\n var x3 = x2 - (w3 - w2) / 2;\n var x4 = x3 - (w4 - w3) / 2;\n\n var y2 = y - (h2 - h1) / 2;\n var y3 = y2 - (h3 - h2) / 2;\n var y4 = y3 - (h4 - h3) / 2;\n var aliasingOffset = 0;\n var shadowDrawn = false;\n\n if (options.borderOuterWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderOuterWidth * pxRatio, r, x + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, y + options.borderOuterWidth * pxRatio / 2 - aliasingOffset, w1, h1, options.colorBorderOuter, options.colorBorderOuterEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderMiddleWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderMiddleWidth * pxRatio, r -= 1 + aliasingOffset * 2, x2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, y2 + options.borderMiddleWidth * pxRatio / 2 - aliasingOffset, w2 + aliasingOffset * 2, h2 + aliasingOffset * 2, options.colorBorderMiddle, options.colorBorderMiddleEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n if (options.borderInnerWidth) {\n shadowDrawn = drawings.drawShadow(context, options, shadowDrawn);\n drawLinearBorder(context, options.borderInnerWidth * pxRatio, r -= 1 + aliasingOffset * 2, x3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, y3 + options.borderInnerWidth * pxRatio / 2 - aliasingOffset, w3 + aliasingOffset * 2, h3 + aliasingOffset * 2, options.colorBorderInner, options.colorBorderInnerEnd);\n aliasingOffset += 0.5 * pxRatio;\n }\n\n drawings.drawShadow(context, options, shadowDrawn);\n\n drawRectangle(context, r, x4, y4, w4 + aliasingOffset * 2, h4 + aliasingOffset * 2, options.colorPlate, options.colorPlateEnd);\n\n context.restore();\n\n return [x4, y4, w4, h4];\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Calculates and returns linear gauge base bar dimensions.\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions|{barStrokeWidth: number, barBeginCircle: number, barWidth: number, hasLeft: boolean, hasRight: boolean}} options\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n * @return {{isVertical: boolean, width: number, length: number, barWidth: number, barLength: number, strokeWidth: number, barMargin: number, radius: number, x0: number, y0: number, barOffset: number, titleMargin: number, unitsMargin: number, X: number, Y: number, baseX: number, baseY: number, ticksPadding: number}}\r\n */\nfunction barDimensions(context, options, x, y, w, h) {\n var pixelRatio = SmartCanvas.pixelRatio;\n var isVertical = h >= w;\n var width = isVertical ? w * 0.85 : h;\n var length = isVertical ? h : w;\n\n //noinspection JSUnresolvedFunction\n x = isVertical ? round(x + (w - width) / 2) : x;\n\n var hasTitle = !!options.title;\n var hasUnits = !!options.units;\n var hasValue = !!options.valueBox;\n\n var titleMargin = void 0;\n var unitsMargin = void 0;\n var valueMargin = void 0;\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n unitsMargin = round(length * 0.05);\n //noinspection JSUnresolvedFunction\n titleMargin = round(length * 0.075);\n //noinspection JSUnresolvedFunction\n valueMargin = round(length * 0.11);\n\n if (hasTitle) {\n length -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) length -= unitsMargin;\n if (hasValue) length -= valueMargin;\n } else {\n //noinspection JSUnresolvedFunction\n unitsMargin = titleMargin = round(width * 0.15);\n\n if (hasTitle) {\n width -= titleMargin;\n y += titleMargin;\n }\n\n if (hasUnits) width -= unitsMargin;\n }\n\n var strokeWidth = options.barStrokeWidth * 2;\n //noinspection JSUnresolvedFunction\n var radius = options.barBeginCircle ? round(width * options.barBeginCircle / 200 - strokeWidth / 2) : 0;\n //noinspection JSUnresolvedFunction\n var barWidth = round(width * options.barWidth / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barLength = round(length * options.barLength / 100 - strokeWidth);\n //noinspection JSUnresolvedFunction\n var barMargin = round((length - barLength) / 2);\n\n // coordinates for arc of the bar if configured\n //noinspection JSUnresolvedFunction\n var x0 = round(x + (isVertical ? width / 2 : barMargin + radius));\n //noinspection JSUnresolvedFunction\n var y0 = round(y + (isVertical ? length - barMargin - radius + strokeWidth / 2 : width / 2));\n var dx = isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n var dy = !isVertical && !(options.hasLeft && options.hasRight) ? (options.hasRight ? -1 : 1) * options.ticksWidth / 100 * width : 0;\n\n //noinspection JSUndefinedPropertyAssignment\n context.barDimensions = {\n isVertical: isVertical,\n width: width,\n length: length,\n barWidth: barWidth,\n barLength: barLength,\n strokeWidth: strokeWidth,\n barMargin: barMargin,\n radius: radius,\n pixelRatio: pixelRatio,\n barOffset: null,\n titleMargin: hasTitle ? titleMargin : 0,\n unitsMargin: hasUnits ? unitsMargin : 0,\n get ticksLength() {\n return this.barLength - this.barOffset - this.strokeWidth;\n },\n X: x + dx,\n Y: y + dy,\n x0: x0 + dx,\n y0: y0 + dy,\n baseX: x,\n baseY: y,\n ticksPadding: options.ticksPadding / 100\n };\n\n return context.barDimensions;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws bar shape from the given options on a given canvas context\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {string} type\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearBarShape(context, options, type, x, y, w, h) {\n var _barDimensions = barDimensions(context, options, x, y, w, h),\n isVertical = _barDimensions.isVertical,\n width = _barDimensions.width,\n barWidth = _barDimensions.barWidth,\n barLength = _barDimensions.barLength,\n strokeWidth = _barDimensions.strokeWidth,\n barMargin = _barDimensions.barMargin,\n radius = _barDimensions.radius,\n x0 = _barDimensions.x0,\n y0 = _barDimensions.y0,\n X = _barDimensions.X,\n Y = _barDimensions.Y;\n\n var fullBarLength = barLength;\n\n context.save();\n context.beginPath();\n\n if (options.barBeginCircle) {\n var direction = drawings.radians(isVertical ? 270 : 0);\n var alpha = Math.asin(barWidth / 2 / radius);\n var cosAlpha = Math.cos(alpha);\n var sinAlpha = Math.sin(alpha);\n\n var x1 = x0 + (isVertical ? radius * sinAlpha : radius * cosAlpha - strokeWidth / 2);\n var y1 = isVertical ? y0 - radius * cosAlpha : y0 + radius * sinAlpha;\n //noinspection JSUnresolvedFunction\n var cutRadius = isVertical ? abs(y1 - y0) : abs(x1 - x0);\n\n //noinspection JSUnresolvedFunction\n context.barDimensions.barOffset = round(cutRadius + radius);\n\n // bottom point\n //noinspection JSUnresolvedFunction\n var x2 = isVertical ? round(x0 - radius * sinAlpha) : x1;\n //noinspection JSUnresolvedFunction\n var y2 = isVertical ? y1 : round(y0 - radius * sinAlpha);\n\n if (type === 'progress') {\n barLength = context.barDimensions.barOffset + (barLength - context.barDimensions.barOffset) * (drawings.normalizedValue(options).normal - options.minValue) / (options.maxValue - options.minValue);\n }\n\n // bar ends at\n //noinspection JSUnresolvedFunction\n var x3 = round(x1 + barLength - context.barDimensions.barOffset + strokeWidth / 2); // h\n //noinspection JSUnresolvedFunction\n var y3 = round(y1 - barLength + context.barDimensions.barOffset - strokeWidth / 2); // v\n\n context.arc(x0, y0, radius, direction + alpha, direction - alpha);\n\n if (isVertical) {\n context.moveTo(x1, y2);\n context.lineTo(x1, y3);\n context.lineTo(x2, y3);\n context.lineTo(x2, y2);\n } else {\n context.moveTo(x1, y2);\n context.lineTo(x3, y2);\n context.lineTo(x3, y1);\n context.lineTo(x1, y1);\n }\n } else {\n // simply rectangle\n //noinspection JSUnresolvedFunction\n var rx = round(isVertical ? X + (width - barWidth) / 2 : X + barMargin);\n //noinspection JSUnresolvedFunction\n var ry = round(isVertical ? Y + barLength + barMargin : Y + (width - barWidth) / 2);\n\n if (type === 'progress') {\n barLength *= (options.value - options.minValue) / (options.maxValue - options.minValue);\n }\n\n if (isVertical) context.rect(rx, ry, barWidth, -barLength);else context.rect(rx, ry, barLength, barWidth);\n }\n\n if (type !== 'progress' && options.barStrokeWidth) {\n context.lineWidth = strokeWidth;\n context.strokeStyle = options.colorBarStroke;\n //context.lineJoin = 'round';\n context.stroke();\n }\n\n if (type !== 'progress' && options.colorBar) {\n context.fillStyle = options.colorBarEnd ? drawings.linearGradient(context, options.colorBar, options.colorBarEnd, barLength, isVertical, isVertical ? Y : X) : options.colorBar;\n context.fill();\n } else if (type === 'progress' && options.colorBarProgress) {\n context.fillStyle = options.colorBarProgressEnd ? drawings.linearGradient(context, options.colorBarProgress, options.colorBarProgressEnd, fullBarLength, isVertical, isVertical ? Y : X) : options.colorBarProgress;\n context.fill();\n }\n\n context.closePath();\n\n // fix dimensions for further usage\n if (options.barBeginCircle) context.barDimensions.radius += strokeWidth;\n\n context.barDimensions.barWidth += strokeWidth;\n context.barDimensions.barLength += strokeWidth;\n}\n\n/**\r\n * Draws gauge bar\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x x-coordinate of the top-left corner of the gauge\r\n * @param {number} y y-coordinate of the top-left corner of the gauge\r\n * @param {number} w width of the gauge\r\n * @param {number} h height of the gauge\r\n */\nfunction drawLinearBar(context, options, x, y, w, h) {\n drawLinearBarShape(context, options, '', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Helper function to calculate bar ticks presence on the sides\r\n *\r\n * @param {string} notWhich\r\n * @param {LinearGaugeOptions} options\r\n * @return {boolean}\r\n */\nfunction hasTicksBar(notWhich, options) {\n return options.needleSide !== notWhich || options.tickSide !== notWhich || options.numberSide !== notWhich;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar progress\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} x x-coordinate of the top-left corner of the gauge\r\n * @param {number} y y-coordinate of the top-left corner of the gauge\r\n * @param {number} w width of the gauge\r\n * @param {number} h height of the gauge\r\n */\nfunction drawLinearBarProgress(context, options, x, y, w, h) {\n options.barProgress && drawLinearBarShape(context, options, 'progress', x, y, w, h);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws gauge bar highlighted areas\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearBarHighlights(context, options) {\n var _context$barDimension = context.barDimensions,\n isVertical = _context$barDimension.isVertical,\n width = _context$barDimension.width,\n length = _context$barDimension.length,\n barWidth = _context$barDimension.barWidth,\n barOffset = _context$barDimension.barOffset,\n barMargin = _context$barDimension.barMargin,\n X = _context$barDimension.X,\n Y = _context$barDimension.Y,\n ticksLength = _context$barDimension.ticksLength,\n ticksPadding = _context$barDimension.ticksPadding;\n\n var hlWidth = width * (parseFloat(options.highlightsWidth) || 0) / 100;\n\n if (!options.highlights || !hlWidth) return;\n\n var hasLeft = options.tickSide !== 'right';\n var hasRight = options.tickSide !== 'left';\n var i = 0;\n var s = options.highlights.length;\n var tickOffset = (width - barWidth) / 2;\n var interval = options.maxValue - options.minValue;\n //noinspection JSUnresolvedFunction\n var eX = round(isVertical ? X + tickOffset : X + barMargin + barOffset);\n var eH = hlWidth;\n var eY = isVertical ? Y + length - barMargin - barOffset : Y + tickOffset;\n //noinspection JSUnresolvedFunction\n var hLeft = round((options.ticksWidth / 100 + ticksPadding) * width) + (hlWidth - options.ticksWidth / 100 * width);\n //noinspection JSUnresolvedFunction\n var hRight = round(barWidth + ticksPadding * width);\n\n context.save();\n\n for (; i < s; i++) {\n var entry = options.highlights[i];\n //noinspection JSUnresolvedFunction\n var eStart = ticksLength * abs(options.minValue - entry.from) / interval;\n //noinspection JSUnresolvedFunction\n var eW = ticksLength * abs((entry.to - entry.from) / interval);\n\n context.beginPath();\n context.fillStyle = entry.color;\n\n if (isVertical) {\n if (hasLeft) context.rect(eX - hLeft, eY - eStart, eH, -eW);\n\n if (hasRight) context.rect(eX + hRight, eY - eStart, eH, -eW);\n } else {\n if (hasLeft) context.rect(eX + eStart, eY - hLeft, eW, eH);\n\n if (hasRight) context.rect(eX + eStart, eY + hRight, eW, eH);\n }\n\n context.fill();\n context.closePath();\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws a tick line on a linear gauge\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param x1\r\n * @param y1\r\n * @param x2\r\n * @param y2\r\n */\nfunction drawLinearTick(context, x1, y1, x2, y2) {\n context.beginPath();\n\n context.moveTo(x1, y1);\n context.lineTo(x2, y2);\n context.stroke();\n\n context.closePath();\n context.save();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {string} color\r\n * @param {number[]} ticks\r\n * @param {number} minVal\r\n * @param {number} maxVal\r\n * @param {boolean} hasLeft\r\n * @param {boolean} hasRight\r\n * @param {number} lineWidth\r\n * @param {number} lineLength\r\n */\nfunction drawLinearTicks(context, color, ticks, minVal, maxVal, hasLeft, hasRight, lineWidth, lineLength) {\n var _context$barDimension2 = context.barDimensions,\n isVertical = _context$barDimension2.isVertical,\n length = _context$barDimension2.length,\n barWidth = _context$barDimension2.barWidth,\n barOffset = _context$barDimension2.barOffset,\n barMargin = _context$barDimension2.barMargin,\n pixelRatio = _context$barDimension2.pixelRatio,\n width = _context$barDimension2.width,\n X = _context$barDimension2.X,\n Y = _context$barDimension2.Y,\n ticksLength = _context$barDimension2.ticksLength,\n ticksPadding = _context$barDimension2.ticksPadding;\n\n var tickOffset = (width - barWidth) / 2;\n var tickX = void 0,\n tickY = void 0;\n var i = 0;\n var s = ticks.length;\n var val = void 0;\n var tickLen = lineLength * width;\n var tickLeft = tickOffset - ticksPadding * width;\n var tickRight = tickOffset + barWidth + tickLen + ticksPadding * width;\n var colors = color instanceof Array ? color : new Array(ticks.length).fill(color);\n\n context.lineWidth = lineWidth * pixelRatio;\n context.save();\n\n var ratio = ticksLength / (maxVal - minVal);\n for (; i < s; i++) {\n val = ticks[i];\n context.strokeStyle = colors[i];\n\n if (isVertical) {\n tickY = Y + length - barMargin - barOffset + (minVal - val) * ratio;\n\n if (hasLeft) {\n tickX = X + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n\n if (hasRight) {\n tickX = X + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, round(tickX - tickLen), tickY);\n }\n } else {\n tickX = X + barMargin + barOffset - (minVal - val) * ratio;\n\n if (hasLeft) {\n tickY = Y + tickLeft;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, tickY, tickX, round(tickY - tickLen));\n }\n\n if (hasRight) {\n tickY = Y + tickRight;\n //noinspection JSUnresolvedFunction\n drawLinearTick(context, tickX, round(tickY), tickX, tickY - tickLen);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws major ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMajorTicks(context, options) {\n var _drawings$prepareTick = drawings.prepareTicks(options),\n _drawings$prepareTick2 = _slicedToArray(_drawings$prepareTick, 2),\n hasLeft = _drawings$prepareTick2[0],\n hasRight = _drawings$prepareTick2[1];\n\n var lineWidth = 2;\n var valuePerNonExactTick = (options.maxValue - options.minValue) / (options.majorTicks.length - 1);\n var colors = options.colorMajorTicks instanceof Array ? options.colorMajorTicks : new Array(options.majorTicks.length).fill(options.colorStrokeTicks || options.colorMajorTicks);\n var ticks = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n\n drawLinearTicks(context, colors, ticks, options.minValue, options.maxValue, hasLeft, hasRight, lineWidth, options.ticksWidth / 100);\n\n if (options.strokeTicks) {\n var _context$barDimension3 = context.barDimensions,\n isVertical = _context$barDimension3.isVertical,\n length = _context$barDimension3.length,\n width = _context$barDimension3.width,\n barWidth = _context$barDimension3.barWidth,\n barMargin = _context$barDimension3.barMargin,\n barOffset = _context$barDimension3.barOffset,\n X = _context$barDimension3.X,\n Y = _context$barDimension3.Y,\n ticksLength = _context$barDimension3.ticksLength,\n pixelRatio = _context$barDimension3.pixelRatio,\n ticksPadding = _context$barDimension3.ticksPadding;\n\n var rightTicks = (width - barWidth) / 2 + barWidth + ticksPadding * width;\n var leftTicks = (width - barWidth) / 2 - ticksPadding * width;\n var sX = void 0,\n sY = void 0,\n eX = void 0,\n eY = void 0;\n\n context.strokeStyle = options.colorStrokeTicks || colors[0];\n\n lineWidth *= pixelRatio;\n\n if (isVertical) {\n sY = Y + length - barMargin - barOffset + lineWidth / 2;\n eY = sY - ticksLength - lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eX = sX = round(X + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n } else {\n sX = X + barMargin + barOffset - lineWidth / 2;\n eX = sX + ticksLength + lineWidth;\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + leftTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n eY = sY = round(Y + rightTicks);\n drawLinearTickStroke(context, sX, sY, eX, eY);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws ticks stroke\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n */\nfunction drawLinearTickStroke(context, sX, sY, eX, eY) {\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws minor ticks\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMinorTicks(context, options) {\n var _drawings$prepareTick3 = drawings.prepareTicks(options),\n _drawings$prepareTick4 = _slicedToArray(_drawings$prepareTick3, 2),\n hasLeft = _drawings$prepareTick4[0],\n hasRight = _drawings$prepareTick4[1];\n\n var ticks = [];\n var i = options.minValue;\n var minTicks = Math.abs(options.minorTicks) || 0;\n var valuePerNonExactTick = minTicks ? (options.maxValue - options.minValue) / (minTicks * (options.majorTicks.length - 1)) : 0;\n\n if (minTicks) {\n if (options.exactTicks) {\n var delta = options.majorTicks[0] % minTicks || 0;\n\n for (; i < options.maxValue; i += minTicks) {\n ticks.push(delta + i);\n }\n } else {\n for (; i < options.maxValue; i += valuePerNonExactTick) {\n ticks.push(i);\n }\n }\n }\n\n drawLinearTicks(context, options.colorMinorTicks || options.colorStrokeTicks, ticks, options.minValue, options.maxValue, hasLeft, hasRight, 1, options.ticksWidthMinor / 100);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws major tick numbers\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearMajorTicksNumbers(context, options) {\n var _context$barDimension4 = context.barDimensions,\n isVertical = _context$barDimension4.isVertical,\n length = _context$barDimension4.length,\n width = _context$barDimension4.width,\n barWidth = _context$barDimension4.barWidth,\n barMargin = _context$barDimension4.barMargin,\n barOffset = _context$barDimension4.barOffset,\n X = _context$barDimension4.X,\n Y = _context$barDimension4.Y,\n ticksLength = _context$barDimension4.ticksLength,\n ticksPadding = _context$barDimension4.ticksPadding;\n\n var range = options.maxValue - options.minValue;\n var valuePerNonExactTick = range / (options.majorTicks.length - 1);\n var tickValues = options.exactTicks ? options.majorTicks : options.majorTicks.map(function (tick, i) {\n return options.minValue + valuePerNonExactTick * i;\n });\n var ticks = tickValues.length;\n var hasLeft = options.numberSide !== 'right';\n var hasRight = options.numberSide !== 'left';\n var textHeight = options.fontNumbersSize * width / 200;\n var i = 0;\n var ticksWidth = (options.ticksWidth / 100 + ticksPadding * 2) * width;\n var numLeft = (width - barWidth) / 2 - ticksWidth;\n var numRight = (width - barWidth) / 2 + barWidth + ticksWidth;\n var textX = void 0,\n textY = void 0,\n textWidth = void 0,\n numberOffset = void 0,\n tick = void 0;\n var colors = options.colorNumbers instanceof Array ? options.colorNumbers : new Array(ticks).fill(options.colorNumbers);\n var textMargin = options.numbersMargin / 100 * width;\n\n context.font = drawings.font(options, 'Numbers', width / 200);\n context.lineWidth = 0;\n context.textAlign = 'center';\n\n for (; i < ticks; i++) {\n context.fillStyle = colors[i];\n tick = options.majorTicks[i];\n numberOffset = options.exactTicks ? ticksLength * ((tickValues[i] - options.minValue) / range) : i * ticksLength / (ticks - 1);\n\n if (isVertical) {\n textY = Y + length - barMargin - barOffset - numberOffset + textHeight / 3;\n\n if (hasLeft) {\n context.textAlign = 'right';\n context.fillText(tick, X + numLeft - textMargin, textY);\n }\n\n if (hasRight) {\n context.textAlign = 'left';\n context.fillText(tick, X + numRight + textMargin, textY);\n }\n } else {\n textWidth = context.measureText(tick).width;\n textX = X + barMargin + barOffset + numberOffset;\n\n if (hasLeft) {\n context.fillText(tick, textX, Y + numLeft - textMargin);\n }\n\n if (hasRight) {\n context.fillText(tick, textX, Y + numRight + textHeight + textMargin);\n }\n }\n }\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge title\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearTitle(context, options) {\n if (!options.title) return;\n\n var _context$barDimension5 = context.barDimensions,\n isVertical = _context$barDimension5.isVertical,\n width = _context$barDimension5.width,\n length = _context$barDimension5.length,\n baseX = _context$barDimension5.baseX,\n baseY = _context$barDimension5.baseY,\n titleMargin = _context$barDimension5.titleMargin;\n\n var textHeight = options.fontTitleSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + titleMargin / 2 - (isVertical ? textHeight : textHeight / 2) - 0.025 * (isVertical ? length : width));\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorTitle;\n context.font = drawings.font(options, 'Title', width / 200);\n context.lineWidth = 0;\n context.fillText(options.title, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge units\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearUnits(context, options) {\n if (!options.units) return;\n\n var _context$barDimension6 = context.barDimensions,\n isVertical = _context$barDimension6.isVertical,\n width = _context$barDimension6.width,\n length = _context$barDimension6.length,\n baseX = _context$barDimension6.baseX,\n baseY = _context$barDimension6.baseY,\n unitsMargin = _context$barDimension6.unitsMargin;\n\n var textHeight = options.fontUnitsSize * width / 200;\n //noinspection JSUnresolvedFunction\n var textX = round(baseX + (isVertical ? width : length) / 2);\n //noinspection JSUnresolvedFunction\n var textY = round(baseY + (isVertical ? length : width) + unitsMargin / 2 - textHeight / 2);\n\n context.save();\n context.textAlign = 'center';\n context.fillStyle = options.colorUnits;\n context.font = drawings.font(options, 'Units', width / 200);\n context.lineWidth = 0;\n context.fillText(options.units, textX, textY, isVertical ? width : length);\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws linear gauge needles\r\n *\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n */\nfunction drawLinearBarNeedle(context, options) {\n if (!options.needle) return;\n\n var _context$barDimension7 = context.barDimensions,\n isVertical = _context$barDimension7.isVertical,\n width = _context$barDimension7.width,\n length = _context$barDimension7.length,\n barWidth = _context$barDimension7.barWidth,\n barOffset = _context$barDimension7.barOffset,\n barMargin = _context$barDimension7.barMargin,\n ticksLength = _context$barDimension7.ticksLength,\n X = _context$barDimension7.X,\n Y = _context$barDimension7.Y,\n ticksPadding = _context$barDimension7.ticksPadding;\n\n var hasLeft = options.needleSide !== 'right';\n var hasRight = options.needleSide !== 'left';\n var position = ticksLength * (drawings.normalizedValue(options).indented - options.minValue) / (options.maxValue - options.minValue);\n var tickWidth = (options.ticksWidth / 100 + ticksPadding) * width;\n var baseLength = barWidth / 2 + tickWidth;\n var needleLength = baseLength * (options.needleEnd / 100);\n var sX = void 0,\n eX = void 0,\n sY = void 0,\n eY = void 0;\n var draw = options.needleType.toLowerCase() === 'arrow' ? drawLinearArrowNeedle : drawLinearLineNeedle;\n var barStart = (width - barWidth) / 2;\n var needleStart = baseLength * (options.needleStart / 100);\n var nLeft = barStart - tickWidth - needleStart;\n var nRight = barStart + barWidth + tickWidth + needleStart;\n\n context.save();\n\n drawings.drawNeedleShadow(context, options);\n\n if (isVertical) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + length - barMargin - barOffset - position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nLeft);\n eX = sX + needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sX = round(X + nRight);\n eX = sX - needleLength;\n draw(context, options, sX, sY, eX, sY, needleLength, true);\n }\n } else {\n //noinspection JSUnresolvedFunction\n sX = round(X + barMargin + barOffset + position);\n\n if (hasLeft) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nLeft);\n eY = sY + needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength);\n }\n\n if (hasRight) {\n //noinspection JSUnresolvedFunction\n sY = round(Y + nRight);\n eY = sY - needleLength;\n draw(context, options, sX, sY, sX, eY, needleLength, true);\n }\n }\n\n context.restore();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Returns needle color style\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n * @return {CanvasGradient|string}\r\n */\nfunction needleStyle(context, options, length, isRight) {\n return options.colorNeedleEnd ? drawings.linearGradient(context, isRight ? options.colorNeedleEnd : options.colorNeedle, isRight ? options.colorNeedle : options.colorNeedleEnd, length, !context.barDimensions.isVertical) : options.colorNeedle;\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws line needle shape\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n */\nfunction drawLinearLineNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n context.lineWidth = options.needleWidth;\n context.strokeStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n context.moveTo(sX, sY);\n context.lineTo(eX, eY);\n context.stroke();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws arrow needle shape\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} sX\r\n * @param {number} sY\r\n * @param {number} eX\r\n * @param {number} eY\r\n * @param {number} length\r\n * @param {boolean} [isRight]\r\n */\nfunction drawLinearArrowNeedle(context, options, sX, sY, eX, eY, length, isRight) {\n //noinspection JSUnresolvedFunction\n var peakLength = round(length * 0.4);\n var bodyLength = length - peakLength;\n var isVertical = sX === eX;\n var halfWidth = options.needleWidth / 2;\n\n context.fillStyle = needleStyle(context, options, length, isRight);\n\n context.beginPath();\n\n if (isVertical) {\n if (sY > eY) bodyLength *= -1;\n\n context.moveTo(sX - halfWidth, sY);\n context.lineTo(sX + halfWidth, sY);\n context.lineTo(sX + halfWidth, sY + bodyLength);\n context.lineTo(sX, eY);\n context.lineTo(sX - halfWidth, sY + bodyLength);\n context.lineTo(sX - halfWidth, sY);\n } else {\n if (sX > eX) bodyLength *= -1;\n\n context.moveTo(sX, sY - halfWidth);\n context.lineTo(sX, sY + halfWidth);\n context.lineTo(sX + bodyLength, sY + halfWidth);\n context.lineTo(eX, sY);\n context.lineTo(sX + bodyLength, sY - halfWidth);\n context.lineTo(sX, sY - halfWidth);\n }\n\n context.fill();\n context.closePath();\n}\n\n/* istanbul ignore next: private, not testable */\n/**\r\n * Draws value box for linear gauge\r\n *\r\n * @access private\r\n * @param {Canvas2DContext} context\r\n * @param {LinearGaugeOptions} options\r\n * @param {number} value\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} w\r\n * @param {number} h\r\n */\nfunction drawLinearValueBox(context, options, value, x, y, w, h) {\n // currently value box is available only for vertical linear gauge,\n // as far as by design it is hard to find a proper place for\n // horizontal ones\n var boxWidth = (parseFloat(options.fontValueSize) || 0) * w / 200;\n var dy = (0.11 * h - boxWidth) / 2;\n\n context.barDimensions.isVertical && drawings.drawValueBox(context, options, value, x + w / 2, y + h - boxWidth - dy, w);\n}\n\n/**\r\n * Minimalistic HTML5 Canvas Linear Gauge\r\n */\n\nvar LinearGauge = function (_BaseGauge2) {\n _inherits(LinearGauge, _BaseGauge2);\n\n /**\r\n * Fired each time before gauge plate is drawn\r\n *\r\n * @event LinearGauge#beforePlate\r\n */\n\n /**\r\n * Fired each time before gauge highlight areas are drawn\r\n *\r\n * @event LinearGauge#beforeHighlights\r\n */\n\n /**\r\n * Fired each time before gauge minor ticks are drawn\r\n *\r\n * @event LinearGauge#beforeMinorTicks\r\n */\n\n /**\r\n * Fired each time before gauge major ticks are drawn\r\n *\r\n * @event LinearGauge#beforeMajorTicks\r\n */\n\n /**\r\n * Fired each time before gauge tick numbers are drawn\r\n *\r\n * @event LinearGauge#beforeNumbers\r\n */\n\n /**\r\n * Fired each time before gauge title is drawn\r\n *\r\n * @event LinearGauge#beforeTitle\r\n */\n\n /**\r\n * Fired each time before gauge units text is drawn\r\n *\r\n * @event LinearGauge#beforeUnits\r\n */\n\n /**\r\n * Fired each time before gauge bar area is drawn\r\n *\r\n * @event LinearGauge#beforeBar\r\n */\n\n /**\r\n * Fired each time before gauge progress bar is drawn\r\n *\r\n * @event LinearGauge#beforeProgressBar\r\n */\n\n /**\r\n * Fired each time before gauge value box is drawn\r\n *\r\n * @event LinearGauge#beforeValueBox\r\n */\n\n /**\r\n * Fired each time before gauge needle is drawn\r\n *\r\n * @event LinearGauge#beforeNeedle\r\n */\n\n /**\r\n * @constructor\r\n * @param {LinearGaugeOptions} options\r\n */\n function LinearGauge(options) {\n _classCallCheck(this, LinearGauge);\n\n options = Object.assign({}, defaultLinearGaugeOptions, options || {});\n return _possibleConstructorReturn(this, (LinearGauge.__proto__ || Object.getPrototypeOf(LinearGauge)).call(this, LinearGauge.configure(options)));\n }\n\n /**\r\n * Checks and updates gauge options properly\r\n *\r\n * @param {*} options\r\n * @return {*}\r\n * @access protected\r\n */\n\n\n _createClass(LinearGauge, [{\n key: 'draw',\n\n\n /* istanbul ignore next */\n /**\r\n * Triggering linear gauge render on a canvas.\r\n *\r\n * @returns {LinearGauge}\r\n */\n value: function draw() {\n try {\n var canvas = this.canvas;\n var _ref2 = [-canvas.drawX, -canvas.drawY, canvas.drawWidth, canvas.drawHeight],\n x = _ref2[0],\n y = _ref2[1],\n w = _ref2[2],\n h = _ref2[3];\n\n var options = this.options;\n\n if (!canvas.elementClone.initialized) {\n var context = canvas.contextClone;\n\n // clear the cache\n context.clearRect(x, y, w, h);\n context.save();\n\n this.emit('beforePlate');\n this.drawBox = drawLinearPlate(context, options, x, y, w, h);\n\n this.emit('beforeBar');\n drawLinearBar.apply(undefined, [context, options].concat(_toConsumableArray(this.drawBox)));\n\n canvas.context.barDimensions = context.barDimensions;\n\n this.emit('beforeHighlights');\n drawLinearBarHighlights(context, options);\n this.emit('beforeMinorTicks');\n drawLinearMinorTicks(context, options);\n this.emit('beforeMajorTicks');\n drawLinearMajorTicks(context, options);\n this.emit('beforeNumbers');\n drawLinearMajorTicksNumbers(context, options);\n this.emit('beforeTitle');\n drawLinearTitle(context, options);\n this.emit('beforeUnits');\n drawLinearUnits(context, options);\n\n canvas.elementClone.initialized = true;\n }\n\n this.canvas.commit();\n\n // clear the canvas\n canvas.context.clearRect(x, y, w, h);\n canvas.context.save();\n\n canvas.context.drawImage(canvas.elementClone, x, y, w, h);\n canvas.context.save();\n\n this.emit('beforeProgressBar');\n drawLinearBarProgress.apply(undefined, [canvas.context, options].concat(_toConsumableArray(this.drawBox)));\n this.emit('beforeNeedle');\n drawLinearBarNeedle(canvas.context, options);\n this.emit('beforeValueBox');\n drawLinearValueBox.apply(undefined, [canvas.context, options, options.animatedValue ? this.options.value : this.value].concat(_toConsumableArray(this.drawBox)));\n\n _get(LinearGauge.prototype.__proto__ || Object.getPrototypeOf(LinearGauge.prototype), 'draw', this).call(this);\n } catch (err) {\n drawings.verifyError(err);\n }\n\n return this;\n }\n }], [{\n key: 'configure',\n value: function configure(options) {\n /* istanbul ignore else */\n if (options.barStrokeWidth >= options.barWidth) {\n //noinspection JSUnresolvedFunction\n options.barStrokeWidth = round(options.barWidth / 2);\n }\n\n //noinspection JSUndefinedPropertyAssignment\n options.hasLeft = hasTicksBar('right', options);\n //noinspection JSUndefinedPropertyAssignment\n options.hasRight = hasTicksBar('left', options);\n\n if (options.value > options.maxValue) {\n options.value = options.maxValue;\n }\n\n if (options.value < options.minValue) {\n options.value = options.minValue;\n }\n\n return BaseGauge.configure(options);\n }\n }]);\n\n return LinearGauge;\n}(BaseGauge);\n\n/**\r\n * @ignore\r\n * @typedef {object} ns\r\n */\n/* istanbul ignore if */\n\n\nif (typeof ns !== 'undefined') {\n ns['LinearGauge'] = LinearGauge;\n}\n\nBaseGauge.initialize('LinearGauge', defaultLinearGaugeOptions);;typeof module !== \"undefined\" && Object.assign(ns, {Collection: Collection,GenericOptions: GenericOptions,Animation: Animation,BaseGauge: BaseGauge,drawings: drawings,SmartCanvas: SmartCanvas,DomObserver: DomObserver,vendorize: vendorize});}(typeof module !== \"undefined\" ? module.exports : window));"]} \ No newline at end of file From f1da5e4cacc4d8aeb1be1ec0b0712a5e54942053 Mon Sep 17 00:00:00 2001 From: piglione73 Date: Thu, 15 Mar 2018 17:34:36 +0100 Subject: [PATCH 4/4] Increment version number --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 1aff5366..80881d18 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "canvas-gauges", - "version": "2.1.4", + "version": "2.1.5", "homepage": "https://github.com/Mikhus/canvas-gauges", "authors": [ "Mykhailo Stadnyk "