{"version":3,"sources":["webpack:///../WCC.UI/node_modules/heatmap.js/build/heatmap.js"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,MAAM,KAA6B;AACnC;AACA,GAAG,UAAU,IAA0C;AACvD,IAAI,oCAAO,OAAO;AAAA;AAAA;AAAA;AAAA,oGAAC;AACnB,GAAG,MAAM,EAEN;;AAEH,CAAC;;AAED;AACA;AACA;AACA;AACA,oBAAoB,iFAAiF;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,SAAS;AACT,kB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;;AAGA;AACA;AACA;;AAEA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,c;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,6BAA6B,mBAAmB;AAChD;AACA;AACA;;AAEA,wBAAwB,eAAe;AACvC,2BAA2B,eAAe;AAC1C;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,e;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,2EAA2E,OAAO,MAAM;;AAExF;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA,qBAAqB,SAAS;AAC9B;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA,CAAC;;;AAGD;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;;AAGA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;;AAEA,CAAC;;;AAGD;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;;AAGA,CAAC,E","file":"npm.heatmap.js.f1edf2d86429ad7e8e36.js","sourcesContent":["/*\n * heatmap.js v2.0.5 | JavaScript Heatmap Library\n *\n * Copyright 2008-2016 Patrick Wied - All rights reserved.\n * Dual licensed under MIT and Beerware license \n *\n * :: 2016-09-05 01:16\n */\n;(function (name, context, factory) {\n\n // Supports UMD. AMD, CommonJS/Node.js and browser context\n if (typeof module !== \"undefined\" && module.exports) {\n module.exports = factory();\n } else if (typeof define === \"function\" && define.amd) {\n define(factory);\n } else {\n context[name] = factory();\n }\n\n})(\"h337\", this, function () {\n\n// Heatmap Config stores default values and will be merged with instance config\nvar HeatmapConfig = {\n defaultRadius: 40,\n defaultRenderer: 'canvas2d',\n defaultGradient: { 0.25: \"rgb(0,0,255)\", 0.55: \"rgb(0,255,0)\", 0.85: \"yellow\", 1.0: \"rgb(255,0,0)\"},\n defaultMaxOpacity: 1,\n defaultMinOpacity: 0,\n defaultBlur: .85,\n defaultXField: 'x',\n defaultYField: 'y',\n defaultValueField: 'value', \n plugins: {}\n};\nvar Store = (function StoreClosure() {\n\n var Store = function Store(config) {\n this._coordinator = {};\n this._data = [];\n this._radi = [];\n this._min = 10;\n this._max = 1;\n this._xField = config['xField'] || config.defaultXField;\n this._yField = config['yField'] || config.defaultYField;\n this._valueField = config['valueField'] || config.defaultValueField;\n\n if (config[\"radius\"]) {\n this._cfgRadius = config[\"radius\"];\n }\n };\n\n var defaultRadius = HeatmapConfig.defaultRadius;\n\n Store.prototype = {\n // when forceRender = false -> called from setData, omits renderall event\n _organiseData: function(dataPoint, forceRender) {\n var x = dataPoint[this._xField];\n var y = dataPoint[this._yField];\n var radi = this._radi;\n var store = this._data;\n var max = this._max;\n var min = this._min;\n var value = dataPoint[this._valueField] || 1;\n var radius = dataPoint.radius || this._cfgRadius || defaultRadius;\n\n if (!store[x]) {\n store[x] = [];\n radi[x] = [];\n }\n\n if (!store[x][y]) {\n store[x][y] = value;\n radi[x][y] = radius;\n } else {\n store[x][y] += value;\n }\n var storedVal = store[x][y];\n\n if (storedVal > max) {\n if (!forceRender) {\n this._max = storedVal;\n } else {\n this.setDataMax(storedVal);\n }\n return false;\n } else if (storedVal < min) {\n if (!forceRender) {\n this._min = storedVal;\n } else {\n this.setDataMin(storedVal);\n }\n return false;\n } else {\n return { \n x: x, \n y: y,\n value: value, \n radius: radius,\n min: min,\n max: max \n };\n }\n },\n _unOrganizeData: function() {\n var unorganizedData = [];\n var data = this._data;\n var radi = this._radi;\n\n for (var x in data) {\n for (var y in data[x]) {\n\n unorganizedData.push({\n x: x,\n y: y,\n radius: radi[x][y],\n value: data[x][y]\n });\n\n }\n }\n return {\n min: this._min,\n max: this._max,\n data: unorganizedData\n };\n },\n _onExtremaChange: function() {\n this._coordinator.emit('extremachange', {\n min: this._min,\n max: this._max\n });\n },\n addData: function() {\n if (arguments[0].length > 0) {\n var dataArr = arguments[0];\n var dataLen = dataArr.length;\n while (dataLen--) {\n this.addData.call(this, dataArr[dataLen]);\n }\n } else {\n // add to store \n var organisedEntry = this._organiseData(arguments[0], true);\n if (organisedEntry) {\n // if it's the first datapoint initialize the extremas with it\n if (this._data.length === 0) {\n this._min = this._max = organisedEntry.value;\n }\n this._coordinator.emit('renderpartial', {\n min: this._min,\n max: this._max,\n data: [organisedEntry]\n });\n }\n }\n return this;\n },\n setData: function(data) {\n var dataPoints = data.data;\n var pointsLen = dataPoints.length;\n\n\n // reset data arrays\n this._data = [];\n this._radi = [];\n\n for(var i = 0; i < pointsLen; i++) {\n this._organiseData(dataPoints[i], false);\n }\n this._max = data.max;\n this._min = data.min || 0;\n \n this._onExtremaChange();\n this._coordinator.emit('renderall', this._getInternalData());\n return this;\n },\n removeData: function() {\n // TODO: implement\n },\n setDataMax: function(max) {\n this._max = max;\n this._onExtremaChange();\n this._coordinator.emit('renderall', this._getInternalData());\n return this;\n },\n setDataMin: function(min) {\n this._min = min;\n this._onExtremaChange();\n this._coordinator.emit('renderall', this._getInternalData());\n return this;\n },\n setCoordinator: function(coordinator) {\n this._coordinator = coordinator;\n },\n _getInternalData: function() {\n return { \n max: this._max,\n min: this._min, \n data: this._data,\n radi: this._radi \n };\n },\n getData: function() {\n return this._unOrganizeData();\n }/*,\n\n TODO: rethink.\n\n getValueAt: function(point) {\n var value;\n var radius = 100;\n var x = point.x;\n var y = point.y;\n var data = this._data;\n\n if (data[x] && data[x][y]) {\n return data[x][y];\n } else {\n var values = [];\n // radial search for datapoints based on default radius\n for(var distance = 1; distance < radius; distance++) {\n var neighbors = distance * 2 +1;\n var startX = x - distance;\n var startY = y - distance;\n\n for(var i = 0; i < neighbors; i++) {\n for (var o = 0; o < neighbors; o++) {\n if ((i == 0 || i == neighbors-1) || (o == 0 || o == neighbors-1)) {\n if (data[startY+i] && data[startY+i][startX+o]) {\n values.push(data[startY+i][startX+o]);\n }\n } else {\n continue;\n } \n }\n }\n }\n if (values.length > 0) {\n return Math.max.apply(Math, values);\n }\n }\n return false;\n }*/\n };\n\n\n return Store;\n})();\n\nvar Canvas2dRenderer = (function Canvas2dRendererClosure() {\n\n var _getColorPalette = function(config) {\n var gradientConfig = config.gradient || config.defaultGradient;\n var paletteCanvas = document.createElement('canvas');\n var paletteCtx = paletteCanvas.getContext('2d');\n\n paletteCanvas.width = 256;\n paletteCanvas.height = 1;\n\n var gradient = paletteCtx.createLinearGradient(0, 0, 256, 1);\n for (var key in gradientConfig) {\n gradient.addColorStop(key, gradientConfig[key]);\n }\n\n paletteCtx.fillStyle = gradient;\n paletteCtx.fillRect(0, 0, 256, 1);\n\n return paletteCtx.getImageData(0, 0, 256, 1).data;\n };\n\n var _getPointTemplate = function(radius, blurFactor) {\n var tplCanvas = document.createElement('canvas');\n var tplCtx = tplCanvas.getContext('2d');\n var x = radius;\n var y = radius;\n tplCanvas.width = tplCanvas.height = radius*2;\n\n if (blurFactor == 1) {\n tplCtx.beginPath();\n tplCtx.arc(x, y, radius, 0, 2 * Math.PI, false);\n tplCtx.fillStyle = 'rgba(0,0,0,1)';\n tplCtx.fill();\n } else {\n var gradient = tplCtx.createRadialGradient(x, y, radius*blurFactor, x, y, radius);\n gradient.addColorStop(0, 'rgba(0,0,0,1)');\n gradient.addColorStop(1, 'rgba(0,0,0,0)');\n tplCtx.fillStyle = gradient;\n tplCtx.fillRect(0, 0, 2*radius, 2*radius);\n }\n\n\n\n return tplCanvas;\n };\n\n var _prepareData = function(data) {\n var renderData = [];\n var min = data.min;\n var max = data.max;\n var radi = data.radi;\n var data = data.data;\n\n var xValues = Object.keys(data);\n var xValuesLen = xValues.length;\n\n while(xValuesLen--) {\n var xValue = xValues[xValuesLen];\n var yValues = Object.keys(data[xValue]);\n var yValuesLen = yValues.length;\n while(yValuesLen--) {\n var yValue = yValues[yValuesLen];\n var value = data[xValue][yValue];\n var radius = radi[xValue][yValue];\n renderData.push({\n x: xValue,\n y: yValue,\n value: value,\n radius: radius\n });\n }\n }\n\n return {\n min: min,\n max: max,\n data: renderData\n };\n };\n\n\n function Canvas2dRenderer(config) {\n var container = config.container;\n var shadowCanvas = this.shadowCanvas = document.createElement('canvas');\n var canvas = this.canvas = config.canvas || document.createElement('canvas');\n var renderBoundaries = this._renderBoundaries = [10000, 10000, 0, 0];\n\n var computed = getComputedStyle(config.container) || {};\n\n canvas.className = 'heatmap-canvas';\n\n this._width = canvas.width = shadowCanvas.width = config.width || +(computed.width.replace(/px/,''));\n this._height = canvas.height = shadowCanvas.height = config.height || +(computed.height.replace(/px/,''));\n\n this.shadowCtx = shadowCanvas.getContext('2d');\n this.ctx = canvas.getContext('2d');\n\n // @TODO:\n // conditional wrapper\n\n canvas.style.cssText = shadowCanvas.style.cssText = 'position:absolute;left:0;top:0;';\n\n container.style.position = 'relative';\n container.appendChild(canvas);\n\n this._palette = _getColorPalette(config);\n this._templates = {};\n\n this._setStyles(config);\n };\n\n Canvas2dRenderer.prototype = {\n renderPartial: function(data) {\n if (data.data.length > 0) {\n this._drawAlpha(data);\n this._colorize();\n }\n },\n renderAll: function(data) {\n // reset render boundaries\n this._clear();\n if (data.data.length > 0) {\n this._drawAlpha(_prepareData(data));\n this._colorize();\n }\n },\n _updateGradient: function(config) {\n this._palette = _getColorPalette(config);\n },\n updateConfig: function(config) {\n if (config['gradient']) {\n this._updateGradient(config);\n }\n this._setStyles(config);\n },\n setDimensions: function(width, height) {\n this._width = width;\n this._height = height;\n this.canvas.width = this.shadowCanvas.width = width;\n this.canvas.height = this.shadowCanvas.height = height;\n },\n _clear: function() {\n this.shadowCtx.clearRect(0, 0, this._width, this._height);\n this.ctx.clearRect(0, 0, this._width, this._height);\n },\n _setStyles: function(config) {\n this._blur = (config.blur == 0)?0:(config.blur || config.defaultBlur);\n\n if (config.backgroundColor) {\n this.canvas.style.backgroundColor = config.backgroundColor;\n }\n\n this._width = this.canvas.width = this.shadowCanvas.width = config.width || this._width;\n this._height = this.canvas.height = this.shadowCanvas.height = config.height || this._height;\n\n\n this._opacity = (config.opacity || 0) * 255;\n this._maxOpacity = (config.maxOpacity || config.defaultMaxOpacity) * 255;\n this._minOpacity = (config.minOpacity || config.defaultMinOpacity) * 255;\n this._useGradientOpacity = !!config.useGradientOpacity;\n },\n _drawAlpha: function(data) {\n var min = this._min = data.min;\n var max = this._max = data.max;\n var data = data.data || [];\n var dataLen = data.length;\n // on a point basis?\n var blur = 1 - this._blur;\n\n while(dataLen--) {\n\n var point = data[dataLen];\n\n var x = point.x;\n var y = point.y;\n var radius = point.radius;\n // if value is bigger than max\n // use max as value\n var value = Math.min(point.value, max);\n var rectX = x - radius;\n var rectY = y - radius;\n var shadowCtx = this.shadowCtx;\n\n\n\n\n var tpl;\n if (!this._templates[radius]) {\n this._templates[radius] = tpl = _getPointTemplate(radius, blur);\n } else {\n tpl = this._templates[radius];\n }\n // value from minimum / value range\n // => [0, 1]\n var templateAlpha = (value-min)/(max-min);\n // this fixes #176: small values are not visible because globalAlpha < .01 cannot be read from imageData\n shadowCtx.globalAlpha = templateAlpha < .01 ? .01 : templateAlpha;\n\n shadowCtx.drawImage(tpl, rectX, rectY);\n\n // update renderBoundaries\n if (rectX < this._renderBoundaries[0]) {\n this._renderBoundaries[0] = rectX;\n }\n if (rectY < this._renderBoundaries[1]) {\n this._renderBoundaries[1] = rectY;\n }\n if (rectX + 2*radius > this._renderBoundaries[2]) {\n this._renderBoundaries[2] = rectX + 2*radius;\n }\n if (rectY + 2*radius > this._renderBoundaries[3]) {\n this._renderBoundaries[3] = rectY + 2*radius;\n }\n\n }\n },\n _colorize: function() {\n var x = this._renderBoundaries[0];\n var y = this._renderBoundaries[1];\n var width = this._renderBoundaries[2] - x;\n var height = this._renderBoundaries[3] - y;\n var maxWidth = this._width;\n var maxHeight = this._height;\n var opacity = this._opacity;\n var maxOpacity = this._maxOpacity;\n var minOpacity = this._minOpacity;\n var useGradientOpacity = this._useGradientOpacity;\n\n if (x < 0) {\n x = 0;\n }\n if (y < 0) {\n y = 0;\n }\n if (x + width > maxWidth) {\n width = maxWidth - x;\n }\n if (y + height > maxHeight) {\n height = maxHeight - y;\n }\n\n var img = this.shadowCtx.getImageData(x, y, width, height);\n var imgData = img.data;\n var len = imgData.length;\n var palette = this._palette;\n\n\n for (var i = 3; i < len; i+= 4) {\n var alpha = imgData[i];\n var offset = alpha * 4;\n\n\n if (!offset) {\n continue;\n }\n\n var finalAlpha;\n if (opacity > 0) {\n finalAlpha = opacity;\n } else {\n if (alpha < maxOpacity) {\n if (alpha < minOpacity) {\n finalAlpha = minOpacity;\n } else {\n finalAlpha = alpha;\n }\n } else {\n finalAlpha = maxOpacity;\n }\n }\n\n imgData[i-3] = palette[offset];\n imgData[i-2] = palette[offset + 1];\n imgData[i-1] = palette[offset + 2];\n imgData[i] = useGradientOpacity ? palette[offset + 3] : finalAlpha;\n\n }\n\n img.data = imgData;\n this.ctx.putImageData(img, x, y);\n\n this._renderBoundaries = [1000, 1000, 0, 0];\n\n },\n getValueAt: function(point) {\n var value;\n var shadowCtx = this.shadowCtx;\n var img = shadowCtx.getImageData(point.x, point.y, 1, 1);\n var data = img.data[3];\n var max = this._max;\n var min = this._min;\n\n value = (Math.abs(max-min) * (data/255)) >> 0;\n\n return value;\n },\n getDataURL: function() {\n return this.canvas.toDataURL();\n }\n };\n\n\n return Canvas2dRenderer;\n})();\n\n\nvar Renderer = (function RendererClosure() {\n\n var rendererFn = false;\n\n if (HeatmapConfig['defaultRenderer'] === 'canvas2d') {\n rendererFn = Canvas2dRenderer;\n }\n\n return rendererFn;\n})();\n\n\nvar Util = {\n merge: function() {\n var merged = {};\n var argsLen = arguments.length;\n for (var i = 0; i < argsLen; i++) {\n var obj = arguments[i]\n for (var key in obj) {\n merged[key] = obj[key];\n }\n }\n return merged;\n }\n};\n// Heatmap Constructor\nvar Heatmap = (function HeatmapClosure() {\n\n var Coordinator = (function CoordinatorClosure() {\n\n function Coordinator() {\n this.cStore = {};\n };\n\n Coordinator.prototype = {\n on: function(evtName, callback, scope) {\n var cStore = this.cStore;\n\n if (!cStore[evtName]) {\n cStore[evtName] = [];\n }\n cStore[evtName].push((function(data) {\n return callback.call(scope, data);\n }));\n },\n emit: function(evtName, data) {\n var cStore = this.cStore;\n if (cStore[evtName]) {\n var len = cStore[evtName].length;\n for (var i=0; i