UNPKG

dragon-ui-claude

Version:

🐲 Ultra-fast, cross-platform Claude Code Max usage dashboard with dragon-inspired design, advanced background services, and multi-currency support

27 lines 194 kB
var To=Object.defineProperty;var Ao=(i,t,e)=>t in i?To(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var S=(i,t,e)=>(Ao(i,typeof t!="symbol"?t+"":t,e),e);function Lo(i,t){for(var e=0;e<t.length;e++){const s=t[e];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in i)){const o=Object.getOwnPropertyDescriptor(s,n);o&&Object.defineProperty(i,n,o.get?o:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}function Fo(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Mn={exports:{}},D={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ge=Symbol.for("react.element"),Io=Symbol.for("react.portal"),Ro=Symbol.for("react.fragment"),Eo=Symbol.for("react.strict_mode"),zo=Symbol.for("react.profiler"),Bo=Symbol.for("react.provider"),Ho=Symbol.for("react.context"),Vo=Symbol.for("react.forward_ref"),Wo=Symbol.for("react.suspense"),No=Symbol.for("react.memo"),jo=Symbol.for("react.lazy"),Gi=Symbol.iterator;function $o(i){return i===null||typeof i!="object"?null:(i=Gi&&i[Gi]||i["@@iterator"],typeof i=="function"?i:null)}var Sn={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Pn=Object.assign,Cn={};function Ut(i,t,e){this.props=i,this.context=t,this.refs=Cn,this.updater=e||Sn}Ut.prototype.isReactComponent={};Ut.prototype.setState=function(i,t){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,t,"setState")};Ut.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function Dn(){}Dn.prototype=Ut.prototype;function Oi(i,t,e){this.props=i,this.context=t,this.refs=Cn,this.updater=e||Sn}var Ti=Oi.prototype=new Dn;Ti.constructor=Oi;Pn(Ti,Ut.prototype);Ti.isPureReactComponent=!0;var Zi=Array.isArray,On=Object.prototype.hasOwnProperty,Ai={current:null},Tn={key:!0,ref:!0,__self:!0,__source:!0};function An(i,t,e){var s,n={},o=null,r=null;if(t!=null)for(s in t.ref!==void 0&&(r=t.ref),t.key!==void 0&&(o=""+t.key),t)On.call(t,s)&&!Tn.hasOwnProperty(s)&&(n[s]=t[s]);var a=arguments.length-2;if(a===1)n.children=e;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];n.children=l}if(i&&i.defaultProps)for(s in a=i.defaultProps,a)n[s]===void 0&&(n[s]=a[s]);return{$$typeof:ge,type:i,key:o,ref:r,props:n,_owner:Ai.current}}function Yo(i,t){return{$$typeof:ge,type:i.type,key:t,ref:i.ref,props:i.props,_owner:i._owner}}function Li(i){return typeof i=="object"&&i!==null&&i.$$typeof===ge}function Uo(i){var t={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(e){return t[e]})}var Qi=/\/+/g;function ii(i,t){return typeof i=="object"&&i!==null&&i.key!=null?Uo(""+i.key):t.toString(36)}function Ee(i,t,e,s,n){var o=typeof i;(o==="undefined"||o==="boolean")&&(i=null);var r=!1;if(i===null)r=!0;else switch(o){case"string":case"number":r=!0;break;case"object":switch(i.$$typeof){case ge:case Io:r=!0}}if(r)return r=i,n=n(r),i=s===""?"."+ii(r,0):s,Zi(n)?(e="",i!=null&&(e=i.replace(Qi,"$&/")+"/"),Ee(n,t,e,"",function(c){return c})):n!=null&&(Li(n)&&(n=Yo(n,e+(!n.key||r&&r.key===n.key?"":(""+n.key).replace(Qi,"$&/")+"/")+i)),t.push(n)),1;if(r=0,s=s===""?".":s+":",Zi(i))for(var a=0;a<i.length;a++){o=i[a];var l=s+ii(o,a);r+=Ee(o,t,e,l,n)}else if(l=$o(i),typeof l=="function")for(i=l.call(i),a=0;!(o=i.next()).done;)o=o.value,l=s+ii(o,a++),r+=Ee(o,t,e,l,n);else if(o==="object")throw t=String(i),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return r}function ye(i,t,e){if(i==null)return i;var s=[],n=0;return Ee(i,s,"","",function(o){return t.call(e,o,n++)}),s}function Xo(i){if(i._status===-1){var t=i._result;t=t(),t.then(function(e){(i._status===0||i._status===-1)&&(i._status=1,i._result=e)},function(e){(i._status===0||i._status===-1)&&(i._status=2,i._result=e)}),i._status===-1&&(i._status=0,i._result=t)}if(i._status===1)return i._result.default;throw i._result}var Y={current:null},ze={transition:null},Ko={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:ze,ReactCurrentOwner:Ai};function Ln(){throw Error("act(...) is not supported in production builds of React.")}D.Children={map:ye,forEach:function(i,t,e){ye(i,function(){t.apply(this,arguments)},e)},count:function(i){var t=0;return ye(i,function(){t++}),t},toArray:function(i){return ye(i,function(t){return t})||[]},only:function(i){if(!Li(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};D.Component=Ut;D.Fragment=Ro;D.Profiler=zo;D.PureComponent=Oi;D.StrictMode=Eo;D.Suspense=Wo;D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ko;D.act=Ln;D.cloneElement=function(i,t,e){if(i==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+i+".");var s=Pn({},i.props),n=i.key,o=i.ref,r=i._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,r=Ai.current),t.key!==void 0&&(n=""+t.key),i.type&&i.type.defaultProps)var a=i.type.defaultProps;for(l in t)On.call(t,l)&&!Tn.hasOwnProperty(l)&&(s[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)s.children=e;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}return{$$typeof:ge,type:i.type,key:n,ref:o,props:s,_owner:r}};D.createContext=function(i){return i={$$typeof:Ho,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},i.Provider={$$typeof:Bo,_context:i},i.Consumer=i};D.createElement=An;D.createFactory=function(i){var t=An.bind(null,i);return t.type=i,t};D.createRef=function(){return{current:null}};D.forwardRef=function(i){return{$$typeof:Vo,render:i}};D.isValidElement=Li;D.lazy=function(i){return{$$typeof:jo,_payload:{_status:-1,_result:i},_init:Xo}};D.memo=function(i,t){return{$$typeof:No,type:i,compare:t===void 0?null:t}};D.startTransition=function(i){var t=ze.transition;ze.transition={};try{i()}finally{ze.transition=t}};D.unstable_act=Ln;D.useCallback=function(i,t){return Y.current.useCallback(i,t)};D.useContext=function(i){return Y.current.useContext(i)};D.useDebugValue=function(){};D.useDeferredValue=function(i){return Y.current.useDeferredValue(i)};D.useEffect=function(i,t){return Y.current.useEffect(i,t)};D.useId=function(){return Y.current.useId()};D.useImperativeHandle=function(i,t,e){return Y.current.useImperativeHandle(i,t,e)};D.useInsertionEffect=function(i,t){return Y.current.useInsertionEffect(i,t)};D.useLayoutEffect=function(i,t){return Y.current.useLayoutEffect(i,t)};D.useMemo=function(i,t){return Y.current.useMemo(i,t)};D.useReducer=function(i,t,e){return Y.current.useReducer(i,t,e)};D.useRef=function(i){return Y.current.useRef(i)};D.useState=function(i){return Y.current.useState(i)};D.useSyncExternalStore=function(i,t,e){return Y.current.useSyncExternalStore(i,t,e)};D.useTransition=function(){return Y.current.useTransition()};D.version="18.3.1";Mn.exports=D;var it=Mn.exports;const Fi=Fo(it),zh=Lo({__proto__:null,default:Fi},[it]);/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */function pe(i){return i+.5|0}const pt=(i,t,e)=>Math.max(Math.min(i,e),t);function te(i){return pt(pe(i*2.55),0,255)}function yt(i){return pt(pe(i*255),0,255)}function dt(i){return pt(pe(i/2.55)/100,0,1)}function Ji(i){return pt(pe(i*100),0,100)}const et={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},_i=[..."0123456789ABCDEF"],qo=i=>_i[i&15],Go=i=>_i[(i&240)>>4]+_i[i&15],ve=i=>(i&240)>>4===(i&15),Zo=i=>ve(i.r)&&ve(i.g)&&ve(i.b)&&ve(i.a);function Qo(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&et[i[1]]*17,g:255&et[i[2]]*17,b:255&et[i[3]]*17,a:t===5?et[i[4]]*17:255}:(t===7||t===9)&&(e={r:et[i[1]]<<4|et[i[2]],g:et[i[3]]<<4|et[i[4]],b:et[i[5]]<<4|et[i[6]],a:t===9?et[i[7]]<<4|et[i[8]]:255})),e}const Jo=(i,t)=>i<255?t(i):"";function tr(i){var t=Zo(i)?qo:Go;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Jo(i.a,t):void 0}const er=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Fn(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function ir(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function sr(i,t,e){const s=Fn(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function nr(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function Ii(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=nr(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Ri(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(yt)}function Ei(i,t,e){return Ri(Fn,i,t,e)}function or(i,t,e){return Ri(sr,i,t,e)}function rr(i,t,e){return Ri(ir,i,t,e)}function In(i){return(i%360+360)%360}function ar(i){const t=er.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?te(+t[5]):yt(+t[5]));const n=In(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=or(n,o,r):t[1]==="hsv"?s=rr(n,o,r):s=Ei(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function lr(i,t){var e=Ii(i);e[0]=In(e[0]+t),e=Ei(e),i.r=e[0],i.g=e[1],i.b=e[2]}function cr(i){if(!i)return;const t=Ii(i),e=t[0],s=Ji(t[1]),n=Ji(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${dt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const ts={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},es={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function hr(){const i={},t=Object.keys(es),e=Object.keys(ts);let s,n,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],n=0;n<e.length;n++)o=e[n],a=a.replace(o,ts[o]);o=parseInt(es[r],16),i[a]=[o>>16&255,o>>8&255,o&255]}return i}let ke;function fr(i){ke||(ke=hr(),ke.transparent=[0,0,0,0]);const t=ke[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const dr=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function ur(i){const t=dr.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?te(r):pt(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?te(s):pt(s,0,255)),n=255&(t[4]?te(n):pt(n,0,255)),o=255&(t[6]?te(o):pt(o,0,255)),{r:s,g:n,b:o,a:e}}}function gr(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${dt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const si=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Vt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function pr(i,t,e){const s=Vt(dt(i.r)),n=Vt(dt(i.g)),o=Vt(dt(i.b));return{r:yt(si(s+e*(Vt(dt(t.r))-s))),g:yt(si(n+e*(Vt(dt(t.g))-n))),b:yt(si(o+e*(Vt(dt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function we(i,t,e){if(i){let s=Ii(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ei(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function Rn(i,t){return i&&Object.assign(t||{},i)}function is(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=yt(i[3]))):(t=Rn(i,{r:0,g:0,b:0,a:1}),t.a=yt(t.a)),t}function mr(i){return i.charAt(0)==="r"?ur(i):ar(i)}class ae{constructor(t){if(t instanceof ae)return t;const e=typeof t;let s;e==="object"?s=is(t):e==="string"&&(s=Qo(t)||fr(t)||mr(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Rn(this._rgb);return t&&(t.a=dt(t.a)),t}set rgb(t){this._rgb=is(t)}rgbString(){return this._valid?gr(this._rgb):void 0}hexString(){return this._valid?tr(this._rgb):void 0}hslString(){return this._valid?cr(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=pr(this._rgb,t._rgb,e)),this}clone(){return new ae(this.rgb)}alpha(t){return this._rgb.a=yt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=pe(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return we(this._rgb,2,t),this}darken(t){return we(this._rgb,2,-t),this}saturate(t){return we(this._rgb,1,t),this}desaturate(t){return we(this._rgb,1,-t),this}rotate(t){return lr(this._rgb,t),this}}/*!
 * Chart.js v4.5.0
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */function ct(){}const br=(()=>{let i=0;return()=>i++})();function A(i){return i==null}function E(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function T(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function z(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function q(i,t){return z(i)?i:t}function C(i,t){return typeof i>"u"?t:i}const xr=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function R(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function I(i,t,e,s){let n,o,r;if(E(i))if(o=i.length,s)for(n=o-1;n>=0;n--)t.call(e,i[n],n);else for(n=0;n<o;n++)t.call(e,i[n],n);else if(T(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function Ne(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function je(i){if(E(i))return i.map(je);if(T(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=je(i[e[n]]);return t}return i}function En(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function _r(i,t,e,s){if(!En(i))return;const n=t[i],o=e[i];T(n)&&T(o)?le(n,o,s):t[i]=je(o)}function le(i,t,e){const s=E(t)?t:[t],n=s.length;if(!T(i))return i;e=e||{};const o=e.merger||_r;let r;for(let a=0;a<n;++a){if(r=s[a],!T(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],i,r,e)}return i}function se(i,t){return le(i,t,{merger:yr})}function yr(i,t,e){if(!En(i))return;const s=t[i],n=e[i];T(s)&&T(n)?se(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=je(n))}const ss={"":i=>i,x:i=>i.x,y:i=>i.y};function vr(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function kr(i){const t=vr(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function jt(i,t){return(ss[t]||(ss[t]=kr(t)))(i)}function zi(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ce=i=>typeof i<"u",vt=i=>typeof i=="function",ns=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function wr(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const V=Math.PI,J=2*V,Mr=J+V,$e=Number.POSITIVE_INFINITY,Sr=V/180,Z=V/2,St=V/4,os=V*2/3,mt=Math.log10,at=Math.sign;function ne(i,t,e){return Math.abs(i-t)<e}function rs(i){const t=Math.round(i);i=ne(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(mt(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Pr(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s===0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function Cr(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function he(i){return!Cr(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function Dr(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function zn(i,t,e){let s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function bt(i){return i*(V/180)}function Bi(i){return i*(180/V)}function as(i){if(!z(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function Or(i,t){const e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);let o=Math.atan2(s,e);return o<-.5*V&&(o+=J),{angle:o,distance:n}}function yi(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Tr(i,t){return(i-t+Mr)%J-V}function G(i){return(i%J+J)%J}function Bn(i,t,e,s){const n=G(i),o=G(t),r=G(e),a=G(o-n),l=G(r-n),c=G(n-o),h=G(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function Q(i,t,e){return Math.max(t,Math.min(e,i))}function Ar(i){return Q(i,-32768,32767)}function xt(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Hi(i,t,e){e=e||(r=>i[r]<t);let s=i.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const At=(i,t,e,s)=>Hi(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),Lr=(i,t,e)=>Hi(i,e,s=>i[s][t]>=e);function Fr(i,t,e){let s=0,n=i.length;for(;s<n&&i[s]<t;)s++;for(;n>s&&i[n-1]>e;)n--;return s>0||n<i.length?i.slice(s,n):i}const Hn=["push","pop","shift","splice","unshift"];function Ir(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Hn.forEach(e=>{const s="_onData"+zi(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function ls(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(Hn.forEach(o=>{delete i[o]}),delete i._chartjs)}function Vn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Wn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Nn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Wn.call(window,()=>{s=!1,i.apply(t,e)}))}}function Rr(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Vi=i=>i==="start"?"left":i==="end"?"right":"center",j=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Er=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function zr(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,h=r.axis,{min:f,max:d,minDefined:u,maxDefined:g}=r.getUserBounds();if(u){if(n=Math.min(At(l,h,f).lo,e?s:At(t,h,r.getPixelForValue(f)).lo),c){const p=l.slice(0,n+1).reverse().findIndex(m=>!A(m[a.axis]));n-=Math.max(0,p)}n=Q(n,0,s-1)}if(g){let p=Math.max(At(l,r.axis,d,!0).hi+1,e?0:At(t,h,r.getPixelForValue(d),!0).hi+1);if(c){const m=l.slice(p-1).findIndex(b=>!A(b[a.axis]));p+=Math.max(0,m)}o=Q(p,n,s)-n}else o=s-n}return{start:n,count:o}}function Br(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const Me=i=>i===0||i===1,cs=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*J/e)),hs=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*J/e)+1,oe={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*Z)+1,easeOutSine:i=>Math.sin(i*Z),easeInOutSine:i=>-.5*(Math.cos(V*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Me(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Me(i)?i:cs(i,.075,.3),easeOutElastic:i=>Me(i)?i:hs(i,.075,.3),easeInOutElastic(i){return Me(i)?i:i<.5?.5*cs(i*2,.1125,.45):.5+.5*hs(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-oe.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?oe.easeInBounce(i*2)*.5:oe.easeOutBounce(i*2-1)*.5+.5};function Wi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function fs(i){return Wi(i)?i:new ae(i)}function ni(i){return Wi(i)?i:new ae(i).saturate(.5).darken(.1).hexString()}const Hr=["x","y","borderWidth","radius","tension"],Vr=["color","borderColor","backgroundColor"];function Wr(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:Vr},numbers:{type:"number",properties:Hr}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Nr(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ds=new Map;function jr(i,t){t=t||{};const e=i+JSON.stringify(t);let s=ds.get(e);return s||(s=new Intl.NumberFormat(i,t),ds.set(e,s)),s}function Ni(i,t,e){return jr(t,e).format(i)}const jn={values(i){return E(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=$r(i,e)}const r=mt(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ni(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(mt(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?jn.numeric.call(this,i,t,e):""}};function $r(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Ge={formatters:jn};function Yr(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ge.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Rt=Object.create(null),vi=Object.create(null);function re(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;s<n;++s){const o=e[s];i=i[o]||(i[o]=Object.create(null))}return i}function oi(i,t,e){return typeof t=="string"?le(re(i,t),e):le(re(i,""),t)}class Ur{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>ni(n.backgroundColor),this.hoverBorderColor=(s,n)=>ni(n.borderColor),this.hoverColor=(s,n)=>ni(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return oi(this,t,e)}get(t){return re(this,t)}describe(t,e){return oi(vi,t,e)}override(t,e){return oi(Rt,t,e)}route(t,e,s,n){const o=re(this,t),r=re(this,s),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[n];return T(l)?Object.assign({},c,l):C(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var B=new Ur({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Wr,Nr,Yr]);function Xr(i){return!i||A(i.size)||A(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ye(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function Kr(i,t,e,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(n=s.data={},o=s.garbageCollect=[],s.font=t),i.save(),i.font=t;let r=0;const a=e.length;let l,c,h,f,d;for(l=0;l<a;l++)if(f=e[l],f!=null&&!E(f))r=Ye(i,n,o,r,f);else if(E(f))for(c=0,h=f.length;c<h;c++)d=f[c],d!=null&&!E(d)&&(r=Ye(i,n,o,r,d));i.restore();const u=o.length/2;if(u>e.length){for(l=0;l<u;l++)delete n[o[l]];o.splice(0,u)}return r}function Pt(i,t,e){const s=i.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*s)/s+n}function us(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function ki(i,t,e,s){$n(i,t,e,s,null)}function $n(i,t,e,s,n){let o,r,a,l,c,h,f,d;const u=t.pointStyle,g=t.rotation,p=t.radius;let m=(g||0)*Sr;if(u&&typeof u=="object"&&(o=u.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(m),i.drawImage(u,-u.width/2,-u.height/2,u.width,u.height),i.restore();return}if(!(isNaN(p)||p<=0)){switch(i.beginPath(),u){default:n?i.ellipse(e,s,n/2,p,0,0,J):i.arc(e,s,p,0,J),i.closePath();break;case"triangle":h=n?n/2:p,i.moveTo(e+Math.sin(m)*h,s-Math.cos(m)*p),m+=os,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*p),m+=os,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*p),i.closePath();break;case"rectRounded":c=p*.516,l=p-c,r=Math.cos(m+St)*l,f=Math.cos(m+St)*(n?n/2-c:l),a=Math.sin(m+St)*l,d=Math.sin(m+St)*(n?n/2-c:l),i.arc(e-f,s-a,c,m-V,m-Z),i.arc(e+d,s-r,c,m-Z,m),i.arc(e+f,s+a,c,m,m+Z),i.arc(e-d,s+r,c,m+Z,m+V),i.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}m+=St;case"rectRot":f=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(n?n/2:p),i.moveTo(e-f,s-a),i.lineTo(e+d,s-r),i.lineTo(e+f,s+a),i.lineTo(e-d,s+r),i.closePath();break;case"crossRot":m+=St;case"cross":f=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(n?n/2:p),i.moveTo(e-f,s-a),i.lineTo(e+f,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r);break;case"star":f=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(n?n/2:p),i.moveTo(e-f,s-a),i.lineTo(e+f,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r),m+=St,f=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(n?n/2:p),i.moveTo(e-f,s-a),i.lineTo(e+f,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r);break;case"line":r=n?n/2:Math.cos(m)*p,a=Math.sin(m)*p,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function ut(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function Ze(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Qe(i){i.restore()}function qr(i,t,e,s,n){if(!t)return i.lineTo(e.x,e.y);if(n==="middle"){const o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else n==="after"!=!!s?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function Gr(i,t,e,s){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?e.cp2x:e.cp1x,s?e.cp2y:e.cp1y,e.x,e.y)}function Zr(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),A(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function Qr(i,t,e,s,n){if(n.strikethrough||n.underline){const o=i.measureText(s),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=n.decorationWidth||2,i.moveTo(r,h),i.lineTo(a,h),i.stroke()}}function Jr(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Et(i,t,e,s,n,o={}){const r=E(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,Zr(i,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Jr(i,o.backdrop),a&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),A(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,s,o.maxWidth)),i.fillText(c,e,s,o.maxWidth),Qr(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function fe(i,t){const{x:e,y:s,w:n,h:o,radius:r}=t;i.arc(e+r.topLeft,s+r.topLeft,r.topLeft,1.5*V,V,!0),i.lineTo(e,s+o-r.bottomLeft),i.arc(e+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,V,Z,!0),i.lineTo(e+n-r.bottomRight,s+o),i.arc(e+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,Z,0,!0),i.lineTo(e+n,s+r.topRight),i.arc(e+n-r.topRight,s+r.topRight,r.topRight,0,-Z,!0),i.lineTo(e+r.topLeft,s)}const ta=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,ea=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function ia(i,t){const e=(""+i).match(ta);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}const sa=i=>+i||0;function Yn(i,t){const e={},s=T(t),n=s?Object.keys(t):t,o=T(i)?s?r=>C(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=sa(o(r));return e}function Un(i){return Yn(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Ft(i){return Yn(i,["topLeft","topRight","bottomLeft","bottomRight"])}function $(i){const t=Un(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function W(i,t){i=i||{},t=t||B.font;let e=C(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=C(i.style,t.style);s&&!(""+s).match(ea)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:C(i.family,t.family),lineHeight:ia(C(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:C(i.weight,t.weight),string:""};return n.string=Xr(n),n}function Se(i,t,e,s){let n=!0,o,r,a;for(o=0,r=i.length;o<r;++o)if(a=i[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),n=!1),e!==void 0&&E(a)&&(a=a[e%a.length],n=!1),a!==void 0))return s&&!n&&(s.cacheable=!1),a}function na(i,t,e){const{min:s,max:n}=i,o=xr(t,(n-s)/2),r=(a,l)=>e&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function kt(i,t){return Object.assign(Object.create(i),t)}function ji(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=Gn("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>ji([a,...i],t,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Kn(a,l,()=>da(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return ps(a).includes(l)},ownKeys(a){return ps(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function $t(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Xn(i,s),setContext:o=>$t(i,o,e,s),override:o=>$t(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Kn(o,r,()=>ra(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Xn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:vt(e)?e:()=>e,isIndexable:vt(s)?s:()=>s}}const oa=(i,t)=>i?i+zi(t):t,$i=(i,t)=>T(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Kn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function ra(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return vt(a)&&r.isScriptable(t)&&(a=aa(t,a,i,e)),E(a)&&a.length&&(a=la(t,a,i,r.isIndexable)),$i(t,a)&&(a=$t(a,n,o&&o[t],r)),a}function aa(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||s);return a.delete(i),$i(i,l)&&(l=Yi(n._scopes,n,i,l)),l}function la(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(T(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const f=Yi(c,n,i,h);t.push($t(f,o,r&&r[i],a))}}return t}function qn(i,t,e){return vt(i)?i(t,e):i}const ca=(i,t)=>i===!0?t:typeof i=="string"?jt(t,i):void 0;function ha(i,t,e,s,n){for(const o of t){const r=ca(e,o);if(r){i.add(r);const a=qn(r._fallback,e,n);if(typeof a<"u"&&a!==e&&a!==s)return a}else if(r===!1&&typeof s<"u"&&e!==s)return null}return!1}function Yi(i,t,e,s){const n=t._rootScopes,o=qn(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=gs(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=gs(a,r,o,l,s),l===null)?!1:ji(Array.from(a),[""],n,o,()=>fa(t,e,s))}function gs(i,t,e,s,n){for(;e;)e=ha(i,t,e,s,n);return e}function fa(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return E(n)&&T(e)?e:n||{}}function da(i,t,e,s){let n;for(const o of t)if(n=Gn(oa(o,i),e),typeof n<"u")return $i(i,n)?Yi(e,s,i,n):n}function Gn(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function ps(i){let t=i._keys;return t||(t=i._keys=ua(i._scopes)),t}function ua(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const ga=Number.EPSILON||1e-14,Yt=(i,t)=>t<i.length&&!i[t].skip&&i[t],Zn=i=>i==="x"?"y":"x";function pa(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=yi(o,n),l=yi(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const f=s*c,d=s*h;return{previous:{x:o.x-f*(r.x-n.x),y:o.y-f*(r.y-n.y)},next:{x:o.x+d*(r.x-n.x),y:o.y+d*(r.y-n.y)}}}function ma(i,t,e){const s=i.length;let n,o,r,a,l,c=Yt(i,0);for(let h=0;h<s-1;++h)if(l=c,c=Yt(i,h+1),!(!l||!c)){if(ne(t[h],0,ga)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],a=Math.pow(n,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),e[h]=n*r*t[h],e[h+1]=o*r*t[h])}}function ba(i,t,e="x"){const s=Zn(e),n=i.length;let o,r,a,l=Yt(i,0);for(let c=0;c<n;++c){if(r=a,a=l,l=Yt(i,c+1),!a)continue;const h=a[e],f=a[s];r&&(o=(h-r[e])/3,a[`cp1${e}`]=h-o,a[`cp1${s}`]=f-o*t[c]),l&&(o=(l[e]-h)/3,a[`cp2${e}`]=h+o,a[`cp2${s}`]=f+o*t[c])}}function xa(i,t="x"){const e=Zn(t),s=i.length,n=Array(s).fill(0),o=Array(s);let r,a,l,c=Yt(i,0);for(r=0;r<s;++r)if(a=l,l=c,c=Yt(i,r+1),!!l){if(c){const h=c[t]-l[t];n[r]=h!==0?(c[e]-l[e])/h:0}o[r]=a?c?at(n[r-1])!==at(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}ma(i,n,o),ba(i,o,t)}function Pe(i,t,e){return Math.max(Math.min(i,e),t)}function _a(i,t){let e,s,n,o,r,a=ut(i[0],t);for(e=0,s=i.length;e<s;++e)r=o,o=a,a=e<s-1&&ut(i[e+1],t),o&&(n=i[e],r&&(n.cp1x=Pe(n.cp1x,t.left,t.right),n.cp1y=Pe(n.cp1y,t.top,t.bottom)),a&&(n.cp2x=Pe(n.cp2x,t.left,t.right),n.cp2y=Pe(n.cp2y,t.top,t.bottom)))}function ya(i,t,e,s,n){let o,r,a,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")xa(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,r=i.length;o<r;++o)a=i[o],l=pa(c,a,i[Math.min(o+1,r-(s?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&_a(i,e)}function Ui(){return typeof window<"u"&&typeof document<"u"}function Xi(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ue(i,t,e){let s;return typeof i=="string"?(s=parseInt(i,10),i.indexOf("%")!==-1&&(s=s/100*t.parentNode[e])):s=i,s}const Je=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function va(i,t){return Je(i).getPropertyValue(t)}const ka=["top","right","bottom","left"];function It(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=ka[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const wa=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Ma(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(wa(n,o,i.target))a=n,l=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Ot(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=Je(e),o=n.boxSizing==="border-box",r=It(n,"padding"),a=It(n,"border","width"),{x:l,y:c,box:h}=Ma(i,e),f=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:u,height:g}=t;return o&&(u-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-f)/u*e.width/s),y:Math.round((c-d)/g*e.height/s)}}function Sa(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&Xi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=Je(o),l=It(a,"border","width"),c=It(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=Ue(a.maxWidth,o,"clientWidth"),n=Ue(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||$e,maxHeight:n||$e}}const Ce=i=>Math.round(i*10)/10;function Pa(i,t,e,s){const n=Je(i),o=It(n,"margin"),r=Ue(n.maxWidth,i,"clientWidth")||$e,a=Ue(n.maxHeight,i,"clientHeight")||$e,l=Sa(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const d=It(n,"border","width"),u=It(n,"padding");c-=u.width+d.width,h-=u.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Ce(Math.min(c,r,l.maxWidth)),h=Ce(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Ce(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Ce(Math.floor(h*s))),{width:c,height:h}}function ms(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(i.currentDevicePixelRatio=s,r.height=n,r.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const Ca=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};Ui()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function bs(i,t){const e=va(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Tt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Da(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Oa(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Tt(i,n,e),a=Tt(n,o,e),l=Tt(o,t,e),c=Tt(r,a,e),h=Tt(a,l,e);return Tt(c,h,e)}const Ta=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},Aa=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Wt(i,t,e){return i?Ta(t,e):Aa()}function Qn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function Jn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function to(i){return i==="angle"?{between:Bn,compare:Tr,normalize:G}:{between:xt,compare:(t,e)=>t-e,normalize:t=>t}}function xs({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function La(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=to(s),l=t.length;let{start:c,end:h,loop:f}=i,d,u;if(f){for(c+=l,h+=l,d=0,u=l;d<u&&r(a(t[c%l][s]),n,o);++d)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:f,style:i.style}}function eo(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,r=t.length,{compare:a,between:l,normalize:c}=to(s),{start:h,end:f,loop:d,style:u}=La(i,t,e),g=[];let p=!1,m=null,b,x,y;const v=()=>l(n,y,b)&&a(n,y)!==0,_=()=>a(o,b)===0||l(o,y,b),M=()=>p||v(),w=()=>!p||_();for(let k=h,P=h;k<=f;++k)x=t[k%r],!x.skip&&(b=c(x[s]),b!==y&&(p=l(b,n,o),m===null&&M()&&(m=a(b,n)===0?k:P),m!==null&&w()&&(g.push(xs({start:m,end:k,loop:d,count:r,style:u})),m=null),P=k,y=b));return m!==null&&g.push(xs({start:m,end:f,loop:d,count:r,style:u})),g}function io(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=eo(s[n],i.points,t);o.length&&e.push(...o)}return e}function Fa(i,t,e,s){let n=0,o=t-1;if(e&&!s)for(;n<t&&!i[n].skip;)n++;for(;n<t&&i[n].skip;)n++;for(n%=t,e&&(o+=n);o>n&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Ia(i,t,e,s){const n=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%n,end:r%n,loop:s}),o}function Ra(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=Fa(e,n,o,s);if(s===!0)return _s(i,[{start:r,end:a,loop:o}],e,t);const l=a<r?a+n:a,c=!!i._fullLoop&&r===0&&a===n-1;return _s(i,Ia(e,r,l,c),e,t)}function _s(i,t,e,s){return!s||!s.setContext||!e?t:Ea(i,t,e,s)}function Ea(i,t,e,s){const n=i._chart.getContext(),o=ys(i.options),{_datasetIndex:r,options:{spanGaps:a}}=i,l=e.length,c=[];let h=o,f=t[0].start,d=f;function u(g,p,m,b){const x=a?-1:1;if(g!==p){for(g+=l;e[g%l].skip;)g-=x;for(;e[p%l].skip;)p+=x;g%l!==p%l&&(c.push({start:g%l,end:p%l,loop:m,style:b}),h=b,f=p%l)}}for(const g of t){f=a?f:g.start;let p=e[f%l],m;for(d=f+1;d<=g.end;d++){const b=e[d%l];m=ys(s.setContext(kt(n,{type:"segment",p0:p,p1:b,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),za(m,h)&&u(f,d-1,g.loop,h),p=b,h=m}f<d-1&&u(f,d-1,g.loop,h)}return c}function ys(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function za(i,t){if(!t)return!1;const e=[],s=function(n,o){return Wi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,s)!==JSON.stringify(t,s)}function De(i,t,e){return i.options.clip?i[e]:t[e]}function Ba(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:De(e,t,"left"),right:De(e,t,"right"),top:De(s,t,"top"),bottom:De(s,t,"bottom")}:t}function so(i,t){const e=t._clip;if(e.disabled)return!1;const s=Ba(t,i.chartArea);return{left:e.left===!1?0:s.left-(e.left===!0?0:e.left),right:e.right===!1?i.width:s.right+(e.right===!0?0:e.right),top:e.top===!1?0:s.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?i.height:s.bottom+(e.bottom===!0?0:e.bottom)}}/*!
 * Chart.js v4.5.0
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */class Ha{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Wn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var ht=new Ha;const vs="transparent",Va={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=fs(i||vs),n=s.valid&&fs(t||vs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Wa{constructor(t,e,s,n){const o=e[s];n=Se([t.to,n,o,t.from]);const r=Se([t.from,o,n]);this._active=!0,this._fn=t.fn||Va[t.type||typeof r],this._easing=oe[t.easing]||oe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Se([t.to,e,n,t.from]),this._from=Se([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][e]()}}class no{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!T(t))return;const e=Object.keys(B.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!T(o))return;const r={};for(const a of e)r[a]=o[a];(E(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=ja(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Na(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let f=o[c];const d=s.get(c);if(f)if(d&&f.active()){f.update(d,h,a);continue}else f.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=f=new Wa(d,t,c,h),n.push(f)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return ht.add(this._chart,s),!0}}function Na(i,t){const e=[],s=Object.keys(t);for(let n=0;n<s.length;n++){const o=i[s[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function ja(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function ks(i,t){const e=i&&i.options||{},s=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:s?o:n,end:s?n:o}}function $a(i,t,e){if(e===!1)return!1;const s=ks(i,e),n=ks(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function Ya(i){let t,e,s,n;return T(i)?(t=i.top,e=i.right,s=i.bottom,n=i.left):t=e=s=n=i,{top:t,right:e,bottom:s,left:n,disabled:i===!1}}function oo(i,t){const e=[],s=i._getSortedDatasetMetas(t);let n,o;for(n=0,o=s.length;n<o;++n)e.push(s[n].index);return e}function ws(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let r,a,l,c;if(t===null)return;let h=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===e){if(h=!0,s.all)continue;break}c=i.values[l],z(c)&&(o||t===0||at(t)===at(c))&&(t+=c)}return!h&&!s.all?0:t}function Ua(i,t){const{iScale:e,vScale:s}=t,n=e.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(i),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[n]:h,[o]:i[h]};return a}function ri(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function Xa(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Ka(i){const{min:t,max:e,minDefined:s,maxDefined:n}=i.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function qa(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function Ms(i,t,e,s){for(const n of t.getMatchingVisibleMetas(s).reverse()){const o=i[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function Ss(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=Xa(o,r,s),f=t.length;let d;for(let u=0;u<f;++u){const g=t[u],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});d=b[c]=qa(n,h,p),d[a]=m,d._top=Ms(d,r,!0,s.type),d._bottom=Ms(d,r,!1,s.type);const x=d._visualValues||(d._visualValues={});x[a]=m}}function ai(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function Ga(i,t){return kt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Za(i,t,e){return kt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function qt(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const li=i=>i==="reset"||i==="none",Ps=(i,t)=>t?i:Object.assign({},i),Qa=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:oo(e,!0),values:null};class Nt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ri(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&qt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(f,d,u,g)=>f==="x"?d:f==="r"?g:u,o=e.xAxisID=C(s.xAxisID,ai(t,"x")),r=e.yAxisID=C(s.yAxisID,ai(t,"y")),a=e.rAxisID=C(s.rAxisID,ai(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,r,a),h=e.vAxisID=n(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ls(this._data,this),t._stacked&&qt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(T(e)){const n=this._cachedMeta;this._data=Ua(e,n)}else if(s!==e){if(s){ls(s,this);const n=this._cachedMeta;qt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Ir(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=ri(e.vScale,e),e.stack!==s.stack&&(n=!0,qt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ss(this,e._parsed),e._stacked=ri(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,f,d;if(this._parsing===!1)s._parsed=n,s._sorted=!0,d=n;else{E(n[t])?d=this.parseArrayData(s,n,t,e):T(n[t])?d=this.parseObjectData(s,n,t,e):d=this.parsePrimitiveData(s,n,t,e);const u=()=>f[a]===null||c&&f[a]<c[a];for(h=0;h<e;++h)s._parsed[h+t]=f=d[h],l&&(u()&&(l=!1),c=f);s._sorted=l}r&&Ss(this,d)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,f=new Array(n);let d,u,g;for(d=0,u=n;d<u;++d)g=d+s,f[d]={[a]:h||o.parse(c[g],g),[l]:r.parse(e[g],g)};return f}parseArrayData(t,e,s,n){const{xScale:o,yScale:r}=t,a=new Array(n);let l,c,h,f;for(l=0,c=n;l<c;++l)h=l+s,f=e[h],a[l]={x:o.parse(f[0],h),y:r.parse(f[1],h)};return a}parseObjectData(t,e,s,n){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,f,d,u;for(h=0,f=n;h<f;++h)d=h+s,u=e[d],c[h]={x:o.parse(jt(u,a),d),y:r.parse(jt(u,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const n=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:oo(n,!0),values:e._stacks[t.axis]._visualValues};return ws(a,r,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let r=o===null?NaN:o;const a=n&&s._stacks[e.axis];n&&a&&(n.values=a,r=ws(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,r=n.length,a=this._getOtherScale(t),l=Qa(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:f}=Ka(a);let d,u;function g(){u=n[d];const p=u[a.axis];return!z(u[t.axis])||h>p||f<p}for(d=0;d<r&&!(!g()&&(this.updateRangeFromParsed(c,t,u,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(c,t,u,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n][t.axis],z(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,s=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Ya(C(this.options.clip,$a(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,s=this._cachedMeta,n=s.data||[],o=e.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||n.length-a,c=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,a,l),h=a;h<a+l;++h){const f=n[h];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,e){const s=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,e,s){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Za(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Ga(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",s){const n=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],l=this.enableOptionSharing&&ce(s);if(a)return Ps(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),f=n?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),h),u=Object.keys(B.elements[t]),g=()=>this.getContext(s,n,e),p=c.resolveNamedOptions(d,u,g,f);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(Ps(p,l))),p}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,f=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),f);l=h.createResolver(d,this.getContext(t,s,e))}const c=new no(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||li(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){li(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!li(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,s=!0){const n=this._cachedMeta,o=n.data,r=t+e;let a;const l=c=>{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),s&&this.updateElements(o,t,e,"reset")}updateElements(t,e,s,n){}_removeElements(t,e){const s=this._cachedMeta;if(this._parsing){const n=s._parsed.splice(t,e);s._stacked&&qt(s,n)}s.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,s,n]=t;this[e](s,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}S(Nt,"defaults",{}),S(Nt,"datasetElementType",null),S(Nt,"dataElementType",null);function Ja(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let s=[];for(let n=0,o=e.length;n<o;n++)s=s.concat(e[n].controller.getAllParsedValues(i));i._cache.$bar=Vn(s.sort((n,o)=>n-o))}return i._cache.$bar}function tl(i){const t=i.iScale,e=Ja(t,i.type);let s=t._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(ce(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=e.length;n<o;++n)r=t.getPixelForValue(e[n]),l();for(a=void 0,n=0,o=t.ticks.length;n<o;++n)r=t.getPixelForTick(n),l();return s}function el(i,t,e,s){const n=e.barThickness;let o,r;return A(n)?(o=t.min*e.categoryPercentage,r=e.barPercentage):(o=n*s,r=1),{chunk:o/s,ratio:r,start:t.pixels[i]-o/2}}function il(i,t,e,s){const n=t.pixels,o=n[i];let r=i>0?n[i-1]:null,a=i<n.length-1?n[i+1]:null;const l=e.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/s,ratio:e.barPercentage,start:c}}function sl(i,t,e,s){const n=e.parse(i[0],s),o=e.parse(i[1],s),r=Math.min(n,o),a=Math.max(n,o);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function ro(i,t,e,s){return E(i)?sl(i,t,e,s):t[e.axis]=e.parse(i,s),t}function Cs(i,t,e,s){const n=i.iScale,o=i.vScale,r=n.getLabels(),a=n===o,l=[];let c,h,f,d;for(c=e,h=e+s;c<h;++c)d=t[c],f={},f[n.axis]=a||n.parse(r[c],c),l.push(ro(d,f,o,c));return l}function ci(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function nl(i,t,e){return i!==0?at(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function ol(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.base<i.y,e="bottom",s="top"),t?(n="end",o="start"):(n="start",o="end"),{start:e,end:s,reverse:t,top:n,bottom:o}}function rl(i,t,e,s){let n=t.borderSkipped;const o={};if(!n){i.borderSkipped=o;return}if(n===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:l,top:c,bottom:h}=ol(i);n==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=h:(o[Ds(h,r,a,l)]=!0,n=c)),o[Ds(n,r,a,l)]=!0,i.borderSkipped=o}function Ds(i,t,e,s){return s?(i=al(i,t,e),i=Os(i,e,t)):i=Os(i,t,e),i}function al(i,t,e){return i===t?e:i===e?t:i}function Os(i,t,e){return i==="start"?t:i==="end"?e:i}function ll(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class Be extends Nt{parsePrimitiveData(t,e,s,n){return Cs(t,e,s,n)}parseArrayData(t,e,s,n){return Cs(t,e,s,n)}parseObjectData(t,e,s,n){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,h=r.axis==="x"?a:l,f=[];let d,u,g,p;for(d=s,u=s+n;d<u;++d)p=e[d],g={},g[o.axis]=o.parse(jt(p,c),d),f.push(ro(jt(p,h),g,r,d));return f}updateRangeFromParsed(t,e,s,n){super.updateRangeFromParsed(t,e,s,n);const o=s._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:s,vScale:n}=e,o=this.getParsed(t),r=o._custom,a=ci(r)?"["+r.start+", "+r.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,s,n){const o=n==="reset",{index:r,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),h=this._getRuler(),{sharedOptions:f,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+s;u++){const g=this.getParsed(u),p=o||A(g[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(u),m=this._calculateBarIndexPixels(u,h),b=(g._stacks||{})[a.axis],x={horizontal:c,base:p.base,enableBorderRadius:!b||ci(g._custom)||r===b._top||r===b._bottom,x:c?p.head:m.center,y:c?m.center:p.head,height:c?m.size:Math.abs(p.size),width:c?Math.abs(p.size):m.size};d&&(x.options=f||this.resolveDataElementOptions(u,t[u].active?"active":n));const y=x.options||t[u].options;rl(x,y,b,r),ll(x,y,h.ratio),this.updateElement(t[u],u,x,n)}}_getStacks(t,e){const{iScale:s}=this._cachedMeta,n=s.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[s.axis],c=h=>{const f=h._parsed.find(u=>u[s.axis]===l),d=f&&f[h.vScale.axis];if(A(d)||isNaN(d))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)t[C(this.chart.options.indexAxis==="x"?s.xAxisID:s.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,r;for(o=0,r=e.data.length;o<r;++o)n.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const a=t.barThickness;return{min:a||tl(e),pixels:n,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:s,index:n},options:{base:o,minBarLength:r}}=this,a=o||0,l=this.getParsed(t),c=l._custom,h=ci(c);let f=l[e.axis],d=0,u=s?this.applyStack(e,l,s):f,g,p;u!==f&&(d=u-f,u=f),h&&(f=c.barStart,u=c.barEnd-c.barStart,f!==0&&at(f)!==at(c.barEnd)&&(d=0),d+=f);const m=!A(o)&&!h?o:d;let b=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(d+u):g=b,p=g-b,Math.abs(p)<r){p=nl(p,e,a)*r,f===a&&(b-=p/2);const x=e.getPixelForDecimal(0),y=e.getPixelForDecimal(1),v=Math.min(x,y),_=Math.max(x,y);b=Math.max(Math.min(b,_),v),g=b+p,s&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(g)-e.getValueForPixel(b))}if(b===e.getPixelForValue(a)){const x=at(p)*e.getLineWidthForValue(a)/2;b+=x,p-=x}return{size:p,base:b,head:g,center:g+p/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,r=C(n.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(e.grouped){const h=o?this._getStackCount(t):e.stackCount,f=n.barThickness==="flex"?il(t,e,n,h*c):el(t,e,n,h*c),d=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,u=this._getAxis().indexOf(C(d,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+u;a=f.start+f.chunk*g+f.chunk/2,l=Math.min(r,f.chunk*f.ratio)}else a=s.getPixelForValue(this.getParsed(t)[s.axis],t),l=Math.min(r,e.min*e.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,s=t.data,n=s.length;let o=0;for(;o<n;++o)this.getParsed(o)[e.axis]!==null&&!s[o].hidden&&s[o].draw(this._ctx)}}S(Be,"id","bar"),S(Be,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),S(Be,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class He extends Nt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:n=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=zr(e,n,r);this._drawStart=a,this._drawCount=l,Br(e)&&(a=0,l=n.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=n;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:c},t),this.updateElements(n,a,l,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:f}=this._getSharedOptions(e,n),d=r.axis,u=a.axis,{spanGaps:g,segment:p}=this.options,m=he(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",x=e+s,y=t.length;let v=e>0&&this.getParsed(e-1);for(let _=0;_<y;++_){const M=t[_],w=b?M:{};if(_<e||_>=x){w.skip=!0;continue}const k=this.getParsed(_),P=A(k[u]),L=w[d]=r.getPixelForValue(k[d],_),O=w[u]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[u],_);w.skip=isNaN(L)||isNaN(O)||P,w.stop=_>0&&Math.abs(k[d]-v[d])>m,p&&(w.parsed=k,w.raw=c.data[_]),f&&(w.options=h||this.resolveDataElementOptions(_,M.active?"active":n)),b||this.updateElement(M,_,w,n),v=k}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}S(He,"id","line"),S(He,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),S(He,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Ct(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ki{constructor(t){S(this,"options");this.options=t||{}}static override(t){Object.assign(Ki.prototype,t)}init(){}formats(){return Ct()}parse(){return Ct()}format(){return Ct()}add(){return Ct()}diff(){return Ct()}startOf(){return Ct()}endOf(){return Ct()}}var cl={_date:Ki};function hl(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?Lr:At;if(s){if(n._sharedOptions){const h=o[0],f=typeof h.getRange=="function"&&h.getRange(t);if(f){const d=c(o,t,e-f),u=c(o,t,e+f);return{lo:d.lo,hi:u.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:f}=n._cachedMeta,{_parsed:d}=i,u=d.slice(0,h.lo+1).reverse().findIndex(p=>!A(p[f.axis]));h.lo-=Math.max(0,u);const g=d.slice(h.hi).findIndex(p=>!A(p[f.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function me(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:h}=o[a],{lo:f,hi:d}=hl(o[a],t,r,n);for(let u=f;u<=d;++u){const g=h[u];g.skip||s(g,c,u)}}}function fl(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(s,n){const o=t?Math.abs(s.x-n.x):0,r=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function hi(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||me(i,e,t,function(a,l,c){!n&&!ut(a,i.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function dl(i,t,e,s){let n=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:f}=Or(r,{x:t.x,y:t.y});Bn(f,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return me(i,e,t,o),n}function ul(i,t,e,s,n,o){let r=[];const a=fl(e);let l=Number.POSITIVE_INFINITY;function c(h,f,d){const u=h.inRange(t.x,t.y,n);if(s&&!u)return;const g=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(g))&&!u)return;const m=a(t,g);m<l?(r=[{element:h,datasetIndex:f,index:d}],l=m):m===l&&r.push({element:h,datasetIndex:f,index:d})}return me(i,e,t,c),r}function fi(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?dl(i,t,e,n):ul(i,t,e,s,n,o)}function Ts(i,t,e,s,n){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return me(i,e,t,(l,c,h)=>{l[r]&&l[r](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,n))}),s&&!a?[]:o}var gl={evaluateInteractionItems:me,modes:{index(i,t,e,s){const n=Ot(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?hi(i,n,o,s,r):fi(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,f=c.data[h];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Ot(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?hi(i,n,o,s,r):fi(i,n,o,!1,s,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(i,t,e,s){const n=Ot(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return hi(i,n,o,s,r)},nearest(i,t,e,s){const n=Ot(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return fi(i,n,o,e.intersect,s,r)},x(i,t,e,s){const n=Ot(t,i);return Ts(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=Ot(t,i);return Ts(i,n,"y",e.intersect,s)}}};const ao=["left","top","right","bottom"];function Gt(i,t){return i.filter(e=>e.pos===t)}function As(i,t){return i.filter(e=>ao.indexOf(e.pos)===-1&&e.box.axis===t)}function Zt(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function pl(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:r,stackWeight:a=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return t}function ml(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!ao.includes(n))continue;const r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function bl(i,t){const e=ml(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];const{fullSize:l}=a.box,c=e[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*s:l&&t.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:l&&t.availableHeight)}return e}function xl(i){const t=pl(i),e=Zt(t.filter(c=>c.box.fullSize),!0),s=Zt(Gt(t,"left"),!0),n=Zt(Gt(t,"right")),o=Zt(Gt(t,"top"),!0),r=Zt(Gt(t,"bottom")),a=As(t,"x"),l=As(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:Gt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Ls(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function lo(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function _l(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!T(n)){e.size&&(i[n]-=e.size);const f=s[e.stack]||{size:0,count:1};f.size=Math.max(f.size,e.horizontal?o.height:o.width),e.size=f.size/f.count,i[n]+=e.size}o.getPadding&&lo(r,o.getPadding());const a=Math.max(0,t.outerWidth-Ls(r,i,"left","right")),l=Math.max(0,t.outerHeight-Ls(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function yl(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function vl(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function ee(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o<r;++o){a=i[o],l=a.box,l.update(a.width||t.w,a.height||t.h,vl(a.horizontal,t));const{same:f,other:d}=_l(t,e,a,s);c|=f&&n.length,h=h||d,l.fullSize||n.push(a)}return c&&ee(n,t,e,s)||h}function Oe(i,t,e,s,n){i.top=e,i.left=t,i.right=t+s,i.bottom=e+n,i.width=s,i.height=n}function Fs(i,t,e,s){const n=e.padding;let{x:o,y:r}=t;for(const a of i){const l=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*h,d=c.size||l.height;ce(c.start)&&(r=c.start),l.fullSize?Oe(l,n.left,r,e.outerWidth-n.right-n.left,d):Oe(l,t.left+c.placed,r,f,d),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*h,d=c.size||l.width;ce(c.start)&&(o=c.start),l.fullSize?Oe(l,o,n.top,d,e.outerHeight-n.bottom-n.top):Oe(l,o,t.top+c.placed,d,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var st={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,s){if(!i)return;const n=$(i.options.layout.padding),o=Math.max(t-n.width,0),r=Math.max(e-n.height,0),a=xl(i.boxes),l=a.vertical,c=a.horizontal;I(i.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},n);lo(d,$(s));const u=Object.assign({maxPadding:d,w:o,h:r,x:n.left,y:n.top},n),g=bl(l.concat(c),f);ee(a.fullSize,u,f,g),ee(l,u,f,g),ee(c,u,f,g)&&ee(l,u,f,g),yl(u),Fs(a.leftAndTop,u,f,g),u.x+=u.w,u.y+=u.h,Fs(a.rightAndBottom,u,f,g),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},I(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class co{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class kl extends co{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ve="$chartjs",wl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Is=i=>i===null||i==="";function Ml(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Ve]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Is(n)){const o=bs(i,"width");o!==void 0&&(i.width=o)}if(Is(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=bs(i,"height");o!==void 0&&(i.height=o)}return i}const ho=Ca?{passive:!0}:!1;function Sl(i,t,e){i&&i.addEventListener(t,e,ho)}function Pl(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,ho)}function Cl(i,t){const e=wl[i.type]||i.type,{x:s,y:n}=Ot(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Xe(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Dl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Xe(a.addedNodes,s),r=r&&!Xe(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Ol(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Xe(a.removedNodes,s),r=r&&!Xe(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const de=new Map;let Rs=0;function fo(){const i=window.devicePixelRatio;i!==Rs&&(Rs=i,de.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Tl(i,t){de.size||window.addEventListener("resize",fo),de.set(i,t)}function Al(i){de.delete(i),de.size||window.removeEventListener("resize",fo)}function Ll(i,t,e){const s=i.canvas,n=s&&Xi(s);if(!n)return;const o=Nn((a,l)=>{const c=n.clientWidth;e(a,l),c<n.clientWidth&&e()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),Tl(i,o),r}function di(i,t,e){e&&e.disconnect(),t==="resize"&&Al(i)}function Fl(i,t,e){const s=i.canvas,n=Nn(o=>{i.ctx!==null&&e(Cl(o,i))},i);return Sl(s,t,n),n}class Il extends co{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Ml(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Ve])return!1;const s=e[Ve].initial;["height","width"].forEach(o=>{const r=s[o];A(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ve],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Dl,detach:Ol,resize:Ll}[e]||Fl;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:di,detach:di,resize:di}[e]||Pl)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Pa(t,e,s,n)}isAttached(t){const e=t&&Xi(t);return!!(e&&e.isConnected)}}function Rl(i){return!Ui()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?kl:Il}class lt{constructor(){S(this,"x");S(this,"y");S(this,"active",!1);S(this,"options");S(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return he(this.x)&&he(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}S(lt,"defaults",{}),S(lt,"defaultRoutes");function El(i,t){const e=i.options.ticks,s=zl(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Hl(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return Vl(t,c,o,r/n),c;const h=Bl(o,t,n);if(r>0){let f,d;const u=r>1?Math.round((l-a)/(r-1)):null;for(Te(t,c,h,A(u)?0:a-u,a),f=0,d=r-1;f<d;f++)Te(t,c,h,o[f],o[f+1]);return Te(t,c,h,l,A(u)?t.length:l+u),c}return Te(t,c,h),c}function zl(i){const t=i.options.offset,e=i._tickSize(),s=i._length/e+(t?0:1),n=i._maxLength/e;return Math.floor(Math.min(s,n))}function Bl(i,t,e){const s=Wl(i),n=t.length/e;if(!s)return Math.max(n,1);const o=Pr(s);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>n)return l}return Math.max(n,1)}function Hl(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function Vl(i,t,e,s){let n=0,o=e[0],r;for(s=Math.ceil(s),r=0;r<i.length;r++)r===o&&(t.push(i[r]),n++,o=e[n*s])}function Te(i,t,e,s,n){const o=C(s,0),r=Math.min(C(n,i.length),i.length);let a=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-s,e=l/Math.floor(l/e)),h=o;h<0;)a++,h=Math.round(o+a*e);for(c=Math.max(o,0);c<r;c++)c===h&&(t.push(i[c]),a++,h=Math.round(o+a*e))}function Wl(i){const t=i.length;let e,s;if(t<2)return!1;for(s=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==s)return!1;return s}const Nl=i=>i==="left"?"right":i==="right"?"left":i,Es=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,zs=(i,t)=>Math.min(t||i,i);function Bs(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o<n;o+=s)e.push(i[Math.floor(o)]);return e}function jl(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,r=i._endPixel,a=1e-6;let l=i.getPixelForTick(n),c;if(!(e&&(s===1?c=Math.max(l-o,r-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-a||l>r+a)))return l}function $l(i,t){I(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;o<n;++o)delete e.data[s[o]];s.splice(0,n)}})}function Qt(i){return i.drawTicks?i.tickLength:0}function Hs(i,t){if(!i.display)return 0;const e=W(i.font,t),s=$(i.padding);return(E(i.text)?i.text.length:1)*e.lineHeight+s.height}function Yl(i,t){return kt(i,{scale:t,type:"scale"})}function Ul(i,t,e){return kt(i,{tick:e,index:t,type:"tick"})}function Xl(i,t,e){let s=Vi(i);return(e&&t!=="right"||!e&&t==="right")&&(s=Nl(s)),s}function Kl(i,t,e,s){const{top:n,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:h}=l;let f=0,d,u,g;const p=r-n,m=a-o;if(i.isHorizontal()){if(u=j(s,o,a),T(e)){const b=Object.keys(e)[0],x=e[b];g=h[b].getPixelForValue(x)+p-t}else e==="center"?g=(c.bottom+c.top)/2+p-t:g=Es(i,e,t);d=a-o}else{if(T(e)){const b=Object.keys(e)[0],x=e[b];u=h[b].getPixelForValue(x)-m+t}else e==="center"?u=(c.left+c.right)/2-m+t:u=Es(i,e,t);g=j(s,r,n),f=e==="left"?-Z:Z}return{titleX:u,titleY:g,maxWidth:d,rotation:f}}class zt extends lt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:s,_suggestedMax:n}=this;return t=q(t,Number.POSITIVE_INFINITY),e=q(e,Number.NEGATIVE_INFINITY),s=q(s,Number.POSITIVE_INFINITY),n=q(n,Number.NEGATIVE_INFINITY),{min:q(t,s),max:q(e,n),minDefined:z(t),maxDefined:z(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:e,max:s};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),n||(e=Math.min(e,r.min)),o||(s=Math.max(s,r.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:q(e,q(s,e)),max:q(s,q(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){R(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=na(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Bs(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=El(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,s;this.isHorizontal()?(e=this.left,s=this.right):(e=this.top,s=this.bottom,t=!t),this._startPixel=e,this._endPixel=s,this._reversePixels=t,this._length=s-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){R(this.options.afterUpdate,[this])}beforeSetDimensions(){R(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){R(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),R(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){R(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s],o.label=R(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){R(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){R(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=zs(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let r=n,a,l,c;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),f=h.widest.width,d=h.highest.height,u=Q(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/s:u/(s-1),f+6>a&&(a=u/(s-(t.offset?.5:1)),l=this.maxHeight-Qt(t.grid)-e.padding-Hs(t.title,this.chart.options.font),c=Math.sqrt(f*f+d*d),r=Bi(Math.min(Math.asin(Q((h.highest.height+6)/a,-1,1)),Math.asin(Q(l/c,-1,1))-Math.asin(Q(d/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){R(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){R(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Hs(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=Qt(o)+l):(t.height=this.maxHeight,t.width=Qt(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:f,highest:d}=this._getLabelSizes(),u=s.padding*2,g=bt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=s.mirror?0:m*f.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:p*f.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,u=0;l?c?(d=n*t.width,u=s*e.height):(d=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,u=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-f+r)*this.width/(this.width-f),0)}else{let h=e.height/2,f=t.height/2;o==="start"?(h=0,f=t.height):o==="end"&&(h=e.height,f=0),this.paddingTop=h+r,this.paddingBottom=f+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){R(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e<s;e++)A(t[e].label)&&(t.splice(e,1),s--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let s=this.ticks;e<s.length&&(s=Bs(s,e)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,s){const{ctx:n,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(e/zs(e,s));let c=0,h=0,f,d,u,g,p,m,b,x,y,v,_;for(f=0;f<e;f+=l){if(g=t[f].label,p=this._resolveTickFontOptions(f),n.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},x=p.lineHeight,y=v=0,!A(g)&&!E(g))y=Ye(n,b.data,b.gc,y,g),v=x;else if(E(g))for(d=0,u=g.length;d<u;++d)_=g[d],!A(_)&&!E(_)&&(y=Ye(n,b.data,b.gc,y,_),v+=x);r.push(y),a.push(v),c=Math.max(y,c),h=Math.max(v,h)}$l(o,e);const M=r.indexOf(c),w=a.indexOf(h),k=P=>({width:r[P]||0,height:a[P]||0});return{first:k(0),last:k(e-1),widest:k(M),highest:k(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ar(this._alignToPixels?Pt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const s=e[t];return s.$context||(s.$context=Ul(this.getContext(),t,s))}return this.$context||(this.$context=Yl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=bt(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*n?a/s:l/n:l*n<a*s?l/s:a/n}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),d=Qt(o),u=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(N){return Pt(s,N,p)};let x,y,v,_,M,w,k,P,L,O,F,U;if(r==="top")x=b(this.bottom),w=this.bottom-d,P=x-m,O=b(t.top)+m,U=t.bottom;else if(r==="bottom")x=b(this.top),O=t.top,U=b(t.bottom)-m,w=x+m,P=this.top+d;else if(r==="left")x=b(this.right),M=this.right-d,k=x-m,L=b(t.left)+m,F=t.right;else if(r==="right")x=b(this.left),L=t.left,F=b(t.right)-m,M=x+m,k=this.left+d;else if(e==="x"){if(r==="center")x=b((t.top+t.bottom)/2+.5);else if(T(r)){const N=Object.keys(r)[0],tt=r[N];x=b(this.chart.scales[N].getPixelForValue(tt))}O=t.top,U=t.bottom,w=x+m,P=w+d}else if(e==="y"){if(r==="center")x=b((t.left+t.right)/2);else if(T(r)){const N=Object.keys(r)[0],tt=r[N];x=b(this.chart.scales[N].getPixelForValue(tt))}M=x-m,k=M-d,L=t.left,F=t.right}const nt=C(n.ticks.maxTicksLimit,f),H=Math.max(1,Math.ceil(f/nt));for(y=0;y<f;y+=H){const N=this.getContext(y),tt=o.setContext(N),be=a.setContext(N),xe=tt.lineWidth,Bt=tt.color,_e=be.dash||[],Ht=be.dashOffset,Xt=tt.tickWidth,wt=tt.tickColor,Kt=tt.tickBorderDash||[],Mt=tt.tickBorderDashOffset;v=jl(this,y,l),v!==void 0&&(_=Pt(s,v,xe),c?M=k=L=F=_:w=P=O=U=_,u.push({tx1:M,ty1:w,tx2:k,ty2:P,x1:L,y1:O,x2:F,y2:U,width:xe,color:Bt,borderDash:_e,borderDashOffset:Ht,tickWidth:Xt,tickColor:wt,tickBorderDash:Kt,tickBorderDashOffset:Mt}))}return this._ticksLength=f,this._borderValue=x,u}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:f}=o,d=Qt(s.grid),u=d+h,g=f?-h:u,p=-bt(this.labelRotation),m=[];let b,x,y,v,_,M,w,k,P,L,O,F,U="middle";if(n==="top")M=this.bottom-g,w=this._getXAxisLabelAlignment();else if(n==="bottom")M=this.top+g,w=this._getXAxisLabelAlignment();else if(n==="left"){const H=this._getYAxisLabelAlignment(d);w=H.textAlign,_=H.x}else if(n==="right"){const H=this._getYAxisLabelAlignment(d);w=H.textAlign,_=H.x}else if(e==="x"){if(n==="center")M=(t.top+t.bottom)/2+u;else if(T(n)){const H=Object.keys(n)[0],N=n[H];M=this.chart.scales[H].getPixelForValue(N)+u}w=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-u;else if(T(n)){const H=Object.keys(n)[0],N=n[H];_=this.chart.scales[H].getPixelForValue(N)}w=this._getYAxisLabelAlignment(d).textAlign}e==="y"&&(l==="start"?U="top":l==="end"&&(U="bottom"));const nt=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){y=a[b],v=y.label;const H=o.setContext(this.getContext(b));k=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),L=P.lineHeight,O=E(v)?v.length:1;const N=O/2,tt=H.color,be=H.textStrokeColor,xe=H.textStrokeWidth;let Bt=w;r?(_=k,w==="inner"&&(b===x-1?Bt=this.options.reverse?"left":"right":b===0?Bt=this.options.reverse?"right":"left":Bt="center"),n==="top"?c==="near"||p!==0?F=-O*L+L/2:c==="center"?F=-nt.highest.height/2-N*L+L:F=-nt.highest.height+L/2:c==="near"||p!==0?F=L/2:c==="center"?F=nt.highest.height/2-N*L:F=nt.highest.height-O*L,f&&(F*=-1),p!==0&&!H.showLabelBackdrop&&(_+=L/2*Math.sin(p))):(M=k,F=(1-O)*L/2);let _e;if(H.showLabelBackdrop){const Ht=$(H.backdropPadding),Xt=nt.heights[b],wt=nt.widths[b];let Kt=F-Ht.top,Mt=0-Ht.left;switch(U){case"middle":Kt-=Xt/2;break;case"bottom":Kt-=Xt;break}switch(w){case"center":Mt-=wt/2;break;case"right":Mt-=wt;break;case"inner":b===x-1?Mt-=wt:b>0&&(Mt-=wt/2);break}_e={left:Mt,top:Kt,width:wt+Ht.width,height:Xt+Ht.height,color:H.backdropColor}}m.push({label:v,font:P,textOffset:F,options:{rotation:p,color:tt,strokeColor:be,strokeWidth:xe,textAlign:Bt,textBaseline:U,translation:[_,M],backdrop:_e}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-bt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o<r;++o){const l=n[o];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;const a=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,f,d;this.isHorizontal()?(c=Pt(t,this.left,r)-r/2,h=Pt(t,this.right,a)+a/2,f=d=l):(f=Pt(t,this.top,r)-r/2,d=Pt(t,this.bottom,a)+a/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,f),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&Ze(s,n);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,h=r.textOffset;Et(s,c,0,h,l,a)}n&&Qe(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=W(s.font),r=$(s.padding),a=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||T(e)?(l+=r.bottom,E(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:f,rotation:d}=Kl(this,l,e,a);Et(t,s.text,0,0,o,{color:s.color,maxWidth:f,rotation:d,textAlign:Xl(a,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,s=C(t.grid&&t.grid.z,-1),n=C(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==zt.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o<r;++o){const a=e[o];a[s]===this.id&&(!t||a.type===t)&&n.push(a)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return W(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ae{constructor(t,e,s){this.type=t,this.scope=e,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let s;Zl(e)&&(s=this.register(e));const n=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,ql(t,r,s),this.override&&B.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,s=t.id,n=this.scope;s in e&&delete e[s],n&&s in B[n]&&(delete B[n][s],this.override&&delete Rt[s])}}function ql(i,t,e){const s=le(Object.create(null),[e?B.get(e):{},B.get(t),i.defaults]);B.set(t,s),i.defaultRoutes&&Gl(t,i.defaultRoutes),i.descriptors&&B.describe(t,i.descriptors)}function Gl(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");B.route(o,n,l,a)})}function Zl(i){return"id"in i&&"defaults"in i}class Ql{constructor(){this.controllers=new Ae(Nt,"datasets",!0),this.elements=new Ae(lt,"elements"),this.plugins=new Ae(Object,"plugins"),this.scales=new Ae(zt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):I(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=zi(t);R(s["before"+n],[],s),e[t](s),R(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const s=this._typedRegistries[e];if(s.isForType(t))return s}return this.plugins}_get(t,e,s){const n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return n}}var rt=new Ql;class Jl{constructor(){this._init=[]}notify(t,e,s,n){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),r=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,s,n){n=n||{};for(const o of t){const r=o.plugin,a=r[s],l=[e,n,o.options];if(R(a,l,r)===!1&&n.cancelable)return!1}return!0}invalidate(){A(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const s=t&&t.config,n=C(s.options&&s.options.plugins,{}),o=tc(s);return n===!1&&!e?[]:ic(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function tc(i){const t={},e=[],s=Object.keys(rt.plugins.items);for(let o=0;o<s.length;o++)e.push(rt.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const r=n[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function ec(i,t){return!t&&i===!1?null:i===!0?{}:i}function ic(i,{plugins:t,localIds:e},s,n){const o=[],r=i.getContext();for(const a of t){const l=a.id,c=ec(s[l],n);c!==null&&o.push({plugin:a,options:sc(i.config,{plugin:a,local:e[l]},c,r)})}return o}function sc(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),r=i.getOptionScopes(s,o);return e&&t.defaults&&r.push(t.defaults),i.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function wi(i,t){const e=B.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function nc(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function oc(i,t){return i===t?"_index_":"_value_"}function Vs(i){if(i==="x"||i==="y"||i==="r")return i}function rc(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function Mi(i,...t){if(Vs(i))return i;for(const e of t){const s=e.axis||rc(e.position)||i.length>1&&Vs(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Ws(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function ac(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return Ws(i,"x",e[0])||Ws(i,"y",e[0])}return{}}function lc(i,t){const e=Rt[i.type]||{scales:{}},s=t.scales||{},n=wi(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!T(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Mi(r,a,ac(r,i),B.scales[a.type]),c=oc(l,n),h=e.scales||{};o[r]=se(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||wi(a,t),h=(Rt[a]||{}).scales||{};Object.keys(h).forEach(f=>{const d=nc(f,l),u=r[d+"AxisID"]||d;o[u]=o[u]||Object.create(null),se(o[u],[{axis:d},s[u],h[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];se(a,[B.scales[a.type],B.scale])}),o}function uo(i){const t=i.options||(i.options={});t.plugins=C(t.plugins,{}),t.scales=lc(i,t)}function go(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function cc(i){return i=i||{},i.data=go(i.data),uo(i),i}const Ns=new Map,po=new Set;function Le(i,t){let e=Ns.get(i);return e||(e=t(),Ns.set(i,e),po.add(e)),e}const Jt=(i,t,e)=>{const s=jt(t,e);s!==void 0&&i.add(s)};class hc{constructor(t){this._config=cc(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=go(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),uo(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Le(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Le(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Le(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Le(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(f=>Jt(l,t,f))),h.forEach(f=>Jt(l,n,f)),h.forEach(f=>Jt(l,Rt[o]||{},f)),h.forEach(f=>Jt(l,B,f)),h.forEach(f=>Jt(l,vi,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),po.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Rt[e]||{},B.datasets[e]||{},{type:e},B,vi]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=js(this._resolverCache,t,n);let l=r;if(dc(r,e)){o.$shared=!1,s=vt(s)?s():s;const c=this.createResolver(t,s,a);l=$t(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=js(this._resolverCache,t,s);return T(e)?$t(o,e,void 0,n):o}}function js(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:ji(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const fc=i=>T(i)&&Object.getOwnPropertyNames(i).some(t=>vt(i[t]));function dc(i,t){const{isScriptable:e,isIndexable:s}=Xn(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(vt(a)||fc(a))||r&&E(a))return!0}return!1}var uc="4.5.0";const gc=["top","bottom","left","right","chartArea"];function $s(i,t){return i==="top"||i==="bottom"||gc.indexOf(i)===-1&&t==="x"}function Ys(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Us(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),R(e&&e.onComplete,[i],t)}function pc(i){const t=i.chart,e=t.options.animation;R(e&&e.onProgress,[i],t)}function mo(i){return Ui()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const We={},Xs=i=>{const t=mo(i);return Object.values(We).filter(e=>e.canvas===t).pop()};function mc(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function bc(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}var gt;let qi=(gt=class{static register(...t){rt.add(...t),Ks()}static unregister(...t){rt.remove(...t),Ks()}constructor(t,e){const s=this.config=new hc(e),n=mo(t),o=Xs(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Rl(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=br(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Jl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Rr(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],We[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ht.listen(this,"complete",Us),ht.listen(this,"progress",pc),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return A(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return rt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ms(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return us(this.canvas,this.ctx),this}stop(){return ht.stop(this),this}resize(t,e){ht.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,ms(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),R(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};I(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Mi(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),I(o,r=>{const a=r.options,l=a.id,c=Mi(l,a),h=C(a.type,r.dtype);(a.position===void 0||$s(a.position,c)!==$s(r.dposition))&&(a.position=r.dposition),n[l]=!0;let f=null;if(l in s&&s[l].type===h)f=s[l];else{const d=rt.getScale(h);f=new d({id:l,type:h,ctx:this.ctx,chart:this}),s[f.id]=f}f.init(a,t)}),I(n,(r,a)=>{r||delete s[a]}),I(s,r=>{st.configure(this,r,r.options),st.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;n<s;++n)this._destroyDatasetMeta(n);t.splice(e,s-e)}this._sortedMetasets=t.slice(0).sort(Ys("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s<n;s++){const o=e[s];let r=this.getDatasetMeta(s);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||wi(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{const l=rt.getController(a),{datasetElementType:c,dataElementType:h}=B.datasets[a];Object.assign(l,{dataElementType:rt.getElement(h),datasetElementType:c&&rt.getElement(c)}),r.controller=new l(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){I(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:f}=this.getDatasetMeta(c),d=!n&&o.indexOf(f)===-1;f.buildOrUpdateElements(d),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),n||I(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ys("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){I(this.scales,t=>{st.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!ns(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;mc(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;o<e;o++)if(!ns(n,s(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;st.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],I(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e<s;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,s=this.data.datasets.length;e<s;++e)this._updateDataset(e,vt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const s=this.getDatasetMeta(t),n={meta:s,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(s.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(ht.has(this)?this.attached&&!ht.running(this)&&ht.start(this):(this.draw(),Us({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const r=e[n];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},n=so(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&Ze(e,n),t.controller.draw(),n&&Qe(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return ut(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=gl.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=kt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);ce(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ht.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),us(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete We[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,s=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};I(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){I(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},I(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[n+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Ne(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(f=>h.datasetIndex===f.datasetIndex&&h.index===f.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),l=wr(t),c=bc(t,this._lastEvent,s,l);s&&(this._lastEvent=null,R(o.onHover,[t,a,this],this),l&&R(o.onClick,[t,a,this],this));const h=!Ne(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}},S(gt,"defaults",B),S(gt,"instances",We),S(gt,"overrides",Rt),S(gt,"registry",rt),S(gt,"version",uc),S(gt,"getChart",Xs),gt);function Ks(){return I(qi.instances,i=>i._plugins.invalidate())}function bo(i,t,e=t){i.lineCap=C(e.borderCapStyle,t.borderCapStyle),i.setLineDash(C(e.borderDash,t.borderDash)),i.lineDashOffset=C(e.borderDashOffset,t.borderDashOffset),i.lineJoin=C(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=C(e.borderWidth,t.borderWidth),i.strokeStyle=C(e.borderColor,t.borderColor)}function xc(i,t,e){i.lineTo(e.x,e.y)}function _c(i){return i.stepped?qr:i.tension||i.cubicInterpolationMode==="monotone"?Gr:xc}function xo(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,l=Math.max(n,r),c=Math.min(o,a),h=n<r&&o<r||n>a&&o>a;return{count:s,start:l,loop:t.loop,ilen:c<l&&!h?s+c-l:c-l}}function yc(i,t,e,s){const{points:n,options:o}=t,{count:r,start:a,loop:l,ilen:c}=xo(n,e,s),h=_c(o);let{move:f=!0,reverse:d}=s||{},u,g,p;for(u=0;u<=c;++u)g=n[(a+(d?c-u:u))%r],!g.skip&&(f?(i.moveTo(g.x,g.y),f=!1):h(i,p,g,d,o.stepped),p=g);return l&&(g=n[(a+(d?c:0))%r],h(i,p,g,d,o.stepped)),!!l}function vc(i,t,e,s){const n=t.points,{count:o,start:r,ilen:a}=xo(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,f=0,d,u,g,p,m,b;const x=v=>(r+(c?a-v:v))%o,y=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(u=n[x(0)],i.moveTo(u.x,u.y)),d=0;d<=a;++d){if(u=n[x(d)],u.skip)continue;const v=u.x,_=u.y,M=v|0;M===g?(_<p?p=_:_>m&&(m=_),h=(f*h+v)/++f):(y(),i.lineTo(v,_),g=M,f=0,p=m=_),b=_}y()}function Si(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?vc:yc}function kc(i){return i.stepped?Da:i.tension||i.cubicInterpolationMode==="monotone"?Oa:Tt}function wc(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),bo(i,t.options),i.stroke(n)}function Mc(i,t,e,s){const{segments:n,options:o}=t,r=Si(t);for(const a of n)bo(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Sc=typeof Path2D=="function";function Pc(i,t,e,s){Sc&&!t.options.segment?wc(i,t,e,s):Mc(i,t,e,s)}class Lt extends lt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;ya(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ra(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=io(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=kc(s);let c,h;for(c=0,h=r.length;c<h;++c){const{start:f,end:d}=r[c],u=o[f],g=o[d];if(u===g){a.push(u);continue}const p=Math.abs((n-u[e])/(g[e]-u[e])),m=l(u,g,p,s.stepped);m[e]=t[e],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,e,s){return Si(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=Si(this);let r=this._loop;e=e||0,s=s||this.points.length-e;for(const a of n)r&=o(t,this,a,{start:e,end:e+s-1});return!!r}draw(t,e,s,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Pc(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}S(Lt,"id","line"),S(Lt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),S(Lt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),S(Lt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function qs(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class ui extends lt{constructor(e){super();S(this,"parsed");S(this,"skip");S(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,s){return qs(this,e,"x",s)}inYRange(e,s){return qs(this,e,"y",s)}getCenterPoint(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}size(e){e=e||this.options||{};let s=e.radius||0;s=Math.max(s,s&&e.hoverRadius||0);const n=s&&e.borderWidth||0;return(s+n)*2}draw(e,s){const n=this.options;this.skip||n.radius<.1||!ut(this,s,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,ki(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}S(ui,"id","point"),S(ui,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),S(ui,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function _o(i,t){const{x:e,y:s,base:n,width:o,height:r}=i.getProps(["x","y","base","width","height"],t);let a,l,c,h,f;return i.horizontal?(f=r/2,a=Math.min(e,n),l=Math.max(e,n),c=s-f,h=s+f):(f=o/2,a=e-f,l=e+f,c=Math.min(s,n),h=Math.max(s,n)),{left:a,top:c,right:l,bottom:h}}function _t(i,t,e,s){return i?0:Q(t,e,s)}function Cc(i,t,e){const s=i.options.borderWidth,n=i.borderSkipped,o=Un(s);return{t:_t(n.top,o.top,0,e),r:_t(n.right,o.right,0,t),b:_t(n.bottom,o.bottom,0,e),l:_t(n.left,o.left,0,t)}}function Dc(i,t,e){const{enableBorderRadius:s}=i.getProps(["enableBorderRadius"]),n=i.options.borderRadius,o=Ft(n),r=Math.min(t,e),a=i.borderSkipped,l=s||T(n);return{topLeft:_t(!l||a.top||a.left,o.topLeft,0,r),topRight:_t(!l||a.top||a.right,o.topRight,0,r),bottomLeft:_t(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:_t(!l||a.bottom||a.right,o.bottomRight,0,r)}}function Oc(i){const t=_o(i),e=t.right-t.left,s=t.bottom-t.top,n=Cc(i,e/2,s/2),o=Dc(i,e/2,s/2);return{outer:{x:t.left,y:t.top,w:e,h:s,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function gi(i,t,e,s){const n=t===null,o=e===null,a=i&&!(n&&o)&&_o(i,s);return a&&(n||xt(t,a.left,a.right))&&(o||xt(e,a.top,a.bottom))}function Tc(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Ac(i,t){i.rect(t.x,t.y,t.w,t.h)}function pi(i,t,e={}){const s=i.x!==e.x?-t:0,n=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-s,r=(i.y+i.h!==e.y+e.h?t:0)-n;return{x:i.x+s,y:i.y+n,w:i.w+o,h:i.h+r,radius:i.radius}}class mi extends lt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:r}=Oc(this),a=Tc(r.radius)?fe:Ac;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,pi(r,e,o)),t.clip(),a(t,pi(o,-e,r)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),a(t,pi(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,s){return gi(this,t,e,s)}inXRange(t,e){return gi(this,t,null,e)}inYRange(t,e){return gi(this,null,t,e)}getCenterPoint(t){const{x:e,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?s:(s+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}S(mi,"id","bar"),S(mi,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),S(mi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Lc(i,t,e){const s=i.segments,n=i.points,o=t.points,r=[];for(const a of s){let{start:l,end:c}=a;c=ti(l,c,n);const h=Pi(e,n[l],n[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:n[l],end:n[c]});continue}const f=io(t,h);for(const d of f){const u=Pi(e,o[d.start],o[d.end],d.loop),g=eo(a,n,u);for(const p of g)r.push({source:p,target:d,start:{[e]:Gs(h,u,"start",Math.max)},end:{[e]:Gs(h,u,"end",Math.min)}})}}return r}function Pi(i,t,e,s){if(s)return;let n=t[i],o=e[i];return i==="angle"&&(n=G(n),o=G(o)),{property:i,start:n,end:o}}function Fc(i,t){const{x:e=null,y:s=null}=i||{},n=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=ti(r,a,n);const l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function ti(i,t,e){for(;t>i;t--){const s=e[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function Gs(i,t,e,s){return i&&t?s(i[e],t[e]):i?i[e]:t?t[e]:0}function yo(i,t){let e=[],s=!1;return E(i)?(s=!0,e=i):e=Fc(i,t),e.length?new Lt({points:e,options:{tension:0},_loop:s,_fullLoop:s}):null}function Zs(i){return i&&i.fill!==!1}function Ic(i,t,e){let n=i[t].fill;const o=[t];let r;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!z(n))return n;if(r=i[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function Rc(i,t,e){const s=Hc(i);if(T(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return z(n)&&Math.floor(n)===n?Ec(s[0],t,n,e):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Ec(i,t,e,s){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=s?!1:e}function zc(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:T(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Bc(i,t,e){let s;return i==="start"?s=e:i==="end"?s=t.options.reverse?t.min:t.max:T(i)?s=i.value:s=t.getBaseValue(),s}function Hc(i){const t=i.options,e=t.fill;let s=C(e&&e.target,e);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function Vc(i){const{scale:t,index:e,line:s}=i,n=[],o=s.segments,r=s.points,a=Wc(t,e);a.push(yo({x:null,y:t.bottom},s));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)Nc(n,r[h],a)}return new Lt({points:n,options:{}})}function Wc(i,t){const e=[],s=i.getMatchingVisibleMetas("line");for(let n=0;n<s.length;n++){const o=s[n];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function Nc(i,t,e){const s=[];for(let n=0;n<e.length;n++){const o=e[n],{first:r,last:a,point:l}=jc(o,t,"x");if(!(!l||r&&a)){if(r)s.unshift(l);else if(i.push(l),!a)break}}i.push(...s)}function jc(i,t,e){const s=i.interpolate(t,e);if(!s)return{};const n=s[e],o=i.segments,r=i.points;let a=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],f=r[h.start][e],d=r[h.end][e];if(xt(n,f,d)){a=n===f,l=n===d;break}}return{first:a,last:l,point:s}}class vo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,s){const{x:n,y:o,radius:r}=this;return e=e||{start:0,end:J},t.arc(n,o,r,e.end,e.start,!0),!s.bounds}interpolate(t){const{x:e,y:s,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:s+Math.sin(o)*n,angle:o}}}function $c(i){const{chart:t,fill:e,line:s}=i;if(z(e))return Yc(t,e);if(e==="stack")return Vc(i);if(e==="shape")return!0;const n=Uc(i);return n instanceof vo?n:yo(n,s)}function Yc(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function Uc(i){return(i.scale||{}).getPointPositionForValue?Kc(i):Xc(i)}function Xc(i){const{scale:t={},fill:e}=i,s=zc(e,t);if(z(s)){const n=t.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function Kc(i){const{scale:t,fill:e}=i,s=t.options,n=t.getLabels().length,o=s.reverse?t.max:t.min,r=Bc(e,t,o),a=[];if(s.grid.circular){const l=t.getPointPositionForValue(0,o);return new vo({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<n;++l)a.push(t.getPointPositionForValue(l,r));return a}function bi(i,t,e){const s=$c(t),{chart:n,index:o,line:r,scale:a,axis:l}=t,c=r.options,h=c.fill,f=c.backgroundColor,{above:d=f,below:u=f}=h||{},g=n.getDatasetMeta(o),p=so(n,g);s&&r.points.length&&(Ze(i,e),qc(i,{line:r,target:s,above:d,below:u,area:e,scale:a,axis:l,clip:p}),Qe(i))}function qc(i,t){const{line:e,target:s,above:n,below:o,area:r,scale:a,clip:l}=t,c=e._loop?"angle":t.axis;i.save();let h=o;o!==n&&(c==="x"?(Qs(i,s,r.top),xi(i,{line:e,target:s,color:n,scale:a,property:c,clip:l}),i.restore(),i.save(),Qs(i,s,r.bottom)):c==="y"&&(Js(i,s,r.left),xi(i,{line:e,target:s,color:o,scale:a,property:c,clip:l}),i.restore(),i.save(),Js(i,s,r.right),h=n)),xi(i,{line:e,target:s,color:h,scale:a,property:c,clip:l}),i.restore()}function Qs(i,t,e){const{segments:s,points:n}=t;let o=!0,r=!1;i.beginPath();for(const a of s){const{start:l,end:c}=a,h=n[l],f=n[ti(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),r=!!t.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(f.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function Js(i,t,e){const{segments:s,points:n}=t;let o=!0,r=!1;i.beginPath();for(const a of s){const{start:l,end:c}=a,h=n[l],f=n[ti(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(e,h.y),i.lineTo(h.x,h.y)),r=!!t.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(e,f.y)}i.lineTo(e,t.first().y),i.closePath(),i.clip()}function xi(i,t){const{line:e,target:s,property:n,color:o,scale:r,clip:a}=t,l=Lc(e,s,n);for(const{source:c,target:h,start:f,end:d}of l){const{style:{backgroundColor:u=o}={}}=c,g=s!==!0;i.save(),i.fillStyle=u,Gc(i,r,a,g&&Pi(n,f,d)),i.beginPath();const p=!!e.pathSegment(i,c);let m;if(g){p?i.closePath():tn(i,s,d,n);const b=!!s.pathSegment(i,h,{move:p,reverse:!0});m=p&&b,m||tn(i,s,f,n)}i.closePath(),i.fill(m?"evenodd":"nonzero"),i.restore()}}function Gc(i,t,e,s){const n=t.chart.chartArea,{property:o,start:r,end:a}=s||{};if(o==="x"||o==="y"){let l,c,h,f;o==="x"?(l=r,c=n.top,h=a,f=n.bottom):(l=n.left,c=r,h=n.right,f=a),i.beginPath(),e&&(l=Math.max(l,e.left),h=Math.min(h,e.right),c=Math.max(c,e.top),f=Math.min(f,e.bottom)),i.rect(l,c,h-l,f-c),i.clip()}}function tn(i,t,e,s){const n=t.interpolate(e,s);n&&i.lineTo(n.x,n.y)}var Hh={id:"filler",afterDatasetsUpdate(i,t,e){const s=(i.data.datasets||[]).length,n=[];let o,r,a,l;for(r=0;r<s;++r)o=i.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof Lt&&(l={visible:i.isDatasetVisible(r),index:r,fill:Rc(a,r,s),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,n.push(l);for(r=0;r<s;++r)l=n[r],!(!l||l.fill===!1)&&(l.fill=Ic(n,r,e.propagate))},beforeDraw(i,t,e){const s=e.drawTime==="beforeDraw",n=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let r=n.length-1;r>=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&bi(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const s=i.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){const o=s[n].$filler;Zs(o)&&bi(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const s=t.meta.$filler;!Zs(s)||e.drawTime!=="beforeDatasetDraw"||bi(i.ctx,s,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const en=(i,t)=>{let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},Zc=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class sn extends lt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=R(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=W(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=en(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a;let f=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach((g,p)=>{const m=s+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(f+=h,c[c.length-(p>0?0:1)]=0,u+=h,d++),l[p]={left:0,top:u,row:d,width:m,height:n},c[c.length-1]+=m+a}),f}_fitCols(t,e,s,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let f=a,d=0,u=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:x,itemHeight:y}=Qc(s,e,o,m,n);b>0&&u+y+2*a>h&&(f+=d+a,c.push({width:d,height:u}),g+=d+a,p++,d=u=0),l[b]={left:g,top:u,col:p,width:x,height:y},d=Math.max(d,x),u+=y+a}),f+=d,c.push({width:d,height:u}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=Wt(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=j(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=j(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+t+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=j(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=j(s,this.top+t+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ze(t,this),this._draw(),Qe(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=B.color,l=Wt(t.rtl,this.left,this.width),c=W(r.font),{padding:h}=r,f=c.size,d=f/2;let u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=en(r,f),b=function(M,w,k){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;n.save();const P=C(k.lineWidth,1);if(n.fillStyle=C(k.fillStyle,a),n.lineCap=C(k.lineCap,"butt"),n.lineDashOffset=C(k.lineDashOffset,0),n.lineJoin=C(k.lineJoin,"miter"),n.lineWidth=P,n.strokeStyle=C(k.strokeStyle,a),n.setLineDash(C(k.lineDash,[])),r.usePointStyle){const L={radius:p*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:P},O=l.xPlus(M,g/2),F=w+d;$n(n,L,O,F,r.pointStyleWidth&&g)}else{const L=w+Math.max((f-p)/2,0),O=l.leftForLtr(M,g),F=Ft(k.borderRadius);n.beginPath(),Object.values(F).some(U=>U!==0)?fe(n,{x:O,y:L,w:g,h:p,radius:F}):n.rect(O,L,g,p),n.fill(),P!==0&&n.stroke()}n.restore()},x=function(M,w,k){Et(n,k.text,M,w+m/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?u={x:j(o,this.left+h,this.right-s[0]),y:this.top+h+v,line:0}:u={x:this.left+h,y:j(o,this.top+v+h,this.bottom-e[0].height),line:0},Qn(this.ctx,t.textDirection);const _=m+h;this.legendItems.forEach((M,w)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const k=n.measureText(M.text).width,P=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),L=g+d+k;let O=u.x,F=u.y;l.setWidth(this.width),y?w>0&&O+L+h>this.right&&(F=u.y+=_,u.line++,O=u.x=j(o,this.left+h,this.right-s[u.line])):w>0&&F+_>this.bottom&&(O=u.x=O+e[u.line].width+h,u.line++,F=u.y=j(o,this.top+v+h,this.bottom-e[u.line].height));const U=l.x(O);if(b(U,F,M),O=Er(P,O+g+d,y?O+L:this.right,t.rtl),x(l.x(O),F,M),y)u.x+=L+h;else if(typeof M.text!="string"){const nt=c.lineHeight;u.y+=ko(M,nt)+h}else u.y+=_}),Jn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=W(e.font),n=$(e.padding);if(!e.display)return;const o=Wt(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,f=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,f=j(t.align,f,this.right-d);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+j(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const u=j(a,f,f+d);r.textAlign=o.textAlign(Vi(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,Et(r,e.text,u,h,s)}_computeTitleHeight(){const t=this.options.title,e=W(t.font),s=$(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(xt(t,this.left,this.right)&&xt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],xt(t,n.left,n.left+n.width)&&xt(e,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(t){const e=this.options;if(!eh(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=Zc(n,s);n&&!o&&R(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&R(e.onHover,[t,s,this],this)}else s&&R(e.onClick,[t,s,this],this)}}function Qc(i,t,e,s,n){const o=Jc(s,i,t,e),r=th(n,s,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Jc(i,t,e,s){let n=i.text;return n&&typeof n!="string"&&(n=n.reduce((o,r)=>o.length>r.length?o:r)),t+e.size/2+s.measureText(n).width}function th(i,t,e){let s=i;return typeof t.text!="string"&&(s=ko(t,e)),s}function ko(i,t){const e=i.text?i.text.length:0;return t*e}function eh(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var Vh={id:"legend",_element:sn,start(i,t,e){const s=i.legend=new sn({ctx:i.ctx,options:e,chart:i});st.configure(i,s,e),st.addBox(i,s)},stop(i){st.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;st.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=$(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class wo extends lt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=E(s.text)?s.text.length:1;this._padding=$(s.padding);const o=n*W(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:r}=this,a=r.align;let l=0,c,h,f;return this.isHorizontal()?(h=j(a,s,o),f=e+t,c=o-s):(r.position==="left"?(h=s+t,f=j(a,n,e),l=V*-.5):(h=o-t,f=j(a,e,n),l=V*.5),c=n-e),{titleX:h,titleY:f,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=W(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Et(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Vi(e.align),textBaseline:"middle",translation:[r,a]})}}function ih(i,t){const e=new wo({ctx:i.ctx,options:t,chart:i});st.configure(i,e,t),st.addBox(i,e),i.titleBlock=e}var Wh={id:"title",_element:wo,start(i,t,e){ih(i,e)},stop(i){const t=i.titleBlock;st.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;st.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ie={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o<r;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=yi(t,c);h<n&&(n=h,a=l)}}if(a){const l=a.tooltipPosition();e=l.x,s=l.y}return{x:e,y:s}}};function ot(i,t){return t&&(E(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function ft(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
`)>-1?i.split(`
`):i}function sh(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function nn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=W(t.bodyFont),c=W(t.titleFont),h=W(t.footerFont),f=o.length,d=n.length,u=s.length,g=$(t.padding);let p=g.height,m=0,b=s.reduce((v,_)=>v+_.before.length+_.lines.length+_.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,f&&(p+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=u*v+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let x=0;const y=function(v){m=Math.max(m,e.measureText(v).width+x)};return e.save(),e.font=c.string,I(i.title,y),e.font=l.string,I(i.beforeBody.concat(i.afterBody),y),x=t.displayColors?r+2+t.boxPadding:0,I(s,v=>{I(v.before,y),I(v.lines,y),I(v.after,y)}),x=0,e.font=h.string,I(i.footer,y),e.restore(),m+=g.width,{width:m,height:p}}function nh(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function oh(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function rh(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),oh(c,i,t,e)&&(c="center"),c}function on(i,t,e){const s=e.yAlign||t.yAlign||nh(i,e);return{xAlign:e.xAlign||t.xAlign||rh(i,t,e,s),yAlign:s}}function ah(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function lh(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function rn(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:f,bottomLeft:d,bottomRight:u}=Ft(r);let g=ah(t,a);const p=lh(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+n:a==="right"&&(g+=Math.max(f,u)+n),{x:Q(g,0,s.width-t.width),y:Q(p,0,s.height-t.height)}}function Fe(i,t,e){const s=$(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function an(i){return ot([],ft(i))}function ch(i,t,e){return kt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function ln(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Mo={beforeTitle:ct,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return e[t.dataIndex]}return""},afterTitle:ct,beforeBody:ct,beforeLabel:ct,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return A(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:ct,afterBody:ct,beforeFooter:ct,footer:ct,afterFooter:ct};function X(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?Mo[t].call(e,s):n}class Ci extends lt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new no(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=ch(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=X(s,"beforeTitle",this,t),o=X(s,"title",this,t),r=X(s,"afterTitle",this,t);let a=[];return a=ot(a,ft(n)),a=ot(a,ft(o)),a=ot(a,ft(r)),a}getBeforeBody(t,e){return an(X(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return I(t,o=>{const r={before:[],lines:[],after:[]},a=ln(s,o);ot(r.before,ft(X(a,"beforeLabel",this,o))),ot(r.lines,X(a,"label",this,o)),ot(r.after,ft(X(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return an(X(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=X(s,"beforeFooter",this,t),o=X(s,"footer",this,t),r=X(s,"afterFooter",this,t);let a=[];return a=ot(a,ft(n)),a=ot(a,ft(o)),a=ot(a,ft(r)),a}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(sh(this.chart,e[l]));return t.filter&&(a=a.filter((h,f,d)=>t.filter(h,f,d,s))),t.itemSort&&(a=a.sort((h,f)=>t.itemSort(h,f,s))),I(a,h=>{const f=ln(t.callbacks,h);n.push(X(f,"labelColor",this,h)),o.push(X(f,"labelPointStyle",this,h)),r.push(X(f,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=ie[s.position].call(this,n,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const l=this._size=nn(this,s),c=Object.assign({},a,l),h=on(this.chart,s,c),f=rn(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:f}=Ft(a),{x:d,y:u}=t,{width:g,height:p}=e;let m,b,x,y,v,_;return o==="center"?(v=u+p/2,n==="left"?(m=d,b=m-r,y=v+r,_=v-r):(m=d+g,b=m+r,y=v-r,_=v+r),x=m):(n==="left"?b=d+Math.max(l,h)+r:n==="right"?b=d+g-Math.max(c,f)-r:b=this.caretX,o==="top"?(y=u,v=y-r,m=b-r,x=b+r):(y=u+p,v=y+r,m=b+r,x=b-r),_=y),{x1:m,x2:b,x3:x,y1:y,y2:v,y3:_}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=Wt(s.rtl,this.x,this.width);for(t.x=Fe(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=W(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,e,s,n,o){const r=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,h=W(o.bodyFont),f=Fe(this,"left",o),d=n.x(f),u=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+u;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=n.leftForLtr(d,c)+c/2,b=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,ki(t,p,m,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,ki(t,p,m,b)}else{t.lineWidth=T(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const p=n.leftForLtr(d,c),m=n.leftForLtr(n.xPlus(d,1),c-2),b=Ft(r.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,fe(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),fe(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=s,f=W(s.bodyFont);let d=f.lineHeight,u=0;const g=Wt(s.rtl,this.x,this.width),p=function(k){e.fillText(k,g.x(t.x+u),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let b,x,y,v,_,M,w;for(e.textAlign=r,e.textBaseline="middle",e.font=f.string,t.x=Fe(this,m,s),e.fillStyle=s.bodyColor,I(this.beforeBody,p),u=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,v=0,M=n.length;v<M;++v){for(b=n[v],x=this.labelTextColors[v],e.fillStyle=x,I(b.before,p),y=b.lines,a&&y.length&&(this._drawColorBox(e,t,v,g,s),d=Math.max(f.lineHeight,l)),_=0,w=y.length;_<w;++_)p(y[_]),d=f.lineHeight;I(b.after,p)}u=0,d=f.lineHeight,I(this.afterBody,p),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let r,a;if(o){const l=Wt(s.rtl,this.x,this.width);for(t.x=Fe(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",r=W(s.footerFont),e.fillStyle=s.footerColor,e.font=r.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+s.footerSpacing}}drawBackground(t,e,s,n){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:h}=s,{topLeft:f,topRight:d,bottomLeft:u,bottomRight:g}=Ft(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+f,l),r==="top"&&this.drawCaret(t,e,s,n),e.lineTo(a+c-d,l),e.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(a+c,l+h-g),e.quadraticCurveTo(a+c,l+h,a+c-g,l+h),r==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(a+u,l+h),e.quadraticCurveTo(a,l+h,a,l+h-u),r==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(a,l+f),e.quadraticCurveTo(a,l,a+f,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=ie[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=nn(this,t),l=Object.assign({},r,this._size),c=on(e,t,l),h=rn(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=$(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),Qn(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Jn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ne(s,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,s),a=this._positionChanged(r,t),l=e||!Ne(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,r=ie[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}S(Ci,"positioners",ie);var Nh={id:"tooltip",_element:Ci,positioners:ie,afterInit(i,t,e){e&&(i.tooltip=new Ci({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Mo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const hh=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function fh(i,t,e,s){const n=i.indexOf(t);if(n===-1)return hh(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const dh=(i,t)=>i===null?null:Q(Math.round(i),0,t);function cn(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class hn extends zt{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const s=this.getLabels();for(const{index:n,label:o}of e)s[n]===o&&s.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(A(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:fh(s,t,C(e,t),this._addedLabels),dh(e,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),e||(n=this.getLabels().length-1)),this.min=s,this.max=n}buildTicks(){const t=this.min,e=this.max,s=this.options.offset,n=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=e;r++)n.push({value:r});return n}getLabelForValue(t){return cn.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}S(hn,"id","category"),S(hn,"defaults",{ticks:{callback:cn}});function uh(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:f,includeBounds:d}=i,u=o||1,g=h-1,{min:p,max:m}=t,b=!A(r),x=!A(a),y=!A(c),v=(m-p)/(f+1);let _=rs((m-p)/g/u)*u,M,w,k,P;if(_<1e-14&&!b&&!x)return[{value:p},{value:m}];P=Math.ceil(m/_)-Math.floor(p/_),P>g&&(_=rs(P*_/g/u)*u),A(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),n==="ticks"?(w=Math.floor(p/_)*_,k=Math.ceil(m/_)*_):(w=p,k=m),b&&x&&o&&Dr((a-r)/o,_/1e3)?(P=Math.round(Math.min((a-r)/_,h)),_=(a-r)/P,w=r,k=a):y?(w=b?r:w,k=x?a:k,P=c-1,_=(k-w)/P):(P=(k-w)/_,ne(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const L=Math.max(as(_),as(w));M=Math.pow(10,A(l)?L:l),w=Math.round(w*M)/M,k=Math.round(k*M)/M;let O=0;for(b&&(d&&w!==r?(e.push({value:r}),w<r&&O++,ne(Math.round((w+O*_)*M)/M,r,fn(r,v,i))&&O++):w<r&&O++);O<P;++O){const F=Math.round((w+O*_)*M)/M;if(x&&F>a)break;e.push({value:F})}return x&&d&&k!==a?e.length&&ne(e[e.length-1].value,a,fn(a,v,i))?e[e.length-1].value=a:e.push({value:a}):(!x||k===a)&&e.push({value:k}),e}function fn(i,t,{horizontal:e,minRotation:s}){const n=bt(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class Ke extends zt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return A(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=e?n:l,a=l=>o=s?o:l;if(t){const l=at(n),c=at(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=uh(n,o);return t.bounds==="ticks"&&zn(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Ni(t,this.chart.options.locale,this.options.ticks.format)}}class dn extends Ke{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=z(t)?t:0,this.max=z(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=bt(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}S(dn,"id","linear"),S(dn,"defaults",{ticks:{callback:Ge.formatters.numeric}});const ue=i=>Math.floor(mt(i)),Dt=(i,t)=>Math.pow(10,ue(i)+t);function un(i){return i/Math.pow(10,ue(i))===1}function gn(i,t,e){const s=Math.pow(10,e),n=Math.floor(i/s);return Math.ceil(t/s)-n}function gh(i,t){const e=t-i;let s=ue(e);for(;gn(i,t,s)>10;)s++;for(;gn(i,t,s)<10;)s--;return Math.min(s,ue(i))}function ph(i,{min:t,max:e}){t=q(i.min,t);const s=[],n=ue(t);let o=gh(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*r)/r,h=Math.floor((t-l)/a/10)*a*10;let f=Math.floor((c-h)/Math.pow(10,o)),d=q(i.min,Math.round((l+h+f*Math.pow(10,o))*r)/r);for(;d<e;)s.push({value:d,major:un(d),significand:f}),f>=10?f=f<15?15:20:f++,f>=20&&(o++,f=2,r=o>=0?1:r),d=Math.round((l+h+f*Math.pow(10,o))*r)/r;const u=q(i.max,d);return s.push({value:u,major:un(u),significand:f}),s}class pn extends zt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=Ke.prototype.parse.apply(this,[t,e]);if(s===0){this._zero=!0;return}return z(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=z(t)?Math.max(0,t):null,this.max=z(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!z(this._userMin)&&(this.min=t===Dt(this.min,0)?Dt(this.min,-1):Dt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,n=this.max;const o=a=>s=t?s:a,r=a=>n=e?n:a;s===n&&(s<=0?(o(1),r(10)):(o(Dt(s,-1)),r(Dt(n,1)))),s<=0&&o(Dt(n,-1)),n<=0&&r(Dt(s,1)),this.min=s,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=ph(e,this);return t.bounds==="ticks"&&zn(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":Ni(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=mt(t),this._valueRange=mt(this.max)-mt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(mt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}S(pn,"id","logarithmic"),S(pn,"defaults",{ticks:{callback:Ge.formatters.logarithmic,major:{enabled:!0}}});function Di(i){const t=i.ticks;if(t.display&&i.display){const e=$(t.backdropPadding);return C(t.font&&t.font.size,B.font.size)+e.height}return 0}function mh(i,t,e){return e=E(e)?e:[e],{w:Kr(i,t.string,e),h:e.length*t.lineHeight}}function mn(i,t,e,s,n){return i===s||i===n?{start:t-e/2,end:t+e/2}:i<s||i>n?{start:t-e,end:t}:{start:t,end:t+e}}function bh(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?V/o:0;for(let l=0;l<o;l++){const c=r.setContext(i.getPointLabelContext(l));n[l]=c.padding;const h=i.getPointPosition(l,i.drawingArea+n[l],a),f=W(c.font),d=mh(i.ctx,f,i._pointLabels[l]);s[l]=d;const u=G(i.getIndexAngle(l)+a),g=Math.round(Bi(u)),p=mn(g,h.x,d.w,0,180),m=mn(g,h.y,d.h,90,270);xh(e,t,u,p,m)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=vh(i,s,n)}function xh(i,t,e,s,n){const o=Math.abs(Math.sin(e)),r=Math.abs(Math.cos(e));let a=0,l=0;s.start<t.l?(a=(t.l-s.start)/o,i.l=Math.min(i.l,t.l-a)):s.end>t.r&&(a=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),n.start<t.t?(l=(t.t-n.start)/r,i.t=Math.min(i.t,t.t-l)):n.end>t.b&&(l=(n.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function _h(i,t,e){const s=i.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=e,l=i.getPointPosition(t,s+n+r,o),c=Math.round(Bi(G(l.angle+Z))),h=Mh(l.y,a.h,c),f=kh(c),d=wh(l.x,a.w,f);return{visible:!0,x:l.x,y:h,textAlign:f,left:d,top:h,right:d+a.w,bottom:h+a.h}}function yh(i,t){if(!t)return!0;const{left:e,top:s,right:n,bottom:o}=i;return!(ut({x:e,y:s},t)||ut({x:e,y:o},t)||ut({x:n,y:s},t)||ut({x:n,y:o},t))}function vh(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Di(o)/2,additionalAngle:r?V/n:0};let c;for(let h=0;h<n;h++){l.padding=e[h],l.size=t[h];const f=_h(i,h,l);s.push(f),a==="auto"&&(f.visible=yh(f,c),f.visible&&(c=f))}return s}function kh(i){return i===0||i===180?"center":i<180?"left":"right"}function wh(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function Mh(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function Sh(i,t,e){const{left:s,top:n,right:o,bottom:r}=e,{backdropColor:a}=t;if(!A(a)){const l=Ft(t.borderRadius),c=$(t.backdropPadding);i.fillStyle=a;const h=s-c.left,f=n-c.top,d=o-s+c.width,u=r-n+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),fe(i,{x:h,y:f,w:d,h:u,radius:l}),i.fill()):i.fillRect(h,f,d,u)}}function Ph(i,t){const{ctx:e,options:{pointLabels:s}}=i;for(let n=t-1;n>=0;n--){const o=i._pointLabelItems[n];if(!o.visible)continue;const r=s.setContext(i.getPointLabelContext(n));Sh(e,r,o);const a=W(r.font),{x:l,y:c,textAlign:h}=o;Et(e,i._pointLabels[n],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function So(i,t,e,s){const{ctx:n}=i;if(e)n.arc(i.xCenter,i.yCenter,t,0,J);else{let o=i.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=i.getPointPosition(r,t),n.lineTo(o.x,o.y)}}function Ch(i,t,e,s,n){const o=i.ctx,r=t.circular,{color:a,lineWidth:l}=t;!r&&!s||!a||!l||e<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),So(i,e,r,s),o.closePath(),o.stroke(),o.restore())}function Dh(i,t,e){return kt(i,{label:e,index:t,type:"pointLabel"})}class Ie extends Ke{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=$(Di(this.options)/2),e=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(e,s)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=z(t)&&!isNaN(t)?t:0,this.max=z(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Di(this.options))}generateTickLabels(t){Ke.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,s)=>{const n=R(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?bh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=J/(this._pointLabels.length||1),s=this.options.startAngle||0;return G(t*e+bt(s))}getDistanceFromCenterForValue(t){if(A(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(A(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const s=e[t];return Dh(this.getContext(),t,s)}}getPointPosition(t,e,s=0){const n=this.getIndexAngle(t)-Z+s;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:s,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:s,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const s=this.ctx;s.save(),s.beginPath(),So(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:s,grid:n,border:o}=e,r=this._pointLabels.length;let a,l,c;if(e.pointLabels.display&&Ph(this,r),n.display&&this.ticks.forEach((h,f)=>{if(f!==0||f===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const d=this.getContext(f),u=n.setContext(d),g=o.setContext(d);Ch(this,u,l,r,g)}}),s.display){for(t.save(),a=r-1;a>=0;a--){const h=s.setContext(this.getPointLabelContext(a)),{color:f,lineWidth:d}=h;!d||!f||(t.lineWidth=d,t.strokeStyle=f,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const n=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=s.setContext(this.getContext(l)),h=W(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const f=$(c.backdropPadding);t.fillRect(-r/2-f.left,-o-h.size/2-f.top,r+f.width,h.size+f.height)}Et(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}S(Ie,"id","radialLinear"),S(Ie,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ge.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),S(Ie,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),S(Ie,"descriptors",{angleLines:{_fallback:"grid"}});const ei={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}},K=Object.keys(ei);function bn(i,t){return i-t}function xn(i,t){if(A(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),z(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(he(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function _n(i,t,e,s){const n=K.length;for(let o=K.indexOf(i);o<n-1;++o){const r=ei[K[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=s)return K[o]}return K[n-1]}function Oh(i,t,e,s,n){for(let o=K.length-1;o>=K.indexOf(e);o--){const r=K[o];if(ei[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return K[e?K.indexOf(e):0]}function Th(i){for(let t=K.indexOf(i)+1,e=K.length;t<e;++t)if(ei[K[t]].common)return K[t]}function yn(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=Hi(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function Ah(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=e[a],l>=0&&(t[l].major=!0);return t}function vn(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],n[a]=r,s.push({value:a,major:!1});return o===0||!e?s:Ah(i,s,n,e)}class qe extends zt{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const s=t.time||(t.time={}),n=this._adapter=new cl._date(t.adapters.date);n.init(e),se(s.displayFormats,n.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:xn(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:n,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=z(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=z(o)&&!isNaN(o)?o:+e.endOf(Date.now(),s)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],s=t[t.length-1]),{min:e,max:s}}buildTicks(){const t=this.options,e=t.time,s=t.ticks,n=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,r=this.max,a=Fr(n,o,r);return this._unit=e.unit||(s.autoSkip?_n(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Oh(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Th(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),vn(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=Q(e,0,r),s=Q(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||_n(o.minUnit,e,s,this._getLabelCapacity(e)),a=C(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=he(l)||l===!0,h={};let f=e,d,u;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(d=f,u=0;d<s;d=+t.add(d,a,r),u++)yn(h,d,g);return(d===s||n.bounds==="ticks"||u===1)&&yn(h,d,g),Object.keys(h).sort(bn).map(p=>+p)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return R(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],f=c&&a[c],d=s[e],u=c&&f&&d&&d.major;return this._adapter.format(t,n||(u?f:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e<s;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,n=bt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),r=Math.sin(n),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,n=s[e.unit]||s.millisecond,o=this._tickFormatFunction(t,0,vn(this,[t],this._majorUnit),n),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e<s;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,s;if(t.length)return t;const n=this.getLabels();for(e=0,s=n.length;e<s;++e)t.push(xn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Vn(t.sort(bn))}}S(qe,"id","time"),S(qe,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Re(i,t,e){let s=0,n=i.length-1,o,r,a,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=At(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=At(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:l}=i[n]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class kn extends qe{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Re(e,this.min),this._tableRange=Re(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r<a;++r)c=t[r],c>=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;r<a;++r)h=n[r+1],l=n[r-1],c=n[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(e)||s.length===1)&&s.push(e),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Re(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Re(this._table,s*this._tableRange+this._minPos,!0)}}S(kn,"id","timeseries"),S(kn,"defaults",qe.defaults);const Po="label";function wn(i,t){typeof i=="function"?i(t):i&&(i.current=t)}function Lh(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function Co(i,t){i.labels=t}function Do(i,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Po;const s=[];i.datasets=t.map(n=>{const o=i.datasets.find(r=>r[e]===n[e]);return!o||!n.data||s.includes(o)?{...n}:(s.push(o),Object.assign(o,n),o)})}function Fh(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Po;const e={labels:[],datasets:[]};return Co(e,i.labels),Do(e,i.datasets,t),e}function Ih(i,t){const{height:e=150,width:s=300,redraw:n=!1,datasetIdKey:o,type:r,data:a,options:l,plugins:c=[],fallbackContent:h,updateMode:f,...d}=i,u=it.useRef(null),g=it.useRef(null),p=()=>{u.current&&(g.current=new qi(u.current,{type:r,data:Fh(a,o),options:l&&{...l},plugins:c}),wn(t,g.current))},m=()=>{wn(t,null),g.current&&(g.current.destroy(),g.current=null)};return it.useEffect(()=>{!n&&g.current&&l&&Lh(g.current,l)},[n,l]),it.useEffect(()=>{!n&&g.current&&Co(g.current.config.data,a.labels)},[n,a.labels]),it.useEffect(()=>{!n&&g.current&&a.datasets&&Do(g.current.config.data,a.datasets,o)},[n,a.datasets]),it.useEffect(()=>{g.current&&(n?(m(),setTimeout(p)):g.current.update(f))},[n,l,a.labels,a.datasets,f]),it.useEffect(()=>{g.current&&(m(),setTimeout(p))},[r]),it.useEffect(()=>(p(),()=>m()),[]),Fi.createElement("canvas",{ref:u,role:"img",height:e,width:s,...d},h)}const Rh=it.forwardRef(Ih);function Oo(i,t){return qi.register(t),it.forwardRef((e,s)=>Fi.createElement(Rh,{...e,ref:s,type:i}))}const jh=Oo("line",He),$h=Oo("bar",Be);export{mi as B,qi as C,dn as L,ui as P,Fi as R,zh as a,hn as b,Nh as c,Vh as d,$h as e,Lt as f,Fo as g,jh as h,Hh as i,Wh as p,it as r};