window.Graph={render:function(t,C){var b=document.createElement("div");b.className="tchart--wrapper";t.appendChild(b);return new this.units.TChart({container:b,data:C})},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)},C=function(b){this.composer=b.composer;this.state=b.state;this.queue={};this.queueSize=0;this.step=this.step.bind(this)};C.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,T=p*(D.w/2+D.l),ma=p*(D.h/2+D.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*(D.h-m-r+(f?0:-4));var wa=(D.h-r+(f?0:D.t))*p;var K=0;for(b=0;b=x+1;a--)l.lineTo(J[a]*z+A,hBottom-(u[a]+F*(u[a-1]-u[a]))),l.lineTo(J[a-1]*z+A,hBottom-u[a-1]);else l.lineTo(J[x]*z+A,hBottom);if(K=x;a--)l.lineTo(J[a]*z+A<<0,hBottom-u[a]<<0);else l.moveTo(J[y]*z+A<<0,hBottom<<0),l.lineTo(J[x]*z+A<<0,hBottom<<0);if(Kna&&(ia=na);l.lineTo(J[a]*z+A<<0,hBottom-ia<<0);u[a]+=V}else l.lineTo(J[x]*z+A<<0,hBottom-na<<0),l.lineTo(J[y]*z+A<<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-T);oa=0>oa?2*Math.PI+oa:oa;pa=Math.pow((ma-Na)*(ma-Na)+(pa-T)*(pa-T),.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[T+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+A,hBottom-u[y],L[0].st,X);l.moveTo(M[0],M[1]);if(0=x;a--){var U=J[a]*z+A;U==T&&(Oa=!0);if(U>=T){var ea=(U-T)/(D.w*p/2);0==F&&(ea=0);M=Y(U,hBottom-u[a],L[0].st,X*ea)}else{if(!Oa){Oa=!0;var Pa=(T-U)/(J[a+1]*z+A-U),fa=hBottom-u[a],za=hBottom-u[a+1];M=Y(T,fa+Pa*(za-fa),L[K].st,0);l.lineTo(M[0],M[1])}ea=(T-U)/(D.w*p/2);M=Y(U,hBottom-u[a],L[K].st,X*ea)}l.lineTo(M[0],M[1])}else M=Y(J[x]*z+A,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>G?this.prevXStep/G:G/this.prevXStep:1,5);w&&1==r&&(x/=2);this.prevXStep=G;q=Math.max(q-Math.ceil((g+.5*B)/z),0);n=Math.min(n+Math.ceil((f+.5*B)/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(;q<=n;q++)u=0==q%E,G="m",w&&(qr:q<=this.opts.state.detailInd2?(u=0==Math.max(q-this.opts.state.detailInd1,0)%I,G="d"):u=0==Math.max(q-(this.opts.state.detailInd2-this.opts.state.detailInd1+1-y),0)%E&&1>r),G=e[q]+G,z=this.items[G],u?z?2==z.tp&&(z.tp=1,h.add([{prop:"ox_"+G,state:z.state,end:1,duration:this.noAnimation?0:200*x,tween:"linear",group:{top:!0}}])):(z={tp:1,xi:e[q],i:q,state:{ind:G}},z.state["ox_"+G]=0,this.items[G]=z,h.add([{prop:"ox_"+G,state:z.state,end:1,duration:this.noAnimation?0:200*x,tween:"linear",group:{top:!0}}])):z&&1==z.tp&&this.hideItem(G,x),z&&0=k.l&&u-B/2<=k.l+k.w&&this.ctx.fillText(a.data.datesShort[q],(u+k.l)*c,(k.t+9)*c));for(q in this.items)z=this.items[q],1==z.tp&&(z.xid.x2+f/D)&&this.hideItem(q,x);this.ctx.globalAlpha=1;w&&1==r&&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=C})();(function(){var t=window.Graph.units,C=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)};C.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-G)?this.items[q]={numLeft:p,strLeft:B,numRight:l,strRight:u,y:G}:(w=!0,this.uuid++,n={animated:!0,strLeft:this.items[q].strLeft,strRight:this.items[q].strRight,oProp:"oyt_"+this.uuid,yProp:"yyt_"+this.uuid,state:{id:"t_"+this.uuid}},n.state[n.oProp]=1,n.state[n.yProp]=D,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[q],this.uuid++,n={animated:!0,strLeft:B,strRight:u,oProp:"oy_"+q,yProp:"yy_"+q,state:{id:q,numLeft:p,strLeft:B,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:G,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[q]&&this.items[q].animated?(this.items[q].numLeft=p,this.items[q].strLeft=B,this.items[q].numRight=l,this.items[q].strRight=u,this.items[q].state.numLeft=p,this.items[q].state.strLeft=B,this.items[q].state.numRight=l,this.items[q].state.strRight=u):this.items[q]={numLeft:p,strLeft:B,numRight:l,strRight:u,y:r.t+r.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=C})();(function(){var t=window.Graph.units,C=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})};C.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],r=k["PADD"+(f?"_MINI_BAR":"")][2],q=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,B=d.detailInd1,D=d.detailInd2,E=void 0==d.zoomMorph?0:d.zoomMorph,F=this.filteredX1,G=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=q*n-g*c;h=(l.h-r)*n;q=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 R=0;for(a=A;a<=w;a++){var P=u?a>=B&&a<=D?Q:q:q;b=Math.round(k[a]*c+g);var N=Math.round(k[a]*c+g+P);0=B&&H<=D?P[H]+E*(N[H]-P[H]):N[H]+E*(N[B]-N[H]):N[H])||0,H=S-H*O,z[a]+=h-H,p.lineTo(F[a],Math.round(h-z[a])),p.lineTo(G[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=B&&d.barInd<=D?(H=P[d.barInd]+E*(N[d.barInd]-P[d.barInd]),P=Q):(P=q,H=N[d.barInd]+E*(N[B]-N[d.barInd])):(H=N[d.barInd],P=q),H=H||0,A=h-(S-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(A)),f=A);p.globalAlpha=1}this.cached=y}};t.TBars=C})();(function(){var t=window.Graph.units,C=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,yMinStep:b.data.yMinStep,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,forceLegend:b.data.forceLegend,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),r=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>r&&(r=this.data.datesShort[p].length)}.bind(this));this.data.maxXTickLength=r}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 q=-1==this.data.hidden.indexOf(f);this.data.yIds[f]=h;this.state["e_"+h]=q;this.state["o_"+h]=q?1:0;this.state["om_"+h]=q?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)};C.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(q,n){var p=b.useSaved?this.data.saved.y[n]:q.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 r=f[k];f=f[m];if(e==r&&d==f)return{isReduced:!1};c>f?(a=f-(c-a),c=f,af&&(c=f));return{isReduced:!0,x1:a,x2:c,xg1:r,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(x,y,A,Q){if(x==Number.MAX_VALUE)c?void 0==A?(x=E.y1m,y=E.y2m):(x=E["y1m_"+A],y=E["y2m_"+A]):void 0==A?(x=E.y1,y=E.y2):(x=E["y1_"+A],y=E["y2_"+A]);else if("bar"==this.graphStyle&&(x=0),x=Math.floor(x),y=Math.ceil(y),e){var R=t.TUtils.roundRange(x,y,D.Y_AXIS_RANGE,Q);x=R.yMin;y=R.yMax;Math.abs(x-y)Math.abs(x-y)&&y++;return{min:x,max:y,range:R}}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]),r=this.data.yMinStep||1,q,n,p,l,u=[],B=[],D=this.settings,E=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 F=Math.floor(m),G=Math.ceil(m),I=Math.floor(w),z=Math.ceil(w);"line"!=this.graphStyle&&"step"!=this.graphStyle||this.data.ys.forEach(function(x,y){var A=d?this.data.saved.y[y]:x.y,Q="step"==this.graphStyle?F:G,R="step"==this.graphStyle?z:I;if(E["e_"+y]||0==y&&this.pairY){for(q=Q;q<=R;q++)n=A[q],void 0!==n&&(nk&&(k=n));"line"==this.graphStyle&&(void 0!==A[F]&&void 0!==A[G]&&(p=A[F]+(m-F)*(A[G]-A[F]),pk&&(k=p)),void 0!==A[I]&&void 0!==A[z]&&(l=A[I]+(w-I)*(A[z]-A[I]),lk&&(k=l)))}this.pairY&&(A=f(h,k,y,void 0),u[y]=A.min,B[y]=A.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(u[0])&&(u[0]=u[1]),isNaN(u[1])&&(u[1]=u[0]),isNaN(B[0])&&(B[0]=B[1]),isNaN(B[1])&&(B[1]=B[0]),{min:u,max:B};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,r){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(q,n){var p=q[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(q,n){var p=q.shift(),l=c.names[p];"x"===c.types[p]?c.details.x=q:this.specialZoomTransition?(c.details.y.push(q),c.details.names.push(l)):c.details.y[this.data.yIds[p]]=q}.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,r=[],q=[];for(m=0;mw&&(w=h[n].length),n=t.TUtils.getXIndex(this.data.x,f[n]),u[m]=n,B[m]=Math.floor(n),D[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),r=a.graph.h-42+h*(2*f-a.graph.h+42);t.TUtils.drawRoundedRect2(e,d,w,r,(a.graph.w-w)/2+a.graph.l,(a.graph.h-42-r)/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=C})();(function(){var t=window.Graph.units,C=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})};C.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=C})();(function(){var t=function(C){this.opts=C;this.ctx=C.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 C=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*C);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*C;this.$fadeTop.height=b.h*C;this.ctxFadeTop.fillStyle=c;this.ctxFadeTop.fillRect(0,0,b.w*C,b.h*C);"bar"!=this.opts.graphStyle&&(b=this.ctxFadeBottom.createLinearGradient(0,0,0,a.h*C),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*C,this.$fadeBottom.height=a.h*C,this.ctxFadeBottom.fillStyle=b,this.ctxFadeBottom.fillRect(0,0,a.w*C,a.h*C))}},setDarkMode:function(C){this.isDarkMode=C;this.onResize()},render:function(){var C=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*C,b.t*C);this.$fadeBottom&&this.ctx.drawImage(this.$fadeBottom,a.l*C,a.t*C)}};window.Graph.units.TFade=t})();(function(){var t=window.Graph.units,C=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)};C.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=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.$canvas=document.createElement("canvas");this.ctx=this.$canvas.getContext("2d",{alpha:!0})};C.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;q=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,B];d||(x.push(e.y1),x.push(e.y2));for(b=0;by?(P=e.y1m_show,A=e.y2m_show):!A&&1>y?(P=e.y1m_hidd,A=e.y2m_hidd):(P=e.y1m,A=e.y2m):(P=e.y1,A=e.y2);A=p*(u.h-m-r)/(A-P);P=(u.h-r+(f?0:u.t))*p+P*A;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,S=-Number.MAX_VALUE,O=-Number.MAX_VALUE,H=!1,W=!0;for(y=z;y<=h;y++){if(B)if(y>=D&&y<=E){var Z=R[y]+F*(Q[y]-R[y]);var J=q}else Z=Q[y]+F*(Q[D]-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*A<<0;ka>O||I&&y==E+1?(H&&(la==N?(l.moveTo(O+x,S-x),l.lineTo(O+x,N-x)):(l.moveTo(O+x,N-x),l.lineTo(O+x,S-x),la!=S&&l.moveTo(O+x,la-x)),H=!1),W&&(l.moveTo(ka+x,yc-x),W=!1),S=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),S=Math.max(S,yc),H=!0);O=ka;var la=yc}}H&&(l.moveTo(O+x,N-x),l.lineTo(O+x,S-x));l.stroke()}}l.globalAlpha=1;f&&this.opts.ctx.drawImage(this.$canvas,u.l*p,u.t*p)}};t.TLines=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;var a,c;this.isTouch=t.TUtils.isTouchDevice();this.enabled=b.data.ys.length;1!=this.enabled||b.data.forceLegend||(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 r;for(g=0;g=k.ed&&(r=k),m-2*Math.PI<=k.st&&m-2*Math.PI>=k.ed&&(r=k);if(this.lastCurPieItemInd!=r.ind){m=[];for(g=0;gp&&l++,p>r.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 G=a.state["e_"+F]&&!isNaN(a.data.ys[F].y[l])?"block":"none";E.$row.style.display=G;this.points&&(this.points[F].style.display=G);w+="block"==G?1:0}.bind(this));this.itemsVisible=w;this.allLabel&&(this.allLabel.$row.style.display=1this.maxLabelWidth&&(this.maxLabelWidth=G);G=E.$value.offsetWidth;G>this.maxValueWidth&&(this.maxValueWidth=G)}}.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 B=this.dx-this.tipW/2,D=Math.min(this.dy-20-this.tipH,r.t+r.h-this.tipH-g);Dr.w/2?this.dx-this.tipW-20:this.dx+20,D=Math.min(Math.max(this.dy-this.tipH/2,r.t+d),r.t+r.h-this.tipH-g));B=Math.min(Math.max(B,e/2),r.w-this.tipW-f/2);this.$tip.style.transform="translate("+(B<<0)+"px,"+(D<<0)+"px)";this.$tip.style.webkitTransform="translate("+(B<<0)+"px,"+(D<<0)+"px)";this.lastTipLeft=B<<0;this.lastTipTop=D<<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=C})();(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(" "),C="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 r=[];if(1>=c)return{xInd1:k,xInd2:m,x:e,ys:d};for(var q=0,n=-999999999,p=h.length,l;k<=m;k++){var u=e[k]*f+g<<0;(n=u>n)?(w[q]=e[k],q++):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]:C[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(q){var n=k*q;q=Math.floor(c/n)*n;n=q+d*Math.ceil((e-q)*g/n)*n;return{good:n<=w&&q>=m,yMin:Math.round(q),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,r=1;;){h=f(5);if(h.good)break;h=f(2);if(h.good)break;h=f(1);if(h.good)break;k*=.1;r++;if(10