window.Graph={render:function(t,B){var b=document.createElement("div");b.className="tchart--wrapper";t.appendChild(b);return new this.units.TChart({container:b,data:B})},units:{}};(function(){var t=function(b,a,c,e){return{linear:function(d,f,g,h){return g*d/h+f},easeInOutQuad:function(d,f,g,h){d/=.5*h;if(1>d)return.5*g*d*d+f;d--;return-g/2*(d*(d-2)-1)+f}}[e](c,b,a-b,1)},B=function(b){this.composer=b.composer;this.state=b.state;this.queue={};this.queueSize=0;this.step=this.step.bind(this)};B.prototype={add:function(b){for(var a=0,c=+new Date,e,d,f,g=this.queue;ad.endDt&&(f=d.endDt);f=g?(f-d.startDt)/g:k?0:1;f=1>f?"exp"==d.tween?h+(d.end-h)*d.speed:t(d.start,d.end,f,d.tween):d.end;f!=h?(d.state[c]=f,e.top=e.top||d.group.top,e.bottom=e.bottom||d.group.bottom):f==d.end&&b.push(c)}for(a=0;ad["f_"+b];1>H&&0F){var Qa=this.opts.animator.get("x1"),Ra=this.opts.animator.get("x2");x1End=Qa?Qa.end:this.opts.state.x1;x2End=Ra?Ra.end:this.opts.state.x2;var Aa=t.TUtils.getXIndex(n,-1==this.opts.state.zoomDir?this.savedX1:x1End,!0),ua=t.TUtils.getXIndex(n,-1==this.opts.state.zoomDir?this.savedX2:x2End,!0)}else Aa=t.TUtils.getXIndex(n,g,!0),ua=t.TUtils.getXIndex(n,h,!0);ua--;var eb=Math.floor(Aa),Sa=Math.ceil(Aa),Ta=Math.floor(ua),fb=Math.ceil(ua),Ba=0,aa=[];for(b=0;bF?(F-.65)/.2:1-(F-.9)/.15,0),1),.8):this.prevElastic,va=2*Math.PI-Math.PI/(7-F)-Math.PI/8*Ua,gb=va;1==this.opts.state.zoomDir?(F=Math.min(Math.max((F-.25)/.4,0),1),this.prevElastic=Ua):F=Math.min(Math.max(2.4*F-1.4,0),1);var L=[],X=k.PIE_RADIUS*(1>E?2.31:1)*p,S=p*(A.w/2+A.l),ma=p*(A.h/2+A.t+2),Va=2*Math.PI*X/p,hb=1/13;for(b=0;bba?"<1%":Math.round(100*ba)+"%",ind:Q[b],value:aa[b],label:Ka.label,color:this.isDarkMode?Ka.colors_n[2]:Ka.colors_d[2]});va=Ia}d.pieAngles=L}var na=p*(A.h-m-q+(f?0:-4));var wa=(A.h-q+(f?0:A.t))*p;var K=0;for(b=0;b=x+1;a--)l.lineTo(J[a]*z+G,hBottom-(u[a]+F*(u[a-1]-u[a]))),l.lineTo(J[a-1]*z+G,hBottom-u[a-1]);else l.lineTo(J[x]*z+G,hBottom);if(K=x;a--)l.lineTo(J[a]*z+G<<0,hBottom-u[a]<<0);else l.moveTo(J[y]*z+G<<0,hBottom<<0),l.lineTo(J[x]*z+G<<0,hBottom<<0);if(Kna&&(ia=na);l.lineTo(J[a]*z+G<<0,hBottom-ia<<0);u[a]+=V}else l.lineTo(J[x]*z+G<<0,hBottom-na<<0),l.lineTo(J[y]*z+G<<0,hBottom-na<<0)}else{var Y=function(pa,Na,ja,qa){var Ya=0,Za=0;da&&1X&&(qa=X);var oa=Math.atan2(ma-Na,pa-S);oa=0>oa?2*Math.PI+oa:oa;pa=Math.pow((ma-Na)*(ma-Na)+(pa-S)*(pa-S),.5);Math.abs(ja-oa)>Math.PI*(1==W?1.5:1)&&(ja-=2*Math.PI);ja<2*-Math.PI&&(ja-=2*-Math.PI);ja=oa+F*(ja-oa);qa=pa+F*(qa-pa);return[S+Math.cos(ja)*qa+Ya,ma-Math.sin(ja)*qa+Za]},ra=1>E?4:L[K].additionalPoints,Oa=!1,Ca=!1,da=d["pieInd_"+Q[K]]||0;0==L[K].percentage&&(l.globalAlpha=0);var M=Y(J[y]*z+G,hBottom-u[y],L[0].st,X);l.moveTo(M[0],M[1]);if(0=x;a--){var T=J[a]*z+G;T==S&&(Oa=!0);if(T>=S){var ea=(T-S)/(A.w*p/2);0==F&&(ea=0);M=Y(T,hBottom-u[a],L[0].st,X*ea)}else{if(!Oa){Oa=!0;var Pa=(S-T)/(J[a+1]*z+G-T),fa=hBottom-u[a],za=hBottom-u[a+1];M=Y(S,fa+Pa*(za-fa),L[K].st,0);l.lineTo(M[0],M[1])}ea=(S-T)/(A.w*p/2);M=Y(T,hBottom-u[a],L[K].st,X*ea)}l.lineTo(M[0],M[1])}else M=Y(J[x]*z+G,hBottom,L[0].st,X),l.lineTo(M[0],M[1]);if(KE&&(E=1);1>I&&(I=1);this.ctx.font=11*c+"px "+a.settings.FONTS;this.ctx.textAlign="center";this.ctx.fillStyle=this.isDarkMode?this.opts.data.axis_n.x:this.opts.data.axis_d.x;var x=1/Math.pow(this.prevXStep?this.prevXStep>D?this.prevXStep/D:D/this.prevXStep:1,5);w&&1==q&&(x/=2);this.prevXStep=D;r=Math.max(r-Math.ceil((g+.5*C)/z),0);n=Math.min(n+Math.ceil((f+.5*C)/z),e.length-1);w&&(p=this.opts.animator.get("x1"),l=this.opts.animator.get("x2"),p=p?p.end:this.opts.state.x1,l=l?l.end:this.opts.state.x2,p=Math.floor(t.TUtils.getXIndex(e,p)),l=Math.floor(t.TUtils.getXIndex(e,l)));if(w)var y=Math.round((Math.min(e[this.opts.state.detailInd2],this.opts.state.xMainMax)-Math.max(e[this.opts.state.detailInd1],this.opts.state.xMainMin))/this.opts.data.mainPeriodLen)+(u?0:1);for(;r<=n;r++)u=0==r%E,D="m",w&&(rq:r<=this.opts.state.detailInd2?(u=0==Math.max(r-this.opts.state.detailInd1,0)%I,D="d"):u=0==Math.max(r-(this.opts.state.detailInd2-this.opts.state.detailInd1+1-y),0)%E&&1>q),D=e[r]+D,z=this.items[D],u?z?2==z.tp&&(z.tp=1,h.add([{prop:"ox_"+D,state:z.state,end:1,duration:this.noAnimation?0:200*x,tween:"linear",group:{top:!0}}])):(z={tp:1,xi:e[r],i:r,state:{ind:D}},z.state["ox_"+D]=0,this.items[D]=z,h.add([{prop:"ox_"+D,state:z.state,end:1,duration:this.noAnimation?0:200*x,tween:"linear",group:{top:!0}}])):z&&1==z.tp&&this.hideItem(D,x),z&&0=k.l&&u-C/2<=k.l+k.w&&this.ctx.fillText(a.data.datesShort[r],(u+k.l)*c,(k.t+9)*c));for(r in this.items)z=this.items[r],1==z.tp&&(z.xid.x2+f/A)&&this.hideItem(r,x);this.ctx.globalAlpha=1;w&&1==q&&l--;lk.w&&(e=11);this.ctx.font="bold "+e*c+"px "+a.settings.FONTS;this.ctx.textAlign="right";this.ctx.fillStyle=this.isDarkMode?"#fff":"#000";this.ctx.fillText(b,(m.l+m.w)*c,(m.t+m.h-7)*c)}};t.TAxisX=B})();(function(){var t=window.Graph.units,B=function(b){this.opts=b;this.ctx=b.ctx;this.uuid=1;this.items={};this.setAnimation(!1);this.setForceUpdate(!1);this.deleteItem=this.deleteItem.bind(this)};B.prototype={onResize:function(){this.setAnimation(!1);this.setForceUpdate(!1)},setDarkMode:function(b){this.isDarkMode=b},setAnimation:function(b){this.noAnimation=!b},setForceUpdate:function(b){this.forceUpdate=b},deleteItem:function(b){delete this.items[b.id]},render:function(b){if(this.opts.pairY){var a=this.calcAxisData("y1_0","y2_0");var c=this.calcAxisData("y1_1","y2_1");c.needAnimation&&!a.needAnimation||1>this.opts.state.o_0?this.updateAxisState("y1_1","y2_1","numRight",c,a,c):this.updateAxisState("y1_0","y2_0","numLeft",a,a,c)}else a=this.calcAxisData("y1","y2"),this.updateAxisState("y1","y2","numLeft",a,a,a);this.renderState(b)},calcAxisData:function(b,a){var c=this.opts.state,e=this.opts.settings.PADD[0],d=this.opts.settings.PADD[2],f=!1,g=this.opts.animator.get(b),h=this.opts.animator.get(a);g=g?g.end:c[b];h=h?h.end:c[a];var k=Math.round((h-g)/this.opts.settings.Y_AXIS_RANGE),m=c[a]>h?c[a]/h:h/c[a],w=(this.opts.state.dims.axisYLines.h-e-d)/(c[a]-c[b]);e=(this.opts.state.dims.axisYLines.h-e-d)/(h-g);if(1.05<(c[b]>g?c[b]/g:g/c[b])||1.05Math.abs(E-D)?this.items[r]={numLeft:p,strLeft:C,numRight:l,strRight:u,y:D}:(w=!0,this.uuid++,n={animated:!0,strLeft:this.items[r].strLeft,strRight:this.items[r].strRight,oProp:"oyt_"+this.uuid,yProp:"yyt_"+this.uuid,state:{id:"t_"+this.uuid}},n.state[n.oProp]=1,n.state[n.yProp]=A,this.items[n.state.id]=n,k.add([{prop:n.oProp,state:n.state,end:0,duration:this.noAnimation?0:200,tween:"linear",group:{top:!0}},{prop:n.yProp,state:n.state,end:E,duration:this.noAnimation?0:this.forceUpdate?333:500,fixed:!this.forceUpdate,tween:this.forceUpdate?null:"exp",speed:.18,group:{top:!0},cbEnd:this.deleteItem}]),delete this.items[r],this.uuid++,n={animated:!0,strLeft:C,strRight:u,oProp:"oy_"+r,yProp:"yy_"+r,state:{id:r,numLeft:p,strLeft:C,numRight:l,strRight:u}},n.state[n.oProp]=0,n.state[n.yProp]=F,this.items[n.state.id]=n,k.add([{prop:n.oProp,state:n.state,end:1,duration:this.noAnimation?0:200,tween:"linear",group:{top:!0}},{prop:n.yProp,state:n.state,end:D,duration:this.noAnimation?0:this.forceUpdate?333:500,fixed:!this.forceUpdate,tween:this.forceUpdate?null:"exp",speed:.18,group:{top:!0},cbEnd:function(I){this.items[I.id]={numLeft:I.numLeft,strLeft:I.strLeft,numRight:I.numRight,strRight:I.strRight,y:I["yy_"+I.id]};clearTimeout(this.animationEndTimeout);this.animationEndTimeout=setTimeout(function(){this.animationInProgress=!1}.bind(this),30)}.bind(this)}]))}else this.items[r]&&this.items[r].animated?(this.items[r].numLeft=p,this.items[r].strLeft=C,this.items[r].numRight=l,this.items[r].strRight=u,this.items[r].state.numLeft=p,this.items[r].state.strLeft=C,this.items[r].state.numRight=l,this.items[r].state.strRight=u):this.items[r]={numLeft:p,strLeft:C,numRight:l,strRight:u,y:q.t+q.h-h-(n-e.y1)*e.yScaleEnd}}e.needAnimation&&!w&&(this.animationInProgress=!1);this.forceUpdate=!1},renderState:function(b){var a=this.opts.settings.dpi,c,e=this.opts.state.dims.axisYLeft,d=this.opts.state.dims.axisYRight,f=this.opts.state.dims.axisYLines,g=this.opts.data.ys;this.ctx.font=11*a+"px "+this.opts.settings.FONTS;this.ctx.strokeStyle=this.isDarkMode?"rgba(255, 255, 255, 0.1)":"rgba(24, 45, 59, 0.1)";this.ctx.lineWidth=1*a;this.ctx.lineCap="square";this.ctx.lineJoin="square";for(c in this.items){var h=this.items[c];if(h.animated){var k=h.state[h.yProp];var m=h.state[h.oProp]}else k=h.y,m=1;0<=k-6&&k-16<=e.h&&(this.ctx.globalAlpha=m*(this.opts.pairY?this.opts.state.o_0:1)*b,this.ctx.textAlign="left",this.ctx.fillStyle=this.opts.pairY?this.isDarkMode?g[0].colors_n[1]:g[0].colors_d[1]:this.isDarkMode?this.opts.data.axis_n.y:this.opts.data.axis_d.y,this.ctx.fillText(h.strLeft,e.l*a,(k-7)*a),this.opts.pairY&&(this.ctx.globalAlpha=m*this.opts.state.o_1*b,this.ctx.textAlign="right",this.ctx.fillStyle=this.isDarkMode?g[1].colors_n[1]:g[1].colors_d[1],this.ctx.fillText(h.strRight,(d.l+d.w)*a,(k-7)*a)));k=(k<<0)-.5;0<=k&&k<=e.h&&(this.ctx.beginPath(),this.ctx.globalAlpha=m*b,this.ctx.moveTo(f.l*a,k*a),this.ctx.lineTo((f.l+f.w)*a,k*a),this.ctx.stroke())}this.ctx.globalAlpha=1}};t.TAxisY=B})();(function(){var t=window.Graph.units,B=function(b){this.opts=b;this.filteredX1=[];this.filteredX2=[];this.filteredJ=[];this.prevY=[];this.$canvas=document.createElement("canvas");this.ctx=this.$canvas.getContext("2d",{alpha:!1})};B.prototype={onResize:function(){var b=this.opts.settings.dpi,a=this.opts.additional.mini?this.opts.state.dims.mini:this.opts.state.dims.graph;this.$canvas.width=a.w*b;this.$canvas.height=a.h*b;this.cached=""},setDarkMode:function(b){this.isDarkMode=b},render:function(){var b,a;var c=this.opts;var e=c.data.ys,d=c.state,f=c.additional.mini;var g=f?d.xg1:d.x1;var h=f?d.xg2:d.x2;var k=c.settings,m=k["PADD"+(f?"_MINI_BAR":"")][0],w=k["PADD"+(f?"_MINI_BAR":"")][1],q=k["PADD"+(f?"_MINI_BAR":"")][2],r=k["PADD"+(f?"_MINI_BAR":"")][3];k=c.data.x;var n=c.settings.dpi,p=this.ctx,l=f?d.dims.mini:d.dims.graph,u=d.zoomMode,C=d.detailInd1,A=d.detailInd2,E=void 0==d.zoomMorph?0:d.zoomMorph,F=this.filteredX1,D=this.filteredX2,I=this.filteredJ,z=this.prevY,x=e.length,y=[l.w,l.h,f?d.xg1:d.x1,f?d.xg2:d.x2,this.isDarkMode,u];f||(y.push(d.y1),y.push(d.y2));for(b=0;bthis.opts.state.xg2Ind&&(w=this.opts.state.xg2Ind-1));c*=n;g=r*n-g*c;h=(l.h-q)*n;r=this.opts.data.mainPeriodLen*c;var Q=this.opts.data.detailPeriodLen*c;if(y!=this.cached){p.fillStyle=this.isDarkMode?"#242f3e":"#fff";p.fillRect(0,0,l.w*n,l.h*n);var U=0;for(a=G;a<=w;a++){var P=u?a>=C&&a<=A?Q:r:r;b=Math.round(k[a]*c+g);var N=Math.round(k[a]*c+g+P);0=C&&H<=A?P[H]+E*(N[H]-P[H]):N[H]+E*(N[C]-N[H]):N[H])||0,H=R-H*O,z[a]+=h-H,p.lineTo(F[a],Math.round(h-z[a])),p.lineTo(D[a],Math.round(h-z[a]));p.closePath();p.fill()}p.globalAlpha=1;this.opts.ctx.drawImage(this.$canvas,l.l*n,l.t*n)}if(-1=C&&d.barInd<=A?(H=P[d.barInd]+E*(N[d.barInd]-P[d.barInd]),P=Q):(P=r,H=N[d.barInd]+E*(N[C]-N[d.barInd])):(H=N[d.barInd],P=r),H=H||0,G=h-(R-H*O)+f,this.opts.ctx.fillRect(Math.round(k[d.barInd]*c+g),Math.round(h-f+l.t*n),Math.max(Math.round(P),1),Math.round(f)-Math.round(G)),f=G);p.globalAlpha=1}this.cached=y}};t.TBars=B})();(function(){var t=window.Graph.units,B=function(b){this.state={};this.state.masterVisibility=1;this.state.slaveVisibility=0;this.specialZoomTransition=void 0;this.darkMode=!!document.documentElement.classList.contains("dark");var a=11>(!!window.ActiveXObject&&+/msie\s(\d+)/i.exec(navigator.userAgent)[1]||NaN),c=-1!=navigator.userAgent.indexOf("Trident/")&&(-1!=navigator.userAgent.indexOf("rv:")||-1!=navigator.appName.indexOf("Netscape"));this.settings={isIE:a||c,isEdge:/Edge\/\d./i.test(navigator.userAgent),dpi:Math.min(window.devicePixelRatio||1,2),Y_AXIS_RANGE:5.3,PADD:[20,16,20,16],PADD_MINI:[2,0,2,0],PADD_MINI_BAR:[0,0,0,0],PADD_MINI_AREA:[0,0,0,0],Y_LABELS_WIDTH:50,X_LABELS_HEIGHT:12,DATES_HEIGHT:18,DATES_WIDTH:300,MINI_GRAPH_HEIGHT:40,MINI_GRAPH_TOP:14,MINI_GRAPH_BOTTOM:2,FADE_HEIGHT:16,PIE_RADIUS:130,FONTS:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};this.data={caption:b.data.title,detailsFunc:b.data.x_on_zoom,hasDetail:!!b.data.x_on_zoom,slave:b.slave,yTickFormatter:b.data.yTickFormatter,yTooltipFormatter:b.data.yTooltipFormatter,xTickFormatter:b.data.xTickFormatter,xTooltipFormatter:b.data.xTooltipFormatter,xRangeFormatter:b.data.xRangeFormatter,strokeWidth:b.data.strokeWidth||"auto",hidden:b.data.hidden||[],tooltipOnHover:!!b.data.tooltipOnHover,sideLegend:b.data.sideLegend||!1,pieZoomRange:b.data.pieZoomRange||6048E5,pieLabelsPercentages:{outboard:b.data.pieLabelsPercentages&&void 0!=b.data.pieLabelsPercentages.outboard?b.data.pieLabelsPercentages.outboard:5,hoverOnly:b.data.pieLabelsPercentages&&void 0!=b.data.pieLabelsPercentages.hoverOnly?b.data.pieLabelsPercentages.hoverOnly:2},subchart:{show:b.data.subchart&&void 0!=b.data.subchart.show?b.data.subchart.show:!0,defaultZoom:b.data.subchart&&b.data.subchart.defaultZoom}};b.data.y_scaled&&(this.pairY=!0);this.graphStyle="line";a=this.settings;b.data.columns.forEach(function(e,d){var f=e.shift(),g=b.data.types[f];if("x"===g){this.data.x=e;this.state.xCount=e.length;this.state.x1=e[.75*e.length<<0];this.state.x2=e[e.length-1];this.state.xg1=e[0];this.state.xg2=e[e.length-1];this.state.xg1Ind=0;this.state.xg2Ind=e.length-1;this.state.xMainMin=e[0];this.state.xMainMax=e[this.state.xg2Ind];this.state.xgMin=e[0];this.state.xgMax=e[this.state.xg2Ind];var h=this.getDefaultZoom({x1:this.state.x1,x2:this.state.x2,xg1:this.state.xg1,xg2:this.state.xg2,"default":this.data.subchart.defaultZoom});this.state.x1=h.x1;this.state.x2=h.x2;this.data.mainPeriodLen=this.data.x[1]-this.data.x[0];this.data.detailPeriodLen=this.data.mainPeriodLen;this.data.dates=[];this.data.datesShort=[];this.data.datesRange=[];var k=t.TUtils.getFormatter("xTooltipFormatter",this.data,0),m=t.TUtils.getFormatter("xTickFormatter",this.data,0),w=t.TUtils.getFormatter("xRangeFormatter",this.data,0),q=0;e.forEach(function(n,p){this.data.dates[p]=k(n,!1);this.data.datesShort[p]=m(n,!1);this.data.datesRange[p]=w(n,!1);this.data.datesShort[p].length>q&&(q=this.data.datesShort[p].length)}.bind(this));this.data.maxXTickLength=q}if("x"!==g){this.data.ys=this.data.ys||[];this.data.yIds=this.data.yIds||{};h=b.data.colors[f];this.data.ys.push({colors_d:[h,h,h],colors_n:[h,h,h],label:b.data.names[f],y:e,tp:g,id:f});"line"==g||"step"==g?(this.data.axis_d={x:"#8E8E93",y:"#8E8E93"},this.data.axis_n={x:"rgba(163,177,194,0.6)",y:"rgba(163,177,194,0.6)"}):(this.data.axis_d={x:"rgba(37,37,41,0.5)",y:"rgba(37,37,41,0.5)"},this.data.axis_n={x:"rgba(163,177,194,0.6)",y:"rgba(236,242,248,0.5)"});h=this.data.ys.length-1;var r=-1==this.data.hidden.indexOf(f);this.data.yIds[f]=h;this.state["e_"+h]=r;this.state["o_"+h]=r?1:0;this.state["om_"+h]=r?1:0;this.state["pieInd_"+h]=0;this.state["f_"+h]=1;this.graphStyle=g}}.bind(this));this.state.activeColumnsCount=this.data.ys.length;this.updateSpeed();"area"==this.graphStyle&&(a.Y_AXIS_RANGE=4.06,this.data.hasDetail=!0);a=this.reduceGlobalRange({});a.isReduced&&(this.state.x1=a.x1,this.state.x2=a.x2,this.state.xg1=a.xg1,this.state.xg2=a.xg2,this.state.xg1Ind=a.xg1Ind,this.state.xg2Ind=a.xg2Ind);this.onResize=this.onResize.bind(this);this.onSwitcherChange=this.onSwitcherChange.bind(this);this.onSwitcherEnter=this.onSwitcherEnter.bind(this);this.onSwitcherLeave=this.onSwitcherLeave.bind(this);this.onHandleMove=this.onHandleMove.bind(this);this.toggleZoom=this.toggleZoom.bind(this);this.createDOM(b.container);window.addEventListener("resize",this.onResize);document.addEventListener("darkmode",function(e){this.setDarkMode(!this.darkMode)}.bind(this),!1);document.addEventListener("chart-hide-tips",function(e){e.detail.except!=this&&this.tip.toggle(!1)}.bind(this),!1);this.opts=b;this.onResize();this.darkMode&&this.setDarkMode(this.darkMode);window.matchMedia("(-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi)").addListener(this.onResize);window.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi)").addListener(this.onResize);window.matchMedia("(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)").addListener(this.onResize);window.matchMedia("(-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi)").addListener(this.onResize)};B.prototype={reduceGlobalRange:function(b){var a=void 0==b.x1?this.state.x1:b.x1,c=void 0==b.x2?this.state.x2:b.x2,e=void 0==b.xg1?this.state.xg1:b.xg1,d=void 0==b.xg2?this.state.xg2:b.xg2,f=b.useSaved?this.data.saved.x:this.data.x,g=Math.floor(t.TUtils.getXIndex(f,this.state.xgMin)),h=Math.ceil(t.TUtils.getXIndex(f,this.state.xgMax)),k=h,m=g,w=this.state.zoomMode?"bar"==this.graphStyle||"step"==this.graphStyle?1:2:0;"area"==this.graphStyle&&(w=0);this.data.ys.forEach(function(r,n){var p=b.useSaved?this.data.saved.y[n]:r.y;if(this.state["e_"+n])for(i=g;i<=h-w;i++)v=p[i],void 0!=v&&(k=Math.min(k,i),m=Math.max(m,i))}.bind(this));m+w==h&&(m=h-Math.max(w-1,0));if(k>=m)return{isReduced:!1};var q=f[k];f=f[m];if(e==q&&d==f)return{isReduced:!1};c>f?(a=f-(c-a),c=f,af&&(c=f));return{isReduced:!0,x1:a,x2:c,xg1:q,xg2:f,xg1Ind:k,xg2Ind:m}},getDefaultZoom:function(b){if(!b["default"])return{x1:b.x1,x2:b.x2};var a={};a.x1=b["default"][0];a.x2=b["default"][1];a.x1=Math.max(a.x1,b.xg1);a.x2=Math.min(a.x2,b.xg2);a.x1>=a.x2&&(a.x1=b.xg1,a.x2=b.xg2);return a},updateSpeed:function(b){var a=Math.max(1-.25*(this.state.deviceSpeed*this.state.activeColumnsCount*this.state.xCount*Math.pow((this.state.x2-this.state.x1)/(this.state.xMainMax-this.state.xMainMin),.5)/16.66<<0),0);a=Math.pow(a,.85);b=1;this.state.speed=void 0==b?a:b;return this.state.speed},getYMinMax:function(b,a,c,e,d){function f(z,x,y,G){if(z==Number.MAX_VALUE)c?void 0==y?(z=A.y1m,x=A.y2m):(z=A["y1m_"+y],x=A["y2m_"+y]):void 0==y?(z=A.y1,x=A.y2):(z=A["y1_"+y],x=A["y2_"+y]);else if("bar"==this.graphStyle&&(z=0),z=Math.floor(z),x=Math.ceil(x),e){var Q=t.TUtils.roundRange(z,x,C.Y_AXIS_RANGE,G);z=Q.yMin;x=Q.yMax}return{min:z,max:x,range:Q}}if("area"==this.graphStyle)return{min:0,max:102};var g=this.state.dims?this.state.dims.graph.w:this.getGraphWidth(this.data.sideLegend).width,h=Number.MAX_VALUE,k=-Number.MAX_VALUE;g=(a-b)/g;var m=t.TUtils.getXIndex(d?this.data.saved.x:this.data.x,b-g*this.settings.PADD[3]),w=t.TUtils.getXIndex(d?this.data.saved.x:this.data.x,a+g*this.settings.PADD[1]),q,r,n,p,l=[],u=[],C=this.settings,A=this.state;!d&&this.state.zoomMode?(m=Math.max(m,this.state.detailInd1),w=Math.min(w,this.state.detailInd2)):(m=Math.max(m,0),w=Math.min(w,this.data.x.length-1));var E=Math.floor(m),F=Math.ceil(m),D=Math.floor(w),I=Math.ceil(w);"line"!=this.graphStyle&&"step"!=this.graphStyle||this.data.ys.forEach(function(z,x){var y=d?this.data.saved.y[x]:z.y,G="step"==this.graphStyle?E:F,Q="step"==this.graphStyle?I:D;if(A["e_"+x]||0==x&&this.pairY){for(q=G;q<=Q;q++)r=y[q],void 0!==r&&(rk&&(k=r));"line"==this.graphStyle&&(void 0!==y[E]&&void 0!==y[F]&&(n=y[E]+(m-E)*(y[F]-y[E]),nk&&(k=n)),void 0!==y[D]&&void 0!==y[I]&&(p=y[D]+(w-D)*(y[I]-y[D]),pk&&(k=p)))}this.pairY&&(y=f(h,k,x,void 0),l[x]=y.min,u[x]=y.max,h=Number.MAX_VALUE,k=-Number.MAX_VALUE)}.bind(this));if("bar"==this.graphStyle){a=[];for(b=0;bk&&(k=yCur)}h=0}if(this.pairY)return isNaN(l[0])&&(l[0]=l[1]),isNaN(l[1])&&(l[1]=l[0]),isNaN(u[0])&&(u[0]=u[1]),isNaN(u[1])&&(u[1]=u[0]),{min:l,max:u};b=f(h,k);return{min:b.min,max:b.max}},setDarkMode:function(b){this.darkMode=b;this.graph.setDarkMode(b);this.axisY.setDarkMode(b);this.fade.setDarkMode(b);this.axisX.setDarkMode(b);this.mini.setDarkMode(b);this.handle.setDarkMode(b);this.tip.setDarkMode(b);this.switchers.setDarkMode(b);this.composer.setDarkMode(b)},getGraphWidth:function(b){var a=this.$el.getBoundingClientRect();return b?(b=this.$switchers.getBoundingClientRect(),500<=a.width-b.width?{hasSpaceForLegend:!0,width:Math.max(a.width-b.width,1)}:{hasSpaceForLegend:!1,width:a.width}):{width:a.width}},onResize:function(){var b=Math.min(window.devicePixelRatio||1,2);if(this.ww!=window.innerWidth||b!=this.settings.dpi){this.settings.dpi=b;this.ww=window.innerWidth;this.data.sideLegend&&(this.$switchers.classList.remove("tchart--switchers__no-space"),b=this.getGraphWidth(!0),b.hasSpaceForLegend||this.$switchers.classList.add("tchart--switchers__no-space"),this.$graph.style.width=b.width+"px");b=this.$graph.getBoundingClientRect();var a=this.settings,c=b.height-a.DATES_HEIGHT-a.MINI_GRAPH_HEIGHT-a.MINI_GRAPH_TOP-a.MINI_GRAPH_BOTTOM;this.state.dims={composer:{w:b.width,h:b.height,l:0,t:0},graph:{w:b.width,h:c,l:0,t:a.DATES_HEIGHT},axisYLeft:{w:a.Y_LABELS_WIDTH,h:c,l:a.PADD[3],t:a.DATES_HEIGHT},axisYRight:{w:a.Y_LABELS_WIDTH,h:c,l:b.width-a.PADD[1]-a.Y_LABELS_WIDTH,t:a.DATES_HEIGHT},axisYLines:{w:b.width-a.PADD[1]-a.PADD[3],h:c,l:a.PADD[3],t:a.DATES_HEIGHT},fadeTop:{w:b.width,h:a.FADE_HEIGHT,l:0,t:a.DATES_HEIGHT},fadeBottom:{w:b.width,h:a.FADE_HEIGHT,l:0,t:a.DATES_HEIGHT+c-a.FADE_HEIGHT},axisX:{w:b.width,h:a.X_LABELS_HEIGHT,l:0,t:a.DATES_HEIGHT+c-a.X_LABELS_HEIGHT},dates:{w:a.DATES_WIDTH,h:a.DATES_HEIGHT,l:b.width-a.DATES_WIDTH-a.PADD[1],t:0},mini:{w:b.width-a.PADD[1]-a.PADD[3],h:a.MINI_GRAPH_HEIGHT,l:a.PADD[3],t:a.DATES_HEIGHT+c+a.MINI_GRAPH_TOP},handle:{w:b.width-a.PADD[1]-a.PADD[3],h:a.MINI_GRAPH_HEIGHT+2,l:a.PADD[3],t:a.DATES_HEIGHT+c+a.MINI_GRAPH_TOP-1},tip:{w:b.width,h:c,l:0,t:a.DATES_HEIGHT}};this.graph.onResize();this.axisY.onResize();this.fade.onResize();this.axisX.onResize();this.mini.onResize();this.handle.onResize();this.tip.onResize();this.composer.onResize()}},createDOM:function(b){var a,c=this.settings;this.$el=document.createElement("div");this.$el.className="tchart";this.data.subchart.show||this.$el.classList.add("tchart__no-subchart");this.data.slave&&this.$el.classList.add("tchart__slave");this.$h1=document.createElement("h1");this.$h1.className="tchart--header";this.$h1.textContent=this.data.caption;this.$el.appendChild(this.$h1);this.$zoom=document.createElement("div");this.$zoom.className="tchart--zoom";this.$el.appendChild(this.$zoom);var e=document.createElement("div");this.$zoom.appendChild(e);e=document.createElement("span");e.textContent="Zoom Out";this.$zoom.appendChild(e);this.$zoom.addEventListener("click",function(){this.toggleZoom(!1)}.bind(this));this.$graph=document.createElement("div");this.$graph.className="tchart--graph";this.$el.appendChild(this.$graph);this.$switchers=document.createElement("div");this.$switchers.className="tchart--switchers";this.data.sideLegend&&this.$switchers.classList.add("tchart--switchers__side-legend");this.$el.appendChild(this.$switchers);b.appendChild(this.$el);b=this.getYMinMax(this.state.x1,this.state.x2,!1,!0);e=this.getYMinMax(this.state.xg1,this.state.xg2,!0);if(this.pairY)for(a=0;am&&(m=this.data.datesShort[f].length);this.data.maxXTickLength=m;this.data.subchart=c.subchart;this.data.hidden=c.hidden;f=this.getDefaultZoom({x1:a,x2:e,xg1:a,xg2:e,"default":this.data.subchart.defaultZoom});this.state.x1=f.x1;this.state.x2=f.x2;this.state.xCount=this.data.x.length;this.state.xg1=a;this.state.xg2=e;this.state.xg1Ind=0;this.state.xg2Ind=this.data.x.length-1;this.state.xMainMin=a;this.state.xMainMax=e;this.state.xgMin=a;this.state.xgMax=e;f=this.reduceGlobalRange({});f.isReduced&&(this.state.x1=f.x1,this.state.x2=f.x2,this.state.xg1=f.xg1,this.state.xg2=f.xg2,this.state.xg1Ind=f.xg1Ind,this.state.xg2Ind=f.xg2Ind);f=this.getYMinMax(this.state.x1,this.state.x2,!1,!0);a=this.getYMinMax(a,e,!0);this.state.y1=f.min;this.state.y2=f.max;this.state.y1m=a.min;this.state.y2m=a.max}else this.switchers.switchers.forEach(function(w,q){w.classList.remove("tchart--switcher__visible")});setTimeout(function(){b||(this.state.zoomModeSlave=!1)}.bind(this),470);this.state.slaveVisibility=b?0:1;d.push({prop:"slaveVisibility",state:this.state,end:b?1:0,duration:450,group:{top:!0,bottom:!0}});this.animator.add(d)}},toggleZoomSpecial:function(b,a,c){var e=[];if(this.state.zoomModeSpecial!=b){var d=this.updateSpeed();if(b){var f=(this.state.x2-this.state.x1)/(this.state.dims.graph.w-this.settings.PADD[3]-this.settings.PADD[1]),g=this.settings.PADD[3]*f;this.state.zoomSpecialOrigin=(a-this.state.x1+g)/(this.state.x2-this.state.x1+g+this.settings.PADD[1]*f);this.state.zoomModeSpecial=!0;this.$h1.classList.add("tchart--header__hidden");this.$zoom.classList.add("tchart--zoom__visible");this.switchers.switchers.forEach(function(h,k){h.classList.remove("tchart--switcher__visible")});this.slaveChart.toggleSlave(!0,this.state.zoomSpecialOrigin,c,d)}else this.$h1.classList.remove("tchart--header__hidden"),this.$zoom.classList.remove("tchart--zoom__visible"),this.switchers.switchers.forEach(function(h,k){h.classList.add("tchart--switcher__visible")}),this.slaveChart.toggleSlave(!1,this.state.zoomSpecialOrigin,null,d);document.body.style.pointerEvents="none";setTimeout(function(){b||(this.state.zoomModeSpecial=!1);document.body.style.pointerEvents=""}.bind(this),470);this.state.masterVisibility=b?1:0;e.push({prop:"masterVisibility",state:this.state,end:b?0:1,duration:450,group:{top:!0,bottom:!0}});this.animator.add(e)}},toggleZoom:function(b,a,c){c&&void 0==this.specialZoomTransition&&(c.columns.length!=this.data.ys.length+1&&(this.specialZoomTransition=!0),this.specialZoomTransition||c.columns.forEach(function(r,n){var p=r[0],l=c.types[p],u=c.names[p];n=this.data.yIds[p];if(void 0!=n){if(p=this.data.ys[n].label,this.data.ys[n].tp!=l||p!=u)this.specialZoomTransition=!0}else"x"!==p&&(this.specialZoomTransition=!0)}.bind(this)),void 0==this.specialZoomTransition&&(this.specialZoomTransition=!1));if(this.specialZoomTransition&&(this.data.master=!0,this.$el.classList.add("tchart__master"),!this.slaveChart)){var e=JSON.parse(JSON.stringify(c));e.yTickFormatter=c.yTickFormatter;e.yTooltipFormatter=c.yTooltipFormatter;e.xTickFormatter=c.xTickFormatter;e.xTooltipFormatter=c.xTooltipFormatter;e.xRangeFormatter=c.xRangeFormatter;e.sideLegend=this.data.sideLegend;this.slaveChart=new t.TChart({container:this.opts.container,slave:!0,data:e});this.slaveChart.setDarkMode(this.darkMode)}c&&!c.details&&(c.details={y:[],names:[]},c.columns.forEach(function(r,n){var p=r.shift(),l=c.names[p];"x"===c.types[p]?c.details.x=r:this.specialZoomTransition?(c.details.y.push(r),c.details.names.push(l)):c.details.y[this.data.yIds[p]]=r}.bind(this)));c&&(c.subchart={show:c.subchart&&void 0!=c.subchart.show?c.subchart.show:!0,defaultZoom:c.subchart&&c.subchart.defaultZoom},c.details.subchart=c.subchart,c.details.hidden=c.hidden||[]);if(this.specialZoomTransition)this.toggleZoomSpecial(b,a,c&&c.details);else{var d=c&&c.details;e=[];if(this.state.zoomMode!=b){if(b){this.state.zoomMode=!0;this.state.zoomDir=1;this.$h1.classList.add("tchart--header__hidden");this.$zoom.classList.add("tchart--zoom__visible");this.zoomEnterSpeed=this.updateSpeed();c&&(this.data.details={yTickFormatter:c.yTickFormatter,yTooltipFormatter:c.yTooltipFormatter,xTickFormatter:c.xTickFormatter,xTooltipFormatter:c.xTooltipFormatter,xRangeFormatter:c.xRangeFormatter,subchart:c.subchart,hidden:c.hidden||[]});if(!this.hasSavedData){this.data.saved={};this.data.saved.x=this.data.x.slice();this.data.saved.dates=this.data.dates.slice();this.data.saved.datesShort=this.data.datesShort.slice();this.data.saved.datesRange=this.data.datesRange.slice();this.data.saved.y=[];for(j=0;jthis.data.x[this.data.x.length-1]&&(k=this.data.x[this.data.x.length-1]+f)):k>this.data.x[this.data.x.length-1]&&(k=this.data.x[this.data.x.length-1]+f,h=k-m,hthis.data.x[e]&&e++;a=e-("bar"==this.graphStyle||"step"==this.graphStyle?1:0);e=this.data.x.length-1;var f=[],g=[],h=[],k=[],m,w,q=[],r=[];for(m=0;mw&&(w=h[n].length),n=t.TUtils.getXIndex(this.data.x,f[n]),u[m]=n,C[m]=Math.floor(n),A[m]=Math.ceil(n);this.data.details.maxXTickLength=w;for(j=0;jh,m="area"==this.opts.graphStyle&&c.zoomMode&&1==h;this.opts.data.master&&(this.$canvas.style.opacity=c.masterVisibility);this.opts.data.slave&&(this.$canvas.style.opacity=c.slaveVisibility,this.opts.chart.$el.style.visibility=0c.slaveVisibility||this.opts.data.master&&1>c.masterVisibility)m?e.clearRect(a.graph.l*d,(a.graph.t-18)*d,a.graph.w*d,(a.graph.h+30)*d):e.clearRect(a.graph.l*d,a.graph.t*d,a.graph.w*d,a.graph.h*d);if("area"==this.opts.graphStyle&&0==h||"bar"==this.opts.graphStyle)e.clearRect(a.graph.l*d,a.graph.t*d,a.graph.w*d,(f.PADD[0]+4)*d),e.clearRect(a.graph.l*d,(a.graph.t+g[0])*d,g[3]*d,(a.graph.h-g[0]-g[2])*d),e.clearRect(a.graph.l*d,(a.graph.t+a.graph.h-g[2])*d,a.graph.w*d,g[2]*d),e.clearRect((a.graph.l+a.graph.w-g[1]-1)*d,(a.graph.t+g[0])*d,(g[1]+1)*d,(a.graph.h-g[0]-g[2])*d);k||m||(e.save(),e.beginPath(),e.rect(a.graph.l*d,a.graph.t*d,a.graph.w*d,a.graph.h*d),e.clip());this.opts.data.master&&1>c.masterVisibility&&(e.save(),g=5*(1-c.masterVisibility)+1,e.translate(a.graph.w*c.zoomSpecialOrigin*(1-g),0),e.scale(g,1));this.opts.data.slave&&1>c.slaveVisibility&&(e.save(),g=c.slaveVisibility,e.translate(a.graph.w*c.zoomSpecialOrigin*(1-g),0),e.scale(g,1));g=1;"area"==this.opts.graphStyle&&c.zoomMode&&(g=1-h);if(k){e.save();f=f.PIE_RADIUS;var w=a.graph.w+h*(2*f-a.graph.w),q=a.graph.h-42+h*(2*f-a.graph.h+42);t.TUtils.drawRoundedRect2(e,d,w,q,(a.graph.w-w)/2+a.graph.l,(a.graph.h-42-q)/2+a.graph.t+23,h*f);e.clip()}this.opts.chart.graph.render();k&&e.restore();this.opts.data.master&&1>c.masterVisibility&&e.restore();this.opts.data.slave&&1>c.slaveVisibility&&e.restore();this.opts.chart.axisY.render(g);this.opts.chart.fade.render();k||m||e.restore();this.opts.chart.axisX.render(g)}b.bottom&&(e.clearRect(a.graph.l*d,(a.handle.t-1)*d,a.graph.w*d,(a.handle.h+2)*d),b=this.opts.data.subchart.show,(c=!this.opts.data.master&&!this.opts.data.slave&&this.opts.data.details&&this.opts.data.subchart.show!=this.opts.data.details.subchart.show)&&(b=b?1>h:0h&&(e.fillStyle=this.isDarkMode?"#242f3e":"#fff",e.globalAlpha=this.opts.data.subchart.show?h:1-h,e.fillRect(a.graph.l*d,(a.handle.t-1)*d,a.graph.w*d,(a.handle.h+2)*d),e.globalAlpha=1))}};t.TComposer=B})();(function(){var t=window.Graph.units,B=function(b){this.opts=b;this.onDragStart=this.onDragStart.bind(this);this.onDragMove=this.onDragMove.bind(this);this.onDragEnd=this.onDragEnd.bind(this);this.isTouch=t.TUtils.isTouchDevice();this.skipMoveEnd=!0;var a=b.useElForMove?b.$el:window;b.$el.addEventListener(this.isTouch?"touchstart":"mousedown",this.onDragStart,{passive:!1});a.addEventListener(this.isTouch?"touchmove":"mousemove",this.onDragMove,{passive:!1});a.addEventListener(this.isTouch?"touchend":"mouseup",this.onDragEnd,{passive:!1})};B.prototype={onDragStart:function(b){this.skipMoveEnd=!0;clearTimeout(this.pointerTimeout);this.isTouch&&1Math.abs(this.dY)?"h":"v";if(this.prevDx!=this.dX||this.prevDy!=this.dY)this.opts.onDragMove&&this.opts.onDragMove({canceled:"v"==this.scroll,d:this.dX,pageX:this.pageX,pageY:this.pageY,isTouch:this.isTouch}),this.prevDx=this.dX,this.prevDy=this.dY}},onDragEnd:function(b){this.skipMoveEnd||(this.skipMoveEnd=!0,this.opts.onDragEnd&&this.opts.onDragEnd({isTouch:this.isTouch,e:b}))}};t.TDrag=B})();(function(){var t=function(B){this.opts=B;this.ctx=B.ctx;"area"!=this.opts.graphStyle&&(this.$fadeTop=document.createElement("canvas"),this.ctxFadeTop=this.$fadeTop.getContext("2d"),"bar"!=this.opts.graphStyle&&(this.$fadeBottom=document.createElement("canvas"),this.ctxFadeBottom=this.$fadeBottom.getContext("2d")))};t.prototype={onResize:function(){var B=this.opts.settings.dpi,b=this.opts.state.dims.fadeTop,a=this.opts.state.dims.fadeBottom;if("area"!=this.opts.graphStyle){var c=this.ctxFadeTop.createLinearGradient(0,0,0,b.h*B);this.isDarkMode?(c.addColorStop(0,"rgba(36,47,62,1)"),c.addColorStop(1,"rgba(36,47,62,0)")):(c.addColorStop(0,"rgba(255,255,255,1)"),c.addColorStop(1,"rgba(255,255,255,0)"));this.$fadeTop.width=b.w*B;this.$fadeTop.height=b.h*B;this.ctxFadeTop.fillStyle=c;this.ctxFadeTop.fillRect(0,0,b.w*B,b.h*B);"bar"!=this.opts.graphStyle&&(b=this.ctxFadeBottom.createLinearGradient(0,0,0,a.h*B),this.isDarkMode?(b.addColorStop(0,"rgba(36,47,62,0)"),b.addColorStop(1,"rgba(36,47,62,1)")):(b.addColorStop(0,"rgba(255,255,255,0)"),b.addColorStop(1,"rgba(255,255,255,1)")),this.$fadeBottom.width=a.w*B,this.$fadeBottom.height=a.h*B,this.ctxFadeBottom.fillStyle=b,this.ctxFadeBottom.fillRect(0,0,a.w*B,a.h*B))}},setDarkMode:function(B){this.isDarkMode=B;this.onResize()},render:function(){var B=this.opts.settings.dpi,b=this.opts.state.dims.fadeTop,a=this.opts.state.dims.fadeBottom;this.$fadeTop&&this.ctx.drawImage(this.$fadeTop,b.l*B,b.t*B);this.$fadeBottom&&this.ctx.drawImage(this.$fadeBottom,a.l*B,a.t*B)}};window.Graph.units.TFade=t})();(function(){var t=window.Graph.units,B=function(b){this.opts=b;this.ctx=b.ctx;this.isTouch=t.TUtils.isTouchDevice();this.$canvas=b.$canvas;this.drag=new t.TDrag({$el:this.$canvas,onDragStart:function(a){this.canvasPos=t.TUtils.getElemPagePos(this.$canvas);var c=a.pageX-this.canvasPos.x,e=a.pageY-this.canvasPos.y;this._x1=b.state.x1;this._x2=b.state.x2;this.constrainHandleSize(!1);this.tp=this.getTp(c-b.settings.PADD[3],e-(this.opts.state.dims.composer.h-b.settings.MINI_GRAPH_HEIGHT-b.settings.MINI_GRAPH_BOTTOM),a.isTouch);this.firstMove=!0;return!this.tp}.bind(this),onDragMove:function(a){this.onDragMove(a.d);this.firstMove=!1}.bind(this),onDragEnd:function(a){}.bind(this)});this.onMouseMove=this.onMouseMove.bind(this);this.onMouseLeave=this.onMouseLeave.bind(this);this.trackMouse(!0)};B.prototype={getTp:function(b,a,c){var e=this.opts.state.dims.handle,d=this.opts.state,f=this.opts.state.zoomMode;if(0>a||a>e.h)return"";var g=c?.3*e.w:10;c&&14>g&&(g=14);c&&30Math.abs(d.x2-d.x1-(f?this.opts.data.mainPeriodLen:this.minRange))&&(d.x2==d.xg2&&(g=c+1),d.x1==d.xg1&&(e=a-1));return b>e&&b=a&&b<=e?"start":b>=g&&b<=c?"end":""},trackMouse:function(b){this.isTouch||(this.$canvas.addEventListener("mousemove",this.onMouseMove),this.$canvas.addEventListener("mouseleave",this.onMouseLeave))},onMouseLeave:function(){this.$canvas.classList.remove("tchart--graph-canvas__handle-pointer");this.$canvas.classList.remove("tchart--graph-canvas__handle-grab");this.$canvas.classList.remove("tchart--graph-canvas__handle-col-resize");delete this.canvasPos},onMouseMove:function(b){this.canvasPos=this.canvasPos||t.TUtils.getElemPagePos(this.$canvas);b=this.getTp(b.pageX-this.canvasPos.x-this.opts.settings.PADD[3],b.pageY-this.canvasPos.y-(this.opts.state.dims.composer.h-this.opts.settings.MINI_GRAPH_HEIGHT-this.opts.settings.MINI_GRAPH_BOTTOM),!1);var a={"":"",both:this.opts.settings.isIE?"pointer":"grab",start:"col-resize",end:"col-resize"};this.onMouseLeave();a[b]&&this.$canvas.classList.add("tchart--graph-canvas__handle-"+a[b])},onResize:function(b){this.constrainHandleSize(!0)},setDarkMode:function(b){this.isDarkMode=b},constrainHandleSize:function(b){var a=32/(this.opts.state.dims.handle.w/(this.opts.state.xg2-this.opts.state.xg1)),c=this.opts.state.x1,e=this.opts.state.x2,d=this.opts.state.xg2;this.minRange=a;e-cd&&(e=d,c=e-a),b&&this.opts.additional.cb(c,e,"constraint"))},onDragMove:function(b){var a=this.tp,c=this.opts.state;b=b/this.opts.state.dims.handle.w*(c.xg2-c.xg1);var e=this._x1,d=this._x2;if("both"==a){var f=e+b;var g=d+b;fc.xg2&&(f=c.xg2-(d-e),g=c.xg2)}"start"==a&&(g=c.x2,f=Math.min(Math.max(e+b,c.xg1),g-this.minRange));"end"==a&&(f=c.x1,g=Math.max(Math.min(d+b,c.xg2),f+this.minRange));c.x1==f&&c.x2==g||this.opts.additional.cb(f,g,a,this.firstMove)},render:function(){var b=this.opts.state.dims.handle,a=this.opts.settings.dpi,c=this.opts.state,e=1/(c.xg2-c.xg1),d=Math.round((c.x1-c.xg1)*e*b.w);c=Math.round((c.x2-c.xg1)*e*b.w);e=this.ctx;e.fillStyle=this.isDarkMode?"rgba(48, 66, 89, 0.6)":"rgba(226, 238, 249, 0.6)";t.TUtils.drawRoundedRect(e,a,d+4,b.h-2,b.l,b.t+1,[7,0,0,7]);e.fill();t.TUtils.drawRoundedRect(e,a,b.w-c+4,b.h-2,b.l+c-4,b.t+1,[0,7,7,0]);e.fill();this.isDarkMode||"line"==this.opts.graphStyle||"step"==this.opts.graphStyle||(e.fillStyle="#fff",t.TUtils.drawRoundedRect(e,a,12,b.h+2,b.l+d-1,b.t-1,[8,0,0,8]),e.fill(),t.TUtils.drawRoundedRect(e,a,12,b.h+2,b.l+c-11,b.t-1,[0,8,8,0]),e.fill());e.fillStyle=this.isDarkMode?"#56626D":"#C0D1E1";t.TUtils.drawRoundedRect(e,a,10,b.h,b.l+d,b.t,[7,0,0,7]);e.fill();t.TUtils.drawRoundedRect(e,a,10,b.h,b.l+c-10,b.t,[0,7,7,0]);e.fill();e.fillRect((b.l+d+10)*a,b.t*a,(c-d-20)*a,a);e.fillRect((b.l+d+10)*a,(b.t+b.h-1)*a,(c-d-20)*a,a);e.strokeStyle="#fff";this.ctx.lineCap="round";this.ctx.lineJoin="round";this.ctx.lineWidth=2*a;e.beginPath();e.moveTo((b.l+d+5)*a,(b.t+17)*a);e.lineTo((b.l+d+5)*a,(b.t+25)*a);e.moveTo((b.l+c-5)*a,(b.t+17)*a);e.lineTo((b.l+c-5)*a,(b.t+25)*a);e.stroke();this.prevX1=d;this.prevX2=c}};t.THandle=B})();(function(){var t=window.Graph.units,B=function(b){this.opts=b;this.$canvas=document.createElement("canvas");this.ctx=this.$canvas.getContext("2d",{alpha:!0})};B.prototype={onResize:function(){var b=this.opts.settings.dpi,a=this.opts.additional.mini?this.opts.state.dims.mini:this.opts.state.dims.graph;this.$canvas.width=a.w*b;this.$canvas.height=a.h*b;this.cached="";this.ctx.fillStyle=this.isDarkMode?"#242f3e":"#fff";this.ctx.fillRect(0,0,a.w*b,a.h*b)},setDarkMode:function(b){this.isDarkMode=b},render:function(){var b,a=this.opts,c=a.data.ys,e=a.state,d=a.additional.mini,f=d||a.data.master&&1>e.masterVisibility&&0e.slaveVisibility&&0this.opts.state.xg2Ind&&(h=this.opts.state.xg2Ind-1));w=this.opts.data.mainPeriodLen*k;r=this.opts.data.detailPeriodLen*k;if(f){var x=[u.w,u.h,d?e.xg1:e.x1,d?e.xg2:e.x2,this.isDarkMode,C];d||(x.push(e.y1),x.push(e.y2));for(b=0;by?(P=e.y1m_show,G=e.y2m_show):!G&&1>y?(P=e.y1m_hidd,G=e.y2m_hidd):(P=e.y1m,G=e.y2m):(P=e.y1,G=e.y2);G=p*(u.h-m-q)/(G-P);P=(u.h-q+(f?0:u.t))*p+P*G;l.beginPath();l.strokeStyle=this.isDarkMode?c[b].colors_n[0]:c[b].colors_d[0];l.globalAlpha=y*(.9*e["f_"+b]+.1);var N=Number.MAX_VALUE,R=-Number.MAX_VALUE,O=-Number.MAX_VALUE,H=!1,W=!0;for(y=z;y<=h;y++){if(C)if(y>=A&&y<=E){var Z=U[y]+F*(Q[y]-U[y]);var J=r}else Z=Q[y]+F*(Q[A]-Q[y]),J=w;else Z=Q[y],J=w;if(isNaN(Z))W=!0;else{var ka=n[y]*k+g<<0;yc=P-Z*G<<0;ka>O||I&&y==E+1?(H&&(la==N?(l.moveTo(O+x,R-x),l.lineTo(O+x,N-x)):(l.moveTo(O+x,N-x),l.lineTo(O+x,R-x),la!=R&&l.moveTo(O+x,la-x)),H=!1),W&&(l.moveTo(ka+x,yc-x),W=!1),R=N=yc,l.lineTo(ka+x,yc-x),I&&l.lineTo((n[y]*k+J+g<<0)+x,yc-x)):(N=Math.min(N,yc),R=Math.max(R,yc),H=!0);O=ka;var la=yc}}H&&(l.moveTo(O+x,N-x),l.lineTo(O+x,R-x));l.stroke()}}l.globalAlpha=1;f&&this.opts.ctx.drawImage(this.$canvas,u.l*p,u.t*p)}};t.TLines=B})();(function(){var t=window.Graph.units,B=function(b){this.opts=b;var a,c;this.isTouch=t.TUtils.isTouchDevice();this.enabled=b.data.ys.length;1==this.enabled&&(b.$parent.style.display="none");this.switchers=b.data.ys.map(function(e,d){var f=document.createElement("div");f.className="tchart--switcher";b.state["e_"+d]?f.classList.toggle("tchart--switcher__active"):this.enabled--;f.setAttribute("data-label",e.label);b.$parent.appendChild(f);var g=document.createElement("span");g.textContent=e.label;f.appendChild(g);this.isTouch||(f.addEventListener("mouseenter",function(w){b.state["e_"+d]&&b.additional.onEnter(d)}),f.addEventListener("mouseleave",function(w){b.state["e_"+d]&&b.additional.onLeave(d)}));f.addEventListener("click",function(w){c?c=!1:(w=f.classList.contains("tchart--switcher__active"))&&1==this.enabled?(f.classList.add("tchart--switcher__denied"),clearTimeout(a),a=setTimeout(function(){f.classList.remove("tchart--switcher__denied")},500)):(this.isTouch||(w?b.additional.onLeave(d):b.additional.onEnter(d)),b.additional.onClick(!w,d))}.bind(this));var h,k,m;this.drag=new t.TDrag({$el:f,noPrevent:!0,useElForMove:!0,onDragStart:function(w){h=w.pageX;k=w.pageY;m=setTimeout(function(){c=!0;if(!this.isTouch)b.additional.onEnter(d);b.additional.onLongTap(d)}.bind(this),500)}.bind(this),onDragMove:function(w){(5a||a>e.h?"":"graph"},trackMouse:function(b,a){this.isTouch||(this.$canvas.addEventListener("mousemove",this.onMouseMove),this.$canvas.addEventListener("mouseleave",this.onMouseLeave))},onMouseLeave:function(){this.$canvas.classList.remove("tchart--graph-canvas__tip-pointer");delete this.canvasPos},onMouseMove:function(b){this.canvasPos=this.canvasPos||t.TUtils.getElemPagePos(this.$canvas);b=this.getTp(b.pageX-this.canvasPos.x,b.pageY-this.canvasPos.y-this.opts.state.dims.tip.t,!1);this.onMouseLeave();b&&this.$canvas.classList.add("tchart--graph-canvas__tip-pointer")},toggle:function(b,a){var c=this.opts,e=c.state;b&&!this.shown&&(this.$tip.classList.add("tchart--tip__visible"),!this.opts.data.hasDetail||this.opts.state.zoomMode||this.opts.state.zoomModeSpecial?this.$tip.classList.remove("tchart--tip__has-zoom"):this.$tip.classList.add("tchart--tip__has-zoom"),this.$tip.classList.remove("tchart--tip__shiftHide"),this.$line&&this.$line.classList.add("tchart--line__visible"),t.TUtils.triggerEvent("chart-hide-tips",{except:this.opts.chart}));if(!b&&this.shown){delete this.lastCurPieItemInd;if("area"==c.graphStyle&&e.zoomMode){for(var d=[],f=0;fm?2*Math.PI+m:m;var q;for(g=0;g=k.ed&&(q=k),m-2*Math.PI<=k.st&&m-2*Math.PI>=k.ed&&(q=k);if(this.lastCurPieItemInd!=q.ind){m=[];for(g=0;gp&&l++,p>q.w-1&&l--;else if(this.opts.state.zoomMode||this.opts.state.zoomModeSpecial)la.state.detailInd2&&l--;"bar"==a.graphStyle&&a.animator.add([{prop:"barInd",state:a.state,end:l,duration:0,tween:"linear",group:{top:!0}},{prop:"barO",state:this.opts.state,end:1,duration:150,tween:"exp",speed:.3,group:{top:!0}}]);if(this.prevXInd!=l||!b.isMove){this.$tip.classList.remove("tchart--tip__piemode");this.$line&&this.$line.classList.remove("tchart--line__piemode");this.labels.forEach(function(E,F){var D=a.state["e_"+F]&&!isNaN(a.data.ys[F].y[l])?"block":"none";E.$row.style.display=D;this.points&&(this.points[F].style.display=D);w+="block"==D?1:0}.bind(this));this.itemsVisible=w;this.allLabel&&(this.allLabel.$row.style.display=1this.maxLabelWidth&&(this.maxLabelWidth=D);D=E.$value.offsetWidth;D>this.maxValueWidth&&(this.maxValueWidth=D)}}.bind(this));b=this.rowPaddings+this.maxLabelWidth+20+this.maxValueWidth;b+="area"==a.graphStyle?this.maxPercentageWidth:0;n=this.rowPaddings+this.$tipDt.offsetWidth+20;n>this.maxDateWidth&&(this.maxDateWidth=n);b=Math.max(b,this.maxDateWidth);this.$tip.style.width=b+"px";this.tipH=this.$tip.offsetHeight;this.tipW=this.$tip.offsetWidth}b=2>=this.itemsVisible?"center":"side";if("center"==b){var C=this.dx-this.tipW/2,A=Math.min(this.dy-20-this.tipH,q.t+q.h-this.tipH-g);Aq.w/2?this.dx-this.tipW-20:this.dx+20,A=Math.min(Math.max(this.dy-this.tipH/2,q.t+d),q.t+q.h-this.tipH-g));C=Math.min(Math.max(C,e/2),q.w-this.tipW-f/2);this.$tip.style.transform="translate("+(C<<0)+"px,"+(A<<0)+"px)";this.$tip.style.webkitTransform="translate("+(C<<0)+"px,"+(A<<0)+"px)";this.lastTipLeft=C<<0;this.lastTipTop=A<<0;this.prevXInd=l;this.updateTipScrollClasses()}}},updateTipScrollClasses:function(){this.$tipScroller.scrollHeight>this.$tipScroller.offsetHeight?this.$tip.classList.add("tchart--tip__scroll"):this.$tip.classList.remove("tchart--tip__scroll");0>=this.$tipScroller.scrollTop?this.$tip.classList.remove("tchart--tip__has_less"):this.$tip.classList.add("tchart--tip__has_less");this.$tipScroller.scrollTop>=this.$tipScroller.scrollHeight-this.$tipScroller.offsetHeight?this.$tip.classList.remove("tchart--tip__has_more"):this.$tip.classList.add("tchart--tip__has_more")},fillPercentages:function(b,a){var c=this.opts,e=[],d=2;c.data.ys.forEach(function(f,g){if(c.state["e_"+g]){e[g]=Math.max(Math.round(100*f.y[b]/a),0);if(isNaN(f.y[b])||0==a)e[g]=0;100==e[g]&&(d=3)}}.bind(this));c.data.ys.forEach(function(f,g){if(c.state["e_"+g]){var h=8*d+17;this.labels[g].$label.style.transform="translateX("+h+"px)";this.labels[g].$label.style.webkitTransform="translateX("+h+"px)";this.labels[g].$perText.nodeValue=e[g]+"%";this.labels[g].$per.style.width=h-7+"px";h>this.maxPercentageWidth&&(this.maxPercentageWidth=h)}}.bind(this))}};t.TTip=B})();(function(){Math.log2=Math.log2||function(c){return Math.log(c)*Math.LOG2E};Math.log10=Math.log10||function(c){return Math.log(c)*Math.LOG10E};var t="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),B="Sun Mon Tue Wed Thu Fri Sat".split(" "),b="January February March April May June July August September October November December".split(" "),a={simplifyData:function(c,e,d,f,g,h,k,m,w){c=(m-k)/w;w=[];var q=[];if(1>=c)return{xInd1:k,xInd2:m,x:e,ys:d};for(var r=0,n=-999999999,p=h.length,l;k<=m;k++){var u=e[k]*f+g<<0;(n=u>n)?(w[r]=e[k],r++):l++;for(j=0;jc[g]&&(e=c[g]));1=c[f]&&e<=c[d]?g=d:f=d;return f+(e-c[f])/(c[g]-c[f])},triggerEvent:function(c,e){"function"==typeof window.CustomEvent&&document.dispatchEvent(new CustomEvent(c,{detail:e||null}))},isTouchDevice:function(){if("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)return!0;var c=["("," -webkit- -moz- -o- -ms- ".split(" ").join("touch-enabled),("),"heartz)"].join("");return window.matchMedia(c).matches},drawRoundedRect:function(c,e,d,f,g,h,k){d*=e;f*=e;g*=e;h*=e;"number"==typeof k&&(k=[k,k,k,k]);k[0]*=e;k[1]*=e;k[2]*=e;k[3]*=e;c.beginPath();c.moveTo(g+k[0],h);c.lineTo(g+d-k[1],h);c.quadraticCurveTo(g+d,h,g+d,h+k[1]);c.lineTo(g+d,h+f-k[2]);c.quadraticCurveTo(g+d,h+f,g+d-k[2],h+f);c.lineTo(g+k[3],h+f);c.quadraticCurveTo(g,h+f,g,h+f-k[3]);c.lineTo(g,h+k[0]);c.quadraticCurveTo(g,h,g+k[0],h);c.closePath()},drawRoundedRect2:function(c,e,d,f,g,h,k){d*=e;f*=e;g*=e;h*=e;k*=e;d<2*k&&(k=d/2);f<2*k&&(k=f/2);c.beginPath();c.moveTo(g+k,h);c.arcTo(g+d,h,g+d,h+f,k);c.arcTo(g+d,h+f,g,h+f,k);c.arcTo(g,h+f,g,h,k);c.arcTo(g,h,g+d,h,k);c.closePath()},getFormatter:function(c,e,d){var f;.5d[4]?"0":"")+d[4]+":"+(10>d[5]?"0":"")+d[5]:B[d[3]]+", "+d[2]+" "+t[d[1]]+" "+d[0]},xTickFormatter:function(c,e){var d=new Date(c);d=[d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCDay(),d.getUTCHours(),d.getUTCMinutes()];return e?(10>d[4]?"0":"")+d[4]+":"+(10>d[5]?"0":"")+d[5]:d[2]+" "+t[d[1]]},xRangeFormatter:function(c,e){var d=new Date(c);d=[d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()];return d[2]+" "+b[d[1]]+" "+d[0]},yTickFormatter:function(c,e,d){return 0==c?0:1E3>e?Math.floor(c):1E3<=e&&1E6>e?d?Math.floor(10*c/1E3)/10+"K":Math.round(c/1E3)+"K":d?Math.floor(10*c/1E6)/10+"M":Math.round(c/1E6)+"M"},yTooltipFormatter:function(c){return"number"!==typeof c?"string"===typeof c?c:"?":a.statsFormatKMBT(c)},statsFormatKMBT:function(c,e,d){if(0==c)return"0";null==e&&(e=a.statsChooseNumKMBT(c));c=a.statsFormatFixedKMBT(c,e);null==d&&(d=a.statsChoosePrecision(c));return c.toFixed(d)+e},statsFormatFixedKMBT:function(c,e){switch(e){case "K":return c/1E3;case "M":return c/1E6;case "B":return c/1E9;case "T":return c/1E12}return c},statsChoosePrecision:function(c){c=Math.abs(c);return 10Math.abs(c-Math.floor(c))?0:1:2},statsChooseNumKMBT:function(c){c=Math.abs(c);return 1E12<=c?"T":1E9<=c?"B":1E6<=c?"M":2E3<=c?"K":""},roundRange:function(c,e,d,f){1>Math.abs(e-c)&&(c-=c/10,e+=e/10);if(f)return{yMin:c-(f.yMinOrig-f.yMin)/(f.yMaxOrig-f.yMinOrig)*(e-c),yMax:e+(f.yMax-f.yMaxOrig)/(f.yMaxOrig-f.yMinOrig)*(e-c),yMinOrig:c,yMaxOrig:e};f=function(r){var n=k*r;r=Math.floor(c/n)*n;n=r+d*Math.ceil((e-r)*g/n)*n;return{good:n<=w&&r>=m,yMin:Math.round(r),yMax:Math.round(n),yMinOrig:c,yMaxOrig:e}};for(var g=1/d,h=(e-c)*g,k=Math.max(Math.pow(10,Math.floor(Math.log10(h))),1),m=c-.5*h,w=e+.5*h,q=1;;){h=f(5);if(h.good)break;h=f(2);if(h.good)break;h=f(1);if(h.good)break;k*=.1;q++;if(10