12 |
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.line_heatmap=e():t.line_heatmap=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){"use strict";n.d(e,"a",function(){return o});var r=n(3),i=n.n(r);function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ID=e,this.heatmap=null}var e,n,r;return e=t,(n=[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={container:document.getElementById(this.ID)};e=Object.assign(e,t),this.heatmap=i.a.create(e),console.log(this.heatmap)}},{key:"setTrackData",value:function(t){var e=this;this.heatmap.setData({max:0,min:0,data:[]}),t.forEach(function(t){e.heatmap.addData(t)})}},{key:"instance",get:function(){return this.heatmap}}])&&a(e.prototype,n),r&&a(e,r),t}()},function(t,e,n){"use strict";(function(t){var r,i,a,o,s,l,u,c,d=n(0),h=(n(2),'<div>\n <div class="line-heatmap-controls">\n <div id="line-heatmap-slider"></div>\n </div>\n <div id="line-heatmap-canvas">\n <div id="line-heatmap-view"></div>\n <div id="line-heatmap-tooltip"></div>\n </div>\n</div>\n'),f=10,p={},m=!0,g=null;function v(t,e,n,r){for(var i=p.heatmap.instance.getData().data,a=0,o=0;o<i.length;++o){var s=i[o];s.x>=t&&s.y>=e&&s.x<=n&&s.y<=r&&(a+=s.value)}return a}function y(){return p.data.length}function x(){return p.data}function b(t){return t.split("\n").filter(function(t){return t.split(",").length>3}).map(function(t){var e=JSON.parse("["+t+"]");return{x:e[0],y:e[1],value:1}})}function _(t,e,n,r,i){var a=v(e,n,r,i),o=a/y();t.innerHTML='<span style="font-size:14px">Quantidade de clicks: '.concat(a,'</span>\n <span style="font-size:14px">Proporção em relação ao total: ').concat(o,"</span>")}function w(t){if(t.length<=1)return 0;if(2==t.length)return S(t[0],t[1]);var e=0;return t.reduce(function(t,n){return e+=S(t,n),n}),e}function S(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}e.a={init:function(e,n){var v=arguments.length>2&&void 0!==arguments[2]&&arguments[2],y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},x=document.getElementById(e);x.innerHTML=h;var w=b(n),S=new d.a("line-heatmap-view");S.create(y),S.setTrackData(w);var C,E=document.getElementById("line-heatmap-slider");if(t.create(E,{start:[1,w.length],connect:!0,step:1,margin:1,range:{min:1,max:w.length}}),p.container=x,p.heatmap=S,p.data=w,p.slider=E,v){C=document.querySelector(".heatmap-canvas"),window.onclick=function(t){if(t.target===C)if(m)t.pageX||t.pageY?(r=t.pageX,i=t.pageY):(r=t.clientX+document.body.scrollLeft+C.scrollLeft,i=t.clientY+document.body.scrollTop+C.scrollTop),r-=C.offsetLeft,i-=C.offsetTop,m=!1;else{t.pageX||t.pageY?(a=t.pageX,o=t.pageY):(a=t.clientX+document.body.scrollLeft+C.scrollLeft,o=t.clientY+document.body.scrollTop+C.scrollTop),a-=C.offsetLeft,o-=C.offsetTop,m=!0,null!==g&&(document.getElementById("line-heatmap-canvas").removeChild(g),g=null),g=document.createElement("div"),s=Math.min(r,a),l=Math.min(i,o)-585,u=Math.max(i,o)-585,c=Math.max(r,a);var e=Math.abs(c-s),n=Math.abs(u-l);_(g,s,l,c,u),g.style.width=e+"px",g.style.height=n+"px",g.style.position="absolute",g.style.top=l+"px",g.style.left=s+"px",g.style.border="1px solid green",document.getElementById("line-heatmap-canvas").append(g)}};var D=document.getElementById("line-heatmap-canvas"),M=document.getElementById("line-heatmap-tooltip");D.onmousemove=function(t){var e=t.layerX,n=t.layerY,r=p.heatmap.instance.getValueAt({x:e,y:n});M.style.display="block",function(t,e,n){var r="translate(".concat(t+f,"px, ").concat(e+f,"px)");M.style.webkitTransform=r,M.innerHTML="(".concat(t,",").concat(e,",").concat(n,")")}(e,n,r)},D.onmouseout=function(){M.style.display="none"}}E.noUiSlider.on("update",function(t,e){var n=this.get(),r=p.data.slice(+n[0]-1,+n[1]+1);p.heatmap.setTrackData(r),null!==g&&_(g,s,l,c,u)})},updateLogString:function(t){var e=b(t);p.data=e,p.slider.noUiSlider.updateOptions({range:{min:1,max:e.length}}),p.heatmap.setTrackData(e)},countClicks:v,totalClicks:y,getData:x,calcPixelsPerClick:function(){return w(x())/y()},calcPixelsPerClickInArea:function(){return null==g?0:w(function(t,e,n,r){for(var i=p.heatmap.instance.getData().data,a=[],o=0;o<i.length;++o){var s=i[o];s.x>=t&&s.y>=e&&s.x<=n&&s.y<=r&&a.push(s)}return a}(s,l,c,u))/v(s,l,c,u)}}}).call(this,n(2))},function(t,e,n){var r,i,a;/*! nouislider - 12.1.0 - 10/25/2018 */i=[],void 0===(a="function"==typeof(r=function(){"use strict";var t="12.1.0";function e(t){return null!=t}function n(t){t.preventDefault()}function r(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function i(t,e,n){n>0&&(l(t,e),setTimeout(function(){u(t,e)},n))}function a(t){return Math.max(Math.min(t,100),0)}function o(t){return Array.isArray(t)?t:[t]}function s(t){var e=(t=String(t)).split(".");return e.length>1?e[1].length:0}function l(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function u(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function c(t){var e=void 0!==window.pageXOffset,n="CSS1Compat"===(t.compatMode||""),r=e?window.pageXOffset:n?t.documentElement.scrollLeft:t.body.scrollLeft,i=e?window.pageYOffset:n?t.documentElement.scrollTop:t.body.scrollTop;return{x:r,y:i}}function d(t,e){return 100/(e-t)}function h(t,e){return 100*e/(t[1]-t[0])}function f(t,e){for(var n=1;t>=e[n];)n+=1;return n}function p(t,e,n){if(n>=t.slice(-1)[0])return 100;var r=f(n,t),i=t[r-1],a=t[r],o=e[r-1],s=e[r];return o+function(t,e){return h(t,t[0]<0?e+Math.abs(t[0]):e-t[0])}([i,a],n)/d(o,s)}function m(t,e,n,r){if(100===r)return r;var i=f(r,t),a=t[i-1],o=t[i];return n?r-a>(o-a)/2?o:a:e[i-1]?t[i-1]+function(t,e){return Math.round(t/e)*e}(r-t[i-1],e[i-1]):r}function g(e,n,i){var a;if("number"==typeof n&&(n=[n]),!Array.isArray(n))throw new Error("noUiSlider ("+t+"): 'range' contains invalid value.");if(!r(a="min"===e?0:"max"===e?100:parseFloat(e))||!r(n[0]))throw new Error("noUiSlider ("+t+"): 'range' value isn't numeric.");i.xPct.push(a),i.xVal.push(n[0]),a?i.xSteps.push(!isNaN(n[1])&&n[1]):isNaN(n[1])||(i.xSteps[0]=n[1]),i.xHighestCompleteStep.push(0)}function v(t,e,n){if(!e)return!0;n.xSteps[t]=h([n.xVal[t],n.xVal[t+1]],e)/d(n.xPct[t],n.xPct[t+1]);var r=(n.xVal[t+1]-n.xVal[t])/n.xNumSteps[t],i=Math.ceil(Number(r.toFixed(3))-1),a=n.xVal[t]+n.xNumSteps[t]*i;n.xHighestCompleteStep[t]=a}function y(t,e,n){var r;this.xPct=[],this.xVal=[],this.xSteps=[n||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=e;var i=[];for(r in t)t.hasOwnProperty(r)&&i.push([t[r],r]);for(i.length&&"object"==typeof i[0][0]?i.sort(function(t,e){return t[0][0]-e[0][0]}):i.sort(function(t,e){return t[0]-e[0]}),r=0;r<i.length;r++)g(i[r][1],i[r][0],this);for(this.xNumSteps=this.xSteps.slice(0),r=0;r<this.xNumSteps.length;r++)v(r,this.xNumSteps[r],this)}y.prototype.getMargin=function(e){var n=this.xNumSteps[0];if(n&&e/n%1!=0)throw new Error("noUiSlider ("+t+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&h(this.xVal,e)},y.prototype.toStepping=function(t){return t=p(this.xVal,this.xPct,t)},y.prototype.fromStepping=function(t){return function(t,e,n){if(n>=100)return t.slice(-1)[0];var r=f(n,e),i=t[r-1],a=t[r],o=e[r-1],s=e[r];return function(t,e){return e*(t[1]-t[0])/100+t[0]}([i,a],(n-o)*d(o,s))}(this.xVal,this.xPct,t)},y.prototype.getStep=function(t){return t=m(this.xPct,this.xSteps,this.snap,t)},y.prototype.getNearbySteps=function(t){var e=f(t,this.xPct);return{stepBefore:{startValue:this.xVal[e-2],step:this.xNumSteps[e-2],highestStep:this.xHighestCompleteStep[e-2]},thisStep:{startValue:this.xVal[e-1],step:this.xNumSteps[e-1],highestStep:this.xHighestCompleteStep[e-1]},stepAfter:{startValue:this.xVal[e],step:this.xNumSteps[e],highestStep:this.xHighestCompleteStep[e]}}},y.prototype.countStepDecimals=function(){var t=this.xNumSteps.map(s);return Math.max.apply(null,t)},y.prototype.convert=function(t){return this.getStep(this.toStepping(t))};var x={to:function(t){return void 0!==t&&t.toFixed(2)},from:Number};function b(e){if(function(t){return"object"==typeof t&&"function"==typeof t.to&&"function"==typeof t.from}(e))return!0;throw new Error("noUiSlider ("+t+"): 'format' requires 'to' and 'from' methods.")}function _(e,n){if(!r(n))throw new Error("noUiSlider ("+t+"): 'step' is not numeric.");e.singleStep=n}function w(e,n){if("object"!=typeof n||Array.isArray(n))throw new Error("noUiSlider ("+t+"): 'range' is not an object.");if(void 0===n.min||void 0===n.max)throw new Error("noUiSlider ("+t+"): Missing 'min' or 'max' in 'range'.");if(n.min===n.max)throw new Error("noUiSlider ("+t+"): 'range' 'min' and 'max' cannot be equal.");e.spectrum=new y(n,e.snap,e.singleStep)}function S(e,n){if(n=o(n),!Array.isArray(n)||!n.length)throw new Error("noUiSlider ("+t+"): 'start' option is incorrect.");e.handles=n.length,e.start=n}function C(e,n){if(e.snap=n,"boolean"!=typeof n)throw new Error("noUiSlider ("+t+"): 'snap' option must be a boolean.")}function E(e,n){if(e.animate=n,"boolean"!=typeof n)throw new Error("noUiSlider ("+t+"): 'animate' option must be a boolean.")}function D(e,n){if(e.animationDuration=n,"number"!=typeof n)throw new Error("noUiSlider ("+t+"): 'animationDuration' option must be a number.")}function M(e,n){var r,i=[!1];if("lower"===n?n=[!0,!1]:"upper"===n&&(n=[!1,!0]),!0===n||!1===n){for(r=1;r<e.handles;r++)i.push(n);i.push(!1)}else{if(!Array.isArray(n)||!n.length||n.length!==e.handles+1)throw new Error("noUiSlider ("+t+"): 'connect' option doesn't match handle count.");i=n}e.connect=i}function N(e,n){switch(n){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider ("+t+"): 'orientation' option is invalid.")}}function k(e,n){if(!r(n))throw new Error("noUiSlider ("+t+"): 'margin' option must be numeric.");if(0!==n&&(e.margin=e.spectrum.getMargin(n),!e.margin))throw new Error("noUiSlider ("+t+"): 'margin' option is only supported on linear sliders.")}function O(e,n){if(!r(n))throw new Error("noUiSlider ("+t+"): 'limit' option must be numeric.");if(e.limit=e.spectrum.getMargin(n),!e.limit||e.handles<2)throw new Error("noUiSlider ("+t+"): 'limit' option is only supported on linear sliders with 2 or more handles.")}function P(e,n){if(!r(n)&&!Array.isArray(n))throw new Error("noUiSlider ("+t+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(n)&&2!==n.length&&!r(n[0])&&!r(n[1]))throw new Error("noUiSlider ("+t+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(0!==n){if(Array.isArray(n)||(n=[n,n]),e.padding=[e.spectrum.getMargin(n[0]),e.spectrum.getMargin(n[1])],!1===e.padding[0]||!1===e.padding[1])throw new Error("noUiSlider ("+t+"): 'padding' option is only supported on linear sliders.");if(e.padding[0]<0||e.padding[1]<0)throw new Error("noUiSlider ("+t+"): 'padding' option must be a positive number(s).");if(e.padding[0]+e.padding[1]>=100)throw new Error("noUiSlider ("+t+"): 'padding' option must not exceed 100% of the range.")}}function U(e,n){switch(n){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider ("+t+"): 'direction' option was not recognized.")}}function A(e,n){if("string"!=typeof n)throw new Error("noUiSlider ("+t+"): 'behaviour' must be a string containing options.");var r=n.indexOf("tap")>=0,i=n.indexOf("drag")>=0,a=n.indexOf("fixed")>=0,o=n.indexOf("snap")>=0,s=n.indexOf("hover")>=0,l=n.indexOf("unconstrained")>=0;if(a){if(2!==e.handles)throw new Error("noUiSlider ("+t+"): 'fixed' behaviour must be used with 2 handles");k(e,e.start[1]-e.start[0])}if(l&&(e.margin||e.limit))throw new Error("noUiSlider ("+t+"): 'unconstrained' behaviour cannot be used with margin or limit");e.events={tap:r||o,drag:i,fixed:a,snap:o,hover:s,unconstrained:l}}function L(e,n){if(!1!==n)if(!0===n){e.tooltips=[];for(var r=0;r<e.handles;r++)e.tooltips.push(!0)}else{if(e.tooltips=o(n),e.tooltips.length!==e.handles)throw new Error("noUiSlider ("+t+"): must pass a formatter for all handles.");e.tooltips.forEach(function(e){if("boolean"!=typeof e&&("object"!=typeof e||"function"!=typeof e.to))throw new Error("noUiSlider ("+t+"): 'tooltips' must be passed a formatter or 'false'.")})}}function V(t,e){t.ariaFormat=e,b(e)}function F(t,e){t.format=e,b(e)}function j(e,n){if(e.keyboardSupport=n,"boolean"!=typeof n)throw new Error("noUiSlider ("+t+"): 'keyboardSupport' option must be a boolean.")}function T(t,e){t.documentElement=e}function B(e,n){if("string"!=typeof n&&!1!==n)throw new Error("noUiSlider ("+t+"): 'cssPrefix' must be a string or `false`.");e.cssPrefix=n}function z(e,n){if("object"!=typeof n)throw new Error("noUiSlider ("+t+"): 'cssClasses' must be an object.");if("string"==typeof e.cssPrefix)for(var r in e.cssClasses={},n)n.hasOwnProperty(r)&&(e.cssClasses[r]=e.cssPrefix+n[r]);else e.cssClasses=n}function R(n){var r={margin:0,limit:0,padding:0,animate:!0,animationDuration:300,ariaFormat:x,format:x},i={step:{r:!1,t:_},start:{r:!0,t:S},connect:{r:!0,t:M},direction:{r:!0,t:U},snap:{r:!1,t:C},animate:{r:!1,t:E},animationDuration:{r:!1,t:D},range:{r:!0,t:w},orientation:{r:!1,t:N},margin:{r:!1,t:k},limit:{r:!1,t:O},padding:{r:!1,t:P},behaviour:{r:!0,t:A},ariaFormat:{r:!1,t:V},format:{r:!1,t:F},tooltips:{r:!1,t:L},keyboardSupport:{r:!0,t:j},documentElement:{r:!1,t:T},cssPrefix:{r:!0,t:B},cssClasses:{r:!0,t:z}},a={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",keyboardSupport:!0,cssPrefix:"noUi-",cssClasses:{target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"}};n.format&&!n.ariaFormat&&(n.ariaFormat=n.format),Object.keys(i).forEach(function(o){if(!e(n[o])&&void 0===a[o]){if(i[o].r)throw new Error("noUiSlider ("+t+"): '"+o+"' is required.");return!0}i[o].t(r,e(n[o])?n[o]:a[o])}),r.pips=n.pips;var o=document.createElement("div"),s=void 0!==o.style.msTransform,l=void 0!==o.style.transform;return r.transformRule=l?"transform":s?"msTransform":"webkitTransform",r.style=[["left","top"],["right","bottom"]][r.dir][r.ort],r}function I(e,r,s){var d,h,f,p,m,g,v,y,x=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},b=window.CSS&&CSS.supports&&CSS.supports("touch-action","none"),_=b&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e)}catch(t){}return t}(),w=e,S=[],C=[],E=0,D=r.spectrum,M=[],N={},k=e.ownerDocument,O=r.documentElement||k.documentElement,P=k.body,U=-1,A=0,L=1,V=2,F="rtl"===k.dir||1===r.ort?0:100;function j(t,e){var n=k.createElement("div");return e&&l(n,e),t.appendChild(n),n}function T(t,e){var n=j(t,r.cssClasses.origin),i=j(n,r.cssClasses.handle);return i.setAttribute("data-handle",e),r.keyboardSupport&&i.setAttribute("tabindex","0"),i.setAttribute("role","slider"),i.setAttribute("aria-orientation",r.ort?"vertical":"horizontal"),0===e?l(i,r.cssClasses.handleLower):e===r.handles-1&&l(i,r.cssClasses.handleUpper),n}function B(t,e){return!!e&&j(t,r.cssClasses.connect)}function z(t,e){return!!r.tooltips[e]&&j(t.firstChild,r.cssClasses.tooltip)}function I(t,e,n){var i=k.createElement("div"),a=[];a[A]=r.cssClasses.valueNormal,a[L]=r.cssClasses.valueLarge,a[V]=r.cssClasses.valueSub;var o=[];o[A]=r.cssClasses.markerNormal,o[L]=r.cssClasses.markerLarge,o[V]=r.cssClasses.markerSub;var s=[r.cssClasses.valueHorizontal,r.cssClasses.valueVertical],u=[r.cssClasses.markerHorizontal,r.cssClasses.markerVertical];function c(t,e){var n=e===r.cssClasses.value,i=n?s:u,l=n?a:o;return e+" "+i[r.ort]+" "+l[t]}return l(i,r.cssClasses.pips),l(i,0===r.ort?r.cssClasses.pipsHorizontal:r.cssClasses.pipsVertical),Object.keys(t).forEach(function(a){!function(t,a,o){if((o=e?e(a,o):o)!==U){var s=j(i,!1);s.className=c(o,r.cssClasses.marker),s.style[r.style]=t+"%",o>A&&((s=j(i,!1)).className=c(o,r.cssClasses.value),s.setAttribute("data-value",a),s.style[r.style]=t+"%",s.innerHTML=n.to(a))}}(a,t[a][0],t[a][1])}),i}function H(){var t;m&&((t=m).parentElement.removeChild(t),m=null)}function X(e){H();var n=e.mode,r=e.density||1,i=e.filter||!1,a=e.values||!1,o=e.stepped||!1,s=function(e,n,r){if("range"===e||"steps"===e)return D.xVal;if("count"===e){if(n<2)throw new Error("noUiSlider ("+t+"): 'values' (>= 2) required for mode 'count'.");var i=n-1,a=100/i;for(n=[];i--;)n[i]=i*a;n.push(100),e="positions"}return"positions"===e?n.map(function(t){return D.fromStepping(r?D.getStep(t):t)}):"values"===e?r?n.map(function(t){return D.fromStepping(D.getStep(D.toStepping(t)))}):n:void 0}(n,a,o),l=function(t,e,n){var r,i={},a=D.xVal[0],o=D.xVal[D.xVal.length-1],s=!1,l=!1,u=0;return(r=n.slice().sort(function(t,e){return t-e}),n=r.filter(function(t){return!this[t]&&(this[t]=!0)},{}))[0]!==a&&(n.unshift(a),s=!0),n[n.length-1]!==o&&(n.push(o),l=!0),n.forEach(function(r,a){var o,c,d,h,f,p,m,g,v,y,x=r,b=n[a+1],_="steps"===e;if(_&&(o=D.xNumSteps[a]),o||(o=b-x),!1!==x&&void 0!==b)for(o=Math.max(o,1e-7),c=x;c<=b;c=(c+o).toFixed(7)/1){for(g=(f=(h=D.toStepping(c))-u)/t,y=f/(v=Math.round(g)),d=1;d<=v;d+=1)i[(p=u+d*y).toFixed(5)]=[D.fromStepping(p),0];m=n.indexOf(c)>-1?L:_?V:A,!a&&s&&(m=0),c===b&&l||(i[h.toFixed(5)]=[c,m]),u=h}}),i}(r,n,s),u=e.format||{to:Math.round};return m=w.appendChild(I(l,i,u))}function Y(){var t=d.getBoundingClientRect(),e="offset"+["Width","Height"][r.ort];return 0===r.ort?t.width||d[e]:t.height||d[e]}function G(t,e,n,i){var a=function(a){return!!(a=function(t,e,n){var r,i,a=0===t.type.indexOf("touch"),o=0===t.type.indexOf("mouse"),s=0===t.type.indexOf("pointer");if(0===t.type.indexOf("MSPointer")&&(s=!0),a){var l=function(t){return t.target===n||n.contains(t.target)};if("touchstart"===t.type){var u=Array.prototype.filter.call(t.touches,l);if(u.length>1)return!1;r=u[0].pageX,i=u[0].pageY}else{var d=Array.prototype.find.call(t.changedTouches,l);if(!d)return!1;r=d.pageX,i=d.pageY}}return e=e||c(k),(o||s)&&(r=t.clientX+e.x,i=t.clientY+e.y),t.pageOffset=e,t.points=[r,i],t.cursor=o||s,t}(a,i.pageOffset,i.target||e))&&!(w.hasAttribute("disabled")&&!i.doNotReject)&&(o=w,s=r.cssClasses.tap,!((o.classList?o.classList.contains(s):new RegExp("\\b"+s+"\\b").test(o.className))&&!i.doNotReject)&&!(t===x.start&&void 0!==a.buttons&&a.buttons>1)&&(!i.hover||!a.buttons)&&(_||a.preventDefault(),a.calcPoint=a.points[r.ort],void n(a,i)));var o,s},o=[];return t.split(" ").forEach(function(t){e.addEventListener(t,a,!!_&&{passive:!0}),o.push([t,a])}),o}function q(t){var e,n,i,o,s,l,u=t-(e=d,n=r.ort,i=e.getBoundingClientRect(),o=e.ownerDocument,s=o.documentElement,l=c(o),/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(l.x=0),n?i.top+l.y-s.clientTop:i.left+l.x-s.clientLeft),h=100*u/Y();return h=a(h),r.dir?100-h:h}function J(t,e){"mouseout"===t.type&&"HTML"===t.target.nodeName&&null===t.relatedTarget&&W(t,e)}function Q(t,e){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===t.buttons&&0!==e.buttonsProperty)return W(t,e);var n=(r.dir?-1:1)*(t.calcPoint-e.startCalcPoint),i=100*n/e.baseSize;at(n>0,i,e.locations,e.handleNumbers)}function W(t,e){e.handle&&(u(e.handle,r.cssClasses.active),E-=1),e.listeners.forEach(function(t){O.removeEventListener(t[0],t[1])}),0===E&&(u(w,r.cssClasses.drag),st(),t.cursor&&(P.style.cursor="",P.removeEventListener("selectstart",n))),e.handleNumbers.forEach(function(t){et("change",t),et("set",t),et("end",t)})}function $(t,e){var i;if(1===e.handleNumbers.length){var a=h[e.handleNumbers[0]];if(a.hasAttribute("disabled"))return!1;i=a.children[0],E+=1,l(i,r.cssClasses.active)}t.stopPropagation();var o=[],s=G(x.move,O,Q,{target:t.target,handle:i,listeners:o,startCalcPoint:t.calcPoint,baseSize:Y(),pageOffset:t.pageOffset,handleNumbers:e.handleNumbers,buttonsProperty:t.buttons,locations:S.slice()}),u=G(x.end,O,W,{target:t.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:e.handleNumbers}),c=G("mouseout",O,J,{target:t.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:e.handleNumbers});o.push.apply(o,s.concat(u,c)),t.cursor&&(P.style.cursor=getComputedStyle(t.target).cursor,h.length>1&&l(w,r.cssClasses.drag),P.addEventListener("selectstart",n,!1)),e.handleNumbers.forEach(function(t){et("start",t)})}function K(t){t.stopPropagation();var e=q(t.calcPoint),n=function(t){var e=100,n=!1;return h.forEach(function(r,i){if(!r.hasAttribute("disabled")){var a=Math.abs(S[i]-t);(a<e||100===a&&100===e)&&(n=i,e=a)}}),n}(e);if(!1===n)return!1;r.events.snap||i(w,r.cssClasses.tap,r.animationDuration),lt(n,e,!0,!0),st(),et("slide",n,!0),et("update",n,!0),et("change",n,!0),et("set",n,!0),r.events.snap&&$(t,{handleNumbers:[n]})}function Z(t){var e=q(t.calcPoint),n=D.getStep(e),r=D.fromStepping(n);Object.keys(N).forEach(function(t){"hover"===t.split(".")[0]&&N[t].forEach(function(t){t.call(p,r)})})}function tt(t,e){N[t]=N[t]||[],N[t].push(e),"update"===t.split(".")[0]&&h.forEach(function(t,e){et("update",e)})}function et(t,e,n){Object.keys(N).forEach(function(i){var a=i.split(".")[0];t===a&&N[i].forEach(function(t){t.call(p,M.map(r.format.to),e,M.slice(),n||!1,S.slice())})})}function nt(t){return t+"%"}function rt(t,e,n,i,o,s){return h.length>1&&!r.events.unconstrained&&(i&&e>0&&(n=Math.max(n,t[e-1]+r.margin)),o&&e<h.length-1&&(n=Math.min(n,t[e+1]-r.margin))),h.length>1&&r.limit&&(i&&e>0&&(n=Math.min(n,t[e-1]+r.limit)),o&&e<h.length-1&&(n=Math.max(n,t[e+1]-r.limit))),r.padding&&(0===e&&(n=Math.max(n,r.padding[0])),e===h.length-1&&(n=Math.min(n,100-r.padding[1]))),!((n=a(n=D.getStep(n)))===t[e]&&!s)&&n}function it(t,e){var n=r.ort;return(n?e:t)+", "+(n?t:e)}function at(t,e,n,r){var i=n.slice(),a=[!t,t],o=[t,!t];r=r.slice(),t&&r.reverse(),r.length>1?r.forEach(function(t,n){var r=rt(i,t,i[t]+e,a[n],o[n],!1);!1===r?e=0:(e=r-i[t],i[t]=r)}):a=o=[!0];var s=!1;r.forEach(function(t,r){s=lt(t,n[t]+e,a[r],o[r])||s}),s&&r.forEach(function(t){et("update",t),et("slide",t)})}function ot(t,e){return r.dir?100-t-e:t}function st(){C.forEach(function(t){var e=S[t]>50?-1:1,n=3+(h.length+e*t);h[t].style.zIndex=n})}function lt(t,e,n,i){return!1!==(e=rt(S,t,e,n,i,!1))&&(function(t,e){S[t]=e,M[t]=D.fromStepping(e);var n="translate("+it(nt(ot(e,0)-F),"0")+")";h[t].style[r.transformRule]=n,ut(t),ut(t+1)}(t,e),!0)}function ut(t){if(f[t]){var e=0,n=100;0!==t&&(e=S[t-1]),t!==f.length-1&&(n=S[t]);var i=n-e,a="translate("+it(nt(ot(e,i)),"0")+")",o="scale("+it(i/100,"1")+")";f[t].style[r.transformRule]=a+" "+o}}function ct(t,e){var n=o(t),a=void 0===S[0];e=void 0===e||!!e,r.animate&&!a&&i(w,r.cssClasses.tap,r.animationDuration),C.forEach(function(t){lt(t,function(t,e){return null===t||!1===t||void 0===t?S[e]:("number"==typeof t&&(t=String(t)),t=r.format.from(t),!1===(t=D.toStepping(t))||isNaN(t)?S[e]:t)}(n[t],t),!0,!1)}),C.forEach(function(t){lt(t,S[t],!0,!0)}),st(),C.forEach(function(t){et("update",t),null!==n[t]&&e&&et("set",t)})}function dt(){var t=M.map(r.format.to);return 1===t.length?t[0]:t}return l(y=w,r.cssClasses.target),0===r.dir?l(y,r.cssClasses.ltr):l(y,r.cssClasses.rtl),0===r.ort?l(y,r.cssClasses.horizontal):l(y,r.cssClasses.vertical),d=j(y,r.cssClasses.base),function(t,e){var n=j(e,r.cssClasses.connects);h=[],(f=[]).push(B(n,t[0]));for(var i=0;i<r.handles;i++)h.push(T(e,i)),C[i]=i,f.push(B(n,t[i+1]))}(r.connect,d),(v=r.events).fixed||h.forEach(function(t,e){G(x.start,t.children[0],$,{handleNumbers:[e]})}),v.tap&&G(x.start,d,K,{}),v.hover&&G(x.move,d,Z,{hover:!0}),v.drag&&f.forEach(function(t,e){if(!1!==t&&0!==e&&e!==f.length-1){var n=h[e-1],i=h[e],a=[t];l(t,r.cssClasses.draggable),v.fixed&&(a.push(n.children[0]),a.push(i.children[0])),a.forEach(function(t){G(x.start,t,$,{handles:[n,i],handleNumbers:[e-1,e]})})}}),ct(r.start),p={destroy:function(){for(var t in r.cssClasses)r.cssClasses.hasOwnProperty(t)&&u(w,r.cssClasses[t]);for(;w.firstChild;)w.removeChild(w.firstChild);delete w.noUiSlider},steps:function(){return S.map(function(t,e){var n=D.getNearbySteps(t),r=M[e],i=n.thisStep.step,a=null;!1!==i&&r+i>n.stepAfter.startValue&&(i=n.stepAfter.startValue-r),a=r>n.thisStep.startValue?n.thisStep.step:!1!==n.stepBefore.step&&r-n.stepBefore.highestStep,100===t?i=null:0===t&&(a=null);var o=D.countStepDecimals();return null!==i&&!1!==i&&(i=Number(i.toFixed(o))),null!==a&&!1!==a&&(a=Number(a.toFixed(o))),[a,i]})},on:tt,off:function(t){var e=t&&t.split(".")[0],n=e&&t.substring(e.length);Object.keys(N).forEach(function(t){var r=t.split(".")[0],i=t.substring(r.length);e&&e!==r||n&&n!==i||delete N[t]})},get:dt,set:ct,setHandle:function(e,n,r){var i=[];if(!((e=Number(e))>=0&&e<C.length))throw new Error("noUiSlider ("+t+"): invalid handle number, got: "+e);for(var a=0;a<C.length;a++)i[a]=null;i[e]=n,ct(i,r)},reset:function(t){ct(r.start,t)},__moveHandles:function(t,e,n){at(t,e,S,n)},options:s,updateOptions:function(t,e){var n=dt(),i=["margin","limit","padding","range","animate","snap","step","format"];i.forEach(function(e){void 0!==t[e]&&(s[e]=t[e])});var a=R(s);i.forEach(function(e){void 0!==t[e]&&(r[e]=a[e])}),D=a.spectrum,r.margin=a.margin,r.limit=a.limit,r.padding=a.padding,r.pips&&X(r.pips),S=[],ct(t.start||n,e)},target:w,removePips:H,pips:X},r.pips&&X(r.pips),r.tooltips&&(g=h.map(z),tt("update",function(t,e,n){if(g[e]){var i=t[e];!0!==r.tooltips[e]&&(i=r.tooltips[e].to(n[e])),g[e].innerHTML=i}})),tt("update",function(t,e,n,i,a){C.forEach(function(t){var e=h[t],i=rt(S,t,0,!0,!0,!0),o=rt(S,t,100,!0,!0,!0),s=a[t],l=r.ariaFormat.to(n[t]);i=D.fromStepping(i).toFixed(1),o=D.fromStepping(o).toFixed(1),s=D.fromStepping(s).toFixed(1),e.children[0].setAttribute("aria-valuemin",i),e.children[0].setAttribute("aria-valuemax",o),e.children[0].setAttribute("aria-valuenow",s),e.children[0].setAttribute("aria-valuetext",l)})}),p}return{__spectrum:y,version:t,create:function(e,n){if(!e||!e.nodeName)throw new Error("noUiSlider ("+t+"): create requires a single element, got: "+e);if(e.noUiSlider)throw new Error("noUiSlider ("+t+"): Slider was already initialized.");var r=R(n),i=I(e,r,n);return e.noUiSlider=i,i}}})?r.apply(e,i):r)||(t.exports=a)},function(t,e,n){var r,i,a;a=function(){var t,e={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},n=function(){var t=function(t){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=t.xField||t.defaultXField,this._yField=t.yField||t.defaultYField,this._valueField=t.valueField||t.defaultValueField,t.radius&&(this._cfgRadius=t.radius)},n=e.defaultRadius;return t.prototype={_organiseData:function(t,e){var r=t[this._xField],i=t[this._yField],a=this._radi,o=this._data,s=this._max,l=this._min,u=t[this._valueField]||1,c=t.radius||this._cfgRadius||n;o[r]||(o[r]=[],a[r]=[]),o[r][i]?o[r][i]+=u:(o[r][i]=u,a[r][i]=c);var d=o[r][i];return d>s?(e?this.setDataMax(d):this._max=d,!1):d<l?(e?this.setDataMin(d):this._min=d,!1):{x:r,y:i,value:u,radius:c,min:l,max:s}},_unOrganizeData:function(){var t=[],e=this._data,n=this._radi;for(var r in e)for(var i in e[r])t.push({x:r,y:i,radius:n[r][i],value:e[r][i]});return{min:this._min,max:this._max,data:t}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var t=arguments[0],e=t.length;e--;)this.addData.call(this,t[e]);else{var n=this._organiseData(arguments[0],!0);n&&(0===this._data.length&&(this._min=this._max=n.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[n]}))}return this},setData:function(t){var e=t.data,n=e.length;this._data=[],this._radi=[];for(var r=0;r<n;r++)this._organiseData(e[r],!1);return this._max=t.max,this._min=t.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(t){return this._max=t,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(t){return this._min=t,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(t){this._coordinator=t},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},t}(),r=function(){var t=function(t){var e=t.gradient||t.defaultGradient,n=document.createElement("canvas"),r=n.getContext("2d");n.width=256,n.height=1;var i=r.createLinearGradient(0,0,256,1);for(var a in e)i.addColorStop(a,e[a]);return r.fillStyle=i,r.fillRect(0,0,256,1),r.getImageData(0,0,256,1).data},e=function(t,e){var n=document.createElement("canvas"),r=n.getContext("2d"),i=t,a=t;if(n.width=n.height=2*t,1==e)r.beginPath(),r.arc(i,a,t,0,2*Math.PI,!1),r.fillStyle="rgba(0,0,0,1)",r.fill();else{var o=r.createRadialGradient(i,a,t*e,i,a,t);o.addColorStop(0,"rgba(0,0,0,1)"),o.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=o,r.fillRect(0,0,2*t,2*t)}return n};function n(e){var n=e.container,r=this.shadowCanvas=document.createElement("canvas"),i=this.canvas=e.canvas||document.createElement("canvas"),a=(this._renderBoundaries=[1e4,1e4,0,0],getComputedStyle(e.container)||{});i.className="heatmap-canvas",this._width=i.width=r.width=e.width||+a.width.replace(/px/,""),this._height=i.height=r.height=e.height||+a.height.replace(/px/,""),this.shadowCtx=r.getContext("2d"),this.ctx=i.getContext("2d"),i.style.cssText=r.style.cssText="position:absolute;left:0;top:0;",n.style.position="relative",n.appendChild(i),this._palette=t(e),this._templates={},this._setStyles(e)}return n.prototype={renderPartial:function(t){t.data.length>0&&(this._drawAlpha(t),this._colorize())},renderAll:function(t){this._clear(),t.data.length>0&&(this._drawAlpha(function(t){for(var e=[],n=t.min,r=t.max,i=t.radi,a=(t=t.data,Object.keys(t)),o=a.length;o--;)for(var s=a[o],l=Object.keys(t[s]),u=l.length;u--;){var c=l[u],d=t[s][c],h=i[s][c];e.push({x:s,y:c,value:d,radius:h})}return{min:n,max:r,data:e}}(t)),this._colorize())},_updateGradient:function(e){this._palette=t(e)},updateConfig:function(t){t.gradient&&this._updateGradient(t),this._setStyles(t)},setDimensions:function(t,e){this._width=t,this._height=e,this.canvas.width=this.shadowCanvas.width=t,this.canvas.height=this.shadowCanvas.height=e},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(t){this._blur=0==t.blur?0:t.blur||t.defaultBlur,t.backgroundColor&&(this.canvas.style.backgroundColor=t.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=t.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=t.height||this._height,this._opacity=255*(t.opacity||0),this._maxOpacity=255*(t.maxOpacity||t.defaultMaxOpacity),this._minOpacity=255*(t.minOpacity||t.defaultMinOpacity),this._useGradientOpacity=!!t.useGradientOpacity},_drawAlpha:function(t){for(var n=this._min=t.min,r=this._max=t.max,i=(t=t.data||[]).length,a=1-this._blur;i--;){var o,s=t[i],l=s.x,u=s.y,c=s.radius,d=Math.min(s.value,r),h=l-c,f=u-c,p=this.shadowCtx;this._templates[c]?o=this._templates[c]:this._templates[c]=o=e(c,a);var m=(d-n)/(r-n);p.globalAlpha=m<.01?.01:m,p.drawImage(o,h,f),h<this._renderBoundaries[0]&&(this._renderBoundaries[0]=h),f<this._renderBoundaries[1]&&(this._renderBoundaries[1]=f),h+2*c>this._renderBoundaries[2]&&(this._renderBoundaries[2]=h+2*c),f+2*c>this._renderBoundaries[3]&&(this._renderBoundaries[3]=f+2*c)}},_colorize:function(){var t=this._renderBoundaries[0],e=this._renderBoundaries[1],n=this._renderBoundaries[2]-t,r=this._renderBoundaries[3]-e,i=this._width,a=this._height,o=this._opacity,s=this._maxOpacity,l=this._minOpacity,u=this._useGradientOpacity;t<0&&(t=0),e<0&&(e=0),t+n>i&&(n=i-t),e+r>a&&(r=a-e);for(var c=this.shadowCtx.getImageData(t,e,n,r),d=c.data,h=d.length,f=this._palette,p=3;p<h;p+=4){var m,g=d[p],v=4*g;if(v)m=o>0?o:g<s?g<l?l:g:s,d[p-3]=f[v],d[p-2]=f[v+1],d[p-1]=f[v+2],d[p]=u?f[v+3]:m}c.data=d,this.ctx.putImageData(c,t,e),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(t){var e=this.shadowCtx.getImageData(t.x,t.y,1,1).data[3],n=this._max,r=this._min;return Math.abs(n-r)*(e/255)>>0},getDataURL:function(){return this.canvas.toDataURL()}},n}(),i=(t=!1,"canvas2d"===e.defaultRenderer&&(t=r),t),a={merge:function(){for(var t={},e=arguments.length,n=0;n<e;n++){var r=arguments[n];for(var i in r)t[i]=r[i]}return t}},o=function(){var t=function(){function t(){this.cStore={}}return t.prototype={on:function(t,e,n){var r=this.cStore;r[t]||(r[t]=[]),r[t].push(function(t){return e.call(n,t)})},emit:function(t,e){var n=this.cStore;if(n[t])for(var r=n[t].length,i=0;i<r;i++){(0,n[t][i])(e)}}},t}(),r=function(t){var e=t._renderer,n=t._coordinator,r=t._store;n.on("renderpartial",e.renderPartial,e),n.on("renderall",e.renderAll,e),n.on("extremachange",function(e){t._config.onExtremaChange&&t._config.onExtremaChange({min:e.min,max:e.max,gradient:t._config.gradient||t._config.defaultGradient})}),r.setCoordinator(n)};function o(){var o=this._config=a.merge(e,arguments[0]||{});if(this._coordinator=new t,o.plugin){var s=o.plugin;if(!e.plugins[s])throw new Error("Plugin '"+s+"' not found. Maybe it was not registered.");var l=e.plugins[s];this._renderer=new l.renderer(o),this._store=new l.store(o)}else this._renderer=new i(o),this._store=new n(o);r(this)}return o.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(t){return this._config=a.merge(this._config,t),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(t){return this._store.getValueAt?this._store.getValueAt(t):this._renderer.getValueAt?this._renderer.getValueAt(t):null}},o}();return{create:function(t){return new o(t)},register:function(t,n){e.plugins[t]=n}}},t.exports?t.exports=a():void 0===(i="function"==typeof(r=a)?r.call(e,n,e,t):r)||(t.exports=i)},function(t,e,n){"use strict";n.r(e);var r=n(1);n.d(e,"Container",function(){return r.a});var i=n(0);n.d(e,"LineHeatmap",function(){return i.a})}])});
- //# sourceMappingURL=line_heatmap.js.map
|