import{M as si,w as Qt,k as nt,r as Ct,N as Wi,O as Hi,d as ji,e as X,D as $n,i as C,o as F,_ as $i,u as Yn,F as _t,t as T,h as D,G as Re,q as Rt,z as it,P as gt,E as ls,f as pt,R as Ko,S as Go,g as kt,y as Yt,x as qo,T as Ut,U as cs,W as Zo,X as Jo}from"./index-D92x6h1h.js";import{P as hs}from"./play-DDT_Ndp2.js";/**
 * @license lucide-vue-next v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ds=si("ChartLineIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
 * @license lucide-vue-next v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const us=si("DownloadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
 * @license lucide-vue-next v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fs=si("PauseIcon",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
 * @license lucide-vue-next v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gs=si("RotateCcwIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Qo=500;function ta(i){const t=Ct(new Map);function e(u){const f=u[i.keyField];return typeof f=="string"||typeof f=="number"?f:null}function s(u,f){let g=t.value.get(u);g||(g=new Map,t.value.set(u,g));let p=g.get(f);return p||(p=[],g.set(f,p)),p}function n(u,f){const g=f-i.windowSec.value*1e3;for(;u.length>0&&u[0].t<g;)u.shift()}function o(u,f,g,p){const m=s(u,f),b=m[m.length-1];b&&p-b.t<Qo?(b.t=p,b.v=g):m.push({t:p,v:g}),n(m,p)}function a(u,f){const g=u[f];return typeof g=="number"&&Number.isFinite(g)?g:0}function r(){if(i.paused.value)return;const u=Date.now(),f=new Set;for(const g of i.rows()){const p=e(g);if(p!==null){f.add(p);for(const m of i.metrics)o(p,m,a(g,m),u)}}for(const g of t.value.keys())f.has(g)||t.value.delete(g);t.value=new Map(t.value)}Qt(i.rows,r,{deep:!0,immediate:!0}),Qt(i.windowSec,()=>{const u=Date.now();for(const f of t.value.values())for(const g of f.values())n(g,u);t.value=new Map(t.value)});const l=nt(()=>t.value),c=nt(()=>{const u=new Map;for(const[f,g]of t.value){const p=new Map;for(const[m,b]of g)p.set(m,b.length>0?b[b.length-1].v:0);u.set(f,p)}return u}),h=nt(()=>{const u=new Map;for(const f of i.metrics){const g=new Map;for(const m of t.value.values()){const b=m.get(f);if(b)for(const _ of b){const y=Math.floor(_.t/1e3)*1e3;g.set(y,(g.get(y)??0)+_.v)}}const p=[];for(const m of[...g.keys()].sort((b,_)=>b-_))p.push({t:m,v:g.get(m)??0});u.set(f,p)}return u});function d(){t.value=new Map}return{samples:l,currentValues:c,aggregate:h,clear:d}}function Et(i,t){if(typeof document>"u")return t;const e=getComputedStyle(document.documentElement).getPropertyValue(i).trim();return e===""?t:e}function ea(){const i=Et("--tvh-primary","#2563eb"),t=Et("--tvh-success","#16a34a"),e=Et("--tvh-warning","#d97706"),s=Et("--tvh-error","#dc2626");return[i,t,e,s,`color-mix(in srgb, ${i} 60%, ${t})`,`color-mix(in srgb, ${i} 60%, ${e})`,`color-mix(in srgb, ${t} 60%, ${s})`,`color-mix(in srgb, ${e} 60%, ${i})`]}function ps(){return{palette:ea(),axisColor:Et("--tvh-border","#e2e8f0"),textColor:Et("--tvh-text-muted","#64748b"),tooltipBg:Et("--tvh-bg-surface","#ffffff"),tooltipFg:Et("--tvh-text","#0f172a")}}function ia(){const i=Ct(ps());let t=null;return Wi(()=>{typeof MutationObserver>"u"||typeof document>"u"||(t=new MutationObserver(()=>{i.value=ps()}),t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}))}),Hi(()=>{t?.disconnect(),t=null}),{theme:i}}/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */function Te(i){return i+.5|0}const It=(i,t,e)=>Math.max(Math.min(i,e),t);function me(i){return It(Te(i*2.55),0,255)}function Vt(i){return It(Te(i*255),0,255)}function Dt(i){return It(Te(i/2.55)/100,0,1)}function ms(i){return It(Te(i*100),0,100)}const ft={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},Di=[..."0123456789ABCDEF"],sa=i=>Di[i&15],na=i=>Di[(i&240)>>4]+Di[i&15],Ee=i=>(i&240)>>4===(i&15),oa=i=>Ee(i.r)&&Ee(i.g)&&Ee(i.b)&&Ee(i.a);function aa(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&ft[i[1]]*17,g:255&ft[i[2]]*17,b:255&ft[i[3]]*17,a:t===5?ft[i[4]]*17:255}:(t===7||t===9)&&(e={r:ft[i[1]]<<4|ft[i[2]],g:ft[i[3]]<<4|ft[i[4]],b:ft[i[5]]<<4|ft[i[6]],a:t===9?ft[i[7]]<<4|ft[i[8]]:255})),e}const ra=(i,t)=>i<255?t(i):"";function la(i){var t=oa(i)?sa:na;return i?"#"+t(i.r)+t(i.g)+t(i.b)+ra(i.a,t):void 0}const ca=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Un(i,t,e){const s=t*Math.min(e,1-e),n=(o,a=(o+i/30)%12)=>e-s*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function ha(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 da(i,t,e){const s=Un(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 ua(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 Yi(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),a=Math.min(e,s,n),r=(o+a)/2;let l,c,h;return o!==a&&(h=o-a,c=r>.5?h/(2-o-a):h/(o+a),l=ua(e,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Ui(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(Vt)}function Xi(i,t,e){return Ui(Un,i,t,e)}function fa(i,t,e){return Ui(da,i,t,e)}function ga(i,t,e){return Ui(ha,i,t,e)}function Xn(i){return(i%360+360)%360}function pa(i){const t=ca.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?me(+t[5]):Vt(+t[5]));const n=Xn(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?s=fa(n,o,a):t[1]==="hsv"?s=ga(n,o,a):s=Xi(n,o,a),{r:s[0],g:s[1],b:s[2],a:e}}function ma(i,t){var e=Yi(i);e[0]=Xn(e[0]+t),e=Xi(e),i.r=e[0],i.g=e[1],i.b=e[2]}function ba(i){if(!i)return;const t=Yi(i),e=t[0],s=ms(t[1]),n=ms(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${Dt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const bs={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"},_s={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 _a(){const i={},t=Object.keys(_s),e=Object.keys(bs);let s,n,o,a,r;for(s=0;s<t.length;s++){for(a=r=t[s],n=0;n<e.length;n++)o=e[n],r=r.replace(o,bs[o]);o=parseInt(_s[a],16),i[r]=[o>>16&255,o>>8&255,o&255]}return i}let Ie;function xa(i){Ie||(Ie=_a(),Ie.transparent=[0,0,0,0]);const t=Ie[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const ya=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function va(i){const t=ya.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const a=+t[7];e=t[8]?me(a):It(a*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?me(s):It(s,0,255)),n=255&(t[4]?me(n):It(n,0,255)),o=255&(t[6]?me(o):It(o,0,255)),{r:s,g:n,b:o,a:e}}}function wa(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${Dt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const ui=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,oe=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function ka(i,t,e){const s=oe(Dt(i.r)),n=oe(Dt(i.g)),o=oe(Dt(i.b));return{r:Vt(ui(s+e*(oe(Dt(t.r))-s))),g:Vt(ui(n+e*(oe(Dt(t.g))-n))),b:Vt(ui(o+e*(oe(Dt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Fe(i,t,e){if(i){let s=Yi(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Xi(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function Kn(i,t){return i&&Object.assign(t||{},i)}function xs(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=Vt(i[3]))):(t=Kn(i,{r:0,g:0,b:0,a:1}),t.a=Vt(t.a)),t}function Ma(i){return i.charAt(0)==="r"?va(i):pa(i)}class Me{constructor(t){if(t instanceof Me)return t;const e=typeof t;let s;e==="object"?s=xs(t):e==="string"&&(s=aa(t)||xa(t)||Ma(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Kn(this._rgb);return t&&(t.a=Dt(t.a)),t}set rgb(t){this._rgb=xs(t)}rgbString(){return this._valid?wa(this._rgb):void 0}hexString(){return this._valid?la(this._rgb):void 0}hslString(){return this._valid?ba(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*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=a*s.a+(1-a)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=ka(this._rgb,t._rgb,e)),this}clone(){return new Me(this.rgb)}alpha(t){return this._rgb.a=Vt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Te(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 Fe(this._rgb,2,t),this}darken(t){return Fe(this._rgb,2,-t),this}saturate(t){return Fe(this._rgb,1,t),this}desaturate(t){return Fe(this._rgb,1,-t),this}rotate(t){return ma(this._rgb,t),this}}/*!
 * Chart.js v4.5.1
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */function Mt(){}const Sa=(()=>{let i=0;return()=>i++})();function I(i){return i==null}function K(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 z(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function q(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function ut(i,t){return q(i)?i:t}function O(i,t){return typeof i>"u"?t:i}const Pa=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,Gn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function $(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function H(i,t,e,s){let n,o,a;if(K(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(z(i))for(a=Object.keys(i),o=a.length,n=0;n<o;n++)t.call(e,i[a[n]],a[n])}function Ge(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 qe(i){if(K(i))return i.map(qe);if(z(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=qe(i[e[n]]);return t}return i}function qn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Ca(i,t,e,s){if(!qn(i))return;const n=t[i],o=e[i];z(n)&&z(o)?Se(n,o,s):t[i]=qe(o)}function Se(i,t,e){const s=K(t)?t:[t],n=s.length;if(!z(i))return i;e=e||{};const o=e.merger||Ca;let a;for(let r=0;r<n;++r){if(a=s[r],!z(a))continue;const l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],i,a,e)}return i}function ye(i,t){return Se(i,t,{merger:Da})}function Da(i,t,e){if(!qn(i))return;const s=t[i],n=e[i];z(s)&&z(n)?ye(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=qe(n))}const ys={"":i=>i,x:i=>i.x,y:i=>i.y};function Aa(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 Oa(i){const t=Aa(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Nt(i,t){return(ys[t]||(ys[t]=Oa(t)))(i)}function Ki(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Pe=i=>typeof i<"u",Wt=i=>typeof i=="function",vs=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Ta(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const N=Math.PI,Y=2*N,La=Y+N,Ze=Number.POSITIVE_INFINITY,Ra=N/180,Z=N/2,Xt=N/4,ws=N*2/3,Ft=Math.log10,vt=Math.sign;function ve(i,t,e){return Math.abs(i-t)<e}function ks(i){const t=Math.round(i);i=ve(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Ft(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Ea(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 Ia(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function le(i){return!Ia(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function Fa(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 mt(i){return i*(N/180)}function Gi(i){return i*(180/N)}function Ms(i){if(!q(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function Jn(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*N&&(o+=Y),{angle:o,distance:n}}function Ai(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function za(i,t){return(i-t+La)%Y-N}function at(i){return(i%Y+Y)%Y}function Ce(i,t,e,s){const n=at(i),o=at(t),a=at(e),r=at(o-n),l=at(a-n),c=at(n-o),h=at(n-a);return n===o||n===a||s&&o===a||r>l&&c<h}function et(i,t,e){return Math.max(t,Math.min(e,i))}function Ba(i){return et(i,-32768,32767)}function At(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function qi(i,t,e){e=e||(a=>i[a]<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 Ot=(i,t,e,s)=>qi(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),Va=(i,t,e)=>qi(i,e,s=>i[s][t]>=e);function Na(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 Qn=["push","pop","shift","splice","unshift"];function Wa(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Qn.forEach(e=>{const s="_onData"+Ki(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o)}),a}})})}function Ss(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)&&(Qn.forEach(o=>{delete i[o]}),delete i._chartjs)}function to(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const eo=(function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame})();function io(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,eo.call(window,()=>{s=!1,i.apply(t,e)}))}}function Ha(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Zi=i=>i==="start"?"left":i==="end"?"right":"center",ot=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,ja=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function so(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:a,vScale:r,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:f,maxDefined:g}=a.getUserBounds();if(f){if(n=Math.min(Ot(l,h,d).lo,e?s:Ot(t,h,a.getPixelForValue(d)).lo),c){const p=l.slice(0,n+1).reverse().findIndex(m=>!I(m[r.axis]));n-=Math.max(0,p)}n=et(n,0,s-1)}if(g){let p=Math.max(Ot(l,a.axis,u,!0).hi+1,e?0:Ot(t,h,a.getPixelForValue(u),!0).hi+1);if(c){const m=l.slice(p-1).findIndex(b=>!I(b[r.axis]));p+=Math.max(0,m)}o=et(p,n,s)-n}else o=s-n}return{start:n,count:o}}function no(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 ze=i=>i===0||i===1,Ps=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*Y/e)),Cs=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*Y/e)+1,we={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(N*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=>ze(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=>ze(i)?i:Ps(i,.075,.3),easeOutElastic:i=>ze(i)?i:Cs(i,.075,.3),easeInOutElastic(i){return ze(i)?i:i<.5?.5*Ps(i*2,.1125,.45):.5+.5*Cs(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-we.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?we.easeInBounce(i*2)*.5:we.easeOutBounce(i*2-1)*.5+.5};function Ji(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ds(i){return Ji(i)?i:new Me(i)}function fi(i){return Ji(i)?i:new Me(i).saturate(.5).darken(.1).hexString()}const $a=["x","y","borderWidth","radius","tension"],Ya=["color","borderColor","backgroundColor"];function Ua(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:Ya},numbers:{type:"number",properties:$a}}),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 Xa(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const As=new Map;function Ka(i,t){t=t||{};const e=i+JSON.stringify(t);let s=As.get(e);return s||(s=new Intl.NumberFormat(i,t),As.set(e,s)),s}function Le(i,t,e){return Ka(t,e).format(i)}const oo={values(i){return K(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=Ga(i,e)}const a=Ft(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Le(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(Ft(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?oo.numeric.call(this,i,t,e):""}};function Ga(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 ni={formatters:oo};function qa(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:ni.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 ie=Object.create(null),Oi=Object.create(null);function ke(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 gi(i,t,e){return typeof t=="string"?Se(ke(i,t),e):Se(ke(i,""),t)}class Za{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)=>fi(n.backgroundColor),this.hoverBorderColor=(s,n)=>fi(n.borderColor),this.hoverColor=(s,n)=>fi(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 gi(this,t,e)}get(t){return ke(this,t)}describe(t,e){return gi(Oi,t,e)}override(t,e){return gi(ie,t,e)}route(t,e,s,n){const o=ke(this,t),a=ke(this,s),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[n];return z(l)?Object.assign({},c,l):O(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var G=new Za({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ua,Xa,qa]);function Ja(i){return!i||I(i.size)||I(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Je(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 Qa(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 a=0;const r=e.length;let l,c,h,d,u;for(l=0;l<r;l++)if(d=e[l],d!=null&&!K(d))a=Je(i,n,o,a,d);else if(K(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!K(u)&&(a=Je(i,n,o,a,u));i.restore();const f=o.length/2;if(f>e.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return a}function Kt(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 Os(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Ti(i,t,e,s){ao(i,t,e,s,null)}function ao(i,t,e,s,n){let o,a,r,l,c,h,d,u;const f=t.pointStyle,g=t.rotation,p=t.radius;let m=(g||0)*Ra;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(m),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(p)||p<=0)){switch(i.beginPath(),f){default:n?i.ellipse(e,s,n/2,p,0,0,Y):i.arc(e,s,p,0,Y),i.closePath();break;case"triangle":h=n?n/2:p,i.moveTo(e+Math.sin(m)*h,s-Math.cos(m)*p),m+=ws,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*p),m+=ws,i.lineTo(e+Math.sin(m)*h,s-Math.cos(m)*p),i.closePath();break;case"rectRounded":c=p*.516,l=p-c,a=Math.cos(m+Xt)*l,d=Math.cos(m+Xt)*(n?n/2-c:l),r=Math.sin(m+Xt)*l,u=Math.sin(m+Xt)*(n?n/2-c:l),i.arc(e-d,s-r,c,m-N,m-Z),i.arc(e+u,s-a,c,m-Z,m),i.arc(e+d,s+r,c,m,m+Z),i.arc(e-u,s+a,c,m+Z,m+N),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+=Xt;case"rectRot":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),i.moveTo(e-d,s-r),i.lineTo(e+u,s-a),i.lineTo(e+d,s+r),i.lineTo(e-u,s+a),i.closePath();break;case"crossRot":m+=Xt;case"cross":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+u,s-a),i.lineTo(e-u,s+a);break;case"star":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+u,s-a),i.lineTo(e-u,s+a),m+=Xt,d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+u,s-a),i.lineTo(e-u,s+a);break;case"line":a=n?n/2:Math.cos(m)*p,r=Math.sin(m)*p,i.moveTo(e-a,s-r),i.lineTo(e+a,s+r);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 Tt(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 oi(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function ai(i){i.restore()}function tr(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 er(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 ir(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),I(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 sr(i,t,e,s,n){if(n.strikethrough||n.underline){const o=i.measureText(s),a=t-o.actualBoundingBoxLeft,r=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(a,h),i.lineTo(r,h),i.stroke()}}function nr(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function se(i,t,e,s,n,o={}){const a=K(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,ir(i,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&nr(i,o.backdrop),r&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),I(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,s,o.maxWidth)),i.fillText(c,e,s,o.maxWidth),sr(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function De(i,t){const{x:e,y:s,w:n,h:o,radius:a}=t;i.arc(e+a.topLeft,s+a.topLeft,a.topLeft,1.5*N,N,!0),i.lineTo(e,s+o-a.bottomLeft),i.arc(e+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,N,Z,!0),i.lineTo(e+n-a.bottomRight,s+o),i.arc(e+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,Z,0,!0),i.lineTo(e+n,s+a.topRight),i.arc(e+n-a.topRight,s+a.topRight,a.topRight,0,-Z,!0),i.lineTo(e+a.topLeft,s)}const or=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,ar=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function rr(i,t){const e=(""+i).match(or);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 lr=i=>+i||0;function Qi(i,t){const e={},s=z(t),n=s?Object.keys(t):t,o=z(i)?s?a=>O(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of n)e[a]=lr(o(a));return e}function ro(i){return Qi(i,{top:"y",right:"x",bottom:"y",left:"x"})}function te(i){return Qi(i,["topLeft","topRight","bottomLeft","bottomRight"])}function lt(i){const t=ro(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Q(i,t){i=i||{},t=t||G.font;let e=O(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=O(i.style,t.style);s&&!(""+s).match(ar)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:O(i.family,t.family),lineHeight:rr(O(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:O(i.weight,t.weight),string:""};return n.string=Ja(n),n}function be(i,t,e,s){let n,o,a;for(n=0,o=i.length;n<o;++n)if(a=i[n],a!==void 0&&a!==void 0)return a}function cr(i,t,e){const{min:s,max:n}=i,o=Gn(t,(n-s)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Ht(i,t){return Object.assign(Object.create(i),t)}function ts(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=uo("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:r=>ts([r,...i],t,o,s)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return co(r,l,()=>br(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return Ls(r).includes(l)},ownKeys(r){return Ls(r)},set(r,l,c){const h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function ce(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:lo(i,s),setContext:o=>ce(i,o,e,s),override:o=>ce(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return co(o,a,()=>dr(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function lo(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:Wt(e)?e:()=>e,isIndexable:Wt(s)?s:()=>s}}const hr=(i,t)=>i?i+Ki(t):t,es=(i,t)=>z(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function co(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function dr(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=i;let r=s[t];return Wt(r)&&a.isScriptable(t)&&(r=ur(t,r,i,e)),K(r)&&r.length&&(r=fr(t,r,i,a.isIndexable)),es(t,r)&&(r=ce(r,n,o&&o[t],a)),r}function ur(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||s);return r.delete(i),es(i,l)&&(l=is(n._scopes,n,i,l)),l}function fr(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(z(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=is(c,n,i,h);t.push(ce(d,o,a&&a[i],r))}}return t}function ho(i,t,e){return Wt(i)?i(t,e):i}const gr=(i,t)=>i===!0?t:typeof i=="string"?Nt(t,i):void 0;function pr(i,t,e,s,n){for(const o of t){const a=gr(e,o);if(a){i.add(a);const r=ho(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==s)return r}else if(a===!1&&typeof s<"u"&&e!==s)return null}return!1}function is(i,t,e,s){const n=t._rootScopes,o=ho(t._fallback,e,s),a=[...i,...n],r=new Set;r.add(s);let l=Ts(r,a,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=Ts(r,a,o,l,s),l===null)?!1:ts(Array.from(r),[""],n,o,()=>mr(t,e,s))}function Ts(i,t,e,s,n){for(;e;)e=pr(i,t,e,s,n);return e}function mr(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return K(n)&&z(e)?e:n||{}}function br(i,t,e,s){let n;for(const o of t)if(n=uo(hr(o,i),e),typeof n<"u")return es(i,n)?is(e,s,i,n):n}function uo(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function Ls(i){let t=i._keys;return t||(t=i._keys=_r(i._scopes)),t}function _r(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)}function fo(i,t,e,s){const{iScale:n}=i,{key:o="r"}=this._parsing,a=new Array(s);let r,l,c,h;for(r=0,l=s;r<l;++r)c=r+e,h=t[c],a[r]={r:n.parse(Nt(h,o),c)};return a}const xr=Number.EPSILON||1e-14,he=(i,t)=>t<i.length&&!i[t].skip&&i[t],go=i=>i==="x"?"y":"x";function yr(i,t,e,s){const n=i.skip?t:i,o=t,a=e.skip?t:e,r=Ai(o,n),l=Ai(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,u=s*h;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function vr(i,t,e){const s=i.length;let n,o,a,r,l,c=he(i,0);for(let h=0;h<s-1;++h)if(l=c,c=he(i,h+1),!(!l||!c)){if(ve(t[h],0,xr)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],r=Math.pow(n,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),e[h]=n*a*t[h],e[h+1]=o*a*t[h])}}function wr(i,t,e="x"){const s=go(e),n=i.length;let o,a,r,l=he(i,0);for(let c=0;c<n;++c){if(a=r,r=l,l=he(i,c+1),!r)continue;const h=r[e],d=r[s];a&&(o=(h-a[e])/3,r[`cp1${e}`]=h-o,r[`cp1${s}`]=d-o*t[c]),l&&(o=(l[e]-h)/3,r[`cp2${e}`]=h+o,r[`cp2${s}`]=d+o*t[c])}}function kr(i,t="x"){const e=go(t),s=i.length,n=Array(s).fill(0),o=Array(s);let a,r,l,c=he(i,0);for(a=0;a<s;++a)if(r=l,l=c,c=he(i,a+1),!!l){if(c){const h=c[t]-l[t];n[a]=h!==0?(c[e]-l[e])/h:0}o[a]=r?c?vt(n[a-1])!==vt(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}vr(i,n,o),wr(i,o,t)}function Be(i,t,e){return Math.max(Math.min(i,e),t)}function Mr(i,t){let e,s,n,o,a,r=Tt(i[0],t);for(e=0,s=i.length;e<s;++e)a=o,o=r,r=e<s-1&&Tt(i[e+1],t),o&&(n=i[e],a&&(n.cp1x=Be(n.cp1x,t.left,t.right),n.cp1y=Be(n.cp1y,t.top,t.bottom)),r&&(n.cp2x=Be(n.cp2x,t.left,t.right),n.cp2y=Be(n.cp2y,t.top,t.bottom)))}function Sr(i,t,e,s,n){let o,a,r,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")kr(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,a=i.length;o<a;++o)r=i[o],l=yr(c,r,i[Math.min(o+1,a-(s?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&Mr(i,e)}function ss(){return typeof window<"u"&&typeof document<"u"}function ns(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Qe(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 ri=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function Pr(i,t){return ri(i).getPropertyValue(t)}const Cr=["top","right","bottom","left"];function ee(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Cr[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Dr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Ar(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(Dr(n,o,i.target))r=n,l=o;else{const c=t.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Zt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=ri(e),o=n.boxSizing==="border-box",a=ee(n,"padding"),r=ee(n,"border","width"),{x:l,y:c,box:h}=Ar(i,e),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:f,height:g}=t;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*e.width/s),y:Math.round((c-u)/g*e.height/s)}}function Or(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&ns(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=ri(o),l=ee(r,"border","width"),c=ee(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,s=Qe(r.maxWidth,o,"clientWidth"),n=Qe(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||Ze,maxHeight:n||Ze}}const zt=i=>Math.round(i*10)/10;function Tr(i,t,e,s){const n=ri(i),o=ee(n,"margin"),a=Qe(n.maxWidth,i,"clientWidth")||Ze,r=Qe(n.maxHeight,i,"clientHeight")||Ze,l=Or(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const u=ee(n,"border","width"),f=ee(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=zt(Math.min(c,a,l.maxWidth)),h=zt(Math.min(h,r,l.maxHeight)),c&&!h&&(h=zt(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=zt(Math.floor(h*s))),{width:c,height:h}}function Rs(i,t,e){const s=t||1,n=zt(i.height*s),o=zt(i.width*s);i.height=zt(i.height),i.width=zt(i.width);const a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(i.currentDevicePixelRatio=s,a.height=n,a.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const Lr=(function(){let i=!1;try{const t={get passive(){return i=!0,!1}};ss()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i})();function Es(i,t){const e=Pr(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Jt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Rr(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 Er(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=Jt(i,n,e),r=Jt(n,o,e),l=Jt(o,t,e),c=Jt(a,r,e),h=Jt(r,l,e);return Jt(c,h,e)}const Ir=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}}},Fr=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function re(i,t,e){return i?Ir(t,e):Fr()}function po(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 mo(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function bo(i){return i==="angle"?{between:Ce,compare:za,normalize:at}:{between:At,compare:(t,e)=>t-e,normalize:t=>t}}function Is({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 zr(i,t,e){const{property:s,start:n,end:o}=e,{between:a,normalize:r}=bo(s),l=t.length;let{start:c,end:h,loop:d}=i,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(t[c%l][s]),n,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:i.style}}function _o(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=bo(s),{start:h,end:d,loop:u,style:f}=zr(i,t,e),g=[];let p=!1,m=null,b,_,y;const v=()=>l(n,y,b)&&r(n,y)!==0,x=()=>r(o,b)===0||l(o,y,b),w=()=>p||v(),k=()=>!p||x();for(let M=h,A=h;M<=d;++M)_=t[M%a],!_.skip&&(b=c(_[s]),b!==y&&(p=l(b,n,o),m===null&&w()&&(m=r(b,n)===0?M:A),m!==null&&k()&&(g.push(Is({start:m,end:M,loop:u,count:a,style:f})),m=null),A=M,y=b));return m!==null&&g.push(Is({start:m,end:d,loop:u,count:a,style:f})),g}function xo(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=_o(s[n],i.points,t);o.length&&e.push(...o)}return e}function Br(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 Vr(i,t,e,s){const n=i.length,o=[];let a=t,r=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?r.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%n,end:a%n,loop:s}),o}function Nr(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:a,end:r}=Br(e,n,o,s);if(s===!0)return Fs(i,[{start:a,end:r,loop:o}],e,t);const l=r<a?r+n:r,c=!!i._fullLoop&&a===0&&r===n-1;return Fs(i,Vr(e,a,l,c),e,t)}function Fs(i,t,e,s){return!s||!s.setContext||!e?t:Wr(i,t,e,s)}function Wr(i,t,e,s){const n=i._chart.getContext(),o=zs(i.options),{_datasetIndex:a,options:{spanGaps:r}}=i,l=e.length,c=[];let h=o,d=t[0].start,u=d;function f(g,p,m,b){const _=r?-1:1;if(g!==p){for(g+=l;e[g%l].skip;)g-=_;for(;e[p%l].skip;)p+=_;g%l!==p%l&&(c.push({start:g%l,end:p%l,loop:m,style:b}),h=b,d=p%l)}}for(const g of t){d=r?d:g.start;let p=e[d%l],m;for(u=d+1;u<=g.end;u++){const b=e[u%l];m=zs(s.setContext(Ht(n,{type:"segment",p0:p,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Hr(m,h)&&f(d,u-1,g.loop,h),p=b,h=m}d<u-1&&f(d,u-1,g.loop,h)}return c}function zs(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function Hr(i,t){if(!t)return!1;const e=[],s=function(n,o){return Ji(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,s)!==JSON.stringify(t,s)}function Ve(i,t,e){return i.options.clip?i[e]:t[e]}function jr(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Ve(e,t,"left"),right:Ve(e,t,"right"),top:Ve(s,t,"top"),bottom:Ve(s,t,"bottom")}:t}function yo(i,t){const e=t._clip;if(e.disabled)return!1;const s=jr(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.1
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */class $r{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],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(s-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=eo.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 a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(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 St=new $r;const Bs="transparent",Yr={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Ds(i||Bs),n=s.valid&&Ds(t||Bs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Ur{constructor(t,e,s,n){const o=e[s];n=be([t.to,n,o,t.from]);const a=be([t.from,o,n]);this._active=!0,this._fn=t.fn||Yr[t.type||typeof a],this._easing=we[t.easing]||we.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=a,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,a=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=be([t.to,e,n,t.from]),this._from=be([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,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e<s),!this._active){this._target[n]=r,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,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 vo{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!z(t))return;const e=Object.keys(G.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!z(o))return;const a={};for(const r of e)a[r]=o[r];(K(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a)})})}_animateOptions(t,e){const s=e.options,n=Kr(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Xr(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new Ur(u,t,c,h),n.push(d)}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 St.add(this._chart,s),!0}}function Xr(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 Kr(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 Vs(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 Gr(i,t,e){if(e===!1)return!1;const s=Vs(i,e),n=Vs(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function qr(i){let t,e,s,n;return z(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 wo(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 Ns(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let a,r,l,c;if(t===null)return;let h=!1;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===e){if(h=!0,s.all)continue;break}c=i.values[l],q(c)&&(o||t===0||vt(t)===vt(c))&&(t+=c)}return!h&&!s.all?0:t}function Zr(i,t){const{iScale:e,vScale:s}=t,n=e.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",a=Object.keys(i),r=new Array(a.length);let l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:i[h]};return r}function pi(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function Jr(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Qr(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 tl(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function Ws(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 Hs(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=Jr(o,a,s),d=t.length;let u;for(let f=0;f<d;++f){const g=t[f],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});u=b[c]=tl(n,h,p),u[r]=m,u._top=Ws(u,a,!0,s.type),u._bottom=Ws(u,a,!1,s.type);const _=u._visualValues||(u._visualValues={});_[r]=m}}function mi(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function el(i,t){return Ht(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function il(i,t,e){return Ht(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function de(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 bi=i=>i==="reset"||i==="none",js=(i,t)=>t?i:Object.assign({},i),sl=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:wo(e,!0),values:null};class jt{static defaults={};static datasetElementType=null;static dataElementType=null;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=pi(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&&de(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,o=e.xAxisID=O(s.xAxisID,mi(t,"x")),a=e.yAxisID=O(s.yAxisID,mi(t,"y")),r=e.rAxisID=O(s.rAxisID,mi(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),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&&Ss(this._data,this),t._stacked&&de(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(z(e)){const n=this._cachedMeta;this._data=Zr(e,n)}else if(s!==e){if(s){Ss(s,this);const n=this._cachedMeta;de(n),n._parsed=[]}e&&Object.isExtensible(e)&&Wa(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=pi(e.vScale,e),e.stack!==s.stack&&(n=!0,de(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Hs(this,e._parsed),e._stacked=pi(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:a}=s,r=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,u;if(this._parsing===!1)s._parsed=n,s._sorted=!0,u=n;else{K(n[t])?u=this.parseArrayData(s,n,t,e):z(n[t])?u=this.parseObjectData(s,n,t,e):u=this.parsePrimitiveData(s,n,t,e);const f=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)s._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);s._sorted=l}a&&Hs(this,u)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),h=o===a,d=new Array(n);let u,f,g;for(u=0,f=n;u<f;++u)g=u+s,d[u]={[r]:h||o.parse(c[g],g),[l]:a.parse(e[g],g)};return d}parseArrayData(t,e,s,n){const{xScale:o,yScale:a}=t,r=new Array(n);let l,c,h,d;for(l=0,c=n;l<c;++l)h=l+s,d=e[h],r[l]={x:o.parse(d[0],h),y:a.parse(d[1],h)};return r}parseObjectData(t,e,s,n){const{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,d,u,f;for(h=0,d=n;h<d;++h)u=h+s,f=e[u],c[h]={x:o.parse(Nt(f,r),u),y:a.parse(Nt(f,l),u)};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,a=e[t.axis],r={keys:wo(n,!0),values:e._stacks[t.axis]._visualValues};return Ns(r,a,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let a=o===null?NaN:o;const r=n&&s._stacks[e.axis];n&&r&&(n.values=r,a=Ns(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,a=n.length,r=this._getOtherScale(t),l=sl(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=Qr(r);let u,f;function g(){f=n[u];const p=f[r.axis];return!q(f[t.axis])||h>p||d<p}for(u=0;u<a&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n<o;++n)a=e[n][t.axis],q(a)&&s.push(a);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=qr(O(this.options.clip,Gr(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,a=[],r=this._drawStart||0,l=this._drawCount||n.length-r,c=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,r,l),h=r;h<r+l;++h){const d=n[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(h=0;h<a.length;++h)a[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 a=this._cachedMeta.data[t];o=a.$context||(a.$context=il(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=el(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,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&Pe(s);if(r)return js(r,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(G.elements[t]),g=()=>this.getContext(s,n,e),p=c.resolveNamedOptions(u,f,g,d);return p.$shared&&(p.$shared=l,o[a]=Object.freeze(js(p,l))),p}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,s,e))}const c=new vo(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||bi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:a}}updateElement(t,e,s,n){bi(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!bi(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[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const n=s.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),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,a=t+e;let r;const l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=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&&de(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])}}function nl(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=to(s.sort((n,o)=>n-o))}return i._cache.$bar}function ol(i){const t=i.iScale,e=nl(t,i.type);let s=t._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(Pe(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a)};for(n=0,o=e.length;n<o;++n)a=t.getPixelForValue(e[n]),l();for(r=void 0,n=0,o=t.ticks.length;n<o;++n)a=t.getPixelForTick(n),l();return s}function al(i,t,e,s){const n=e.barThickness;let o,a;return I(n)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:t.pixels[i]-o/2}}function rl(i,t,e,s){const n=t.pixels,o=n[i];let a=i>0?n[i-1]:null,r=i<n.length-1?n[i+1]:null;const l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:e.barPercentage,start:c}}function ll(i,t,e,s){const n=e.parse(i[0],s),o=e.parse(i[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function ko(i,t,e,s){return K(i)?ll(i,t,e,s):t[e.axis]=e.parse(i,s),t}function $s(i,t,e,s){const n=i.iScale,o=i.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,u;for(c=e,h=e+s;c<h;++c)u=t[c],d={},d[n.axis]=r||n.parse(a[c],c),l.push(ko(u,d,o,c));return l}function _i(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function cl(i,t,e){return i!==0?vt(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function hl(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 dl(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:a,end:r,reverse:l,top:c,bottom:h}=hl(i);n==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=h:(o[Ys(h,a,r,l)]=!0,n=c)),o[Ys(n,a,r,l)]=!0,i.borderSkipped=o}function Ys(i,t,e,s){return s?(i=ul(i,t,e),i=Us(i,e,t)):i=Us(i,t,e),i}function ul(i,t,e){return i===t?e:i===e?t:i}function Us(i,t,e){return i==="start"?t:i==="end"?e:i}function fl(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class gl extends jt{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,s,n){return $s(t,e,s,n)}parseArrayData(t,e,s,n){return $s(t,e,s,n)}parseObjectData(t,e,s,n){const{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,h=a.axis==="x"?r:l,d=[];let u,f,g,p;for(u=s,f=s+n;u<f;++u)p=e[u],g={},g[o.axis]=o.parse(Nt(p,c),u),d.push(ko(Nt(p,h),g,a,u));return d}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),a=o._custom,r=_i(a)?"["+a.start+", "+a.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:r}}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:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+s;f++){const g=this.getParsed(f),p=o||I(g[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,h),b=(g._stacks||{})[r.axis],_={horizontal:c,base:p.base,enableBorderRadius:!b||_i(g._custom)||a===b._top||a===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};u&&(_.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const y=_.options||t[f].options;dl(_,y,b,a),fl(_,y,h.ratio),this.updateElement(t[f],f,_,n)}}_getStacks(t,e){const{iScale:s}=this._cachedMeta,n=s.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=s.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[s.axis],c=h=>{const d=h._parsed.find(f=>f[s.axis]===l),u=d&&d[h.vScale.axis];if(I(u)||isNaN(u))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_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[O(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,a;for(o=0,a=e.data.length;o<a;++o)n.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const r=t.barThickness;return{min:r||ol(e),pixels:n,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:s,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,h=_i(c);let d=l[e.axis],u=0,f=s?this.applyStack(e,l,s):d,g,p;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&vt(d)!==vt(c.barEnd)&&(u=0),u+=d);const m=!I(o)&&!h?o:u;let b=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(u+f):g=b,p=g-b,Math.abs(p)<a){p=cl(p,e,r)*a,d===r&&(b-=p/2);const _=e.getPixelForDecimal(0),y=e.getPixelForDecimal(1),v=Math.min(_,y),x=Math.max(_,y);b=Math.max(Math.min(b,x),v),g=b+p,s&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(g)-e.getValueForPixel(b))}if(b===e.getPixelForValue(r)){const _=vt(p)*e.getLineWidthForValue(r)/2;b+=_,p-=_}return{size:p,base:b,head:g,center:g+p/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,a=O(n.maxBarThickness,1/0);let r,l;const c=this._getAxisCount();if(e.grouped){const h=o?this._getStackCount(t):e.stackCount,d=n.barThickness==="flex"?rl(t,e,n,h*c):al(t,e,n,h*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(O(u,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=d.start+d.chunk*g+d.chunk/2,l=Math.min(a,d.chunk*d.ratio)}else r=s.getPixelForValue(this.getParsed(t)[s.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,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)}}class pl extends jt{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,s,n){const o=super.parsePrimitiveData(t,e,s,n);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+s).radius;return o}parseArrayData(t,e,s,n){const o=super.parseArrayData(t,e,s,n);for(let a=0;a<o.length;a++){const r=e[s+a];o[a]._custom=O(r[2],this.resolveDataElementOptions(a+s).radius)}return o}parseObjectData(t,e,s,n){const o=super.parseObjectData(t,e,s,n);for(let a=0;a<o.length;a++){const r=e[s+a];o[a]._custom=O(r&&r.r&&+r.r,this.resolveDataElementOptions(a+s).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let s=t.length-1;s>=0;--s)e=Math.max(e,t[s].size(this.resolveDataElementOptions(s))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:s[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),h=a.axis,d=r.axis;for(let u=e;u<e+s;u++){const f=t[u],g=!o&&this.getParsed(u),p={},m=p[h]=o?a.getPixelForDecimal(.5):a.getPixelForValue(g[h]),b=p[d]=o?r.getBasePixel():r.getPixelForValue(g[d]);p.skip=isNaN(m)||isNaN(b),c&&(p.options=l||this.resolveDataElementOptions(u,f.active?"active":n),o&&(p.options.radius=0)),this.updateElement(f,u,p,n)}}resolveDataElementOptions(t,e){const s=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return e!=="active"&&(n.radius=0),n.radius+=O(s&&s._custom,o),n}}function ml(i,t,e){let s=1,n=1,o=0,a=0;if(t<Y){const r=i,l=r+t,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(y,v,x)=>Ce(y,r,l,!0)?1:Math.max(v,v*e,x,x*e),g=(y,v,x)=>Ce(y,r,l,!0)?-1:Math.min(v,v*e,x,x*e),p=f(0,c,d),m=f(Z,h,u),b=g(N,c,d),_=g(N+Z,h,u);s=(p-b)/2,n=(m-_)/2,o=-(p+b)/2,a=-(m+_)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}class os extends jt{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{const d=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:s,borderRadius:a&&(r||d.borderRadius),index:c}}):[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=l=>+s[l];if(z(s[t])){const{key:l="value"}=this._parsing;o=c=>+Nt(s[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)n._parsed[a]=o(a)}}_getRotation(){return mt(this.options.rotation-90)}_getCircumference(){return mt(this.options.circumference)}_getRotationExtents(){let t=Y,e=-Y;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const n=this.chart.getDatasetMeta(s).controller,o=n._getRotation(),a=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:s}=e,n=this._cachedMeta,o=n.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(s.width,s.height)-a)/2,0),l=Math.min(Pa(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:g,offsetY:p}=ml(d,h,l),m=(s.width-a)/u,b=(s.height-a)/f,_=Math.max(Math.min(m,b)/2,0),y=Gn(this.options.radius,_),v=Math.max(y*l,0),x=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=p*y,n.total=this.calculateTotal(),this.outerRadius=y-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const s=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/Y)}updateElements(t,e,s,n){const o=n==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,h=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,g=u?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,n);let b=this._getRotation(),_;for(_=0;_<e;++_)b+=this._circumference(_,o);for(_=e;_<e+s;++_){const y=this._circumference(_,o),v=t[_],x={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+y,circumference:y,outerRadius:g,innerRadius:f};m&&(x.options=p||this.resolveDataElementOptions(_,v.active?"active":n)),b+=y,this.updateElement(v,_,x,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let s=0,n;for(n=0;n<e.length;n++){const o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?Y*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=Le(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,a,r,l;if(!t){for(n=0,o=s.data.datasets.length;n<o;++n)if(s.isDatasetVisible(n)){a=s.getDatasetMeta(n),t=a.data,r=a.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)l=r.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let s=0,n=t.length;s<n;++s){const o=this.resolveDataElementOptions(s);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(e+=this._getRingWeight(s));return e}_getRingWeight(t){return Math.max(O(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class bl extends jt{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:n=[],_dataset:o}=e,a=this.chart._animationsDisabled;let{start:r,count:l}=so(e,n,a);this._drawStart=r,this._drawCount=l,no(e)&&(r=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:!a,options:c},t),this.updateElements(n,r,l,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:g,segment:p}=this.options,m=le(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",_=e+s,y=t.length;let v=e>0&&this.getParsed(e-1);for(let x=0;x<y;++x){const w=t[x],k=b?w:{};if(x<e||x>=_){k.skip=!0;continue}const M=this.getParsed(x),A=I(M[f]),L=k[u]=a.getPixelForValue(M[u],x),R=k[f]=o||A?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[f],x);k.skip=isNaN(L)||isNaN(R)||A,k.stop=x>0&&Math.abs(M[u]-v[u])>m,p&&(k.parsed=M,k.raw=c.data[x]),d&&(k.options=h||this.resolveDataElementOptions(x,w.active?"active":n)),b||this.updateElement(w,x,k,n),v=M}}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)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class Mo extends jt{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=Le(e._parsed[t].r,s.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,s,n){return fo.bind(this)(t,e,s,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((s,n)=>{const o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,s=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),a=Math.max(s.cutoutPercentage?o/100*s.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,s,n){const o=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*N;let f=u,g;const p=360/this.countVisibleElements();for(g=0;g<e;++g)f+=this._computeAngle(g,n,p);for(g=e;g<e+s;g++){const m=t[g];let b=f,_=f+this._computeAngle(g,n,p),y=a.getDataVisibility(g)?c.getDistanceFromCenterForValue(this.getParsed(g).r):0;f=_,o&&(l.animateScale&&(y=0),l.animateRotate&&(b=_=u));const v={x:h,y:d,innerRadius:0,outerRadius:y,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(g,m.active?"active":n)};this.updateElement(m,g,v,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((s,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,s){return this.chart.getDataVisibility(t)?mt(this.resolveDataElementOptions(t,e).angle||s):0}}class _l extends os{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class xl extends jt{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,s=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(s[e.axis])}}parseObjectData(t,e,s,n){return fo.bind(this)(t,e,s,n)}update(t){const e=this._cachedMeta,s=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(s.points=n,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const r={_loop:!0,_fullLoop:o.length===n.length,options:a};this.updateElement(s,void 0,r,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,s,n){const o=this._cachedMeta.rScale,a=n==="reset";for(let r=e;r<e+s;r++){const l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":n),h=o.getPointPositionForValue(r,this.getParsed(r).r),d=a?o.xCenter:h.x,u=a?o.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,r,f,n)}}}class yl extends jt{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:n,yScale:o}=e,a=this.getParsed(t),r=n.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:s[t]||"",value:"("+r+", "+l+")"}}update(t){const e=this._cachedMeta,{data:s=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:a}=so(e,s,n);if(this._drawStart=o,this._drawCount=a,no(e)&&(o=0,a=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=s;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(s,o,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,s,n){const o=n==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),u=this.includeOptions(n,d),f=a.axis,g=r.axis,{spanGaps:p,segment:m}=this.options,b=le(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||n==="none";let y=e>0&&this.getParsed(e-1);for(let v=e;v<e+s;++v){const x=t[v],w=this.getParsed(v),k=_?x:{},M=I(w[g]),A=k[f]=a.getPixelForValue(w[f],v),L=k[g]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[g],v);k.skip=isNaN(A)||isNaN(L)||M,k.stop=v>0&&Math.abs(w[f]-y[f])>b,m&&(k.parsed=w,k.raw=c.data[v]),u&&(k.options=d||this.resolveDataElementOptions(v,x.active?"active":n)),_||this.updateElement(x,v,k,n),y=w}this.updateSharedOptions(d,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}const s=t.dataset,n=s.options&&s.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,a)/2}}var vl=Object.freeze({__proto__:null,BarController:gl,BubbleController:pl,DoughnutController:os,LineController:bl,PieController:_l,PolarAreaController:Mo,RadarController:xl,ScatterController:yl});function Gt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class as{static override(t){Object.assign(as.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Gt()}parse(){return Gt()}format(){return Gt()}add(){return Gt()}diff(){return Gt()}startOf(){return Gt()}endOf(){return Gt()}}var wl={_date:as};function kl(i,t,e,s){const{controller:n,data:o,_sorted:a}=i,r=n._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const c=r._reversePixels?Va:Ot;if(s){if(n._sharedOptions){const h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){const u=c(o,t,e-d),f=c(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:d}=n._cachedMeta,{_parsed:u}=i,f=u.slice(0,h.lo+1).reverse().findIndex(p=>!I(p[d.axis]));h.lo-=Math.max(0,f);const g=u.slice(h.hi).findIndex(p=>!I(p[d.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function li(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){const{index:c,data:h}=o[r],{lo:d,hi:u}=kl(o[r],t,a,n);for(let f=d;f<=u;++f){const g=h[f];g.skip||s(g,c,f)}}}function Ml(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,a=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function xi(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||li(i,e,t,function(r,l,c){!n&&!Tt(r,i.chartArea,0)||r.inRange(t.x,t.y,s)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Sl(i,t,e,s){let n=[];function o(a,r,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],s),{angle:d}=Jn(a,{x:t.x,y:t.y});Ce(d,c,h)&&n.push({element:a,datasetIndex:r,index:l})}return li(i,e,t,o),n}function Pl(i,t,e,s,n,o){let a=[];const r=Ml(e);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(t.x,t.y,n);if(s&&!f)return;const g=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(g))&&!f)return;const m=r(t,g);m<l?(a=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&a.push({element:h,datasetIndex:d,index:u})}return li(i,e,t,c),a}function yi(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?Sl(i,t,e,n):Pl(i,t,e,s,n,o)}function Xs(i,t,e,s,n){const o=[],a=e==="x"?"inXRange":"inYRange";let r=!1;return li(i,e,t,(l,c,h)=>{l[a]&&l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),s&&!r?[]:o}var Cl={modes:{index(i,t,e,s){const n=Zt(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?xi(i,n,o,s,a):yi(i,n,o,!1,s,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Zt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?xi(i,n,o,s,a):yi(i,n,o,!1,s,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(i,t,e,s){const n=Zt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return xi(i,n,o,s,a)},nearest(i,t,e,s){const n=Zt(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return yi(i,n,o,e.intersect,s,a)},x(i,t,e,s){const n=Zt(t,i);return Xs(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=Zt(t,i);return Xs(i,n,"y",e.intersect,s)}}};const So=["left","top","right","bottom"];function ue(i,t){return i.filter(e=>e.pos===t)}function Ks(i,t){return i.filter(e=>So.indexOf(e.pos)===-1&&e.box.axis===t)}function fe(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 Dl(i){const t=[];let e,s,n,o,a,r;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:a,stackWeight:r=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return t}function Al(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!So.includes(n))continue;const a=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function Ol(i,t){const e=Al(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,a,r;for(o=0,a=i.length;o<a;++o){r=i[o];const{fullSize:l}=r.box,c=e[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*s:l&&t.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:l&&t.availableHeight)}return e}function Tl(i){const t=Dl(i),e=fe(t.filter(c=>c.box.fullSize),!0),s=fe(ue(t,"left"),!0),n=fe(ue(t,"right")),o=fe(ue(t,"top"),!0),a=fe(ue(t,"bottom")),r=Ks(t,"x"),l=Ks(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:ue(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function Gs(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Po(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 Ll(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!z(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Po(a,o.getPadding());const r=Math.max(0,t.outerWidth-Gs(a,i,"left","right")),l=Math.max(0,t.outerHeight-Gs(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Rl(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 El(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function _e(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o<a;++o){r=i[o],l=r.box,l.update(r.width||t.w,r.height||t.h,El(r.horizontal,t));const{same:d,other:u}=Ll(t,e,r,s);c|=d&&n.length,h=h||u,l.fullSize||n.push(r)}return c&&_e(n,t,e,s)||h}function Ne(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 qs(i,t,e,s){const n=e.padding;let{x:o,y:a}=t;for(const r of i){const l=r.box,c=s[r.stack]||{placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){const d=t.w*h,u=c.size||l.height;Pe(c.start)&&(a=c.start),l.fullSize?Ne(l,n.left,a,e.outerWidth-n.right-n.left,u):Ne(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*h,u=c.size||l.width;Pe(c.start)&&(o=c.start),l.fullSize?Ne(l,o,n.top,u,e.outerHeight-n.bottom-n.top):Ne(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var rt={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=lt(i.options.layout.padding),o=Math.max(t-n.width,0),a=Math.max(e-n.height,0),r=Tl(i.boxes),l=r.vertical,c=r.horizontal;H(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,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);Po(u,lt(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=Ol(l.concat(c),d);_e(r.fullSize,f,d,g),_e(l,f,d,g),_e(c,f,d,g)&&_e(l,f,d,g),Rl(f),qs(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,qs(r.rightAndBottom,f,d,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},H(r.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.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 Il extends Co{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Xe="$chartjs",Fl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Zs=i=>i===null||i==="";function zl(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Xe]={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",Zs(n)){const o=Es(i,"width");o!==void 0&&(i.width=o)}if(Zs(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Es(i,"height");o!==void 0&&(i.height=o)}return i}const Do=Lr?{passive:!0}:!1;function Bl(i,t,e){i&&i.addEventListener(t,e,Do)}function Vl(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Do)}function Nl(i,t){const e=Fl[i.type]||i.type,{x:s,y:n}=Zt(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ti(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Wl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||ti(r.addedNodes,s),a=a&&!ti(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Hl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||ti(r.removedNodes,s),a=a&&!ti(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Ae=new Map;let Js=0;function Ao(){const i=window.devicePixelRatio;i!==Js&&(Js=i,Ae.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function jl(i,t){Ae.size||window.addEventListener("resize",Ao),Ae.set(i,t)}function $l(i){Ae.delete(i),Ae.size||window.removeEventListener("resize",Ao)}function Yl(i,t,e){const s=i.canvas,n=s&&ns(s);if(!n)return;const o=io((r,l)=>{const c=n.clientWidth;e(r,l),c<n.clientWidth&&e()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),jl(i,o),a}function vi(i,t,e){e&&e.disconnect(),t==="resize"&&$l(i)}function Ul(i,t,e){const s=i.canvas,n=io(o=>{i.ctx!==null&&e(Nl(o,i))},i);return Bl(s,t,n),n}class Xl extends Co{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(zl(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Xe])return!1;const s=e[Xe].initial;["height","width"].forEach(o=>{const a=s[o];I(a)?e.removeAttribute(o):e.setAttribute(o,a)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Xe],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:Wl,detach:Hl,resize:Yl}[e]||Ul;n[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:vi,detach:vi,resize:vi}[e]||Vl)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Tr(t,e,s,n)}isAttached(t){const e=t&&ns(t);return!!(e&&e.isConnected)}}function Kl(i){return!ss()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Il:Xl}class Lt{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return le(this.x)&&le(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}}function Gl(i,t){const e=i.options.ticks,s=ql(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Jl(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return Ql(t,c,o,a/n),c;const h=Zl(o,t,n);if(a>0){let d,u;const f=a>1?Math.round((l-r)/(a-1)):null;for(We(t,c,h,I(f)?0:r-f,r),d=0,u=a-1;d<u;d++)We(t,c,h,o[d],o[d+1]);return We(t,c,h,l,I(f)?t.length:l+f),c}return We(t,c,h),c}function ql(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 Zl(i,t,e){const s=tc(i),n=t.length/e;if(!s)return Math.max(n,1);const o=Ea(s);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>n)return l}return Math.max(n,1)}function Jl(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function Ql(i,t,e,s){let n=0,o=e[0],a;for(s=Math.ceil(s),a=0;a<i.length;a++)a===o&&(t.push(i[a]),n++,o=e[n*s])}function We(i,t,e,s,n){const o=O(s,0),a=Math.min(O(n,i.length),i.length);let r=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-s,e=l/Math.floor(l/e)),h=o;h<0;)r++,h=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===h&&(t.push(i[c]),r++,h=Math.round(o+r*e))}function tc(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 ec=i=>i==="left"?"right":i==="right"?"left":i,Qs=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,tn=(i,t)=>Math.min(t||i,i);function en(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 ic(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,a=i._endPixel,r=1e-6;let l=i.getPixelForTick(n),c;if(!(e&&(s===1?c=Math.max(l-o,a-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-r||l>a+r)))return l}function sc(i,t){H(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 ge(i){return i.drawTicks?i.tickLength:0}function sn(i,t){if(!i.display)return 0;const e=Q(i.font,t),s=lt(i.padding);return(K(i.text)?i.text.length:1)*e.lineHeight+s.height}function nc(i,t){return Ht(i,{scale:t,type:"scale"})}function oc(i,t,e){return Ht(i,{tick:e,index:t,type:"tick"})}function ac(i,t,e){let s=Zi(i);return(e&&t!=="right"||!e&&t==="right")&&(s=ec(s)),s}function rc(i,t,e,s){const{top:n,left:o,bottom:a,right:r,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,u,f,g;const p=a-n,m=r-o;if(i.isHorizontal()){if(f=ot(s,o,r),z(e)){const b=Object.keys(e)[0],_=e[b];g=h[b].getPixelForValue(_)+p-t}else e==="center"?g=(c.bottom+c.top)/2+p-t:g=Qs(i,e,t);u=r-o}else{if(z(e)){const b=Object.keys(e)[0],_=e[b];f=h[b].getPixelForValue(_)-m+t}else e==="center"?f=(c.left+c.right)/2-m+t:f=Qs(i,e,t);g=ot(s,a,n),d=e==="left"?-Z:Z}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}class ne 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=ut(t,Number.POSITIVE_INFINITY),e=ut(e,Number.NEGATIVE_INFINITY),s=ut(s,Number.POSITIVE_INFINITY),n=ut(n,Number.NEGATIVE_INFINITY),{min:ut(t,s),max:ut(e,n),minDefined:q(t),maxDefined:q(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:e,max:s};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),n||(e=Math.min(e,a.min)),o||(s=Math.max(s,a.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:ut(e,ut(s,e)),max:ut(s,ut(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(){$(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.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=cr(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?en(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Gl(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(){$(this.options.afterUpdate,[this])}beforeSetDimensions(){$(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(){$(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),$(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){$(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=$(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){$(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){$(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=tn(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let a=n,r,l,c;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=et(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/s:f/(s-1),d+6>r&&(r=f/(s-(t.offset?.5:1)),l=this.maxHeight-ge(t.grid)-e.padding-sn(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=Gi(Math.min(Math.asin(et((h.highest.height+6)/r,-1,1)),Math.asin(et(l/c,-1,1))-Math.asin(et(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){$(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){$(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=sn(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ge(o)+l):(t.height=this.maxHeight,t.width=ge(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,g=mt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(r){const b=s.mirror?0:m*d.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=s.mirror?0:p*d.width+m*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),r?(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:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*t.width,f=s*e.height):(u=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_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(){$(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++)I(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=en(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,a=[],r=[],l=Math.floor(e/tn(e,s));let c=0,h=0,d,u,f,g,p,m,b,_,y,v,x;for(d=0;d<e;d+=l){if(g=t[d].label,p=this._resolveTickFontOptions(d),n.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},_=p.lineHeight,y=v=0,!I(g)&&!K(g))y=Je(n,b.data,b.gc,y,g),v=_;else if(K(g))for(u=0,f=g.length;u<f;++u)x=g[u],!I(x)&&!K(x)&&(y=Je(n,b.data,b.gc,y,x),v+=_);a.push(y),r.push(v),c=Math.max(y,c),h=Math.max(v,h)}sc(o,e);const w=a.indexOf(c),k=r.indexOf(h),M=A=>({width:a[A]||0,height:r[A]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(k),widths:a,heights:r}}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 Ba(this._alignToPixels?Kt(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=oc(this.getContext(),t,s))}return this.$context||(this.$context=nc(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=mt(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*s>r*n?r/s:l/n:l*n<r*s?l/s:r/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:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=ge(o),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(j){return Kt(s,j,p)};let _,y,v,x,w,k,M,A,L,R,E,J;if(a==="top")_=b(this.bottom),k=this.bottom-u,A=_-m,R=b(t.top)+m,J=t.bottom;else if(a==="bottom")_=b(this.top),R=t.top,J=b(t.bottom)-m,k=_+m,A=this.top+u;else if(a==="left")_=b(this.right),w=this.right-u,M=_-m,L=b(t.left)+m,E=t.right;else if(a==="right")_=b(this.left),L=t.left,E=b(t.right)-m,w=_+m,M=this.left+u;else if(e==="x"){if(a==="center")_=b((t.top+t.bottom)/2+.5);else if(z(a)){const j=Object.keys(a)[0],U=a[j];_=b(this.chart.scales[j].getPixelForValue(U))}R=t.top,J=t.bottom,k=_+m,A=k+u}else if(e==="y"){if(a==="center")_=b((t.left+t.right)/2);else if(z(a)){const j=Object.keys(a)[0],U=a[j];_=b(this.chart.scales[j].getPixelForValue(U))}w=_-m,M=w-u,L=t.left,E=t.right}const st=O(n.ticks.maxTicksLimit,d),W=Math.max(1,Math.ceil(d/st));for(y=0;y<d;y+=W){const j=this.getContext(y),U=o.setContext(j),ct=r.setContext(j),tt=U.lineWidth,wt=U.color,$t=ct.dash||[],P=ct.dashOffset,S=U.tickWidth,B=U.tickColor,V=U.tickBorderDash||[],bt=U.tickBorderDashOffset;v=ic(this,y,l),v!==void 0&&(x=Kt(s,v,tt),c?w=M=L=E=x:k=A=R=J=x,f.push({tx1:w,ty1:k,tx2:M,ty2:A,x1:L,y1:R,x2:E,y2:J,width:tt,color:wt,borderDash:$t,borderDashOffset:P,tickWidth:S,tickColor:B,tickBorderDash:V,tickBorderDashOffset:bt}))}return this._ticksLength=d,this._borderValue=_,f}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=ge(s.grid),f=u+h,g=d?-h:f,p=-mt(this.labelRotation),m=[];let b,_,y,v,x,w,k,M,A,L,R,E,J="middle";if(n==="top")w=this.bottom-g,k=this._getXAxisLabelAlignment();else if(n==="bottom")w=this.top+g,k=this._getXAxisLabelAlignment();else if(n==="left"){const W=this._getYAxisLabelAlignment(u);k=W.textAlign,x=W.x}else if(n==="right"){const W=this._getYAxisLabelAlignment(u);k=W.textAlign,x=W.x}else if(e==="x"){if(n==="center")w=(t.top+t.bottom)/2+f;else if(z(n)){const W=Object.keys(n)[0],j=n[W];w=this.chart.scales[W].getPixelForValue(j)+f}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")x=(t.left+t.right)/2-f;else if(z(n)){const W=Object.keys(n)[0],j=n[W];x=this.chart.scales[W].getPixelForValue(j)}k=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?J="top":l==="end"&&(J="bottom"));const st=this._getLabelSizes();for(b=0,_=r.length;b<_;++b){y=r[b],v=y.label;const W=o.setContext(this.getContext(b));M=this.getPixelForTick(b)+o.labelOffset,A=this._resolveTickFontOptions(b),L=A.lineHeight,R=K(v)?v.length:1;const j=R/2,U=W.color,ct=W.textStrokeColor,tt=W.textStrokeWidth;let wt=k;a?(x=M,k==="inner"&&(b===_-1?wt=this.options.reverse?"left":"right":b===0?wt=this.options.reverse?"right":"left":wt="center"),n==="top"?c==="near"||p!==0?E=-R*L+L/2:c==="center"?E=-st.highest.height/2-j*L+L:E=-st.highest.height+L/2:c==="near"||p!==0?E=L/2:c==="center"?E=st.highest.height/2-j*L:E=st.highest.height-R*L,d&&(E*=-1),p!==0&&!W.showLabelBackdrop&&(x+=L/2*Math.sin(p))):(w=M,E=(1-R)*L/2);let $t;if(W.showLabelBackdrop){const P=lt(W.backdropPadding),S=st.heights[b],B=st.widths[b];let V=E-P.top,bt=0-P.left;switch(J){case"middle":V-=S/2;break;case"bottom":V-=S;break}switch(k){case"center":bt-=B/2;break;case"right":bt-=B;break;case"inner":b===_-1?bt-=B:b>0&&(bt-=B/2);break}$t={left:bt,top:V,width:B+P.width,height:S+P.height,color:W.backdropColor}}m.push({label:v,font:A,textOffset:E,options:{rotation:p,color:U,strokeColor:ct,strokeWidth:tt,textAlign:wt,textBaseline:J,translation:[x,w],backdrop:$t}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-mt(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,a=this._getLabelSizes(),r=t+o,l=a.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-r,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+r,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:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,a),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,a;const r=(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,a=n.length;o<a;++o){const l=n[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({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()),a=s.display?o.width:0;if(!a)return;const r=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,d,u;this.isHorizontal()?(c=Kt(t,this.left,a)-a/2,h=Kt(t,this.right,r)+r/2,d=u=l):(d=Kt(t,this.top,a)-a/2,u=Kt(t,this.bottom,r)+r/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&oi(s,n);const o=this.getLabelItems(t);for(const a of o){const r=a.options,l=a.font,c=a.label,h=a.textOffset;se(s,c,0,h,l,r)}n&&ai(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=Q(s.font),a=lt(s.padding),r=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||z(e)?(l+=a.bottom,K(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=rc(this,l,e,r);se(t,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:ac(r,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=O(t.grid&&t.grid.z,-1),n=O(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==ne.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,a;for(o=0,a=e.length;o<a;++o){const r=e[o];r[s]===this.id&&(!t||r.type===t)&&n.push(r)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return Q(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class He{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;hc(e)&&(s=this.register(e));const n=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,lc(t,a,s),this.override&&G.override(t.id,t.overrides)),a}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 G[n]&&(delete G[n][s],this.override&&delete ie[s])}}function lc(i,t,e){const s=Se(Object.create(null),[e?G.get(e):{},G.get(t),i.defaults]);G.set(t,s),i.defaultRoutes&&cc(t,i.defaultRoutes),i.descriptors&&G.describe(t,i.descriptors)}function cc(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");G.route(o,n,l,r)})}function hc(i){return"id"in i&&"defaults"in i}class dc{constructor(){this.controllers=new He(jt,"datasets",!0),this.elements=new He(Lt,"elements"),this.plugins=new He(Object,"plugins"),this.scales=new He(ne,"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):H(n,a=>{const r=s||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,s){const n=Ki(t);$(s["before"+n],[],s),e[t](s),$(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 yt=new dc;class uc{constructor(){this._init=void 0}notify(t,e,s,n){if(e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=n?this._descriptors(t).filter(n):this._descriptors(t),a=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,s,n){n=n||{};for(const o of t){const a=o.plugin,r=a[s],l=[e,n,o.options];if($(r,l,a)===!1&&n.cancelable)return!1}return!0}invalidate(){I(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=O(s.options&&s.options.plugins,{}),o=fc(s);return n===!1&&!e?[]:pc(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function fc(i){const t={},e=[],s=Object.keys(yt.plugins.items);for(let o=0;o<s.length;o++)e.push(yt.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const a=n[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function gc(i,t){return!t&&i===!1?null:i===!0?{}:i}function pc(i,{plugins:t,localIds:e},s,n){const o=[],a=i.getContext();for(const r of t){const l=r.id,c=gc(s[l],n);c!==null&&o.push({plugin:r,options:mc(i.config,{plugin:r,local:e[l]},c,a)})}return o}function mc(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),a=i.getOptionScopes(s,o);return e&&t.defaults&&a.push(t.defaults),i.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Li(i,t){const e=G.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function bc(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function _c(i,t){return i===t?"_index_":"_value_"}function nn(i){if(i==="x"||i==="y"||i==="r")return i}function xc(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function Ri(i,...t){if(nn(i))return i;for(const e of t){const s=e.axis||xc(e.position)||i.length>1&&nn(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function on(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function yc(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 on(i,"x",e[0])||on(i,"y",e[0])}return{}}function vc(i,t){const e=ie[i.type]||{scales:{}},s=t.scales||{},n=Li(i.type,t),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!z(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=Ri(a,r,yc(a,i),G.scales[r.type]),c=_c(l,n),h=e.scales||{};o[a]=ye(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||Li(r,t),h=(ie[r]||{}).scales||{};Object.keys(h).forEach(d=>{const u=bc(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),ye(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];ye(r,[G.scales[r.type],G.scale])}),o}function Oo(i){const t=i.options||(i.options={});t.plugins=O(t.plugins,{}),t.scales=vc(i,t)}function To(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function wc(i){return i=i||{},i.data=To(i.data),Oo(i),i}const an=new Map,Lo=new Set;function je(i,t){let e=an.get(i);return e||(e=t(),an.set(i,e),Lo.add(e)),e}const pe=(i,t,e)=>{const s=Nt(t,e);s!==void 0&&i.add(s)};class kc{constructor(t){this._config=wc(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=To(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(),Oo(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return je(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return je(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return je(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return je(`${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,a=this._cachedScopes(t,s),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>pe(l,t,d))),h.forEach(d=>pe(l,n,d)),h.forEach(d=>pe(l,ie[o]||{},d)),h.forEach(d=>pe(l,G,d)),h.forEach(d=>pe(l,Oi,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Lo.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,ie[e]||{},G.datasets[e]||{},{type:e},G,Oi]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=rn(this._resolverCache,t,n);let l=a;if(Sc(a,e)){o.$shared=!1,s=Wt(s)?s():s;const c=this.createResolver(t,s,r);l=ce(a,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=rn(this._resolverCache,t,s);return z(e)?ce(o,e,void 0,n):o}}function rn(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:ts(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}const Mc=i=>z(i)&&Object.getOwnPropertyNames(i).some(t=>Wt(i[t]));function Sc(i,t){const{isScriptable:e,isIndexable:s}=lo(i);for(const n of t){const o=e(n),a=s(n),r=(a||o)&&i[n];if(o&&(Wt(r)||Mc(r))||a&&K(r))return!0}return!1}var Pc="4.5.1";const Cc=["top","bottom","left","right","chartArea"];function ln(i,t){return i==="top"||i==="bottom"||Cc.indexOf(i)===-1&&t==="x"}function cn(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function hn(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),$(e&&e.onComplete,[i],t)}function Dc(i){const t=i.chart,e=t.options.animation;$(e&&e.onProgress,[i],t)}function Ro(i){return ss()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Ke={},dn=i=>{const t=Ro(i);return Object.values(Ke).filter(e=>e.canvas===t).pop()};function Ac(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const a=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=a)}}}function Oc(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}class Ei{static defaults=G;static instances=Ke;static overrides=ie;static registry=yt;static version=Pc;static getChart=dn;static register(...t){yt.add(...t),un()}static unregister(...t){yt.remove(...t),un()}constructor(t,e){const s=this.config=new kc(e),n=Ro(t),o=dn(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 a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Kl(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Sa(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,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 uc,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ha(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Ke[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}St.listen(this,"complete",hn),St.listen(this,"progress",Dc),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return I(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 yt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Rs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Os(this.canvas,this.ctx),this}stop(){return St.stop(this),this}resize(t,e){St.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,a=this.platform.getMaximumSize(n,t,e,o),r=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Rs(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),$(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};H(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=Ri(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),H(o,a=>{const r=a.options,l=r.id,c=Ri(l,r),h=O(r.type,a.dtype);(r.position===void 0||ln(r.position,c)!==ln(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const u=yt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(r,t)}),H(n,(a,r)=>{a||delete s[r]}),H(s,a=>{rt.configure(this,a,a.options),rt.addBox(this,a)})}_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(cn("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 a=this.getDatasetMeta(s);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(s),a=this.getDatasetMeta(s)),a.type=r,a.indexAxis=o.indexAxis||Li(r,this.options),a.order=o.order||0,a.index=s,a.label=""+o.label,a.visible=this.isDatasetVisible(s),a.controller)a.controller.updateIndex(s),a.controller.linkScales();else{const l=yt.getController(r),{datasetElementType:c,dataElementType:h}=G.datasets[r];Object.assign(l,{dataElementType:yt.getElement(h),datasetElementType:c&&yt.getElement(c)}),a.controller=new l(this,s),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){H(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 a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:d}=this.getDatasetMeta(c),u=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=s.layout.autoPadding?a:0,this._updateLayout(a),n||H(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(cn("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){H(this.scales,t=>{rt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!vs(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 a=s==="_removeElements"?-o:o;Ac(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=s(0);for(let o=1;o<e;o++)if(!vs(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;rt.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],H(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,Wt(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&&(St.has(this)?this.attached&&!St.running(this)&&St.start(this):(this.draw(),hn({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 a=e[n];(!t||a.visible)&&s.push(a)}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=yo(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&oi(e,n),t.controller.draw(),n&&ai(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return Tt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Cl.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=Ht(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),a=o.controller._resolveAnimations(void 0,n);Pe(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.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(),St.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(),Os(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ke[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,a)=>{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};H(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 a;const r=()=>{n("attach",r),this.attached=!0,this.resize(),s("resize",o),s("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){H(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},H(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,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[n+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:a})=>{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!Ge(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(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=s?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.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,a=e,r=this._getActiveElements(t,n,s,a),l=Ta(t),c=Oc(t,this._lastEvent,s,l);s&&(this._lastEvent=null,$(o.onHover,[t,r,this],this),l&&$(o.onClick,[t,r,this],this));const h=!Ge(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,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)}}function un(){return H(Ei.instances,i=>i._plugins.invalidate())}function Tc(i,t,e){const{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/a,at(s-e));if(i.beginPath(),i.arc(n,o,a-c/2,s+d/2,e-d/2),r>0){const u=Math.min(c/r,at(s-e));i.arc(n,o,r+c/2,e-u/2,s+u/2,!0)}else{const u=Math.min(c/2,a*at(s-e));if(h==="round")i.arc(n,o,u,e-N/2,s+N/2,!0);else if(h==="bevel"){const f=2*u*u,g=-f*Math.cos(e+N/2)+n,p=-f*Math.sin(e+N/2)+o,m=f*Math.cos(s+N/2)+n,b=f*Math.sin(s+N/2)+o;i.lineTo(g,p),i.lineTo(m,b)}}i.closePath(),i.moveTo(0,0),i.rect(0,0,i.canvas.width,i.canvas.height),i.clip("evenodd")}function Lc(i,t,e){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=n/r;i.beginPath(),i.arc(o,a,r,s-c,e+c),l>n?(c=n/l,i.arc(o,a,l,e+c,s-c,!0)):i.arc(o,a,n,e+Z,s-Z),i.closePath(),i.clip()}function Rc(i){return Qi(i,["outerStart","outerEnd","innerStart","innerEnd"])}function Ec(i,t,e,s){const n=Rc(i.options.borderRadius),o=(e-t)/2,a=Math.min(o,s*t/2),r=l=>{const c=(e-Math.min(o,l))*s/2;return et(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:et(n.innerStart,0,a),innerEnd:et(n.innerEnd,0,a)}}function ae(i,t,e,s){return{x:e+i*Math.cos(t),y:s+i*Math.sin(t)}}function ei(i,t,e,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+s+e-c,0),u=h>0?h+s+e+c:0;let f=0;const g=n-l;if(s){const W=h>0?h-s:0,j=d>0?d-s:0,U=(W+j)/2,ct=U!==0?g*U/(U+s):g;f=(g-ct)/2}const p=Math.max(.001,g*d-e/N)/d,m=(g-p)/2,b=l+m+f,_=n-m-f,{outerStart:y,outerEnd:v,innerStart:x,innerEnd:w}=Ec(t,u,d,_-b),k=d-y,M=d-v,A=b+y/k,L=_-v/M,R=u+x,E=u+w,J=b+x/R,st=_-w/E;if(i.beginPath(),o){const W=(A+L)/2;if(i.arc(a,r,d,A,W),i.arc(a,r,d,W,L),v>0){const tt=ae(M,L,a,r);i.arc(tt.x,tt.y,v,L,_+Z)}const j=ae(E,_,a,r);if(i.lineTo(j.x,j.y),w>0){const tt=ae(E,st,a,r);i.arc(tt.x,tt.y,w,_+Z,st+Math.PI)}const U=(_-w/u+(b+x/u))/2;if(i.arc(a,r,u,_-w/u,U,!0),i.arc(a,r,u,U,b+x/u,!0),x>0){const tt=ae(R,J,a,r);i.arc(tt.x,tt.y,x,J+Math.PI,b-Z)}const ct=ae(k,b,a,r);if(i.lineTo(ct.x,ct.y),y>0){const tt=ae(k,A,a,r);i.arc(tt.x,tt.y,y,b-Z,A)}}else{i.moveTo(a,r);const W=Math.cos(A)*d+a,j=Math.sin(A)*d+r;i.lineTo(W,j);const U=Math.cos(L)*d+a,ct=Math.sin(L)*d+r;i.lineTo(U,ct)}i.closePath()}function Ic(i,t,e,s,n){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){ei(i,t,e,s,l,n);for(let c=0;c<o;++c)i.fill();isNaN(r)||(l=a+(r%Y||Y))}return ei(i,t,e,s,l,n),i.fill(),l}function Fc(i,t,e,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g=l.borderAlign==="inner";if(!c)return;i.setLineDash(d||[]),i.lineDashOffset=u,g?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let p=t.endAngle;if(o){ei(i,t,e,s,p,n);for(let m=0;m<o;++m)i.stroke();isNaN(r)||(p=a+(r%Y||Y))}g&&Lc(i,t,p),l.selfJoin&&p-a>=N&&f===0&&h!=="miter"&&Tc(i,t,p),o||(ei(i,t,e,s,p,n),i.stroke())}class zc extends Lt{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,s){const n=this.getProps(["x","y"],s),{angle:o,distance:a}=Jn(n,{x:t,y:e}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),u=(this.options.spacing+this.options.borderWidth)/2,f=O(d,l-r),g=Ce(o,r,l)&&r!==l,p=f>=Y||g,m=At(a,c+u,h+u);return p&&m}getCenterPoint(t){const{x:e,y:s,startAngle:n,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(a+r+c+l)/2;return{x:e+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:s}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=s>Y?Math.floor(s/Y):0,s===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const l=1-Math.sin(Math.min(N,s||0)),c=n*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,Ic(t,this,c,o,a),Fc(t,this,c,o,a),t.restore()}}function Eo(i,t,e=t){i.lineCap=O(e.borderCapStyle,t.borderCapStyle),i.setLineDash(O(e.borderDash,t.borderDash)),i.lineDashOffset=O(e.borderDashOffset,t.borderDashOffset),i.lineJoin=O(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=O(e.borderWidth,t.borderWidth),i.strokeStyle=O(e.borderColor,t.borderColor)}function Bc(i,t,e){i.lineTo(e.x,e.y)}function Vc(i){return i.stepped?tr:i.tension||i.cubicInterpolationMode==="monotone"?er:Bc}function Io(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:a,end:r}=t,l=Math.max(n,a),c=Math.min(o,r),h=n<a&&o<a||n>r&&o>r;return{count:s,start:l,loop:t.loop,ilen:c<l&&!h?s+c-l:c-l}}function Nc(i,t,e,s){const{points:n,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Io(n,e,s),h=Vc(o);let{move:d=!0,reverse:u}=s||{},f,g,p;for(f=0;f<=c;++f)g=n[(r+(u?c-f:f))%a],!g.skip&&(d?(i.moveTo(g.x,g.y),d=!1):h(i,p,g,u,o.stepped),p=g);return l&&(g=n[(r+(u?c:0))%a],h(i,p,g,u,o.stepped)),!!l}function Wc(i,t,e,s){const n=t.points,{count:o,start:a,ilen:r}=Io(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,d=0,u,f,g,p,m,b;const _=v=>(a+(c?r-v:v))%o,y=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(f=n[_(0)],i.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=n[_(u)],f.skip)continue;const v=f.x,x=f.y,w=v|0;w===g?(x<p?p=x:x>m&&(m=x),h=(d*h+v)/++d):(y(),i.lineTo(v,x),g=w,d=0,p=m=x),b=x}y()}function Ii(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Wc:Nc}function Hc(i){return i.stepped?Rr:i.tension||i.cubicInterpolationMode==="monotone"?Er:Jt}function jc(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Eo(i,t.options),i.stroke(n)}function $c(i,t,e,s){const{segments:n,options:o}=t,a=Ii(t);for(const r of n)Eo(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Yc=typeof Path2D=="function";function Uc(i,t,e,s){Yc&&!t.options.segment?jc(i,t,e,s):$c(i,t,e,s)}class ci extends Lt{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};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;Sr(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=Nr(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,a=xo(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=Hc(s);let c,h;for(c=0,h=a.length;c<h;++c){const{start:d,end:u}=a[c],f=o[d],g=o[u];if(f===g){r.push(f);continue}const p=Math.abs((n-f[e])/(g[e]-f[e])),m=l(f,g,p,s.stepped);m[e]=t[e],r.push(m)}return r.length===1?r[0]:r}pathSegment(t,e,s){return Ii(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=Ii(this);let a=this._loop;e=e||0,s=s||this.points.length-e;for(const r of n)a&=o(t,this,r,{start:e,end:e+s-1});return!!a}draw(t,e,s,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Uc(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function fn(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class Xc extends Lt{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,s){const n=this.options,{x:o,y:a}=this.getProps(["x","y"],s);return Math.pow(t-o,2)+Math.pow(e-a,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return fn(this,t,"x",e)}inYRange(t,e){return fn(this,t,"y",e)}getCenterPoint(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const s=e&&t.borderWidth||0;return(e+s)*2}draw(t,e){const s=this.options;this.skip||s.radius<.1||!Tt(this,e,this.size(s)/2)||(t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.fillStyle=s.backgroundColor,Ti(t,s,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Fo(i,t){const{x:e,y:s,base:n,width:o,height:a}=i.getProps(["x","y","base","width","height"],t);let r,l,c,h,d;return i.horizontal?(d=a/2,r=Math.min(e,n),l=Math.max(e,n),c=s-d,h=s+d):(d=o/2,r=e-d,l=e+d,c=Math.min(s,n),h=Math.max(s,n)),{left:r,top:c,right:l,bottom:h}}function Bt(i,t,e,s){return i?0:et(t,e,s)}function Kc(i,t,e){const s=i.options.borderWidth,n=i.borderSkipped,o=ro(s);return{t:Bt(n.top,o.top,0,e),r:Bt(n.right,o.right,0,t),b:Bt(n.bottom,o.bottom,0,e),l:Bt(n.left,o.left,0,t)}}function Gc(i,t,e){const{enableBorderRadius:s}=i.getProps(["enableBorderRadius"]),n=i.options.borderRadius,o=te(n),a=Math.min(t,e),r=i.borderSkipped,l=s||z(n);return{topLeft:Bt(!l||r.top||r.left,o.topLeft,0,a),topRight:Bt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Bt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Bt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function qc(i){const t=Fo(i),e=t.right-t.left,s=t.bottom-t.top,n=Kc(i,e/2,s/2),o=Gc(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 wi(i,t,e,s){const n=t===null,o=e===null,r=i&&!(n&&o)&&Fo(i,s);return r&&(n||At(t,r.left,r.right))&&(o||At(e,r.top,r.bottom))}function Zc(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Jc(i,t){i.rect(t.x,t.y,t.w,t.h)}function ki(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,a=(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+a,radius:i.radius}}class Qc extends Lt{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};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:a}=qc(this),r=Zc(a.radius)?De:Jc;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,ki(a,e,o)),t.clip(),r(t,ki(o,-e,a)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),r(t,ki(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,s){return wi(this,t,e,s)}inXRange(t,e){return wi(this,t,null,e)}inYRange(t,e){return wi(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}}var th=Object.freeze({__proto__:null,ArcElement:zc,BarElement:Qc,LineElement:ci,PointElement:Xc});const Fi=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],gn=Fi.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));function zo(i){return Fi[i%Fi.length]}function Bo(i){return gn[i%gn.length]}function eh(i,t){return i.borderColor=zo(t),i.backgroundColor=Bo(t),++t}function ih(i,t){return i.backgroundColor=i.data.map(()=>zo(t++)),t}function sh(i,t){return i.backgroundColor=i.data.map(()=>Bo(t++)),t}function nh(i){let t=0;return(e,s)=>{const n=i.getDatasetMeta(s).controller;n instanceof os?t=ih(e,t):n instanceof Mo?t=sh(e,t):n&&(t=eh(e,t))}}function pn(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function oh(i){return i&&(i.borderColor||i.backgroundColor)}function ah(){return G.borderColor!=="rgba(0,0,0,0.1)"||G.backgroundColor!=="rgba(0,0,0,0.1)"}var rh={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;const{data:{datasets:s},options:n}=i.config,{elements:o}=n,a=pn(s)||oh(n)||o&&pn(o)||ah();if(!e.forceOverride&&a)return;const r=nh(i);s.forEach(r)}};function lh(i,t,e,s,n){const o=n.samples||s;if(o>=e)return i.slice(t,t+e);const a=[],r=(e-2)/(o-2);let l=0;const c=t+e-1;let h=t,d,u,f,g,p;for(a[l++]=i[h],d=0;d<o-2;d++){let m=0,b=0,_;const y=Math.floor((d+1)*r)+1+t,v=Math.min(Math.floor((d+2)*r)+1,e)+t,x=v-y;for(_=y;_<v;_++)m+=i[_].x,b+=i[_].y;m/=x,b/=x;const w=Math.floor(d*r)+1+t,k=Math.min(Math.floor((d+1)*r)+1,e)+t,{x:M,y:A}=i[h];for(f=g=-1,_=w;_<k;_++)g=.5*Math.abs((M-m)*(i[_].y-A)-(M-i[_].x)*(b-A)),g>f&&(f=g,u=i[_],p=_);a[l++]=u,h=p}return a[l++]=i[c],a}function ch(i,t,e,s){let n=0,o=0,a,r,l,c,h,d,u,f,g,p;const m=[],b=t+e-1,_=i[t].x,v=i[b].x-_;for(a=t;a<t+e;++a){r=i[a],l=(r.x-_)/v*s,c=r.y;const x=l|0;if(x===h)c<g?(g=c,d=a):c>p&&(p=c,u=a),n=(o*n+r.x)/++o;else{const w=a-1;if(!I(d)&&!I(u)){const k=Math.min(d,u),M=Math.max(d,u);k!==f&&k!==w&&m.push({...i[k],x:n}),M!==f&&M!==w&&m.push({...i[M],x:n})}a>0&&w!==f&&m.push(i[w]),m.push(r),h=x,o=0,g=p=c,d=u=f=a}}return m}function Vo(i){if(i._decimated){const t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function mn(i){i.data.datasets.forEach(t=>{Vo(t)})}function hh(i,t){const e=t.length;let s=0,n;const{iScale:o}=i,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(s=et(Ot(t,o.axis,a).lo,0,e-1)),c?n=et(Ot(t,o.axis,r).hi+1,s,e)-s:n=e-s,{start:s,count:n}}var dh={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){mn(i);return}const s=i.width;i.data.datasets.forEach((n,o)=>{const{_data:a,indexAxis:r}=n,l=i.getDatasetMeta(o),c=a||n.data;if(be([r,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=i.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||i.options.parsing)return;let{start:d,count:u}=hh(l,c);const f=e.threshold||4*s;if(u<=f){Vo(n);return}I(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=lh(c,d,u,s,e);break;case"min-max":g=ch(c,d,u,s);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=g})},destroy(i){mn(i)}};function uh(i,t,e){const s=i.segments,n=i.points,o=t.points,a=[];for(const r of s){let{start:l,end:c}=r;c=hi(l,c,n);const h=zi(e,n[l],n[c],r.loop);if(!t.segments){a.push({source:r,target:h,start:n[l],end:n[c]});continue}const d=xo(t,h);for(const u of d){const f=zi(e,o[u.start],o[u.end],u.loop),g=_o(r,n,f);for(const p of g)a.push({source:p,target:u,start:{[e]:bn(h,f,"start",Math.max)},end:{[e]:bn(h,f,"end",Math.min)}})}}return a}function zi(i,t,e,s){if(s)return;let n=t[i],o=e[i];return i==="angle"&&(n=at(n),o=at(o)),{property:i,start:n,end:o}}function fh(i,t){const{x:e=null,y:s=null}=i||{},n=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=hi(a,r,n);const l=n[a],c=n[r];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 hi(i,t,e){for(;t>i;t--){const s=e[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function bn(i,t,e,s){return i&&t?s(i[e],t[e]):i?i[e]:t?t[e]:0}function No(i,t){let e=[],s=!1;return K(i)?(s=!0,e=i):e=fh(i,t),e.length?new ci({points:e,options:{tension:0},_loop:s,_fullLoop:s}):null}function _n(i){return i&&i.fill!==!1}function gh(i,t,e){let n=i[t].fill;const o=[t];let a;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!q(n))return n;if(a=i[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function ph(i,t,e){const s=xh(i);if(z(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return q(n)&&Math.floor(n)===n?mh(s[0],t,n,e):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function mh(i,t,e,s){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=s?!1:e}function bh(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:z(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function _h(i,t,e){let s;return i==="start"?s=e:i==="end"?s=t.options.reverse?t.min:t.max:z(i)?s=i.value:s=t.getBaseValue(),s}function xh(i){const t=i.options,e=t.fill;let s=O(e&&e.target,e);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function yh(i){const{scale:t,index:e,line:s}=i,n=[],o=s.segments,a=s.points,r=vh(t,e);r.push(No({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++)wh(n,a[h],r)}return new ci({points:n,options:{}})}function vh(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 wh(i,t,e){const s=[];for(let n=0;n<e.length;n++){const o=e[n],{first:a,last:r,point:l}=kh(o,t,"x");if(!(!l||a&&r)){if(a)s.unshift(l);else if(i.push(l),!r)break}}i.push(...s)}function kh(i,t,e){const s=i.interpolate(t,e);if(!s)return{};const n=s[e],o=i.segments,a=i.points;let r=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],d=a[h.start][e],u=a[h.end][e];if(At(n,d,u)){r=n===d,l=n===u;break}}return{first:r,last:l,point:s}}class Wo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,s){const{x:n,y:o,radius:a}=this;return e=e||{start:0,end:Y},t.arc(n,o,a,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 Mh(i){const{chart:t,fill:e,line:s}=i;if(q(e))return Sh(t,e);if(e==="stack")return yh(i);if(e==="shape")return!0;const n=Ph(i);return n instanceof Wo?n:No(n,s)}function Sh(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function Ph(i){return(i.scale||{}).getPointPositionForValue?Dh(i):Ch(i)}function Ch(i){const{scale:t={},fill:e}=i,s=bh(e,t);if(q(s)){const n=t.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function Dh(i){const{scale:t,fill:e}=i,s=t.options,n=t.getLabels().length,o=s.reverse?t.max:t.min,a=_h(e,t,o),r=[];if(s.grid.circular){const l=t.getPointPositionForValue(0,o);return new Wo({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<n;++l)r.push(t.getPointPositionForValue(l,a));return r}function Mi(i,t,e){const s=Mh(t),{chart:n,index:o,line:a,scale:r,axis:l}=t,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:f=d}=h||{},g=n.getDatasetMeta(o),p=yo(n,g);s&&a.points.length&&(oi(i,e),Ah(i,{line:a,target:s,above:u,below:f,area:e,scale:r,axis:l,clip:p}),ai(i))}function Ah(i,t){const{line:e,target:s,above:n,below:o,area:a,scale:r,clip:l}=t,c=e._loop?"angle":t.axis;i.save();let h=o;o!==n&&(c==="x"?(xn(i,s,a.top),Si(i,{line:e,target:s,color:n,scale:r,property:c,clip:l}),i.restore(),i.save(),xn(i,s,a.bottom)):c==="y"&&(yn(i,s,a.left),Si(i,{line:e,target:s,color:o,scale:r,property:c,clip:l}),i.restore(),i.save(),yn(i,s,a.right),h=n)),Si(i,{line:e,target:s,color:h,scale:r,property:c,clip:l}),i.restore()}function xn(i,t,e){const{segments:s,points:n}=t;let o=!0,a=!1;i.beginPath();for(const r of s){const{start:l,end:c}=r,h=n[l],d=n[hi(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),a=!!t.pathSegment(i,r,{move:a}),a?i.closePath():i.lineTo(d.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function yn(i,t,e){const{segments:s,points:n}=t;let o=!0,a=!1;i.beginPath();for(const r of s){const{start:l,end:c}=r,h=n[l],d=n[hi(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(e,h.y),i.lineTo(h.x,h.y)),a=!!t.pathSegment(i,r,{move:a}),a?i.closePath():i.lineTo(e,d.y)}i.lineTo(e,t.first().y),i.closePath(),i.clip()}function Si(i,t){const{line:e,target:s,property:n,color:o,scale:a,clip:r}=t,l=uh(e,s,n);for(const{source:c,target:h,start:d,end:u}of l){const{style:{backgroundColor:f=o}={}}=c,g=s!==!0;i.save(),i.fillStyle=f,Oh(i,a,r,g&&zi(n,d,u)),i.beginPath();const p=!!e.pathSegment(i,c);let m;if(g){p?i.closePath():vn(i,s,u,n);const b=!!s.pathSegment(i,h,{move:p,reverse:!0});m=p&&b,m||vn(i,s,d,n)}i.closePath(),i.fill(m?"evenodd":"nonzero"),i.restore()}}function Oh(i,t,e,s){const n=t.chart.chartArea,{property:o,start:a,end:r}=s||{};if(o==="x"||o==="y"){let l,c,h,d;o==="x"?(l=a,c=n.top,h=r,d=n.bottom):(l=n.left,c=a,h=n.right,d=r),i.beginPath(),e&&(l=Math.max(l,e.left),h=Math.min(h,e.right),c=Math.max(c,e.top),d=Math.min(d,e.bottom)),i.rect(l,c,h-l,d-c),i.clip()}}function vn(i,t,e,s){const n=t.interpolate(e,s);n&&i.lineTo(n.x,n.y)}var Th={id:"filler",afterDatasetsUpdate(i,t,e){const s=(i.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=i.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof ci&&(l={visible:i.isDatasetVisible(a),index:a,fill:ph(r,a,s),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],!(!l||l.fill===!1)&&(l.fill=gh(n,a,e.propagate))},beforeDraw(i,t,e){const s=e.drawTime==="beforeDraw",n=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let a=n.length-1;a>=0;--a){const r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),s&&r.fill&&Mi(i.ctx,r,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;_n(o)&&Mi(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const s=t.meta.$filler;!_n(s)||e.drawTime!=="beforeDatasetDraw"||Mi(i.ctx,s,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const wn=(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)}},Lh=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class kn 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=$(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=Q(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=wn(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,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:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-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*r>a)&&(d+=h,c[c.length-(p>0?0:1)]=0,f+=h,u++),l[p]={left:0,top:f,row:u,width:m,height:n},c[c.length-1]+=m+r}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,u=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:_,itemHeight:y}=Rh(s,e,o,m,n);b>0&&f+y+2*r>h&&(d+=u+r,c.push({width:u,height:f}),g+=u+r,p++,u=f=0),l[b]={left:g,top:f,col:p,width:_,height:y},u=Math.max(u,_),f+=y+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,a=re(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=ot(s,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=ot(s,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=ot(s,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=ot(s,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.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;oi(t,this),this._draw(),ai(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:a}=t,r=G.color,l=re(t.rtl,this.left,this.width),c=Q(a.font),{padding:h}=a,d=c.size,u=d/2;let f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=wn(a,d),b=function(w,k,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;n.save();const A=O(M.lineWidth,1);if(n.fillStyle=O(M.fillStyle,r),n.lineCap=O(M.lineCap,"butt"),n.lineDashOffset=O(M.lineDashOffset,0),n.lineJoin=O(M.lineJoin,"miter"),n.lineWidth=A,n.strokeStyle=O(M.strokeStyle,r),n.setLineDash(O(M.lineDash,[])),a.usePointStyle){const L={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:A},R=l.xPlus(w,g/2),E=k+u;ao(n,L,R,E,a.pointStyleWidth&&g)}else{const L=k+Math.max((d-p)/2,0),R=l.leftForLtr(w,g),E=te(M.borderRadius);n.beginPath(),Object.values(E).some(J=>J!==0)?De(n,{x:R,y:L,w:g,h:p,radius:E}):n.rect(R,L,g,p),n.fill(),A!==0&&n.stroke()}n.restore()},_=function(w,k,M){se(n,M.text,w,k+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?f={x:ot(o,this.left+h,this.right-s[0]),y:this.top+h+v,line:0}:f={x:this.left+h,y:ot(o,this.top+v+h,this.bottom-e[0].height),line:0},po(this.ctx,t.textDirection);const x=m+h;this.legendItems.forEach((w,k)=>{n.strokeStyle=w.fontColor,n.fillStyle=w.fontColor;const M=n.measureText(w.text).width,A=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),L=g+u+M;let R=f.x,E=f.y;l.setWidth(this.width),y?k>0&&R+L+h>this.right&&(E=f.y+=x,f.line++,R=f.x=ot(o,this.left+h,this.right-s[f.line])):k>0&&E+x>this.bottom&&(R=f.x=R+e[f.line].width+h,f.line++,E=f.y=ot(o,this.top+v+h,this.bottom-e[f.line].height));const J=l.x(R);if(b(J,E,w),R=ja(A,R+g+u,y?R+L:this.right,t.rtl),_(l.x(R),E,w),y)f.x+=L+h;else if(typeof w.text!="string"){const st=c.lineHeight;f.y+=Ho(w,st)+h}else f.y+=x}),mo(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=Q(e.font),n=lt(e.padding);if(!e.display)return;const o=re(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=ot(t.align,d,this.right-u);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+ot(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=ot(r,d,d+u);a.textAlign=o.textAlign(Zi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,se(a,e.text,f,h,s)}_computeTitleHeight(){const t=this.options.title,e=Q(t.font),s=lt(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(At(t,this.left,this.right)&&At(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],At(t,n.left,n.left+n.width)&&At(e,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(t){const e=this.options;if(!Fh(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=Lh(n,s);n&&!o&&$(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&$(e.onHover,[t,s,this],this)}else s&&$(e.onClick,[t,s,this],this)}}function Rh(i,t,e,s,n){const o=Eh(s,i,t,e),a=Ih(n,s,t.lineHeight);return{itemWidth:o,itemHeight:a}}function Eh(i,t,e,s){let n=i.text;return n&&typeof n!="string"&&(n=n.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+s.measureText(n).width}function Ih(i,t,e){let s=i;return typeof t.text!="string"&&(s=Ho(t,e)),s}function Ho(i,t){const e=i.text?i.text.length:0;return t*e}function Fh(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var zh={id:"legend",_element:kn,start(i,t,e){const s=i.legend=new kn({ctx:i.ctx,options:e,chart:i});rt.configure(i,s,e),rt.addBox(i,s)},stop(i){rt.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;rt.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:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=lt(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:a&&(r||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 rs 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=K(s.text)?s.text.length:1;this._padding=lt(s.padding);const o=n*Q(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:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=ot(r,s,o),d=e+t,c=o-s):(a.position==="left"?(h=s+t,d=ot(r,n,e),l=N*-.5):(h=o-t,d=ot(r,e,n),l=N*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=Q(e.font),o=s.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);se(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Zi(e.align),textBaseline:"middle",translation:[a,r]})}}function Bh(i,t){const e=new rs({ctx:i.ctx,options:t,chart:i});rt.configure(i,e,t),rt.addBox(i,e),i.titleBlock=e}var Vh={id:"title",_element:rs,start(i,t,e){Bh(i,e)},stop(i){const t=i.titleBlock;rt.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;rt.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 $e=new WeakMap;var Nh={id:"subtitle",start(i,t,e){const s=new rs({ctx:i.ctx,options:e,chart:i});rt.configure(i,s,e),rt.addBox(i,s),$e.set(i,s)},stop(i){rt.removeBox(i,$e.get(i)),$e.delete(i)},beforeUpdate(i,t,e){const s=$e.get(i);rt.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const xe={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 r=i[t].element;if(r&&r.hasValue()){const l=r.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((r,l)=>r+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,a,r;for(o=0,a=i.length;o<a;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Ai(t,c);h<n&&(n=h,r=l)}}if(r){const l=r.tooltipPosition();e=l.x,s=l.y}return{x:e,y:s}}};function xt(i,t){return t&&(K(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function Pt(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
`)>-1?i.split(`
`):i}function Wh(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:i,label:a,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Mn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=Q(t.bodyFont),c=Q(t.titleFont),h=Q(t.footerFont),d=o.length,u=n.length,f=s.length,g=lt(t.padding);let p=g.height,m=0,b=s.reduce((v,x)=>v+x.before.length+x.lines.length+x.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;p+=f*v+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let _=0;const y=function(v){m=Math.max(m,e.measureText(v).width+_)};return e.save(),e.font=c.string,H(i.title,y),e.font=l.string,H(i.beforeBody.concat(i.afterBody),y),_=t.displayColors?a+2+t.boxPadding:0,H(s,v=>{H(v.before,y),H(v.lines,y),H(v.after,y)}),_=0,e.font=h.string,H(i.footer,y),e.restore(),m+=g.width,{width:m,height:p}}function Hh(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function jh(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function $h(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),jh(c,i,t,e)&&(c="center"),c}function Sn(i,t,e){const s=e.yAlign||t.yAlign||Hh(i,e);return{xAlign:e.xAlign||t.xAlign||$h(i,t,e,s),yAlign:s}}function Yh(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Uh(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Pn(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=te(a);let g=Yh(t,r);const p=Uh(t,l,c);return l==="center"?r==="left"?g+=c:r==="right"&&(g-=c):r==="left"?g-=Math.max(h,u)+n:r==="right"&&(g+=Math.max(d,f)+n),{x:et(g,0,s.width-t.width),y:et(p,0,s.height-t.height)}}function Ye(i,t,e){const s=lt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function Cn(i){return xt([],Pt(i))}function Xh(i,t,e){return Ht(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Dn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const jo={beforeTitle:Mt,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:Mt,beforeBody:Mt,beforeLabel:Mt,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 I(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:Mt,afterBody:Mt,beforeFooter:Mt,footer:Mt,afterFooter:Mt};function ht(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?jo[t].call(e,s):n}class An extends Lt{static positioners=xe;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 vo(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Xh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=ht(s,"beforeTitle",this,t),o=ht(s,"title",this,t),a=ht(s,"afterTitle",this,t);let r=[];return r=xt(r,Pt(n)),r=xt(r,Pt(o)),r=xt(r,Pt(a)),r}getBeforeBody(t,e){return Cn(ht(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return H(t,o=>{const a={before:[],lines:[],after:[]},r=Dn(s,o);xt(a.before,Pt(ht(r,"beforeLabel",this,o))),xt(a.lines,ht(r,"label",this,o)),xt(a.after,Pt(ht(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return Cn(ht(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=ht(s,"beforeFooter",this,t),o=ht(s,"footer",this,t),a=ht(s,"afterFooter",this,t);let r=[];return r=xt(r,Pt(n)),r=xt(r,Pt(o)),r=xt(r,Pt(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(Wh(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,u)=>t.filter(h,d,u,s))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,s))),H(r,h=>{const d=Dn(t.callbacks,h);n.push(ht(d,"labelColor",this,h)),o.push(ht(d,"labelPointStyle",this,h)),a.push(ht(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const r=xe[s.position].call(this,n,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);const l=this._size=Mn(this,s),c=Object.assign({},r,l),h=Sn(this.chart,s,c),d=Pn(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,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:a,cornerRadius:r}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=te(r),{x:u,y:f}=t,{width:g,height:p}=e;let m,b,_,y,v,x;return o==="center"?(v=f+p/2,n==="left"?(m=u,b=m-a,y=v+a,x=v-a):(m=u+g,b=m+a,y=v-a,x=v+a),_=m):(n==="left"?b=u+Math.max(l,h)+a:n==="right"?b=u+g-Math.max(c,d)-a:b=this.caretX,o==="top"?(y=f,v=y-a,m=b-a,_=b+a):(y=f+p,v=y+a,m=b+a,_=b-a),x=y),{x1:m,x2:b,x3:_,y1:y,y2:v,y3:x}}drawTitle(t,e,s){const n=this.title,o=n.length;let a,r,l;if(o){const c=re(s.rtl,this.x,this.width);for(t.x=Ye(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",a=Q(s.titleFont),r=s.titleSpacing,e.fillStyle=s.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=s.titleMarginBottom-r)}}_drawColorBox(t,e,s,n,o){const a=this.labelColors[s],r=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,h=Q(o.bodyFont),d=Ye(this,"left",o),u=n.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},m=n.leftForLtr(u,c)+c/2,b=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ti(t,p,m,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Ti(t,p,m,b)}else{t.lineWidth=z(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const p=n.leftForLtr(u,c),m=n.leftForLtr(n.xPlus(u,1),c-2),b=te(a.borderRadius);Object.values(b).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,De(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),De(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=a.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:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=Q(s.bodyFont);let u=d.lineHeight,f=0;const g=re(s.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+u/2),t.y+=u+o},m=g.textAlign(a);let b,_,y,v,x,w,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Ye(this,m,s),e.fillStyle=s.bodyColor,H(this.beforeBody,p),f=r&&m!=="right"?a==="center"?c/2+h:c+2+h:0,v=0,w=n.length;v<w;++v){for(b=n[v],_=this.labelTextColors[v],e.fillStyle=_,H(b.before,p),y=b.lines,r&&y.length&&(this._drawColorBox(e,t,v,g,s),u=Math.max(d.lineHeight,l)),x=0,k=y.length;x<k;++x)p(y[x]),u=d.lineHeight;H(b.after,p)}f=0,u=d.lineHeight,H(this.afterBody,p),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let a,r;if(o){const l=re(s.rtl,this.x,this.width);for(t.x=Ye(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",a=Q(s.footerFont),e.fillStyle=s.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(n[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s.footerSpacing}}drawBackground(t,e,s,n){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:h}=s,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=te(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,s,n),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(r+c,l+h-g),e.quadraticCurveTo(r+c,l+h,r+c-g,l+h),a==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(r+f,l+h),e.quadraticCurveTo(r,l+h,r,l+h-f),a==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,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 a=xe[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Mn(this,t),l=Object.assign({},a,this._size),c=Sn(e,t,l),h=Pn(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.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 a=lt(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),po(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),mo(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!Ge(s,n),a=this._positionChanged(n,e);(o||a)&&(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||[],a=this._getActiveElements(t,o,e,s),r=this._positionChanged(a,t),l=e||!Ge(a,o)||r;return l&&(this._active=a,(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(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,a=xe[o.position].call(this,t,e);return a!==!1&&(s!==a.x||n!==a.y)}}var Kh={id:"tooltip",_element:An,positioners:xe,afterInit(i,t,e){e&&(i.tooltip=new An({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:jo},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"]},Gh=Object.freeze({__proto__:null,Colors:rh,Decimation:dh,Filler:Th,Legend:zh,SubTitle:Nh,Title:Vh,Tooltip:Kh});const qh=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Zh(i,t,e,s){const n=i.indexOf(t);if(n===-1)return qh(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Jh=(i,t)=>i===null?null:et(Math.round(i),0,t);function On(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class Qh extends ne{static id="category";static defaults={ticks:{callback:On}};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(I(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:Zh(s,t,O(e,t),this._addedLabels),Jh(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 a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){return On.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}}function td(i,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,g=h-1,{min:p,max:m}=t,b=!I(a),_=!I(r),y=!I(c),v=(m-p)/(d+1);let x=ks((m-p)/g/f)*f,w,k,M,A;if(x<1e-14&&!b&&!_)return[{value:p},{value:m}];A=Math.ceil(m/x)-Math.floor(p/x),A>g&&(x=ks(A*x/g/f)*f),I(l)||(w=Math.pow(10,l),x=Math.ceil(x*w)/w),n==="ticks"?(k=Math.floor(p/x)*x,M=Math.ceil(m/x)*x):(k=p,M=m),b&&_&&o&&Fa((r-a)/o,x/1e3)?(A=Math.round(Math.min((r-a)/x,h)),x=(r-a)/A,k=a,M=r):y?(k=b?a:k,M=_?r:M,A=c-1,x=(M-k)/A):(A=(M-k)/x,ve(A,Math.round(A),x/1e3)?A=Math.round(A):A=Math.ceil(A));const L=Math.max(Ms(x),Ms(k));w=Math.pow(10,I(l)?L:l),k=Math.round(k*w)/w,M=Math.round(M*w)/w;let R=0;for(b&&(u&&k!==a?(e.push({value:a}),k<a&&R++,ve(Math.round((k+R*x)*w)/w,a,Tn(a,v,i))&&R++):k<a&&R++);R<A;++R){const E=Math.round((k+R*x)*w)/w;if(_&&E>r)break;e.push({value:E})}return _&&u&&M!==r?e.length&&ve(e[e.length-1].value,r,Tn(r,v,i))?e[e.length-1].value=r:e.push({value:r}):(!_||M===r)&&e.push({value:M}),e}function Tn(i,t,{horizontal:e,minRotation:s}){const n=mt(s),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class ii extends ne{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 I(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 a=l=>n=e?n:l,r=l=>o=s?o:l;if(t){const l=vt(n),c=vt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(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,a=td(n,o);return t.bounds==="ticks"&&Zn(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}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 Le(t,this.chart.options.locale,this.options.ticks.format)}}class ed extends ii{static id="linear";static defaults={ticks:{callback:ni.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=q(t)?t:0,this.max=q(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=mt(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}}const Oe=i=>Math.floor(Ft(i)),qt=(i,t)=>Math.pow(10,Oe(i)+t);function Ln(i){return i/Math.pow(10,Oe(i))===1}function Rn(i,t,e){const s=Math.pow(10,e),n=Math.floor(i/s);return Math.ceil(t/s)-n}function id(i,t){const e=t-i;let s=Oe(e);for(;Rn(i,t,s)>10;)s++;for(;Rn(i,t,s)<10;)s--;return Math.min(s,Oe(i))}function sd(i,{min:t,max:e}){t=ut(i.min,t);const s=[],n=Oe(t);let o=id(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),u=ut(i.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<e;)s.push({value:u,major:Ln(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;const f=ut(i.max,u);return s.push({value:f,major:Ln(f),significand:d}),s}class nd extends ne{static id="logarithmic";static defaults={ticks:{callback:ni.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=ii.prototype.parse.apply(this,[t,e]);if(s===0){this._zero=!0;return}return q(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=q(t)?Math.max(0,t):null,this.max=q(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!q(this._userMin)&&(this.min=t===qt(this.min,0)?qt(this.min,-1):qt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,n=this.max;const o=r=>s=t?s:r,a=r=>n=e?n:r;s===n&&(s<=0?(o(1),a(10)):(o(qt(s,-1)),a(qt(n,1)))),s<=0&&o(qt(n,-1)),n<=0&&a(qt(s,1)),this.min=s,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=sd(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":Le(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ft(t),this._valueRange=Ft(this.max)-Ft(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ft(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Bi(i){const t=i.ticks;if(t.display&&i.display){const e=lt(t.backdropPadding);return O(t.font&&t.font.size,G.font.size)+e.height}return 0}function od(i,t,e){return e=K(e)?e:[e],{w:Qa(i,t.string,e),h:e.length*t.lineHeight}}function En(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 ad(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,a=i.options.pointLabels,r=a.centerPointLabels?N/o:0;for(let l=0;l<o;l++){const c=a.setContext(i.getPointLabelContext(l));n[l]=c.padding;const h=i.getPointPosition(l,i.drawingArea+n[l],r),d=Q(c.font),u=od(i.ctx,d,i._pointLabels[l]);s[l]=u;const f=at(i.getIndexAngle(l)+r),g=Math.round(Gi(f)),p=En(g,h.x,u.w,0,180),m=En(g,h.y,u.h,90,270);rd(e,t,f,p,m)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=hd(i,s,n)}function rd(i,t,e,s,n){const o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e));let r=0,l=0;s.start<t.l?(r=(t.l-s.start)/o,i.l=Math.min(i.l,t.l-r)):s.end>t.r&&(r=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),n.start<t.t?(l=(t.t-n.start)/a,i.t=Math.min(i.t,t.t-l)):n.end>t.b&&(l=(n.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function ld(i,t,e){const s=i.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,s+n+a,o),c=Math.round(Gi(at(l.angle+Z))),h=fd(l.y,r.h,c),d=dd(c),u=ud(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function cd(i,t){if(!t)return!0;const{left:e,top:s,right:n,bottom:o}=i;return!(Tt({x:e,y:s},t)||Tt({x:e,y:o},t)||Tt({x:n,y:s},t)||Tt({x:n,y:o},t))}function hd(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Bi(o)/2,additionalAngle:a?N/n:0};let c;for(let h=0;h<n;h++){l.padding=e[h],l.size=t[h];const d=ld(i,h,l);s.push(d),r==="auto"&&(d.visible=cd(d,c),d.visible&&(c=d))}return s}function dd(i){return i===0||i===180?"center":i<180?"left":"right"}function ud(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function fd(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function gd(i,t,e){const{left:s,top:n,right:o,bottom:a}=e,{backdropColor:r}=t;if(!I(r)){const l=te(t.borderRadius),c=lt(t.backdropPadding);i.fillStyle=r;const h=s-c.left,d=n-c.top,u=o-s+c.width,f=a-n+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),De(i,{x:h,y:d,w:u,h:f,radius:l}),i.fill()):i.fillRect(h,d,u,f)}}function pd(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 a=s.setContext(i.getPointLabelContext(n));gd(e,a,o);const r=Q(a.font),{x:l,y:c,textAlign:h}=o;se(e,i._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function $o(i,t,e,s){const{ctx:n}=i;if(e)n.arc(i.xCenter,i.yCenter,t,0,Y);else{let o=i.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a<s;a++)o=i.getPointPosition(a,t),n.lineTo(o.x,o.y)}}function md(i,t,e,s,n){const o=i.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!s||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),$o(i,e,a,s),o.closePath(),o.stroke(),o.restore())}function bd(i,t,e){return Ht(i,{label:e,index:t,type:"pointLabel"})}class _d extends ii{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ni.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};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=lt(Bi(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=q(t)&&!isNaN(t)?t:0,this.max=q(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Bi(this.options))}generateTickLabels(t){ii.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,s)=>{const n=$(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?ad(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=Y/(this._pointLabels.length||1),s=this.options.startAngle||0;return at(t*e+mt(s))}getDistanceFromCenterForValue(t){if(I(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(I(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 bd(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(),$o(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,a=this._pointLabels.length;let r,l,c;if(e.pointLabels.display&&pd(this,a),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const u=this.getContext(d),f=n.setContext(u),g=o.setContext(u);md(this,f,l,a,g)}}),s.display){for(t.save(),r=a-1;r>=0;r--){const h=s.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,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,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=s.setContext(this.getContext(l)),h=Q(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const d=lt(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}se(t,r.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}const di={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}},dt=Object.keys(di);function In(i,t){return i-t}function Fn(i,t){if(I(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let a=t;return typeof s=="function"&&(a=s(a)),q(a)||(a=typeof s=="string"?e.parse(a,s):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(le(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function zn(i,t,e,s){const n=dt.length;for(let o=dt.indexOf(i);o<n-1;++o){const a=di[dt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=s)return dt[o]}return dt[n-1]}function xd(i,t,e,s,n){for(let o=dt.length-1;o>=dt.indexOf(e);o--){const a=dt[o];if(di[a].common&&i._adapter.diff(n,s,a)>=t-1)return a}return dt[e?dt.indexOf(e):0]}function yd(i){for(let t=dt.indexOf(i)+1,e=dt.length;t<e;++t)if(di[dt[t]].common)return dt[t]}function Bn(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=qi(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function vd(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=e[r],l>=0&&(t[l].major=!0);return t}function Vn(i,t,e){const s=[],n={},o=t.length;let a,r;for(a=0;a<o;++a)r=t[a],n[r]=a,s.push({value:r,major:!1});return o===0||!e?s:vd(i,s,n,e)}class Vi extends ne{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};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 wl._date(t.adapters.date);n.init(e),ye(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:Fn(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:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=q(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=q(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,a=this.max,r=Na(n,o,a);return this._unit=e.unit||(s.autoSkip?zn(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):xd(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:yd(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),Vn(this,r,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 a=t.length<3?.5:.25;e=et(e,0,a),s=et(s,0,a),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,a=o.unit||zn(o.minUnit,e,s,this._getLabelCapacity(e)),r=O(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=le(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(s,e,a)>1e5*r)throw new Error(e+" and "+s+" are too far apart with stepSize of "+r+" "+a);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<s;u=+t.add(u,r,a),f++)Bn(h,u,g);return(u===s||n.bounds==="ticks"||f===1)&&Bn(h,u,g),Object.keys(h).sort(In).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,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return $(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d: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=mt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),a=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:s*o+r*a,h:s*a+r*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),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r: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(Fn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return to(t.sort(In))}}function Ue(i,t,e){let s=0,n=i.length-1,o,a,r,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=Ot(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=Ot(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class wd extends Vi{static id="timeseries";static defaults=Vi.defaults;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=Ue(e,this.min),this._tableRange=Ue(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(a=0,r=n.length;a<r;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-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(Ue(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Ue(this._table,s*this._tableRange+this._minPos,!0)}}var kd=Object.freeze({__proto__:null,CategoryScale:Qh,LinearScale:ed,LogarithmicScale:nd,RadialLinearScale:_d,TimeScale:Vi,TimeSeriesScale:wd});const Md=[vl,th,Gh,kd];function Ni(i){return!Number.isFinite(i)||i<=0?"0 kb/s":i<1e6?`${Math.round(i/1e3)} kb/s`:i<1e9?`${(i/1e6).toFixed(1)} Mb/s`:`${(i/1e9).toFixed(2)} Gb/s`}const Sd=ji({__name:"BandwidthChart",props:{series:{},theme:{},windowSec:{},minHeight:{default:220}},setup(i){Ei.register(...Md);const t=i,e=Ct(null);let s=null;function n(l){const c=l.units==="bytes"?8:1;return{label:l.label,data:l.data.map(h=>({x:h.t,y:h.v*c})),borderColor:l.color,backgroundColor:l.color,borderWidth:2,pointRadius:0,tension:.25,borderDash:l.dashed?[4,4]:void 0,spanGaps:!0}}const o=nt(()=>({type:"line",data:{datasets:t.series.map(n)},options:{responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{mode:"index",intersect:!1},scales:{x:{type:"linear",min:Date.now()-t.windowSec*1e3,max:Date.now(),grid:{color:t.theme.axisColor,drawTicks:!1},ticks:{color:t.theme.textColor,maxRotation:0,autoSkipPadding:24,callback:l=>{const c=Math.round((Number(l)-Date.now())/1e3);return c===0?"now":`${c}s`}}},y:{beginAtZero:!0,grid:{color:t.theme.axisColor},ticks:{color:t.theme.textColor,callback:l=>Ni(Number(l))}}},plugins:{legend:{display:!1},tooltip:{backgroundColor:t.theme.tooltipBg,titleColor:t.theme.tooltipFg,bodyColor:t.theme.tooltipFg,borderColor:t.theme.axisColor,borderWidth:1,callbacks:{label:l=>`${l.dataset.label}: ${Ni(Number(l.parsed.y))}`,title:l=>{if(l.length===0)return"";const c=Math.round((Number(l[0].parsed.x)-Date.now())/1e3);return c===0?"now":`${c}s`}}}}}}));function a(){if(!s)return;const l=t.series.map(n);if(s.data.datasets=l,s.options.scales?.x){const c=s.options.scales.x;c.min=Date.now()-t.windowSec*1e3,c.max=Date.now()}s.update("none")}function r(){s&&(s.destroy(),s=null),e.value&&(s=new Ei(e.value,o.value))}return Wi(r),Qt(()=>t.theme,r,{deep:!0}),Qt(()=>t.series.length,r),Qt(()=>t.windowSec,r),Qt(()=>t.series,a,{deep:!0}),Hi(()=>{s&&(s.destroy(),s=null)}),(l,c)=>(F(),X("div",{class:"bandwidth-chart",style:$n({minHeight:`${i.minHeight}px`})},[C("canvas",{ref_key:"canvasRef",ref:e},null,512)],4))}}),Pi=$i(Sd,[["__scopeId","data-v-f092bd91"]]),Pd={class:"bandwidth-chart__toolbar"},Cd={key:0,class:"bandwidth-chart__group"},Dd={class:"bandwidth-chart__group-label"},Ad={class:"bandwidth-chart__segmented"},Od=["onClick"],Td={class:"bandwidth-chart__group"},Ld={class:"bandwidth-chart__group-label"},Rd={class:"bandwidth-chart__segmented"},Ed=["onClick"],Id={key:1,class:"bandwidth-chart__group"},Fd={class:"bandwidth-chart__group-label"},zd={class:"bandwidth-chart__check"},Bd=["checked"],Vd={class:"bandwidth-chart__check"},Nd=["checked"],Wd={class:"bandwidth-chart__body"},Hd={key:0,class:"bandwidth-chart__empty"},jd={class:"bandwidth-chart__panel-title"},$d={key:0,class:"bandwidth-chart__legend"},Yd={key:0,class:"bandwidth-chart__legend-key"},Ud={class:"bandwidth-chart__legend-key-item"},Xd={class:"bandwidth-chart__legend-key-item"},Kd={class:"bandwidth-chart__legend-header"},Gd={class:"bandwidth-chart__legend-col"},qd={class:"bandwidth-chart__legend-col"},Zd={class:"bandwidth-chart__legend-col"},Jd={key:0,class:"bandwidth-chart__legend-row bandwidth-chart__legend-row--total"},Qd={class:"bandwidth-chart__legend-name"},tu={class:"bandwidth-chart__legend-col"},eu={class:"bandwidth-chart__legend-col"},iu={class:"bandwidth-chart__legend-col"},su={key:0,class:"bandwidth-chart__legend-row bandwidth-chart__legend-row--total"},nu={class:"bandwidth-chart__legend-name"},ou={class:"bandwidth-chart__legend-col"},au={class:"bandwidth-chart__legend-col"},ru={class:"bandwidth-chart__legend-col"},lu={key:1,class:"bandwidth-chart__legend-row bandwidth-chart__legend-row--total"},cu={class:"bandwidth-chart__legend-name"},hu={class:"bandwidth-chart__legend-col"},du={class:"bandwidth-chart__legend-col"},uu={class:"bandwidth-chart__legend-col"},fu={class:"bandwidth-chart__legend-name"},gu={class:"bandwidth-chart__legend-col"},pu={class:"bandwidth-chart__legend-col"},mu={class:"bandwidth-chart__legend-col"},bu={class:"bandwidth-chart__legend-col"},_u={class:"bandwidth-chart__legend-col"},xu={class:"bandwidth-chart__legend-col"},yu={class:"bandwidth-chart__legend-row bandwidth-chart__legend-row--total"},vu={class:"bandwidth-chart__legend-name"},wu={key:0,class:"bandwidth-chart__legend-col"},ku={key:1,class:"bandwidth-chart__legend-col"},Mu=ji({__name:"BandwidthChartBody",props:{mode:{},windowSec:{},showIn:{type:Boolean},showOut:{type:Boolean},isSubscriptions:{type:Boolean},rowCount:{},noun:{},units:{},combinedSeries:{},aggregateSeries:{},independentPanels:{},legend:{},totals:{},aggregateStats:{},theme:{}},emits:["update:mode","update:windowSec","update:showIn","update:showOut"],setup(i,{emit:t}){const{t:e}=Yn(),s=i,n=t;function o(c){return Ni(s.units==="bytes"?c*8:c)}const a=[{value:"combined",label:e("Combined")},{value:"independent",label:e("Independent")},{value:"aggregate",label:e("Aggregate")}],r=[{value:30,label:"30s"},{value:60,label:"1 min"},{value:300,label:"5 min"}],l=c=>Ko("span",{class:"bandwidth-chart__dot",style:{background:c.color},"aria-hidden":"true"});return(c,h)=>(F(),X(_t,null,[C("div",Pd,[i.rowCount>1?(F(),X("div",Cd,[C("span",Dd,T(D(e)("Mode")),1),C("div",Ad,[(F(),X(_t,null,Re(a,d=>C("button",{key:d.value,type:"button",class:ls(["bandwidth-chart__segment",{"bandwidth-chart__segment--active":i.mode===d.value}]),onClick:u=>n("update:mode",d.value)},T(d.label),11,Od)),64))])])):Rt("",!0),C("div",Td,[C("span",Ld,T(D(e)("Window")),1),C("div",Rd,[(F(),X(_t,null,Re(r,d=>C("button",{key:d.value,type:"button",class:ls(["bandwidth-chart__segment",{"bandwidth-chart__segment--active":i.windowSec===d.value}]),onClick:u=>n("update:windowSec",d.value)},T(d.label),11,Ed)),64))])]),i.isSubscriptions?(F(),X("div",Id,[C("span",Fd,T(D(e)("Show")),1),C("label",zd,[C("input",{type:"checkbox",checked:i.showIn,onChange:h[0]||(h[0]=d=>n("update:showIn",d.target.checked))},null,40,Bd),it(" "+T(D(e)("In")),1)]),C("label",Vd,[C("input",{type:"checkbox",checked:i.showOut,onChange:h[1]||(h[1]=d=>n("update:showOut",d.target.checked))},null,40,Nd),it(" "+T(D(e)("Out")),1)])])):Rt("",!0)]),C("div",Wd,[i.rowCount===0?(F(),X("p",Hd,T(D(e)("Select rows in the grid to chart their bandwidth.")),1)):i.mode==="combined"?(F(),gt(Pi,{key:1,series:i.combinedSeries,theme:i.theme,"window-sec":i.windowSec,"min-height":280},null,8,["series","theme","window-sec"])):i.mode==="aggregate"?(F(),gt(Pi,{key:2,series:i.aggregateSeries,theme:i.theme,"window-sec":i.windowSec,"min-height":280},null,8,["series","theme","window-sec"])):i.mode==="independent"?(F(!0),X(_t,{key:3},Re(i.independentPanels,d=>(F(),X("div",{key:d.key,class:"bandwidth-chart__panel"},[C("div",jd,T(d.label),1),pt(Pi,{series:d.series,theme:i.theme,"window-sec":i.windowSec,"min-height":140},null,8,["series","theme","window-sec"])]))),128)):Rt("",!0)]),i.rowCount>0?(F(),X("div",$d,[i.isSubscriptions?(F(),X("div",Yd,[C("span",Ud,[h[2]||(h[2]=C("span",{class:"bandwidth-chart__stroke bandwidth-chart__stroke--solid","aria-hidden":"true"},null,-1)),it(" ↓ "+T(D(e)("In (solid)")),1)]),C("span",Xd,[h[3]||(h[3]=C("span",{class:"bandwidth-chart__stroke bandwidth-chart__stroke--dashed","aria-hidden":"true"},null,-1)),it(" ↑ "+T(D(e)("Out (dashed)")),1)])])):Rt("",!0),C("div",Kd,[C("span",null,T(i.mode==="aggregate"?D(e)("Aggregate"):D(e)("Legend")),1),C("span",Gd,T(D(e)("now")),1),C("span",qd,T(D(e)("min")),1),C("span",Zd,T(D(e)("peak")),1)]),i.mode==="aggregate"?(F(),X(_t,{key:1},[i.isSubscriptions?(F(),X(_t,{key:1},[i.showIn?(F(),X("div",su,[C("span",nu,[h[4]||(h[4]=C("span",{class:"bandwidth-chart__stroke bandwidth-chart__stroke--solid","aria-hidden":"true"},null,-1)),it(" ↓ "+T(D(e)("Σ In")),1)]),C("span",ou,T(o(i.aggregateStats.get("in")?.now??0)),1),C("span",au,T(o(i.aggregateStats.get("in")?.min??0)),1),C("span",ru,T(o(i.aggregateStats.get("in")?.peak??0)),1)])):Rt("",!0),i.showOut?(F(),X("div",lu,[C("span",cu,[h[5]||(h[5]=C("span",{class:"bandwidth-chart__stroke bandwidth-chart__stroke--dashed","aria-hidden":"true"},null,-1)),it(" ↑ "+T(D(e)("Σ Out")),1)]),C("span",hu,T(o(i.aggregateStats.get("out")?.now??0)),1),C("span",du,T(o(i.aggregateStats.get("out")?.min??0)),1),C("span",uu,T(o(i.aggregateStats.get("out")?.peak??0)),1)])):Rt("",!0)],64)):(F(),X("div",Jd,[C("span",Qd,T(D(e)("Σ Total ({0} {1})",String(i.rowCount),i.rowCount===1?i.noun:`${i.noun}s`)),1),C("span",tu,T(o(i.aggregateStats.get("bps")?.now??0)),1),C("span",eu,T(o(i.aggregateStats.get("bps")?.min??0)),1),C("span",iu,T(o(i.aggregateStats.get("bps")?.peak??0)),1)]))],64)):(F(),X(_t,{key:2},[(F(!0),X(_t,null,Re(i.legend,d=>(F(),X("div",{key:d.key,class:"bandwidth-chart__legend-row"},[C("span",fu,[pt(l,{color:d.color},null,8,["color"]),it(" "+T(d.label),1)]),i.isSubscriptions?(F(),X(_t,{key:1},[C("span",bu,[it(" ↓ "+T(o(d.values.get("in")?.now??0))+" ",1),h[6]||(h[6]=C("br",null,null,-1)),it(" ↑ "+T(o(d.values.get("out")?.now??0)),1)]),C("span",_u,[it(" ↓ "+T(o(d.values.get("in")?.min??0))+" ",1),h[7]||(h[7]=C("br",null,null,-1)),it(" ↑ "+T(o(d.values.get("out")?.min??0)),1)]),C("span",xu,[it(" ↓ "+T(o(d.values.get("in")?.peak??0))+" ",1),h[8]||(h[8]=C("br",null,null,-1)),it(" ↑ "+T(o(d.values.get("out")?.peak??0)),1)])],64)):(F(),X(_t,{key:0},[C("span",gu,T(o(d.values.get("bps")?.now??0)),1),C("span",pu,T(o(d.values.get("bps")?.min??0)),1),C("span",mu,T(o(d.values.get("bps")?.peak??0)),1)],64))]))),128)),C("div",yu,[C("span",vu,T(D(e)("Σ Total")),1),i.isSubscriptions?(F(),X("span",ku,[it(" ↓ "+T(o(i.totals.get("in")??0))+" ",1),h[9]||(h[9]=C("br",null,null,-1)),it(" ↑ "+T(o(i.totals.get("out")??0)),1)])):(F(),X("span",wu,T(o(i.totals.get("bps")??0)),1))])],64))])):Rt("",!0)],64))}}),Nn=$i(Mu,[["__scopeId","data-v-c1087322"]]),Su={class:"bandwidth-chart__header"},Pu={class:"bandwidth-chart__title"},Cu={class:"bandwidth-chart__header-actions"},Du=["aria-label"],Au={class:"bandwidth-dock__inner"},Ou={class:"bandwidth-chart__header bandwidth-dock__header"},Tu={class:"bandwidth-chart__title"},Lu={class:"bandwidth-chart__header-actions"},Ru={class:"bandwidth-dock__scroll"},Ci=420,Wn=300,Hn=900,jn="tvh-bandwidth-panel-width",Eu=ji({__name:"BandwidthChartView",props:{visible:{type:Boolean},rows:{type:Function},keyField:{},metrics:{},units:{},rowLabel:{type:Function},noun:{}},emits:["update:visible"],setup(i,{emit:t}){const{t:e}=Yn(),s=i,n=t,o=nt({get:()=>s.visible,set:P=>n("update:visible",P)}),a=Ct("combined"),r=Ct(60),l=Ct(!1),c=Ct(!0),h=Ct(!0),d=Go();function u(){try{const P=localStorage.getItem(jn);if(!P)return Ci;const S=Number(P);return Number.isFinite(S)?Math.min(Math.max(S,Wn),Hn):Ci}catch{return Ci}}const f=Ct(u());function g(){try{localStorage.setItem(jn,String(f.value))}catch{}}function p(P){P.preventDefault();const S=P.clientX,B=f.value;function V(Yo){const Uo=S-Yo.clientX,Xo=B+Uo;f.value=Math.min(Math.max(Xo,Wn),Hn)}function bt(){globalThis.window.removeEventListener("pointermove",V),globalThis.window.removeEventListener("pointerup",bt),g()}globalThis.window.addEventListener("pointermove",V),globalThis.window.addEventListener("pointerup",bt)}const m=nt(()=>s.metrics.includes("in")),b=nt(()=>s.rows().length);Qt(b,P=>{P<=1&&a.value!=="combined"&&(a.value="combined")});const _=nt(()=>{if(!m.value)return s.metrics;const P=[];return c.value&&P.push("in"),h.value&&P.push("out"),P}),{theme:y}=ia(),{samples:v,currentValues:x,aggregate:w,clear:k}=ta({rows:s.rows,keyField:s.keyField,metrics:s.metrics,windowSec:r,paused:l}),M=nt(()=>s.rows().map((P,S)=>({key:P[s.keyField],label:s.rowLabel(P),color:y.value.palette[S%y.value.palette.length],row:P})));function A(P,S){return v.value.get(P)?.get(S)??[]}const L=nt(()=>{const P=[];for(const S of M.value)for(const B of _.value)P.push({label:m.value?`${S.label} · ${B.toUpperCase()}`:S.label,data:A(S.key,B),color:S.color,dashed:B==="out",units:s.units});return P}),R=nt(()=>{const P=[];for(const S of _.value)P.push({label:m.value?`Σ ${S.toUpperCase()}`:e("Σ Total"),data:w.value.get(S)??[],color:y.value.palette[m.value&&S==="out"?1:0],dashed:S==="out",units:s.units});return P}),E=nt(()=>M.value.map(P=>({key:P.key,label:P.label,series:_.value.map(S=>({label:m.value?S.toUpperCase():P.label,data:A(P.key,S),color:P.color,dashed:S==="out",units:s.units}))})));function J(P){if(P.length===0)return{now:0,min:0,peak:0};let S=1/0,B=0;for(const V of P)V.v<S&&(S=V.v),V.v>B&&(B=V.v);return{now:P[P.length-1].v,min:S,peak:B}}const st=nt(()=>M.value.map(P=>{const S=new Map;for(const B of s.metrics)S.set(B,J(A(P.key,B)));return{key:P.key,label:P.label,color:P.color,values:S}})),W=nt(()=>{const P=new Map;for(const S of s.metrics){let B=0;for(const V of x.value.values())B+=V.get(S)??0;P.set(S,B)}return P}),j=nt(()=>{const P=new Map;for(const S of s.metrics)P.set(S,J(w.value.get(S)??[]));return P});function U(){const P=document.querySelector(".bandwidth-chart__body canvas");if(!P)return;const S=P.toDataURL("image/png"),B=document.createElement("a");B.href=S,B.download=`bandwidth-${Date.now()}.png`,B.click()}function ct(){l.value=!l.value}function tt(){n("update:visible",!1)}function wt(P){P.key==="Escape"&&s.visible&&n("update:visible",!1)}Wi(()=>{document.addEventListener("keydown",wt)}),Hi(()=>{document.removeEventListener("keydown",wt)});const $t=nt(()=>{const P=b.value,S=P===1?s.noun:`${s.noun}s`;return e("Bandwidth · {0} {1}",String(P),S)});return(P,S)=>{const B=qo("tooltip");return D(d)?(F(),gt(D(Zo),{key:0,visible:o.value,"onUpdate:visible":S[4]||(S[4]=V=>o.value=V),position:"right",modal:!1,dismissable:!1,class:"bandwidth-drawer",pt:{root:{class:"bandwidth-chart__root"}}},{header:kt(()=>[C("div",Su,[C("span",Pu,[pt(D(ds),{size:18,"stroke-width":2}),it(" "+T($t.value),1)]),C("div",Cu,[Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":l.value?D(e)("Resume"):D(e)("Pause"),onClick:ct},{default:kt(()=>[(F(),gt(cs(l.value?D(hs):D(fs)),{size:16,"stroke-width":2}))]),_:1},8,["aria-label"])),[[B,l.value?D(e)("Resume"):D(e)("Pause"),void 0,{bottom:!0}]]),Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":D(e)("Reset history"),onClick:D(k)},{default:kt(()=>[pt(D(gs),{size:16,"stroke-width":2})]),_:1},8,["aria-label","onClick"])),[[B,D(e)("Reset history"),void 0,{bottom:!0}]]),Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":D(e)("Export PNG"),onClick:U},{default:kt(()=>[pt(D(us),{size:16,"stroke-width":2})]),_:1},8,["aria-label"])),[[B,D(e)("Export PNG"),void 0,{bottom:!0}]])])])]),default:kt(()=>[pt(Nn,{mode:a.value,"onUpdate:mode":S[0]||(S[0]=V=>a.value=V),"window-sec":r.value,"onUpdate:windowSec":S[1]||(S[1]=V=>r.value=V),"show-in":c.value,"onUpdate:showIn":S[2]||(S[2]=V=>c.value=V),"show-out":h.value,"onUpdate:showOut":S[3]||(S[3]=V=>h.value=V),"is-subscriptions":m.value,"row-count":b.value,noun:i.noun,units:i.units,"combined-series":L.value,"aggregate-series":R.value,"independent-panels":E.value,legend:st.value,totals:W.value,"aggregate-stats":j.value,theme:D(y)},null,8,["mode","window-sec","show-in","show-out","is-subscriptions","row-count","noun","units","combined-series","aggregate-series","independent-panels","legend","totals","aggregate-stats","theme"])]),_:1},8,["visible"])):i.visible?(F(),X("aside",{key:1,class:"bandwidth-dock",style:$n({width:`${f.value}px`})},[C("button",{type:"button",class:"bandwidth-dock__splitter","aria-label":D(e)("Resize bandwidth chart panel (currently {0} px wide)",String(f.value)),onPointerdown:p},null,40,Du),C("div",Au,[C("header",Ou,[C("span",Tu,[pt(D(ds),{size:18,"stroke-width":2}),it(" "+T($t.value),1)]),C("div",Lu,[Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":l.value?D(e)("Resume"):D(e)("Pause"),onClick:ct},{default:kt(()=>[(F(),gt(cs(l.value?D(hs):D(fs)),{size:16,"stroke-width":2}))]),_:1},8,["aria-label"])),[[B,l.value?D(e)("Resume"):D(e)("Pause"),void 0,{bottom:!0}]]),Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":D(e)("Reset history"),onClick:D(k)},{default:kt(()=>[pt(D(gs),{size:16,"stroke-width":2})]),_:1},8,["aria-label","onClick"])),[[B,D(e)("Reset history"),void 0,{bottom:!0}]]),Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":D(e)("Export PNG"),onClick:U},{default:kt(()=>[pt(D(us),{size:16,"stroke-width":2})]),_:1},8,["aria-label"])),[[B,D(e)("Export PNG"),void 0,{bottom:!0}]]),Yt((F(),gt(D(Ut),{severity:"secondary",text:"","aria-label":D(e)("Close"),onClick:tt},{default:kt(()=>[pt(D(Jo),{size:16,"stroke-width":2})]),_:1},8,["aria-label"])),[[B,D(e)("Close"),void 0,{bottom:!0}]])])]),C("div",Ru,[pt(Nn,{mode:a.value,"onUpdate:mode":S[5]||(S[5]=V=>a.value=V),"window-sec":r.value,"onUpdate:windowSec":S[6]||(S[6]=V=>r.value=V),"show-in":c.value,"onUpdate:showIn":S[7]||(S[7]=V=>c.value=V),"show-out":h.value,"onUpdate:showOut":S[8]||(S[8]=V=>h.value=V),"is-subscriptions":m.value,"row-count":b.value,noun:i.noun,units:i.units,"combined-series":L.value,"aggregate-series":R.value,"independent-panels":E.value,legend:st.value,totals:W.value,"aggregate-stats":j.value,theme:D(y)},null,8,["mode","window-sec","show-in","show-out","is-subscriptions","row-count","noun","units","combined-series","aggregate-series","independent-panels","legend","totals","aggregate-stats","theme"])])])],4)):Rt("",!0)}}}),zu=$i(Eu,[["__scopeId","data-v-42e5e4e7"]]);export{zu as B,ds as C};
