(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(function(){try{return require("moment")}catch(t){}}()):"function"==typeof define&&define.amd?define(["require"],function(t){return e(function(){try{return t("moment")}catch(t){}}())}):(t=t||self,t.Chart=e(t.moment))})(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){return t&&t.default||t}function i(){for(var t={},e=Object.keys(Xe),n=e.length,i=0;i1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function s(t){var e=function(e){if(null==e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"==typeof n)for(var i=n.length,a=0;a=0&&e<1?S(Math.round(255*e)):"")}function m(t,e){return e<1||t[3]&&t[3]<1?v(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function v(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function b(t,e){if(e<1||t[3]&&t[3]<1)return x(t,e);var n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgb("+n+"%, "+i+"%, "+a+"%)"}function x(t,e){var n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgba("+n+"%, "+i+"%, "+a+"%, "+(e||t[3]||1)+")"}function y(t,e){return e<1||t[3]&&t[3]<1?_(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function _(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function k(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function w(t){return en[t.slice(0,3)]}function M(t,e,n){return Math.min(Math.max(e,t),n)}function S(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}function C(t){return!t||sn.isNullOrUndef(t.size)||sn.isNullOrUndef(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function P(t,e,n,i){var a,r,o,l,s,u,d,c,h,f=Object.keys(n);for(a=0,r=f.length;a0||(jn.forEach(function(e){delete t[e]}),delete t._chartjs)}}function T(t,e){var n=e.startAngle,i=e.endAngle,a=e.pixelMargin,r=a/e.outerRadius,o=e.x,l=e.y;t.beginPath(),t.arc(o,l,e.outerRadius,n-r,i+r),e.innerRadius>a?(r=a/e.innerRadius,t.arc(o,l,e.innerRadius-a,i+r,n-r,!0)):t.arc(o,l,a,i+Math.PI/2,n-Math.PI/2),t.closePath(),t.clip()}function I(t,e,n,i){var a,r=n.endAngle;for(i&&(n.endAngle=n.startAngle+Yn,T(t,n),n.endAngle=r,n.endAngle===n.startAngle&&n.fullCircles&&(n.endAngle+=Yn,n.fullCircles--)),t.beginPath(),t.arc(n.x,n.y,n.innerRadius,n.startAngle+Yn,n.startAngle,!0),a=0;at.x&&(e=N(e,"left","right")):t.basen?n:i,r:s.right||a<0?0:a>e?e:a,b:s.bottom||r<0?0:r>n?n:r,l:s.left||o<0?0:o>e?e:o}}function W(t){var e=z(t),n=e.right-e.left,i=e.bottom-e.top,a=E(t,n/2,i/2);return{outer:{x:e.left,y:e.top,w:n,h:i},inner:{x:e.left+a.l,y:e.top+a.t,w:n-a.l-a.r,h:i-a.t-a.b}}}function V(t,e,n){var i=null===e,a=null===n,r=!(!t||i&&a)&&z(t);return r&&(i||e>=r.left&&e<=r.right)&&(a||n>=r.top&&n<=r.bottom)}function H(t,e){var n,i,a,r,o=t._length;for(a=1,r=e.length;a0?Math.min(o,Math.abs(i-n)):o,n=i;return o}function j(t,e,n){var i,a,r=n.barThickness,o=e.stackCount,l=e.pixels[t],s=In.isNullOrUndef(r)?H(e.scale,e.pixels):-1;return In.isNullOrUndef(r)?(i=s*n.categoryPercentage,a=n.barPercentage):(i=r*o,a=1),{chunk:i/o,ratio:a,start:l-i/2}}function q(t,e,n){var i,a,r=e.pixels,o=r[t],l=t>0?r[t-1]:null,s=t-1?t.split("\n"):t}function Pt(t){var e=t._xScale,n=t._yScale||t._scale,i=t._index,a=t._datasetIndex,r=t._chart.getDatasetMeta(a).controller,o=r._getIndexScale(),l=r._getValueScale();return{xLabel:e?e.getLabelForIndex(i,a):"",yLabel:n?n.getLabelForIndex(i,a):"",label:o?""+o.getLabelForIndex(i,a):"",value:l?""+l.getLabelForIndex(i,a):"",index:i,datasetIndex:a,x:t._model.x,y:t._model.y}}function At(t){var e=yn.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,rtl:t.rtl,textDirection:t.textDirection,bodyFontColor:t.bodyFontColor,_bodyFontFamily:$i(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:$i(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:$i(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:$i(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:$i(t.titleFontStyle,e.defaultFontStyle),titleFontSize:$i(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:$i(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:$i(t.footerFontStyle,e.defaultFontStyle),footerFontSize:$i(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Dt(t,e){var n=t._chart.ctx,i=2*e.yPadding,a=0,r=e.body,o=r.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);o+=e.beforeBody.length+e.afterBody.length;var l=e.title.length,s=e.footer.length,u=e.titleFontSize,d=e.bodyFontSize,c=e.footerFontSize;i+=l*u,i+=l?(l-1)*e.titleSpacing:0,i+=l?e.titleMarginBottom:0,i+=o*d,i+=o?(o-1)*e.bodySpacing:0,i+=s?e.footerMarginTop:0,i+=s*c,i+=s?(s-1)*e.footerSpacing:0;var h=0,f=function(t){a=Math.max(a,n.measureText(t).width+h)};return n.font=In.fontString(u,e._titleFontStyle,e._titleFontFamily),In.each(e.title,f),n.font=In.fontString(d,e._bodyFontStyle,e._bodyFontFamily),In.each(e.beforeBody.concat(e.afterBody),f),h=e.displayColors?d+2:0,In.each(r,function(t){In.each(t.before,f),In.each(t.lines,f),In.each(t.after,f)}),h=0,n.font=In.fontString(c,e._footerFontStyle,e._footerFontFamily),In.each(e.footer,f),a+=2*e.xPadding,{width:a,height:i}}function Tt(t,e){var n,i,a,r,o,l=t._model,s=t._chart,u=t._chart.chartArea,d="center",c="center";l.ys.height-e.height&&(c="bottom");var h=(u.left+u.right)/2,f=(u.top+u.bottom)/2;"center"===c?(n=function(t){return t<=h},i=function(t){return t>h}):(n=function(t){return t<=e.width/2},i=function(t){return t>=s.width-e.width/2}),a=function(t){return t+e.width+l.caretSize+l.caretPadding>s.width},r=function(t){return t-e.width-l.caretSize-l.caretPadding<0},o=function(t){return t<=f?"top":"bottom"},n(l.x)?(d="left",a(l.x)&&(d="center",c=o(l.y))):i(l.x)&&(d="right",r(l.x)&&(d="center",c=o(l.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:d,yAlign:g.yAlign?g.yAlign:c}}function It(t,e,n,i){var a=t.x,r=t.y,o=t.caretSize,l=t.caretPadding,s=t.cornerRadius,u=n.xAlign,d=n.yAlign,c=o+l,h=s+l;return"right"===u?a-=e.width:"center"===u&&(a-=e.width/2,a+e.width>i.width&&(a=i.width-e.width),a<0&&(a=0)),"top"===d?r+=c:r-="bottom"===d?e.height+c:e.height/2,"center"===d?"left"===u?a+=c:"right"===u&&(a-=c):"left"===u?a-=h:"right"===u&&(a+=h),{x:a,y:r}}function Ft(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function Ot(t){return St([],Ct(t))}function Lt(){return In.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){if("xAxes"===t||"yAxes"===t){var a,r,o,l=n[t].length;for(e[t]||(e[t]=[]),a=0;a=e[t].length&&e[t].push({}),!e[t][a].type||o.type&&o.type!==e[t][a].type?In.merge(e[t][a],[Zi.getScaleDefaults(r),o]):In.merge(e[t][a],o)}else In._merger(t,e,n,i)}})}function Rt(){return In.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){var a=e[t]||{},r=n[t];"scales"===t?e[t]=Lt(a,r):"scale"===t?e[t]=In.merge(a,[Zi.getScaleDefaults(r.type),r]):In._merger(t,e,n,i)}})}function zt(t){t=t||{};var e=t.data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=Rt(yn.global,yn[t.type],t.options||{}),t}function Nt(t){var e=t.options;In.each(t.scales,function(e){Fi.removeBox(t,e)}),e=Rt(yn.global,yn[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Bt(t,e,n){var i,a=function(t){return t.id===i};do{i=e+n++}while(In.findIndex(t,a)>=0);return i}function Et(t){return"top"===t||"bottom"===t}function Wt(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}function Vt(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}function Ht(t){this.options=t||{}}function jt(t,e){for(var n=[],i=t.length/e,a=0,r=t.length;as+u)))return o}function Ut(t,e){In.each(t,function(t){var n,i=t.gc,a=i.length/2;if(a>e){for(n=0;nu)return r;return Math.max(u,1)}function te(t){var e,n,i=[];for(e=0,n=t.length;ed&&(m=In.niceNum(r*m/d/u)*u),s||_a(f)?n=Math.pow(10,In._decimalPlaces(m)):(n=Math.pow(10,f),m=Math.ceil(m*n)/n),i=Math.floor(g/m)*m,a=Math.ceil(p/m)*m,s&&(!_a(c)&&In.almostWhole(c/m,m/1e3)&&(i=c),!_a(h)&&In.almostWhole(h/m,m/1e3)&&(a=h)),r=(a-i)/m,r=In.almostEquals(r,Math.round(r),m/1e3)?Math.round(r):Math.ceil(r),i=Math.round(i*n)/n,a=Math.round(a*n)/n,o.push(_a(c)?i:c);for(var v=1;v=0?1:s),r=Math.round(i*Math.pow(10,n)*s)/s}while(n=0?t:e}function ue(t){var e=t.ticks;return e.display&&t.display?Oa(e.fontSize,yn.global.defaultFontSize)+2*e.backdropPaddingY:0}function de(t,e,n){return In.isArray(n)?{w:In.longestText(t,t.font,n),h:n.length*e}:{w:t.measureText(n).width,h:e}}function ce(t,e,n,i,a){return t===i||t===a?{start:e-n/2,end:e+n/2}:ta?{start:e-n,end:e}:{start:e,end:e+n}}function he(t){var e,n,i,a=In.options._parseFont(t.options.pointLabels),r={l:0,r:t.width,t:0,b:t.height-t.paddingTop},o={};t.ctx.font=a.string,t._pointLabelSizes=[];var l=t.chart.data.labels.length;for(e=0;er.r&&(r.r=d.end,o.r=s),c.startr.b&&(r.b=c.end,o.b=s)}t.setReductions(t.drawingArea,r,o)}function fe(t){return 0===t||180===t?"center":t<180?"left":"right"}function ge(t,e,n,i){var a,r,o=n.y+i/2;if(In.isArray(e))for(a=0,r=e.length;a270||t<90)&&(n.y-=e.h)}function me(t){var e=t.ctx,n=t.options,i=n.pointLabels,a=ue(n),r=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),o=In.options._parseFont(i);e.save(),e.font=o.string,e.textBaseline="middle";for(var l=t.chart.data.labels.length-1;l>=0;l--){var s=0===l?a/2:0,u=t.getPointPosition(l,r+s+5),d=La(i.fontColor,l,yn.global.defaultFontColor);e.fillStyle=d;var c=t.getIndexAngle(l),h=In.toDegrees(c);e.textAlign=fe(h),pe(h,t._pointLabelSizes[l],u),ge(e,t.pointLabels[l],u,o.lineHeight)}e.restore()}function ve(t,e,n,i){var a,r=t.ctx,o=e.circular,l=t.chart.data.labels.length,s=La(e.color,i-1),u=La(e.lineWidth,i-1);if((o||l)&&s&&u){if(r.save(),r.strokeStyle=s,r.lineWidth=u,r.setLineDash&&(r.setLineDash(e.borderDash||[]),r.lineDashOffset=e.borderDashOffset||0),r.beginPath(),o)r.arc(t.xCenter,t.yCenter,n,0,2*Math.PI);else{a=t.getPointPosition(0,n),r.moveTo(a.x,a.y);for(var d=1;de&&l=0&&o<=l;){if(i=o+l>>1,a=t[i-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]n))return{lo:a,hi:r};l=i-1}}return{lo:r,hi:null}}function Se(t,e,n,i){var a=Me(t,e,n),r=a.lo?a.hi?a.lo:t[t.length-2]:t[0],o=a.lo?a.hi?a.hi:t[t.length-1]:t[1],l=o[e]-r[e],s=l?(n-r[e])/l:0,u=(o[i]-r[i])*s;return r[i]+u}function Ce(t,e){var n=t._adapter,i=t.options.time,a=i.parser,r=a||i.format,o=e;return"function"==typeof a&&(o=a(o)),In.isFinite(o)||(o="string"==typeof r?n.parse(o,r):n.parse(o)),null!==o?+o:(a||"function"!=typeof r||(o=r(e),In.isFinite(o)||(o=n.parse(o))),o)}function Pe(t,e){if(In.isNullOrUndef(e))return null;var n=t.options.time,i=Ce(t,t.getRightValue(e));return null===i?i:(n.round&&(i=+t._adapter.startOf(i,n.round)),i)}function Ae(t,e,n,i){var a,r,o,l=Ua.length;for(a=Ua.indexOf(t);a=Ua.indexOf(n);r--)if(o=Ua[r],qa[o].common&&t._adapter.diff(a,i,o)>=e-1)return o;return Ua[n?Ua.indexOf(n):0]}function Te(t){for(var e=Ua.indexOf(t)+1,n=Ua.length;e1e5*u)throw e+" and "+n+" are too far apart with stepSize of "+u+" "+s;for(a=c;a=0&&(e[r].major=!0);return e}function Le(t,e,n){var i,a,r=[],o={},l=e.length;for(i=0;i=n)&&i;switch(r){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return r;default:return!1}}function ze(t){var e,n=t.el._model||{},i=t.el._scale||{},a=t.fill,r=null;if(isFinite(a))return null;if("start"===a?r=void 0===n.scaleBottom?i.bottom:n.scaleBottom:"end"===a?r=void 0===n.scaleTop?i.top:n.scaleTop:void 0!==n.scaleZero?r=n.scaleZero:i.getBasePixel&&(r=i.getBasePixel()),null!=r){if(void 0!==r.x&&void 0!==r.y)return r;if(In.isFinite(r))return e=i.isHorizontal(),{x:e?r:null,y:e?null:r}}return null}function Ne(t){var e,n,i,a,r,o=t.el._scale,l=o.options,s=o.chart.data.labels.length,u=t.fill,d=[];if(!s)return null;for(e=l.ticks.reverse?o.max:o.min,n=l.ticks.reverse?o.min:o.max,i=o.getPointPositionForValue(0,e),a=0;a0;--r)In.canvas.lineTo(t,n[r],n[r-1],!0);else for(o=n[0].cx,l=n[0].cy,s=Math.sqrt(Math.pow(n[0].x-o,2)+Math.pow(n[0].y-l,2)),r=a-1;r>0;--r)t.arc(o,l,s,n[r].angle,n[r-1].angle,!0)}}function je(t,e,n,i,a,r){var o,l,s,u,d,c,h,f,g=e.length,p=i.spanGaps,m=[],v=[],b=0,x=0;for(t.beginPath(),o=0,l=g;oe?e:t.boxWidth}function Ue(t,e){var n=new nr({ctx:t.ctx,options:e,chart:t});Fi.configure(t,n,e),Fi.addBox(t,n),t.legend=n}function Ye(t,e){var n=new rr({ctx:t.ctx,options:e,chart:t});Fi.configure(t,n,e),Fi.addBox(t,n),t.titleBlock=n}t=t&&t.hasOwnProperty("default")?t.default:t;var Ge={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169], darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Xe=e(function(t){function e(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}var n={};for(var i in Ge)Ge.hasOwnProperty(i)&&(n[Ge[i]]=i);var a=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var r in a)if(a.hasOwnProperty(r)){if(!("channels"in a[r]))throw new Error("missing channels property: "+r);if(!("labels"in a[r]))throw new Error("missing channel labels property: "+r);if(a[r].labels.length!==a[r].channels)throw new Error("channel and label counts mismatch: "+r);var o=a[r].channels,l=a[r].labels;delete a[r].channels,delete a[r].labels,Object.defineProperty(a[r],"channels",{value:o}),Object.defineProperty(a[r],"labels",{value:l})}a.rgb.hsl=function(t){var e,n,i,a=t[0]/255,r=t[1]/255,o=t[2]/255,l=Math.min(a,r,o),s=Math.max(a,r,o),u=s-l;return s===l?e=0:a===s?e=(r-o)/u:r===s?e=2+(o-a)/u:o===s&&(e=4+(a-r)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=(l+s)/2,n=s===l?0:i<=.5?u/(s+l):u/(2-s-l),[e,100*n,100*i]},a.rgb.hsv=function(t){var e,n,i,a,r,o=t[0]/255,l=t[1]/255,s=t[2]/255,u=Math.max(o,l,s),d=u-Math.min(o,l,s),c=function(t){return(u-t)/6/d+.5};return 0===d?a=r=0:(r=d/u,e=c(o),n=c(l),i=c(s),o===u?a=i-n:l===u?a=1/3+e-i:s===u&&(a=2/3+n-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*r,100*u]},a.rgb.hwb=function(t){var e=t[0],n=t[1],i=t[2],r=a.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(n,i));return i=1-1/255*Math.max(e,Math.max(n,i)),[r,100*o,100*i]},a.rgb.cmyk=function(t){var e,n,i,a,r=t[0]/255,o=t[1]/255,l=t[2]/255;return a=Math.min(1-r,1-o,1-l),e=(1-r-a)/(1-a)||0,n=(1-o-a)/(1-a)||0,i=(1-l-a)/(1-a)||0,[100*e,100*n,100*i,100*a]},a.rgb.keyword=function(t){var i=n[t];if(i)return i;var a,r=1/0;for(var o in Ge)if(Ge.hasOwnProperty(o)){var l=Ge[o],s=e(t,l);s.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92;var a=.4124*e+.3576*n+.1805*i,r=.2126*e+.7152*n+.0722*i,o=.0193*e+.1192*n+.9505*i;return[100*a,100*r,100*o]},a.rgb.lab=function(t){var e,n,i,r=a.rgb.xyz(t),o=r[0],l=r[1],s=r[2];return o/=95.047,l/=100,s/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*l-16,n=500*(o-l),i=200*(l-s),[e,n,i]},a.hsl.rgb=function(t){var e,n,i,a,r,o=t[0]/360,l=t[1]/100,s=t[2]/100;if(0===l)return r=255*s,[r,r,r];n=s<.5?s*(1+l):s+l-s*l,e=2*s-n,a=[0,0,0];for(var u=0;u<3;u++)i=o+1/3*-(u-1),i<0&&i++,i>1&&i--,r=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,a[u]=255*r;return a},a.hsl.hsv=function(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100,o=a,l=Math.max(r,.01);return r*=2,a*=r<=1?r:2-r,o*=l<=1?l:2-l,n=(r+a)/2,e=0===r?2*o/(l+o):2*a/(r+a),[i,100*e,100*n]},a.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,a=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-n),l=255*i*(1-n*r),s=255*i*(1-n*(1-r));switch(i*=255,a){case 0:return[i,s,o];case 1:return[l,i,o];case 2:return[o,i,s];case 3:return[o,l,i];case 4:return[s,o,i];case 5:return[i,o,l]}},a.hsv.hsl=function(t){var e,n,i,a=t[0],r=t[1]/100,o=t[2]/100,l=Math.max(o,.01);return i=(2-r)*o,e=(2-r)*l,n=r*l,n/=e<=1?e:2-e,n=n||0,i/=2,[a,100*n,100*i]},a.hwb.rgb=function(t){var e,n,i,a,r,o,l,s=t[0]/360,u=t[1]/100,d=t[2]/100,c=u+d;switch(c>1&&(u/=c,d/=c),e=Math.floor(6*s),n=1-d,i=6*s-e,0!=(1&e)&&(i=1-i),a=u+i*(n-u),e){default:case 6:case 0:r=n,o=a,l=u;break;case 1:r=a,o=n,l=u;break;case 2:r=u,o=n,l=a;break;case 3:r=u,o=a,l=n;break;case 4:r=a,o=u,l=n;break;case 5:r=n,o=u,l=a}return[255*r,255*o,255*l]},a.cmyk.rgb=function(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100,l=t[3]/100;return e=1-Math.min(1,a*(1-l)+l),n=1-Math.min(1,r*(1-l)+l),i=1-Math.min(1,o*(1-l)+l),[255*e,255*n,255*i]},a.xyz.rgb=function(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100;return e=3.2406*a+-1.5372*r+-.4986*o,n=-.9689*a+1.8758*r+.0415*o,i=.0557*a+-.204*r+1.057*o,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=Math.min(Math.max(0,e),1),n=Math.min(Math.max(0,n),1),i=Math.min(Math.max(0,i),1),[255*e,255*n,255*i]},a.xyz.lab=function(t){var e,n,i,a=t[0],r=t[1],o=t[2];return a/=95.047,r/=100,o/=108.883,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,e=116*r-16,n=500*(a-r),i=200*(r-o),[e,n,i]},a.lab.xyz=function(t){var e,n,i,a=t[0],r=t[1],o=t[2];n=(a+16)/116,e=r/500+n,i=n-o/200;var l=Math.pow(n,3),s=Math.pow(e,3),u=Math.pow(i,3);return n=l>.008856?l:(n-16/116)/7.787,e=s>.008856?s:(e-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},a.lab.lch=function(t){var e,n,i,a=t[0],r=t[1],o=t[2];return e=Math.atan2(o,r),n=360*e/2/Math.PI,n<0&&(n+=360),i=Math.sqrt(r*r+o*o),[a,i,n]},a.lch.lab=function(t){var e,n,i,a=t[0],r=t[1],o=t[2];return i=o/360*2*Math.PI,e=r*Math.cos(i),n=r*Math.sin(i),[a,e,n]},a.rgb.ansi16=function(t){var e=t[0],n=t[1],i=t[2],r=1 in arguments?arguments[1]:a.rgb.hsv(t)[2];if(r=Math.round(r/50),0===r)return 30;var o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===r&&(o+=60),o},a.hsv.ansi16=function(t){return a.rgb.ansi16(a.hsv.rgb(t),t[2])},a.rgb.ansi256=function(t){var e=t[0],n=t[1],i=t[2];if(e===n&&n===i)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var a=16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5);return a},a.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var n=.5*(1+~~(t>50)),i=(1&e)*n*255,a=(e>>1&1)*n*255,r=(e>>2&1)*n*255;return[i,a,r]},a.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;t-=16;var i=Math.floor(t/36)/5*255,a=Math.floor((n=t%36)/6)/5*255,r=n%6/5*255;return[i,a,r]},a.rgb.hex=function(t){var e=((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2])),n=e.toString(16).toUpperCase();return"000000".substring(n.length)+n},a.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map(function(t){return t+t}).join(""));var i=parseInt(n,16),a=i>>16&255,r=i>>8&255,o=255&i;return[a,r,o]},a.rgb.hcg=function(t){var e,n,i=t[0]/255,a=t[1]/255,r=t[2]/255,o=Math.max(Math.max(i,a),r),l=Math.min(Math.min(i,a),r),s=o-l;return e=s<1?l/(1-s):0,n=s<=0?0:o===i?(a-r)/s%6:o===a?2+(r-i)/s:4+(i-a)/s+4,n/=6,n%=1,[360*n,100*s,100*e]},a.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=1,a=0;return i=n<.5?2*e*n:2*e*(1-n),i<1&&(a=(n-.5*i)/(1-i)),[t[0],100*i,100*a]},a.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=e*n,a=0;return i<1&&(a=(n-i)/(1-i)),[t[0],100*i,100*a]},a.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];var a=[0,0,0],r=e%1*6,o=r%1,l=1-o,s=0;switch(Math.floor(r)){case 0:a[0]=1,a[1]=o,a[2]=0;break;case 1:a[0]=l,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=o;break;case 3:a[0]=0,a[1]=l,a[2]=1;break;case 4:a[0]=o,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=l}return s=(1-n)*i,[255*(n*a[0]+s),255*(n*a[1]+s),255*(n*a[2]+s)]},a.hcg.hsv=function(t){var e=t[1]/100,n=t[2]/100,i=e+n*(1-e),a=0;return i>0&&(a=e/i),[t[0],100*a,100*i]},a.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100,i=n*(1-e)+.5*e,a=0;return i>0&&i<.5?a=e/(2*i):i>=.5&&i<1&&(a=e/(2*(1-i))),[t[0],100*a,100*i]},a.hcg.hwb=function(t){var e=t[1]/100,n=t[2]/100,i=e+n*(1-e);return[t[0],100*(i-e),100*(1-i)]},a.hwb.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=1-n,a=i-e,r=0;return a<1&&(r=(i-a)/(1-a)),[t[0],100*a,100*r]},a.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},a.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},a.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},a.gray.hsl=a.gray.hsv=function(t){return[0,0,t[0]]},a.gray.hwb=function(t){return[0,100,t[0]]},a.gray.cmyk=function(t){return[0,0,0,t[0]]},a.gray.lab=function(t){return[t[0],0,0]},a.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=(e<<16)+(e<<8)+e,i=n.toString(16).toUpperCase();return"000000".substring(i.length)+i},a.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]}}),Ke=(Xe.rgb,Xe.hsl,Xe.hsv,Xe.hwb,Xe.cmyk,Xe.xyz,Xe.lab,Xe.lch,Xe.hex,Xe.keyword,Xe.ansi16,Xe.ansi256,Xe.hcg,Xe.apple,Xe.gray,function(t){for(var e=a(t),n={},i=Object.keys(e),r=i.length,l=0;ln?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,i=t,a=void 0===e?.5:e,r=2*a-1,o=n.alpha()-i.alpha(),l=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,s=1-l;return this.rgb(l*n.red()+s*i.red(),l*n.green()+s*i.green(),l*n.blue()+s*i.blue()).alpha(n.alpha()*a+i.alpha()*(1-a))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new an,i=this.values,a=n.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],e={}.toString.call(t),"[object Array]"===e?a[r]=t.slice(0):"[object Number]"===e?a[r]=t:console.error("unexpected color value:",t));return n}},an.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},an.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},an.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i=0;a--)e.call(n,t[a],a);else for(a=0;a=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-un.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*un.easeInBounce(2*t):.5*un.easeOutBounce(2*t-1)+.5}},dn={effects:un};sn.easingEffects=un;var cn=Math.PI,hn=cn/180,fn=2*cn,gn=cn/2,pn=cn/4,mn=2*cn/3,vn={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,i,a,r){if(r){var o=Math.min(r,a/2,i/2),l=e+o,s=n+o,u=e+i-o,d=n+a-o;t.moveTo(e,s),le.left-n&&t.xe.top-n&&t.y0&&t.requestAnimationFrame()},advance:function(){for(var t,e,n,i,a=this.animations,r=0;r=n?(In.callback(t.onAnimationComplete,[t],e),e.animating=!1,a.splice(r,1)):++r}},Hn=In.options.resolve,jn=["push","pop","shift","splice","unshift"],qn=function(t,e){this.initialize(t,e)};In.extend(qn.prototype,{datasetElementType:null,dataElementType:null,_datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],_dataElementOptions:["backgroundColor","borderColor","borderWidth","pointStyle"],initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements(),n._type=n.getMeta().type},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.chart,i=n.scales,a=t.getDataset(),r=n.options.scales;null!==e.xAxisID&&e.xAxisID in i&&!a.xAxisID||(e.xAxisID=a.xAxisID||r.xAxes[0].id),null!==e.yAxisID&&e.yAxisID in i&&!a.yAxisID||(e.yAxisID=a.yAxisID||r.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this._update(!0)},destroy:function(){this._data&&D(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,i=n.getMeta(),a=n.getDataset().data||[],r=i.data;for(t=0,e=a.length;ti&&t.insertElements(i,a-i)},insertElements:function(t,e){for(var n=0;nl;)a-=Yn;for(;a=o&&a<=l,u=r>=n.innerRadius&&r<=n.outerRadius;return s&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t,e=this._chart.ctx,n=this._view,i="inner"===n.borderAlign?.33:0,a={x:n.x,y:n.y,innerRadius:n.innerRadius,outerRadius:Math.max(n.outerRadius-i,0),pixelMargin:i,startAngle:n.startAngle,endAngle:n.endAngle,fullCircles:Math.floor(n.circumference/Yn)};if(e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,a.fullCircles){for(a.endAngle=a.startAngle+Yn,e.beginPath(),e.arc(a.x,a.y,a.outerRadius,a.startAngle,a.endAngle),e.arc(a.x,a.y,a.innerRadius,a.endAngle,a.startAngle,!0),e.closePath(),t=0;t=0&&m.min>=0?m.min:m.max,_=void 0===m.start?m.end:m.max>=0&&m.min>=0?m.max-m.min:m.min-m.max,k=p.length;if(b||void 0===b&&void 0!==x)for(i=0;i=0&&u.max>=0?u.max:u.min,(m.min<0&&r<0||m.max>=0&&r>0)&&(y+=r));return o=h.getPixelForValue(y),l=h.getPixelForValue(y+_),s=l-o,void 0!==v&&Math.abs(s)=0&&!f||_<0&&f?o-v:o+v),{size:s,base:o,head:l,center:l+s/2}},calculateBarIndexPixels:function(t,e,n,i){var a=this,r="flex"===i.barThickness?q(e,n,i):j(e,n,i),o=a.getStackIndex(t,a.getMeta().stack),l=r.start+r.chunk*o+r.chunk/2,s=Math.min(si(i.maxBarThickness,1/0),r.chunk*r.ratio);return{base:l-s/2,head:l+s/2,center:l,size:s}},draw:function(){var t=this,e=t.chart,n=t._getValueScale(),i=t.getMeta().data,a=t.getDataset(),r=i.length,o=0;for(In.canvas.clipArea(e.ctx,e.chartArea);o=gi?-pi:b<-gi?pi:0;var x=b+m,y=Math.cos(b),_=Math.sin(b),k=Math.cos(x),w=Math.sin(x),M=b<=0&&x>=0||x>=pi,S=b<=mi&&x>=mi||x>=pi+mi,C=b===-gi||x>=gi,P=b<=-mi&&x>=-mi||x>=gi+mi,A=C?-1:Math.min(y,y*p,k,k*p),D=P?-1:Math.min(_,_*p,w,w*p),T=M?1:Math.max(y,y*p,k,k*p),I=S?1:Math.max(_,_*p,w,w*p);u=(T-A)/2,d=(I-D)/2,c=-(T+A)/2,h=-(I+D)/2}for(i=0,a=g.length;i0&&!isNaN(t)?pi*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,n,i,a,r,o,l,s,u=this,d=0,c=u.chart;if(!t)for(e=0,n=c.data.datasets.length;ed?l:d,d=s>d?s:d);return d},setHoverStyle:function(t){var e=t._model,n=t._options,i=In.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=fi(n.hoverBackgroundColor,i(n.backgroundColor)),e.borderColor=fi(n.hoverBorderColor,i(n.borderColor)),e.borderWidth=fi(n.hoverBorderWidth,n.borderWidth)},_getRingWeightOffset:function(t){for(var e=0,n=0;n0&&_i(d[e-1]._model,u)&&(i.controlPointPreviousX=t(i.controlPointPreviousX,u.left,u.right),i.controlPointPreviousY=t(i.controlPointPreviousY,u.top,u.bottom)),e0&&(r=t.getDatasetMeta(r[0]._datasetIndex).data),r},"x-axis":function(t,e){return Q(t,e,{intersect:!1})},point:function(t,e){var n=X(e,t);return Z(t,n)},nearest:function(t,e,n){var i=X(e,t);n.axis=n.axis||"xy";var a=J(n.axis);return $(t,i,n.intersect,a)},x:function(t,e,n){var i=X(e,t),a=[],r=!1;return K(t,function(t){t.inXRange(i.x)&&a.push(t),t.inRange(i.x,i.y)&&(r=!0)}),n.intersect&&!r&&(a=[]),a},y:function(t,e,n){var i=X(e,t),a=[],r=!1;return K(t,function(t){t.inYRange(i.y)&&a.push(t),t.inRange(i.x,i.y)&&(r=!0)}),n.intersect&&!r&&(a=[]),a}}},Ii=In.extend;yn._set("global",{layout:{padding:{top:0,right:0,bottom:0,left:0}}});var Fi={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),e.fullWidth=e.fullWidth||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw:function(){e.draw.apply(e,arguments)}}]},t.boxes.push(e)},removeBox:function(t,e){var n=t.boxes?t.boxes.indexOf(e):-1;-1!==n&&t.boxes.splice(n,1)},configure:function(t,e,n){for(var i,a=["fullWidth","position","weight"],r=a.length,o=0;o div {\n\tposition: absolute;\n\twidth: 1000000px;\n\theight: 1000000px;\n\tleft: 0;\n\ttop: 0;\n}\n\n.chartjs-size-monitor-shrink > div {\n\tposition: absolute;\n\twidth: 200%;\n\theight: 200%;\n\tleft: 0;\n\ttop: 0;\n}\n",Ri=Object.freeze({__proto__:null,default:Li}),zi=n(Ri),Ni="$chartjs",Bi="chartjs-",Ei=Bi+"size-monitor",Wi=Bi+"render-monitor",Vi=Bi+"render-animation",Hi=["animationstart","webkitAnimationStart"],ji={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qi=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}(),Ui=!!qi&&{passive:!0},Yi={disableCSSInjection:!1,_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,_ensureLoaded:function(t){if(!this.disableCSSInjection){var e=t.getRootNode?t.getRootNode():document,n=e.host?e:document.head;Mt(n,zi)}},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(this._ensureLoaded(t),ht(t,e),n):null},releaseContext:function(t){var e=t.canvas;if(e[Ni]){var n=e[Ni].initial;["height","width"].forEach(function(t){var i=n[t];In.isNullOrUndef(i)?e.removeAttribute(t):e.setAttribute(t,i)}),In.each(n.style||{},function(t,n){e.style[n]=t}),e.width=e.width,delete e[Ni]}},addEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=n[Ni]||(n[Ni]={}),r=a.proxies||(a.proxies={}),o=r[t.id+"_"+e]=function(e){n(mt(e,t))};ft(i,e,o)}else kt(i,n,t)},removeEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=n[Ni]||{},r=a.proxies||{},o=r[t.id+"_"+e];o&>(i,e,o)}else wt(i)}};In.addEvent=ft,In.removeEvent=gt;var Gi=Yi._enabled?Yi:Oi,Xi=In.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},Gi);yn._set("global",{plugins:{}});var Ki={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e,n){var i,a,r,o,l,s=this.descriptors(t),u=s.length;for(i=0;i0){var r=t[0];r.label?n=r.label:r.xLabel?n=r.xLabel:a>0&&r.index0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&r&&(t.save(),t.globalAlpha=a,this.drawBackground(i,e,t,n),i.y+=e.yPadding,In.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),In.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e=this,n=e._options,i=!1;return e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:(e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),n.reverse&&e._active.reverse()),i=!In.arrayEquals(e._active,e._lastActive),i&&(e._lastActive=e._active,(n.enabled||n.custom)&&(e._eventPosition={x:t.x,y:t.y},e.update(!0),e.pivot())),i}}),ea=Qi,na=ta;na.positioners=ea;var ia=In.valueOrDefault;yn._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var aa=function(t,e){return this.construct(t,e),this};In.extend(aa.prototype,{construct:function(t,e){var n=this;e=zt(e);var i=Xi.acquireContext(t,e),a=i&&i.canvas,r=a&&a.height,o=a&&a.width;n.id=In.uid(),n.ctx=i,n.canvas=a,n.config=e,n.width=o,n.height=r,n.aspectRatio=r?o/r:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,aa.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),i&&a?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return Ki.notify(t,"beforeInit"),In.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),Ki.notify(t,"afterInit"),t},clear:function(){return In.canvas.clear(this),this},stop:function(){return Vn.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,a=n.maintainAspectRatio&&e.aspectRatio||null,r=Math.max(0,Math.floor(In.getMaximumWidth(i))),o=Math.max(0,Math.floor(a?r/a:In.getMaximumHeight(i)));if((e.width!==r||e.height!==o)&&(i.width=e.width=r,i.height=e.height=o,i.style.width=r+"px",i.style.height=o+"px",In.retinaScale(e,n.devicePixelRatio),!t)){var l={width:r,height:o};Ki.notify(e,"resize",[l]),n.onResize&&n.onResize(e,l),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;In.each(e.xAxes,function(t,n){t.id||(t.id=Bt(e.xAxes,"x-axis-",n))}),In.each(e.yAxes,function(t,n){t.id||(t.id=Bt(e.yAxes,"y-axis-",n))}),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},i=[],a=Object.keys(n).reduce(function(t,e){return t[e]=!1,t},{});e.scales&&(i=i.concat((e.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category",dposition:"bottom"}}),(e.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear",dposition:"left"}}))),e.scale&&i.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),In.each(i,function(e){var i=e.options,r=i.id,o=ia(i.type,e.dtype);Et(i.position)!==Et(e.dposition)&&(i.position=e.dposition),a[r]=!0;var l=null;if(r in n&&n[r].type===o)l=n[r],l.options=i,l.ctx=t.ctx,l.chart=t;else{var s=Zi.getScaleConstructor(o);if(!s)return;l=new s({id:r,type:o,options:i,ctx:t.ctx,chart:t}),n[l.id]=l}l.mergeTicksOptions(),e.isDefault&&(t.scale=l)}),In.each(a,function(t,e){t||delete n[e]}),t.scales=n,Zi.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,i=[],a=n.data.datasets;for(t=0,e=a.length;t=0;--n)i.drawDataset(e[n],t);Ki.notify(i,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,i={meta:t,index:t.index,easingValue:e};!1!==Ki.notify(n,"beforeDatasetDraw",[i])&&(t.controller.draw(e),Ki.notify(n,"afterDatasetDraw",[i]))},_drawTooltip:function(t){var e=this,n=e.tooltip,i={tooltip:n,easingValue:t};!1!==Ki.notify(e,"beforeTooltipDraw",[i])&&(n.draw(),Ki.notify(e,"afterTooltipDraw",[i]))},getElementAtEvent:function(t){return Ti.modes.single(this,t)},getElementsAtEvent:function(t){return Ti.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return Ti.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var i=Ti.modes[e];return"function"==typeof i?i(this,t,n):[]},getDatasetAtEvent:function(t){return Ti.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var i=n._meta[e.id];return i||(i=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n.order||0,index:t}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e=0;i--){var a=t[i];if(e(a))return a}},In.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},In.almostEquals=function(t,e,n){return Math.abs(t-e)=t},In.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},In.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},In.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},In.toRadians=function(t){return t*(Math.PI/180)},In.toDegrees=function(t){return t*(180/Math.PI)},In._decimalPlaces=function(t){if(In.isFinite(t)){for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}},In.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),r=Math.atan2(i,n);return r<-.5*Math.PI&&(r+=2*Math.PI),{angle:r,distance:a}},In.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},In.aliasPixel=function(t){return t%2==0?0:.5},In._alignPixel=function(t,e,n){var i=t.currentDevicePixelRatio,a=n/2;return Math.round((e-a)*i)/i+a},In.splineCurve=function(t,e,n,i){var a=t.skip?e:t,r=e,o=n.skip?e:n,l=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),s=Math.sqrt(Math.pow(o.x-r.x,2)+Math.pow(o.y-r.y,2)),u=l/(l+s),d=s/(l+s);u=isNaN(u)?0:u,d=isNaN(d)?0:d;var c=i*u,h=i*d;return{previous:{x:r.x-c*(o.x-a.x),y:r.y-c*(o.y-a.y)},next:{x:r.x+h*(o.x-a.x),y:r.y+h*(o.y-a.y)}}},In.EPSILON=Number.EPSILON||1e-14,In.splineCurveMonotone=function(t){var e,n,i,a,r,o,l,s,u,d=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),c=d.length;for(e=0;e0?d[e-1]:null,a=e0?d[e-1]:null,a=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},In.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},In.niceNum=function(t,e){var n,i=Math.floor(In.log10(t)),a=t/Math.pow(10,i);return n=e?a<1.5?1:a<3?2:a<7?5:10:a<=1?1:a<=2?2:a<=5?5:10,n*Math.pow(10,i)},In.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},In.getRelativePosition=function(t,e){var n,i,a=t.originalEvent||t,r=t.target||t.srcElement,o=r.getBoundingClientRect(),l=a.touches;l&&l.length>0?(n=l[0].clientX,i=l[0].clientY):(n=a.clientX,i=a.clientY);var s=parseFloat(In.getStyle(r,"padding-left")),u=parseFloat(In.getStyle(r,"padding-top")),d=parseFloat(In.getStyle(r,"padding-right")),c=parseFloat(In.getStyle(r,"padding-bottom")),h=o.right-o.left-s-d,f=o.bottom-o.top-u-c;return n=Math.round((n-o.left-s)/h*r.width/e.currentDevicePixelRatio),i=Math.round((i-o.top-u)/f*r.height/e.currentDevicePixelRatio),{x:n,y:i}},In.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},In.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},In._calculatePadding=function(t,e,n){return e=In.getStyle(t,e),e.indexOf("%")>-1?n*parseInt(e,10)/100:parseInt(e,10)},In._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},In.getMaximumWidth=function(t){var e=In._getParentNode(t);if(!e)return t.clientWidth;var n=e.clientWidth,i=In._calculatePadding(e,"padding-left",n),a=In._calculatePadding(e,"padding-right",n),r=n-i-a,o=In.getConstraintWidth(t);return isNaN(o)?r:Math.min(r,o)},In.getMaximumHeight=function(t){var e=In._getParentNode(t);if(!e)return t.clientHeight;var n=e.clientHeight,i=In._calculatePadding(e,"padding-top",n),a=In._calculatePadding(e,"padding-bottom",n),r=n-i-a,o=In.getConstraintHeight(t);return isNaN(o)?r:Math.min(r,o)},In.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},In.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==n){var i=t.canvas,a=t.height,r=t.width;i.height=a*n,i.width=r*n,t.ctx.scale(n,n),i.style.height||i.style.width||(i.style.height=a+"px",i.style.width=r+"px")}},In.fontString=function(t,e,n){return e+" "+t+"px "+n},In.longestText=function(t,e,n,i){i=i||{};var a=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(a=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var o,l,s,u,d,c=0,h=n.length;for(o=0;on.length){for(o=0;oi&&(i=r),i},In.numberOfLabelLines=function(t){var e=1;return In.each(t,function(t){In.isArray(t)&&t.length>e&&(e=t.length)}),e},In.color=on?function(t){return t instanceof CanvasGradient&&(t=yn.global.defaultColor),on(t)}:function(t){return console.error("Color.js not found!"),t},In.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:In.color(t).saturate(.5).darken(.1).rgbString()}};In.extend(Ht.prototype,{formats:Vt,parse:Vt,format:Vt,add:Vt,diff:Vt,startOf:Vt,endOf:Vt,_create:function(t){return t}}),Ht.override=function(t){In.extend(Ht.prototype,t)};var la=Ht,sa={_date:la},ua={formatters:{values:function(t){return In.isArray(t)?t:""+t},linear:function(t,e,n){var i=n.length>3?n[2]-n[1]:n[1]-n[0];Math.abs(i)>1&&t!==Math.floor(t)&&(i=t-Math.floor(t));var a=In.log10(Math.abs(i)),r="";if(0!==t){var o=Math.max(Math.abs(n[0]),Math.abs(n[n.length-1]));if(o<1e-4){var l=In.log10(Math.abs(t)),s=Math.floor(l)-Math.floor(a);s=Math.max(Math.min(s,20),0),r=t.toExponential(s)}else{var u=-1*Math.floor(a);u=Math.max(Math.min(u,20),0),r=t.toFixed(u)}}else r="0";return r},logarithmic:function(t,e,n){var i=t/Math.pow(10,Math.floor(In.log10(t)));return 0===t?"0":1===i||2===i||5===i||0===e||e===n.length-1?t.toExponential():""}}},da=In.isArray,ca=In.isNullOrUndef,ha=In.valueOrDefault,fa=In.valueAtIndexOrDefault;yn._set("scale",{display:!0,position:"left",offset:!1,gridLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",zeroLineBorderDash:[],zeroLineBorderDashOffset:0,offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{display:!1,labelString:"",padding:{top:4,bottom:4}},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:ua.formatters.values,minor:{},major:{}}});var ga=Bn.extend({zeroLineIndex:0,getPadding:function(){var t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}},getTicks:function(){return this._ticks},_getLabels:function(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]},mergeTicksOptions:function(){},beforeUpdate:function(){In.callback(this.options.beforeUpdate,[this])},update:function(t,e,n){var i,a,r,o,l,s=this,u=s.options.ticks,d=u.sampleSize;if(s.beforeUpdate(),s.maxWidth=t,s.maxHeight=e,s.margins=In.extend({left:0,right:0,top:0,bottom:0},n),s._ticks=null,s.ticks=null,s._labelSizes=null,s._maxLabelLines=0,s.longestLabelWidth=0,s.longestTextCache=s.longestTextCache||{},s._gridLineItems=null,s._labelItems=null,s.beforeSetDimensions(),s.setDimensions(),s.afterSetDimensions(),s.beforeDataLimits(),s.determineDataLimits(),s.afterDataLimits(),s.beforeBuildTicks(),o=s.buildTicks()||[],o=s.afterBuildTicks(o)||o,(!o||!o.length)&&s.ticks)for(o=[],i=0,a=s.ticks.length;i=h||d<=1||!l.isHorizontal()?l.labelRotation=c:(t=l._getLabelSizes(),e=t.widest.width,n=t.highest.height-t.highest.offset,i=Math.min(l.maxWidth,l.chart.width-e),a=s.offset?l.maxWidth/d:i/(d-1),e+6>a&&(a=i/(d-(s.offset?.5:1)),r=l.maxHeight-Gt(s.gridLines)-u.padding-Xt(s.scaleLabel),o=Math.sqrt(e*e+n*n),f=In.toDegrees(Math.min(Math.asin(Math.min((t.highest.height+6)/a,1)),Math.asin(Math.min(r/o,1))-Math.asin(n/o))),f=Math.max(c,Math.min(h,f))),l.labelRotation=f)},afterCalculateTickRotation:function(){In.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){In.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},n=t.chart,i=t.options,a=i.ticks,r=i.scaleLabel,o=i.gridLines,l=t._isVisible(),s="bottom"===i.position,u=t.isHorizontal();if(u?e.width=t.maxWidth:l&&(e.width=Gt(o)+Xt(r)),u?l&&(e.height=Gt(o)+Xt(r)):e.height=t.maxHeight,a.display&&l){var d=Zt(a),c=t._getLabelSizes(),h=c.first,f=c.last,g=c.widest,p=c.highest,m=.4*d.minor.lineHeight,v=a.padding;if(u){var b=0!==t.labelRotation,x=In.toRadians(t.labelRotation),y=Math.cos(x),_=Math.sin(x),k=_*g.width+y*(p.height-(b?p.offset:0))+(b?0:m);e.height=Math.min(t.maxHeight,e.height+k+v);var w,M,S=t.getPixelForTick(0)-t.left,C=t.right-t.getPixelForTick(t.getTicks().length-1);b?(w=s?y*h.width+_*h.offset:_*(h.height-h.offset),M=s?_*(f.height-f.offset):y*f.width+_*f.offset):(w=h.width/2,M=f.width/2),t.paddingLeft=Math.max((w-S)*t.width/(t.width-S),0)+3,t.paddingRight=Math.max((M-C)*t.width/(t.width-C),0)+3}else{var P=a.mirror?0:g.width+v+m;e.width=Math.min(t.maxWidth,e.width+P),t.paddingTop=h.height/2,t.paddingBottom=f.height/2}}t.handleMargins(),u?(t.width=t._length=n.width-t.margins.left-t.margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t.margins.top-t.margins.bottom)},handleMargins:function(){var t=this;t.margins&&(t.margins.left=Math.max(t.paddingLeft,t.margins.left),t.margins.top=Math.max(t.paddingTop,t.margins.top),t.margins.right=Math.max(t.paddingRight,t.margins.right),t.margins.bottom=Math.max(t.paddingBottom,t.margins.bottom))},afterFit:function(){In.callback(this.options.afterFit,[this])},isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(ca(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},_convertTicksToLabels:function(t){var e,n,i,a=this;for(a.ticks=t.map(function(t){return t.value}),a.beforeTickToLabelConversion(),e=a.convertTicksToLabels(t)||a.ticks,a.afterTickToLabelConversion(),n=0,i=t.length;ni-1?null:e.getPixelForDecimal(t*a+(n?a/2:0))},getPixelForDecimal:function(t){var e=this;return e._reversePixels&&(t=1-t),e._startPixel+t*e._length},getDecimalForPixel:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,i,a,r=this,o=r.options.ticks,l=r._length,s=o.maxTicksLimit||l/r._tickSize()+1,u=o.major.enabled?te(t):[],d=u.length,c=u[0],h=u[d-1];if(d>s)return ee(t,u,d/s),$t(t);if(i=Qt(u,t,l,s),d>0){for(e=0,n=d-1;e1?(h-c)/(d-1):null,ne(t,i,In.isNullOrUndef(a)?0:c-a,c),ne(t,i,h,In.isNullOrUndef(a)?t.length:h+a),$t(t)}return ne(t,i),$t(t)},_tickSize:function(){var t=this,e=t.options.ticks,n=In.toRadians(t.labelRotation),i=Math.abs(Math.cos(n)),a=Math.abs(Math.sin(n)),r=t._getLabelSizes(),o=e.autoSkipPadding||0,l=r?r.widest.width+o:0,s=r?r.highest.height+o:0;return t.isHorizontal()?s*i>l*a?l/i:s/a:s*a=0&&(o=t)),void 0!==r&&(t=n.indexOf(r),t>=0&&(l=t)),e.minIndex=o,e.maxIndex=l,e.min=n[o],e.max=n[l]},buildTicks:function(){var t=this,e=t._getLabels(),n=t.minIndex,i=t.maxIndex;t.ticks=0===n&&i===e.length-1?e:e.slice(n,i+1)},getLabelForIndex:function(t,e){var n=this,i=n.chart;return i.getDatasetMeta(e).controller._getValueScaleId()===n.id?n.getRightValue(i.data.datasets[e].data[t]):n._getLabels()[t]},_configure:function(){var t=this,e=t.options.offset,n=t.ticks;pa.prototype._configure.call(t),t.isHorizontal()||(t._reversePixels=!t._reversePixels),n&&(t._startValue=t.minIndex-(e?.5:0),t._valueRange=Math.max(n.length-(e?0:1),1))},getPixelForValue:function(t,e,n){var i,a,r,o=this;return ma(e)||ma(n)||(t=o.chart.data.datasets[n].data[e]),ma(t)||(i=o.isHorizontal()?t.x:t.y),(void 0!==i||void 0!==t&&isNaN(e))&&(a=o._getLabels(),t=In.valueOrDefault(i,t),r=a.indexOf(t),e=-1!==r?r:e,isNaN(e)&&(e=t)),o.getPixelForDecimal((e-o._startValue)/o._valueRange)},getPixelForTick:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t],t+this.minIndex)},getValueForPixel:function(t){var e=this,n=Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange);return Math.min(Math.max(n,0),e.ticks.length-1)},getBasePixel:function(){return this.bottom}}),xa=va;ba._defaults=xa;var ya=In.noop,_a=In.isNullOrUndef,ka=pa.extend({getRightValue:function(t){return"string"==typeof t?+t:pa.prototype.getRightValue.call(this,t)},handleTickRangeOptions:function(){var t=this,e=t.options,n=e.ticks;if(n.beginAtZero){var i=In.sign(t.min),a=In.sign(t.max);i<0&&a<0?t.max=0:i>0&&a>0&&(t.min=0)}var r=void 0!==n.min||void 0!==n.suggestedMin,o=void 0!==n.max||void 0!==n.suggestedMax;void 0!==n.min?t.min=n.min:void 0!==n.suggestedMin&&(null===t.min?t.min=n.suggestedMin:t.min=Math.min(t.min,n.suggestedMin)),void 0!==n.max?t.max=n.max:void 0!==n.suggestedMax&&(null===t.max?t.max=n.suggestedMax:t.max=Math.max(t.max,n.suggestedMax)),r!==o&&t.min>=t.max&&(r?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,n.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this,n=e.options.ticks,i=n.stepSize,a=n.maxTicksLimit;return i?t=Math.ceil(e.max/i)-Math.floor(e.min/i)+1:(t=e._computeTickLimit(),a=a||11),a&&(t=Math.min(a,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:ya,buildTicks:function(){var t=this,e=t.options,n=e.ticks,i=t.getTickLimit();i=Math.max(2,i);var a={maxTicks:i,min:n.min,max:n.max,precision:n.precision,stepSize:In.valueOrDefault(n.fixedStepSize,n.stepSize)},r=t.ticks=ie(a,t);t.handleDirectionalChanges(),t.max=In.max(r),t.min=In.min(r),n.reverse?(r.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var t=this;t.ticksAsNumbers=t.ticks.slice(),t.zeroLineIndex=t.ticks.indexOf(0),pa.prototype.convertTicksToLabels.call(t)},_configure:function(){var t,e=this,n=e.getTicks(),i=e.min,a=e.max;pa.prototype._configure.call(e),e.options.offset&&n.length&&(t=(a-i)/Math.max(n.length-1,1)/2,i-=t,a+=t),e._startValue=i,e._endValue=a,e._valueRange=a-i}}),wa={position:"left",ticks:{callback:ua.formatters.linear}},Ma=0,Sa=1,Ca=ka.extend({determineDataLimits:function(){var t,e,n,i,a=this,r=a.options,o=a.chart,l=o.data.datasets,s=a._getMatchingVisibleMetas(),u=r.stacked,d={},c=s.length;if(a.min=Number.POSITIVE_INFINITY,a.max=Number.NEGATIVE_INFINITY,void 0===u)for(t=0;!u&&te.length-1?null:this.getPixelForValue(e[t])}}),Pa=wa;Ca._defaults=Pa;var Aa=In.valueOrDefault,Da=In.math.log10,Ta={position:"left",ticks:{callback:ua.formatters.logarithmic}},Ia=pa.extend({determineDataLimits:function(){function t(t){return c?t.xAxisID===l.id:t.yAxisID===l.id}var e,n,i,a,r,o,l=this,s=l.options,u=l.chart,d=u.data.datasets,c=l.isHorizontal();l.min=Number.POSITIVE_INFINITY,l.max=Number.NEGATIVE_INFINITY,l.minNotZero=Number.POSITIVE_INFINITY;var h=s.stacked;if(void 0===h)for(e=0;e0){var e=In.min(t),n=In.max(t);l.min=Math.min(l.min,e),l.max=Math.max(l.max,n)}})}else for(e=0;e0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(Da(t.max))):t.minNotZero=n)},buildTicks:function(){var t=this,e=t.options.ticks,n=!t.isHorizontal(),i={min:se(e.min),max:se(e.max)},a=t.ticks=le(i,t);t.max=In.max(a),t.min=In.min(a),e.reverse?(n=!n,t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),n&&a.reverse()},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),pa.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return this._getScaleLabel(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){var e=this.tickValues;return t<0||t>e.length-1?null:this.getPixelForValue(e[t])},_getFirstTickValue:function(t){var e=Math.floor(Da(t)),n=Math.floor(t/Math.pow(10,e));return n*Math.pow(10,e)},_configure:function(){var t=this,e=t.min,n=0;pa.prototype._configure.call(t),0===e&&(e=t._getFirstTickValue(t.minNotZero),n=Aa(t.options.ticks.fontSize,yn.global.defaultFontSize)/t._length),t._startValue=Da(e),t._valueOffset=n,t._valueRange=(Da(t.max)-Da(e))/(1-n)},getPixelForValue:function(t){var e=this,n=0;return t=+e.getRightValue(t),t>e.min&&t>0&&(n=(Da(t)-e._startValue)/e._valueRange+e._valueOffset),e.getPixelForDecimal(n)},getValueForPixel:function(t){var e=this,n=e.getDecimalForPixel(t);return 0===n&&0===e.min?0:Math.pow(10,e._startValue+(n-e._valueOffset)*e._valueRange)}}),Fa=Ta;Ia._defaults=Fa;var Oa=In.valueOrDefault,La=In.valueAtIndexOrDefault,Ra=In.options.resolve,za={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:ua.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}},Na=ka.extend({setDimensions:function(){var t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=ue(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2},determineDataLimits:function(){var t=this,e=t.chart,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;In.each(e.data.datasets,function(a,r){if(e.isDatasetVisible(r)){var o=e.getDatasetMeta(r);In.each(a.data,function(e,a){var r=+t.getRightValue(e);isNaN(r)||o.data[a].hidden||(n=Math.min(r,n),i=Math.max(r,i))})}}),t.min=n===Number.POSITIVE_INFINITY?0:n,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},_computeTickLimit:function(){return Math.ceil(this.drawingArea/ue(this.options))},convertTicksToLabels:function(){var t=this;ka.prototype.convertTicksToLabels.call(t),t.pointLabels=t.chart.data.labels.map(function(){var e=In.callback(t.options.pointLabels.callback,arguments,t);return e||0===e?e:""})},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){var t=this,e=t.options;e.display&&e.pointLabels.display?he(t):t.setCenterPoint(0,0,0,0)},setReductions:function(t,e,n){var i=this,a=e.l/Math.sin(n.l),r=Math.max(e.r-i.width,0)/Math.sin(n.r),o=-e.t/Math.cos(n.t),l=-Math.max(e.b-(i.height-i.paddingTop),0)/Math.cos(n.b);a=be(a),r=be(r),o=be(o),l=be(l),i.drawingArea=Math.min(Math.floor(t-(a+r)/2),Math.floor(t-(o+l)/2)),i.setCenterPoint(a,r,o,l)},setCenterPoint:function(t,e,n,i){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,l=n+a.drawingArea,s=a.height-a.paddingTop-i-a.drawingArea;a.xCenter=Math.floor((o+r)/2+a.left),a.yCenter=Math.floor((l+s)/2+a.top+a.paddingTop)},getIndexAngle:function(t){var e=this.chart,n=360/e.data.labels.length,i=e.options||{},a=i.startAngle||0,r=(t*n+a)%360;return(r<0?r+360:r)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(In.isNullOrUndef(t))return NaN;var n=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*n:(t-e.min)*n},getPointPosition:function(t,e){var n=this,i=n.getIndexAngle(t)-Math.PI/2;return{x:Math.cos(i)*e+n.xCenter,y:Math.sin(i)*e+n.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(t){var e=this,n=e.min,i=e.max;return e.getPointPositionForValue(t||0,e.beginAtZero?0:n<0&&i<0?i:n>0&&i>0?n:0)},_drawGrid:function(){var t,e,n,i=this,a=i.ctx,r=i.options,o=r.gridLines,l=r.angleLines,s=Oa(l.lineWidth,o.lineWidth),u=Oa(l.color,o.color);if(r.pointLabels.display&&me(i),o.display&&In.each(i.ticks,function(t,n){0!==n&&(e=i.getDistanceFromCenterForValue(i.ticksAsNumbers[n]),ve(i,o,e,n))}),l.display&&s&&u){for(a.save(),a.lineWidth=s,a.strokeStyle=u,a.setLineDash&&(a.setLineDash(Ra([l.borderDash,o.borderDash,[]])),a.lineDashOffset=Ra([l.borderDashOffset,o.borderDashOffset,0])),t=i.chart.data.labels.length-1;t>=0;t--)e=i.getDistanceFromCenterForValue(r.ticks.reverse?i.min:i.max),n=i.getPointPosition(t,e),a.beginPath(),a.moveTo(i.xCenter,i.yCenter),a.lineTo(n.x,n.y),a.stroke();a.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options,i=n.ticks;if(i.display){var a,r,o=t.getIndexAngle(0),l=In.options._parseFont(i),s=Oa(i.fontColor,yn.global.defaultFontColor);e.save(),e.font=l.string,e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",In.each(t.ticks,function(n,o){(0!==o||i.reverse)&&(a=t.getDistanceFromCenterForValue(t.ticksAsNumbers[o]),i.showLabelBackdrop&&(r=e.measureText(n).width,e.fillStyle=i.backdropColor,e.fillRect(-r/2-i.backdropPaddingX,-a-l.size/2-i.backdropPaddingY,r+2*i.backdropPaddingX,l.size+2*i.backdropPaddingY)),e.fillStyle=s,e.fillText(n,0,-a))}),e.restore()}},_drawTitle:In.noop}),Ba=za;Na._defaults=Ba;var Ea=In._deprecated,Wa=In.options.resolve,Va=In.valueOrDefault,Ha=Number.MIN_SAFE_INTEGER||-9007199254740991,ja=Number.MAX_SAFE_INTEGER||9007199254740991,qa={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ua=Object.keys(qa),Ya={position:"bottom",distribution:"linear",bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}},Ga=pa.extend({initialize:function(){this.mergeTicksOptions(),pa.prototype.initialize.call(this)},update:function(){var t=this,e=t.options,n=e.time||(e.time={}),i=t._adapter=new sa._date(e.adapters.date);return Ea("time scale",n.format,"time.format","time.parser"),Ea("time scale",n.min,"time.min","ticks.min"),Ea("time scale",n.max,"time.max","ticks.max"),In.mergeIf(n.displayFormats,i.formats()),pa.prototype.update.apply(t,arguments)},getRightValue:function(t){return t&&void 0!==t.t&&(t=t.t),pa.prototype.getRightValue.call(this,t)},determineDataLimits:function(){var t,e,n,i,a,r,o,l=this,s=l.chart,u=l._adapter,d=l.options,c=d.time.unit||"day",h=ja,f=Ha,g=[],p=[],m=[],v=l._getLabels();for(t=0,n=v.length;t1?ye(g).sort(xe):g.sort(xe),h=Math.min(h,g[0]),f=Math.max(f,g[g.length-1])),h=Pe(l,_e(d))||h,f=Pe(l,ke(d))||f,h=h===ja?+u.startOf(Date.now(),c):h,f=f===Ha?+u.endOf(Date.now(),c)+1:f,l.min=Math.min(h,f),l.max=Math.max(h+1,f),l._table=[],l._timestamps={data:g,datasets:p,labels:m}},buildTicks:function(){var t,e,n,i=this,a=i.min,r=i.max,o=i.options,l=o.ticks,s=o.time,u=i._timestamps,d=[],c=i.getLabelCapacity(a),h=l.source,f=o.distribution;for(u="data"===h||"auto"===h&&"series"===f?u.data:"labels"===h?u.labels:Ie(i,a,r,c),"ticks"===o.bounds&&u.length&&(a=u[0],r=u[u.length-1]),a=Pe(i,_e(o))||a,r=Pe(i,ke(o))||r,t=0,e=u.length;t=a&&n<=r&&d.push(n);return i.min=a,i.max=r,i._unit=s.unit||(l.autoSkip?Ae(s.minUnit,i.min,i.max,c):De(i,d.length,s.minUnit,i.min,i.max)),i._majorUnit=l.major.enabled&&"year"!==i._unit?Te(i._unit):void 0,i._table=we(i._timestamps.data,a,r,f),i._offsets=Fe(i._table,d,a,r,o),l.reverse&&d.reverse(),Le(i,d,i._majorUnit)},getLabelForIndex:function(t,e){var n=this,i=n._adapter,a=n.chart.data,r=n.options.time,o=a.labels&&t=0&&t0?l:1}}),Xa=Ya;Ga._defaults=Xa;var Ka={category:ba,linear:Ca,logarithmic:Ia,radialLinear:Na,time:Ga},Za={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};sa._date.override("function"==typeof t?{_id:"moment",formats:function(){return Za},parse:function(e,n){return"string"==typeof e&&"string"==typeof n?e=t(e,n):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,n){return t(e).format(n)},add:function(e,n,i){return t(e).add(n,i).valueOf()},diff:function(e,n,i){return t(e).diff(t(n),i)},startOf:function(e,n,i){return e=t(e),"isoWeek"===n?e.isoWeekday(i).valueOf():e.startOf(n).valueOf()},endOf:function(e,n){return t(e).endOf(n).valueOf()},_create:function(e){return t(e)}}:{}),yn._set("global",{plugins:{filler:{propagate:!0}}});var $a={dataset:function(t){var e=t.fill,n=t.chart,i=n.getDatasetMeta(e),a=i&&n.isDatasetVisible(e),r=a&&i.dataset._children||[],o=r.length||0;return o?function(t,e){return e=0;--n)e=s[n].$filler,e&&e.visible&&(i=e.el,a=i._view,r=i._children||[],o=e.mapper,l=a.backgroundColor||yn.global.defaultColor,o&&l&&r.length&&(In.canvas.clipArea(u,t.chartArea),je(u,r,o,a,l,i._loop),In.canvas.unclipArea(u)))}},Qa=In.rtl.getRtlAdapter,tr=In.noop,er=In.valueOrDefault;yn._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},i=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map(function(n){var a=n.controller.getStyle(i?0:void 0);return{text:e[n.index].label,fillStyle:a.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,pointStyle:a.pointStyle,rotation:a.rotation,datasetIndex:n.index}},this)}}},legendCallback:function(t){var e,n,i,a,r=document.createElement("ul"),o=t.data.datasets;for(r.setAttribute("class",t.id+"-legend"),e=0,n=o.length;es.width)&&(c+=o+n.padding,d[d.length-(e>0?0:1)]=0),l[e]={left:0,top:0,width:r,height:o},d[d.length-1]+=r+n.padding}),s.height+=c}else{var h=n.padding,f=t.columnWidths=[],g=t.columnHeights=[],p=n.padding,m=0,v=0;In.each(t.legendItems,function(t,e){var i=qe(n,o),r=i+o/2+a.measureText(t.text).width;e>0&&v+o+2*h>s.height&&(p+=m+n.padding,f.push(m),g.push(v),m=0,v=0),m=Math.max(m,r),v+=o+h,l[e]={left:0,top:0,width:r,height:o}}),p+=m,f.push(m),g.push(v),s.width+=p}t.width=s.width,t.height=s.height}else t.width=s.width=t.height=s.height=0},afterFit:tr,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,n=e.labels,i=yn.global,a=i.defaultColor,r=i.elements.line,o=t.height,l=t.columnHeights,s=t.width,u=t.lineWidths;if(e.display){var d,c=Qa(e.rtl,t.left,t.minSize.width),h=t.ctx,f=er(n.fontColor,i.defaultFontColor),g=In.options._parseFont(n),p=g.size;h.textAlign=c.textAlign("left"),h.textBaseline="middle",h.lineWidth=.5,h.strokeStyle=f,h.fillStyle=f,h.font=g.string;var m=qe(n,p),v=t.legendHitBoxes,b=function(t,e,i){if(!(isNaN(m)||m<=0)){h.save();var o=er(i.lineWidth,r.borderWidth);if(h.fillStyle=er(i.fillStyle,a),h.lineCap=er(i.lineCap,r.borderCapStyle),h.lineDashOffset=er(i.lineDashOffset,r.borderDashOffset),h.lineJoin=er(i.lineJoin,r.borderJoinStyle),h.lineWidth=o,h.strokeStyle=er(i.strokeStyle,a),h.setLineDash&&h.setLineDash(er(i.lineDash,r.borderDash)),n&&n.usePointStyle){var l=m*Math.SQRT2/2,s=c.xPlus(t,m/2),u=e+p/2;In.canvas.drawPoint(h,i.pointStyle,l,s,u,i.rotation)}else h.fillRect(c.leftForLtr(t,m),e,m,p),0!==o&&h.strokeRect(c.leftForLtr(t,m),e,m,p);h.restore()}},x=function(t,e,n,i){var a=p/2,r=c.xPlus(t,m+a),o=e+a;h.fillText(n.text,r,o),n.hidden&&(h.beginPath(),h.lineWidth=2,h.moveTo(r,o),h.lineTo(c.xPlus(r,i),o),h.stroke())},y=function(t,i){switch(e.align){case"start":return n.padding;case"end":return t-i;default:return(t-i+n.padding)/2}},_=t.isHorizontal();d=_?{x:t.left+y(s,u[0]),y:t.top+n.padding,line:0}:{x:t.left+n.padding,y:t.top+y(o,l[0]),line:0},In.rtl.overrideTextDirection(t.ctx,e.textDirection);var k=p+n.padding;In.each(t.legendItems,function(e,i){var a=h.measureText(e.text).width,r=m+p/2+a,f=d.x,g=d.y;c.setWidth(t.minSize.width),_?i>0&&f+r+n.padding>t.left+t.minSize.width&&(g=d.y+=k,d.line++,f=d.x=t.left+y(s,u[d.line])):i>0&&g+k>t.top+t.minSize.height&&(f=d.x=f+t.columnWidths[d.line]+n.padding,d.line++,g=d.y=t.top+y(o,l[d.line]));var w=c.x(f);b(w,g,e),v[i].left=c.leftForLtr(w,v[i].width),v[i].top=g,x(w,g,e,a),_?d.x+=r+n.padding:d.y+=k}),In.rtl.restoreTextDirection(t.ctx,e.textDirection)}},_getLegendItemAt:function(t,e){var n,i,a,r=this;if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)for(a=r.legendHitBoxes,n=0;n=i.left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height)return r.legendItems[n];return null},handleEvent:function(t){var e,n=this,i=n.options,a="mouseup"===t.type?"click":t.type;if("mousemove"===a){if(!i.onHover&&!i.onLeave)return}else{if("click"!==a)return;if(!i.onClick)return}e=n._getLegendItemAt(t.x,t.y),"click"===a?e&&i.onClick&&i.onClick.call(n,t.native,e):(i.onLeave&&e!==n._hoveredItem&&(n._hoveredItem&&i.onLeave.call(n,t.native,n._hoveredItem),n._hoveredItem=e),i.onHover&&e&&i.onHover.call(n,t.native,e))}}),ir={id:"legend",_element:nr,beforeInit:function(t){var e=t.options.legend;e&&Ue(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(In.mergeIf(e,yn.global.legend),n?(Fi.configure(t,n,e),n.options=e):Ue(t,e)):n&&(Fi.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}},ar=In.noop;yn._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var rr=Bn.extend({initialize:function(t){var e=this;In.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:ar,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:ar,beforeSetDimensions:ar,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:ar,beforeBuildLabels:ar,buildLabels:ar,afterBuildLabels:ar,beforeFit:ar,fit:function(){var t,e,n=this,i=n.options,a=n.minSize={},r=n.isHorizontal();i.display?(t=In.isArray(i.text)?i.text.length:1,e=t*In.options._parseFont(i).lineHeight+2*i.padding,n.width=a.width=r?n.maxWidth:e,n.height=a.height=r?e:n.maxHeight):n.width=a.width=n.height=a.height=0},afterFit:ar,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=t.options;if(n.display){var i,a,r,o=In.options._parseFont(n),l=o.lineHeight,s=l/2+n.padding,u=0,d=t.top,c=t.left,h=t.bottom,f=t.right;e.fillStyle=In.valueOrDefault(n.fontColor,yn.global.defaultFontColor),e.font=o.string,t.isHorizontal()?(a=c+(f-c)/2,r=d+s,i=f-c):(a="left"===n.position?c+s:f-s,r=d+(h-d)/2,i=h-d,u=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(a,r),e.rotate(u),e.textAlign="center",e.textBaseline="middle";var g=n.text;if(In.isArray(g))for(var p=0,m=0;m