designtopack/public/site/plugins/analytics/index.js
isUnknown 084bb46379 feat: filtre par page, multi-courbes chart, tri alphabétique options
- Ajout filtre multiselect par page(s) dans le dashboard analytics
- Chart multi-courbes par page quand aucun filtre page sélectionné
- Options de pages indépendantes du filtre page (persistent à la sélection)
- Options de pages dépendantes du filtre utilisateur
- Tracking modal-file avec format "Projet / Label" dans dialog.js
- Tri alphabétique des options du filtre par page
- Fix user list 500 error (email string, client field check)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 11:53:50 +01:00

18 lines
164 KiB
JavaScript

var Ul=Object.defineProperty;var Xl=(G,H,tt)=>H in G?Ul(G,H,{enumerable:!0,configurable:!0,writable:!0,value:tt}):G[H]=tt;var D=(G,H,tt)=>Xl(G,typeof H!="symbol"?H+"":H,tt);(function(){"use strict";/*!
* @kurkle/color v0.3.4
* https://github.com/kurkle/color#readme
* (c) 2024 Jukka Kurkela
* Released under the MIT License
*/function G(i){return i+.5|0}const H=(i,t,e)=>Math.max(Math.min(i,e),t);function tt(i){return H(G(i*2.55),0,255)}function dt(i){return H(G(i*255),0,255)}function at(i){return H(G(i/2.55)/100,0,1)}function yi(i){return H(G(i*100),0,100)}const X={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},He=[..."0123456789ABCDEF"],Mn=i=>He[i&15],Dn=i=>He[(i&240)>>4]+He[i&15],ne=i=>(i&240)>>4===(i&15),Pn=i=>ne(i.r)&&ne(i.g)&&ne(i.b)&&ne(i.a);function Cn(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&X[i[1]]*17,g:255&X[i[2]]*17,b:255&X[i[3]]*17,a:t===5?X[i[4]]*17:255}:(t===7||t===9)&&(e={r:X[i[1]]<<4|X[i[2]],g:X[i[3]]<<4|X[i[4]],b:X[i[5]]<<4|X[i[6]],a:t===9?X[i[7]]<<4|X[i[8]]:255})),e}const On=(i,t)=>i<255?t(i):"";function Tn(i){var t=Pn(i)?Mn:Dn;return i?"#"+t(i.r)+t(i.g)+t(i.b)+On(i.a,t):void 0}const An=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function vi(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 Ln(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 In(i,t,e){const s=vi(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 Fn(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 We(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=Fn(e,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Ne(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(dt)}function Ve(i,t,e){return Ne(vi,i,t,e)}function Rn(i,t,e){return Ne(In,i,t,e)}function zn(i,t,e){return Ne(Ln,i,t,e)}function ki(i){return(i%360+360)%360}function En(i){const t=An.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?tt(+t[5]):dt(+t[5]));const n=ki(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?s=Rn(n,o,a):t[1]==="hsv"?s=zn(n,o,a):s=Ve(n,o,a),{r:s[0],g:s[1],b:s[2],a:e}}function Bn(i,t){var e=We(i);e[0]=ki(e[0]+t),e=Ve(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Hn(i){if(!i)return;const t=We(i),e=t[0],s=yi(t[1]),n=yi(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${at(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const wi={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"},Si={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 Wn(){const i={},t=Object.keys(Si),e=Object.keys(wi);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,wi[o]);o=parseInt(Si[a],16),i[r]=[o>>16&255,o>>8&255,o&255]}return i}let oe;function Nn(i){oe||(oe=Wn(),oe.transparent=[0,0,0,0]);const t=oe[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Vn=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function jn(i){const t=Vn.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const a=+t[7];e=t[8]?tt(a):H(a*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?tt(s):H(s,0,255)),n=255&(t[4]?tt(n):H(n,0,255)),o=255&(t[6]?tt(o):H(o,0,255)),{r:s,g:n,b:o,a:e}}}function $n(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${at(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const je=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Ot=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Yn(i,t,e){const s=Ot(at(i.r)),n=Ot(at(i.g)),o=Ot(at(i.b));return{r:dt(je(s+e*(Ot(at(t.r))-s))),g:dt(je(n+e*(Ot(at(t.g))-n))),b:dt(je(o+e*(Ot(at(t.b))-o))),a:i.a+e*(t.a-i.a)}}function ae(i,t,e){if(i){let s=We(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ve(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function Mi(i,t){return i&&Object.assign(t||{},i)}function Di(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=dt(i[3]))):(t=Mi(i,{r:0,g:0,b:0,a:1}),t.a=dt(t.a)),t}function Un(i){return i.charAt(0)==="r"?jn(i):En(i)}class Bt{constructor(t){if(t instanceof Bt)return t;const e=typeof t;let s;e==="object"?s=Di(t):e==="string"&&(s=Cn(t)||Nn(t)||Un(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Mi(this._rgb);return t&&(t.a=at(t.a)),t}set rgb(t){this._rgb=Di(t)}rgbString(){return this._valid?$n(this._rgb):void 0}hexString(){return this._valid?Tn(this._rgb):void 0}hslString(){return this._valid?Hn(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=Yn(this._rgb,t._rgb,e)),this}clone(){return new Bt(this.rgb)}alpha(t){return this._rgb.a=dt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=G(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 ae(this._rgb,2,t),this}darken(t){return ae(this._rgb,2,-t),this}saturate(t){return ae(this._rgb,1,t),this}desaturate(t){return ae(this._rgb,1,-t),this}rotate(t){return Bn(this._rgb,t),this}}/*!
* Chart.js v4.5.1
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*/function rt(){}const Xn=(()=>{let i=0;return()=>i++})();function I(i){return i==null}function E(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function O(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function W(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function et(i,t){return W(i)?i:t}function C(i,t){return typeof i>"u"?t:i}const Kn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function F(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function L(i,t,e,s){let n,o,a;if(E(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(O(i))for(a=Object.keys(i),o=a.length,n=0;n<o;n++)t.call(e,i[a[n]],a[n])}function re(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 le(i){if(E(i))return i.map(le);if(O(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=le(i[e[n]]);return t}return i}function Pi(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function qn(i,t,e,s){if(!Pi(i))return;const n=t[i],o=e[i];O(n)&&O(o)?Ht(n,o,s):t[i]=le(o)}function Ht(i,t,e){const s=E(t)?t:[t],n=s.length;if(!O(i))return i;e=e||{};const o=e.merger||qn;let a;for(let r=0;r<n;++r){if(a=s[r],!O(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 Wt(i,t){return Ht(i,t,{merger:Gn})}function Gn(i,t,e){if(!Pi(i))return;const s=t[i],n=e[i];O(s)&&O(n)?Wt(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=le(n))}const Ci={"":i=>i,x:i=>i.x,y:i=>i.y};function Zn(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 Qn(i){const t=Zn(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function ce(i,t){return(Ci[t]||(Ci[t]=Qn(t)))(i)}function $e(i){return i.charAt(0).toUpperCase()+i.slice(1)}const he=i=>typeof i<"u",ft=i=>typeof i=="function",Oi=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Jn(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const N=Math.PI,Z=2*N,to=Z+N,de=Number.POSITIVE_INFINITY,eo=N/180,Q=N/2,bt=N/4,Ti=N*2/3,Ai=Math.log10,Tt=Math.sign;function Nt(i,t,e){return Math.abs(i-t)<e}function Li(i){const t=Math.round(i);i=Nt(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Ai(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function io(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 so(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function Vt(i){return!so(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function no(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function oo(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 _t(i){return i*(N/180)}function ao(i){return i*(180/N)}function Ii(i){if(!W(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function ro(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+=Z),{angle:o,distance:n}}function Ye(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function lo(i,t){return(i-t+to)%Z-N}function it(i){return(i%Z+Z)%Z}function Fi(i,t,e,s){const n=it(i),o=it(t),a=it(e),r=it(o-n),l=it(a-n),c=it(n-o),h=it(n-a);return n===o||n===a||s&&o===a||r>l&&c<h}function K(i,t,e){return Math.max(t,Math.min(e,i))}function co(i){return K(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 Ue(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 xt=(i,t,e,s)=>Ue(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),ho=(i,t,e)=>Ue(i,e,s=>i[s][t]>=e);function fo(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 Ri=["push","pop","shift","splice","unshift"];function uo(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Ri.forEach(e=>{const s="_onData"+$e(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 zi(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)&&(Ri.forEach(o=>{delete i[o]}),delete i._chartjs)}function go(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Ei=(function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame})();function Bi(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Ei.call(window,()=>{s=!1,i.apply(t,e)}))}}function po(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Hi=i=>i==="start"?"left":i==="end"?"right":"center",U=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,mo=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function bo(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:f,minDefined:u,maxDefined:m}=a.getUserBounds();if(u){if(n=Math.min(xt(l,h,d).lo,e?s:xt(t,h,a.getPixelForValue(d)).lo),c){const g=l.slice(0,n+1).reverse().findIndex(p=>!I(p[r.axis]));n-=Math.max(0,g)}n=K(n,0,s-1)}if(m){let g=Math.max(xt(l,a.axis,f,!0).hi+1,e?0:xt(t,h,a.getPixelForValue(f),!0).hi+1);if(c){const p=l.slice(g-1).findIndex(b=>!I(b[r.axis]));g+=Math.max(0,p)}o=K(g,n,s)-n}else o=s-n}return{start:n,count:o}}function _o(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 fe=i=>i===0||i===1,Wi=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*Z/e)),Ni=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*Z/e)+1,jt={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*Q)+1,easeOutSine:i=>Math.sin(i*Q),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=>fe(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=>fe(i)?i:Wi(i,.075,.3),easeOutElastic:i=>fe(i)?i:Ni(i,.075,.3),easeInOutElastic(i){return fe(i)?i:i<.5?.5*Wi(i*2,.1125,.45):.5+.5*Ni(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-jt.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?jt.easeInBounce(i*2)*.5:jt.easeOutBounce(i*2-1)*.5+.5};function Xe(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Vi(i){return Xe(i)?i:new Bt(i)}function Ke(i){return Xe(i)?i:new Bt(i).saturate(.5).darken(.1).hexString()}const xo=["x","y","borderWidth","radius","tension"],yo=["color","borderColor","backgroundColor"];function vo(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:yo},numbers:{type:"number",properties:xo}}),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 ko(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ji=new Map;function wo(i,t){t=t||{};const e=i+JSON.stringify(t);let s=ji.get(e);return s||(s=new Intl.NumberFormat(i,t),ji.set(e,s)),s}function $i(i,t,e){return wo(t,e).format(i)}const So={values(i){return E(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=Mo(i,e)}const a=Ai(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),$i(i,s,l)}};function Mo(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 Yi={formatters:So};function Do(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:Yi.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 yt=Object.create(null),qe=Object.create(null);function $t(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 Ge(i,t,e){return typeof t=="string"?Ht($t(i,t),e):Ht($t(i,""),t)}class Po{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)=>Ke(n.backgroundColor),this.hoverBorderColor=(s,n)=>Ke(n.borderColor),this.hoverColor=(s,n)=>Ke(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 Ge(this,t,e)}get(t){return $t(this,t)}describe(t,e){return Ge(qe,t,e)}override(t,e){return Ge(yt,t,e)}route(t,e,s,n){const o=$t(this,t),a=$t(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 O(l)?Object.assign({},c,l):C(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var R=new Po({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[vo,ko,Do]);function Co(i){return!i||I(i.size)||I(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ui(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 vt(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 Xi(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Ze(i,t,e,s){Ki(i,t,e,s,null)}function Ki(i,t,e,s,n){let o,a,r,l,c,h,d,f;const u=t.pointStyle,m=t.rotation,g=t.radius;let p=(m||0)*eo;if(u&&typeof u=="object"&&(o=u.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(p),i.drawImage(u,-u.width/2,-u.height/2,u.width,u.height),i.restore();return}if(!(isNaN(g)||g<=0)){switch(i.beginPath(),u){default:n?i.ellipse(e,s,n/2,g,0,0,Z):i.arc(e,s,g,0,Z),i.closePath();break;case"triangle":h=n?n/2:g,i.moveTo(e+Math.sin(p)*h,s-Math.cos(p)*g),p+=Ti,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*g),p+=Ti,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*g),i.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(p+bt)*l,d=Math.cos(p+bt)*(n?n/2-c:l),r=Math.sin(p+bt)*l,f=Math.sin(p+bt)*(n?n/2-c:l),i.arc(e-d,s-r,c,p-N,p-Q),i.arc(e+f,s-a,c,p-Q,p),i.arc(e+d,s+r,c,p,p+Q),i.arc(e-f,s+a,c,p+Q,p+N),i.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}p+=bt;case"rectRot":d=Math.cos(p)*(n?n/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,f=Math.sin(p)*(n?n/2:g),i.moveTo(e-d,s-r),i.lineTo(e+f,s-a),i.lineTo(e+d,s+r),i.lineTo(e-f,s+a),i.closePath();break;case"crossRot":p+=bt;case"cross":d=Math.cos(p)*(n?n/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,f=Math.sin(p)*(n?n/2:g),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+f,s-a),i.lineTo(e-f,s+a);break;case"star":d=Math.cos(p)*(n?n/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,f=Math.sin(p)*(n?n/2:g),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+f,s-a),i.lineTo(e-f,s+a),p+=bt,d=Math.cos(p)*(n?n/2:g),a=Math.cos(p)*g,r=Math.sin(p)*g,f=Math.sin(p)*(n?n/2:g),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+f,s-a),i.lineTo(e-f,s+a);break;case"line":a=n?n/2:Math.cos(p)*g,r=Math.sin(p)*g,i.moveTo(e-a,s-r),i.lineTo(e+a,s+r);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(p)*(n?n/2:g),s+Math.sin(p)*g);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function Yt(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 ue(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function ge(i){i.restore()}function Oo(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 To(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 Ao(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 Lo(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 Io(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function pe(i,t,e,s,n,o={}){const a=E(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,Ao(i,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&Io(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),Lo(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function Qe(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,Q,!0),i.lineTo(e+n-a.bottomRight,s+o),i.arc(e+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,Q,0,!0),i.lineTo(e+n,s+a.topRight),i.arc(e+n-a.topRight,s+a.topRight,a.topRight,0,-Q,!0),i.lineTo(e+a.topLeft,s)}const Fo=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Ro=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function zo(i,t){const e=(""+i).match(Fo);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 Eo=i=>+i||0;function qi(i,t){const e={},s=O(t),n=s?Object.keys(t):t,o=O(i)?s?a=>C(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of n)e[a]=Eo(o(a));return e}function Bo(i){return qi(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Ut(i){return qi(i,["topLeft","topRight","bottomLeft","bottomRight"])}function J(i){const t=Bo(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function V(i,t){i=i||{},t=t||R.font;let e=C(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=C(i.style,t.style);s&&!(""+s).match(Ro)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:C(i.family,t.family),lineHeight:zo(C(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:C(i.weight,t.weight),string:""};return n.string=Co(n),n}function me(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 Ho(i,t,e){const{min:s,max:n}=i,o=Kn(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 kt(i,t){return Object.assign(Object.create(i),t)}function Je(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=ts("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:r=>Je([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 Zi(r,l,()=>Xo(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return es(r).includes(l)},ownKeys(r){return es(r)},set(r,l,c){const h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function Lt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Gi(i,s),setContext:o=>Lt(i,o,e,s),override:o=>Lt(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 Zi(o,a,()=>No(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 Gi(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:ft(e)?e:()=>e,isIndexable:ft(s)?s:()=>s}}const Wo=(i,t)=>i?i+$e(t):t,ti=(i,t)=>O(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Zi(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function No(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=i;let r=s[t];return ft(r)&&a.isScriptable(t)&&(r=Vo(t,r,i,e)),E(r)&&r.length&&(r=jo(t,r,i,a.isIndexable)),ti(t,r)&&(r=Lt(r,n,o&&o[t],a)),r}function Vo(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),ti(i,l)&&(l=ei(n._scopes,n,i,l)),l}function jo(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(O(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=ei(c,n,i,h);t.push(Lt(d,o,a&&a[i],r))}}return t}function Qi(i,t,e){return ft(i)?i(t,e):i}const $o=(i,t)=>i===!0?t:typeof i=="string"?ce(t,i):void 0;function Yo(i,t,e,s,n){for(const o of t){const a=$o(e,o);if(a){i.add(a);const r=Qi(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 ei(i,t,e,s){const n=t._rootScopes,o=Qi(t._fallback,e,s),a=[...i,...n],r=new Set;r.add(s);let l=Ji(r,a,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=Ji(r,a,o,l,s),l===null)?!1:Je(Array.from(r),[""],n,o,()=>Uo(t,e,s))}function Ji(i,t,e,s,n){for(;e;)e=Yo(i,t,e,s,n);return e}function Uo(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return E(n)&&O(e)?e:n||{}}function Xo(i,t,e,s){let n;for(const o of t)if(n=ts(Wo(o,i),e),typeof n<"u")return ti(i,n)?ei(e,s,i,n):n}function ts(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function es(i){let t=i._keys;return t||(t=i._keys=Ko(i._scopes)),t}function Ko(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const qo=Number.EPSILON||1e-14,It=(i,t)=>t<i.length&&!i[t].skip&&i[t],is=i=>i==="x"?"y":"x";function Go(i,t,e,s){const n=i.skip?t:i,o=t,a=e.skip?t:e,r=Ye(o,n),l=Ye(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,f=s*h;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+f*(a.x-n.x),y:o.y+f*(a.y-n.y)}}}function Zo(i,t,e){const s=i.length;let n,o,a,r,l,c=It(i,0);for(let h=0;h<s-1;++h)if(l=c,c=It(i,h+1),!(!l||!c)){if(Nt(t[h],0,qo)){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 Qo(i,t,e="x"){const s=is(e),n=i.length;let o,a,r,l=It(i,0);for(let c=0;c<n;++c){if(a=r,r=l,l=It(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 Jo(i,t="x"){const e=is(t),s=i.length,n=Array(s).fill(0),o=Array(s);let a,r,l,c=It(i,0);for(a=0;a<s;++a)if(r=l,l=c,c=It(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?Tt(n[a-1])!==Tt(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}Zo(i,n,o),Qo(i,o,t)}function be(i,t,e){return Math.max(Math.min(i,e),t)}function ta(i,t){let e,s,n,o,a,r=Yt(i[0],t);for(e=0,s=i.length;e<s;++e)a=o,o=r,r=e<s-1&&Yt(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 ea(i,t,e,s,n){let o,a,r,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Jo(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=Go(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&&ta(i,e)}function ii(){return typeof window<"u"&&typeof document<"u"}function si(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function _e(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 xe=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function ia(i,t){return xe(i).getPropertyValue(t)}const sa=["top","right","bottom","left"];function wt(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=sa[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const na=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function oa(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(na(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 St(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=xe(e),o=n.boxSizing==="border-box",a=wt(n,"padding"),r=wt(n,"border","width"),{x:l,y:c,box:h}=oa(i,e),d=a.left+(h&&r.left),f=a.top+(h&&r.top);let{width:u,height:m}=t;return o&&(u-=a.width+r.width,m-=a.height+r.height),{x:Math.round((l-d)/u*e.width/s),y:Math.round((c-f)/m*e.height/s)}}function aa(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&si(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=xe(o),l=wt(r,"border","width"),c=wt(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,s=_e(r.maxWidth,o,"clientWidth"),n=_e(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||de,maxHeight:n||de}}const ut=i=>Math.round(i*10)/10;function ra(i,t,e,s){const n=xe(i),o=wt(n,"margin"),a=_e(n.maxWidth,i,"clientWidth")||de,r=_e(n.maxHeight,i,"clientHeight")||de,l=aa(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const f=wt(n,"border","width"),u=wt(n,"padding");c-=u.width+f.width,h-=u.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=ut(Math.min(c,a,l.maxWidth)),h=ut(Math.min(h,r,l.maxHeight)),c&&!h&&(h=ut(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=ut(Math.floor(h*s))),{width:c,height:h}}function ss(i,t,e){const s=t||1,n=ut(i.height*s),o=ut(i.width*s);i.height=ut(i.height),i.width=ut(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 la=(function(){let i=!1;try{const t={get passive(){return i=!0,!1}};ii()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i})();function ns(i,t){const e=ia(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Mt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function ca(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 ha(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=Mt(i,n,e),r=Mt(n,o,e),l=Mt(o,t,e),c=Mt(a,r,e),h=Mt(r,l,e);return Mt(c,h,e)}const da=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}}},fa=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Ft(i,t,e){return i?da(t,e):fa()}function os(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 as(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function rs(i){return i==="angle"?{between:Fi,compare:lo,normalize:it}:{between:At,compare:(t,e)=>t-e,normalize:t=>t}}function ls({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 ua(i,t,e){const{property:s,start:n,end:o}=e,{between:a,normalize:r}=rs(s),l=t.length;let{start:c,end:h,loop:d}=i,f,u;if(d){for(c+=l,h+=l,f=0,u=l;f<u&&a(r(t[c%l][s]),n,o);++f)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:i.style}}function cs(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=rs(s),{start:h,end:d,loop:f,style:u}=ua(i,t,e),m=[];let g=!1,p=null,b,x,v;const k=()=>l(n,v,b)&&r(n,v)!==0,_=()=>r(o,b)===0||l(o,v,b),S=()=>g||k(),w=()=>!g||_();for(let y=h,M=h;y<=d;++y)x=t[y%a],!x.skip&&(b=c(x[s]),b!==v&&(g=l(b,n,o),p===null&&S()&&(p=r(b,n)===0?y:M),p!==null&&w()&&(m.push(ls({start:p,end:y,loop:f,count:a,style:u})),p=null),M=y,v=b));return p!==null&&m.push(ls({start:p,end:d,loop:f,count:a,style:u})),m}function hs(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=cs(s[n],i.points,t);o.length&&e.push(...o)}return e}function ga(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 pa(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 ma(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:a,end:r}=ga(e,n,o,s);if(s===!0)return ds(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 ds(i,pa(e,a,l,c),e,t)}function ds(i,t,e,s){return!s||!s.setContext||!e?t:ba(i,t,e,s)}function ba(i,t,e,s){const n=i._chart.getContext(),o=fs(i.options),{_datasetIndex:a,options:{spanGaps:r}}=i,l=e.length,c=[];let h=o,d=t[0].start,f=d;function u(m,g,p,b){const x=r?-1:1;if(m!==g){for(m+=l;e[m%l].skip;)m-=x;for(;e[g%l].skip;)g+=x;m%l!==g%l&&(c.push({start:m%l,end:g%l,loop:p,style:b}),h=b,d=g%l)}}for(const m of t){d=r?d:m.start;let g=e[d%l],p;for(f=d+1;f<=m.end;f++){const b=e[f%l];p=fs(s.setContext(kt(n,{type:"segment",p0:g,p1:b,p0DataIndex:(f-1)%l,p1DataIndex:f%l,datasetIndex:a}))),_a(p,h)&&u(d,f-1,m.loop,h),g=b,h=p}d<f-1&&u(d,f-1,m.loop,h)}return c}function fs(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function _a(i,t){if(!t)return!1;const e=[],s=function(n,o){return Xe(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,s)!==JSON.stringify(t,s)}function ye(i,t,e){return i.options.clip?i[e]:t[e]}function xa(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:ye(e,t,"left"),right:ye(e,t,"right"),top:ye(s,t,"top"),bottom:ye(s,t,"bottom")}:t}function us(i,t){const e=t._clip;if(e.disabled)return!1;const s=xa(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 ya{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=Ei.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 lt=new ya;const gs="transparent",va={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Vi(i||gs),n=s.valid&&Vi(t||gs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class ka{constructor(t,e,s,n){const o=e[s];n=me([t.to,n,o,t.from]);const a=me([t.from,o,n]);this._active=!0,this._fn=t.fn||va[t.type||typeof a],this._easing=jt[t.easing]||jt.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=me([t.to,e,n,t.from]),this._from=me([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 ps{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!O(t))return;const e=Object.keys(R.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!O(o))return;const a={};for(const r of e)a[r]=o[r];(E(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a)})})}_animateOptions(t,e){const s=e.options,n=Sa(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&wa(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 f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,r);continue}else d.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=d=new ka(f,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 lt.add(this._chart,s),!0}}function wa(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 Sa(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 ms(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 Ma(i,t,e){if(e===!1)return!1;const s=ms(i,e),n=ms(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function Da(i){let t,e,s,n;return O(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 bs(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 _s(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],W(c)&&(o||t===0||Tt(t)===Tt(c))&&(t+=c)}return!h&&!s.all?0:t}function Pa(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 ni(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function Ca(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Oa(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 Ta(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function xs(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 ys(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=Ca(o,a,s),d=t.length;let f;for(let u=0;u<d;++u){const m=t[u],{[l]:g,[c]:p}=m,b=m._stacks||(m._stacks={});f=b[c]=Ta(n,h,g),f[r]=p,f._top=xs(f,a,!0,s.type),f._bottom=xs(f,a,!1,s.type);const x=f._visualValues||(f._visualValues={});x[r]=p}}function oi(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function Aa(i,t){return kt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function La(i,t,e){return kt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Xt(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 ai=i=>i==="reset"||i==="none",vs=(i,t)=>t?i:Object.assign({},i),Ia=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:bs(e,!0),values:null};class Kt{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=ni(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&&Xt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,f,u,m)=>d==="x"?f:d==="r"?m:u,o=e.xAxisID=C(s.xAxisID,oi(t,"x")),a=e.yAxisID=C(s.yAxisID,oi(t,"y")),r=e.rAxisID=C(s.rAxisID,oi(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&&zi(this._data,this),t._stacked&&Xt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(O(e)){const n=this._cachedMeta;this._data=Pa(e,n)}else if(s!==e){if(s){zi(s,this);const n=this._cachedMeta;Xt(n),n._parsed=[]}e&&Object.isExtensible(e)&&uo(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=ni(e.vScale,e),e.stack!==s.stack&&(n=!0,Xt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(ys(this,e._parsed),e._stacked=ni(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,f;if(this._parsing===!1)s._parsed=n,s._sorted=!0,f=n;else{E(n[t])?f=this.parseArrayData(s,n,t,e):O(n[t])?f=this.parseObjectData(s,n,t,e):f=this.parsePrimitiveData(s,n,t,e);const u=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)s._parsed[h+t]=d=f[h],l&&(u()&&(l=!1),c=d);s._sorted=l}a&&ys(this,f)}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 f,u,m;for(f=0,u=n;f<u;++f)m=f+s,d[f]={[r]:h||o.parse(c[m],m),[l]:a.parse(e[m],m)};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,f,u;for(h=0,d=n;h<d;++h)f=h+s,u=e[f],c[h]={x:o.parse(ce(u,r),f),y:a.parse(ce(u,l),f)};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:bs(n,!0),values:e._stacks[t.axis]._visualValues};return _s(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=_s(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=Ia(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=Oa(r);let f,u;function m(){u=n[f];const g=u[r.axis];return!W(u[t.axis])||h>g||d<g}for(f=0;f<a&&!(!m()&&(this.updateRangeFromParsed(c,t,u,l),o));++f);if(o){for(f=a-1;f>=0;--f)if(!m()){this.updateRangeFromParsed(c,t,u,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],W(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=Da(C(this.options.clip,Ma(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=La(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=Aa(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&&he(s);if(r)return vs(r,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),h),u=Object.keys(R.elements[t]),m=()=>this.getContext(s,n,e),g=c.resolveNamedOptions(f,u,m,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(vs(g,l))),g}_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),f=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(f,this.getContext(t,s,e))}const c=new ps(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||ai(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){ai(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!ai(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&&Xt(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])}}D(Kt,"defaults",{}),D(Kt,"datasetElementType",null),D(Kt,"dataElementType",null);class ve extends Kt{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}=bo(e,n,a);this._drawStart=r,this._drawCount=l,_o(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),f=a.axis,u=r.axis,{spanGaps:m,segment:g}=this.options,p=Vt(m)?m:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",x=e+s,v=t.length;let k=e>0&&this.getParsed(e-1);for(let _=0;_<v;++_){const S=t[_],w=b?S:{};if(_<e||_>=x){w.skip=!0;continue}const y=this.getParsed(_),M=I(y[u]),T=w[f]=a.getPixelForValue(y[f],_),P=w[u]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,y,l):y[u],_);w.skip=isNaN(T)||isNaN(P)||M,w.stop=_>0&&Math.abs(y[f]-k[f])>p,g&&(w.parsed=y,w.raw=c.data[_]),d&&(w.options=h||this.resolveDataElementOptions(_,S.active?"active":n)),b||this.updateElement(S,_,w,n),k=y}}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()}}D(ve,"id","line"),D(ve,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),D(ve,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Dt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ri{constructor(t){D(this,"options");this.options=t||{}}static override(t){Object.assign(ri.prototype,t)}init(){}formats(){return Dt()}parse(){return Dt()}format(){return Dt()}add(){return Dt()}diff(){return Dt()}startOf(){return Dt()}endOf(){return Dt()}}var Fa={_date:ri};function Ra(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?ho:xt;if(s){if(n._sharedOptions){const h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){const f=c(o,t,e-d),u=c(o,t,e+d);return{lo:f.lo,hi:u.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:d}=n._cachedMeta,{_parsed:f}=i,u=f.slice(0,h.lo+1).reverse().findIndex(g=>!I(g[d.axis]));h.lo-=Math.max(0,u);const m=f.slice(h.hi).findIndex(g=>!I(g[d.axis]));h.hi+=Math.max(0,m)}return h}}return{lo:0,hi:o.length-1}}function ke(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:f}=Ra(o[r],t,a,n);for(let u=d;u<=f;++u){const m=h[u];m.skip||s(m,c,u)}}}function za(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 li(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||ke(i,e,t,function(r,l,c){!n&&!Yt(r,i.chartArea,0)||r.inRange(t.x,t.y,s)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Ea(i,t,e,s){let n=[];function o(a,r,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],s),{angle:d}=ro(a,{x:t.x,y:t.y});Fi(d,c,h)&&n.push({element:a,datasetIndex:r,index:l})}return ke(i,e,t,o),n}function Ba(i,t,e,s,n,o){let a=[];const r=za(e);let l=Number.POSITIVE_INFINITY;function c(h,d,f){const u=h.inRange(t.x,t.y,n);if(s&&!u)return;const m=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(m))&&!u)return;const p=r(t,m);p<l?(a=[{element:h,datasetIndex:d,index:f}],l=p):p===l&&a.push({element:h,datasetIndex:d,index:f})}return ke(i,e,t,c),a}function ci(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?Ea(i,t,e,n):Ba(i,t,e,s,n,o)}function ks(i,t,e,s,n){const o=[],a=e==="x"?"inXRange":"inYRange";let r=!1;return ke(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 Ha={modes:{index(i,t,e,s){const n=St(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?li(i,n,o,s,a):ci(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=St(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?li(i,n,o,s,a):ci(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=St(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return li(i,n,o,s,a)},nearest(i,t,e,s){const n=St(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return ci(i,n,o,e.intersect,s,a)},x(i,t,e,s){const n=St(t,i);return ks(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=St(t,i);return ks(i,n,"y",e.intersect,s)}}};const ws=["left","top","right","bottom"];function qt(i,t){return i.filter(e=>e.pos===t)}function Ss(i,t){return i.filter(e=>ws.indexOf(e.pos)===-1&&e.box.axis===t)}function Gt(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 Wa(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 Na(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!ws.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 Va(i,t){const e=Na(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 ja(i){const t=Wa(i),e=Gt(t.filter(c=>c.box.fullSize),!0),s=Gt(qt(t,"left"),!0),n=Gt(qt(t,"right")),o=Gt(qt(t,"top"),!0),a=Gt(qt(t,"bottom")),r=Ss(t,"x"),l=Ss(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:qt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function Ms(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Ds(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 $a(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!O(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&&Ds(a,o.getPadding());const r=Math.max(0,t.outerWidth-Ms(a,i,"left","right")),l=Math.max(0,t.outerHeight-Ms(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 Ya(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 Ua(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 Zt(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,Ua(r.horizontal,t));const{same:d,other:f}=$a(t,e,r,s);c|=d&&n.length,h=h||f,l.fullSize||n.push(r)}return c&&Zt(n,t,e,s)||h}function we(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 Ps(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,f=c.size||l.height;he(c.start)&&(a=c.start),l.fullSize?we(l,n.left,a,e.outerWidth-n.right-n.left,f):we(l,t.left+c.placed,a,d,f),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*h,f=c.size||l.width;he(c.start)&&(o=c.start),l.fullSize?we(l,o,n.top,f,e.outerHeight-n.bottom-n.top):we(l,o,t.top+c.placed,f,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var gt={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=J(i.options.layout.padding),o=Math.max(t-n.width,0),a=Math.max(e-n.height,0),r=ja(i.boxes),l=r.vertical,c=r.horizontal;L(i.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,p)=>p.box.options&&p.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),f=Object.assign({},n);Ds(f,J(s));const u=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),m=Va(l.concat(c),d);Zt(r.fullSize,u,d,m),Zt(l,u,d,m),Zt(c,u,d,m)&&Zt(l,u,d,m),Ya(u),Ps(r.leftAndTop,u,d,m),u.x+=u.w,u.y+=u.h,Ps(r.rightAndBottom,u,d,m),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},L(r.chartArea,g=>{const p=g.box;Object.assign(p,i.chartArea),p.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class Cs{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 Xa extends Cs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Se="$chartjs",Ka={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Os=i=>i===null||i==="";function qa(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Se]={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",Os(n)){const o=ns(i,"width");o!==void 0&&(i.width=o)}if(Os(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=ns(i,"height");o!==void 0&&(i.height=o)}return i}const Ts=la?{passive:!0}:!1;function Ga(i,t,e){i&&i.addEventListener(t,e,Ts)}function Za(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Ts)}function Qa(i,t){const e=Ka[i.type]||i.type,{x:s,y:n}=St(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Me(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Ja(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Me(r.addedNodes,s),a=a&&!Me(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function tr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Me(r.removedNodes,s),a=a&&!Me(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Qt=new Map;let As=0;function Ls(){const i=window.devicePixelRatio;i!==As&&(As=i,Qt.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function er(i,t){Qt.size||window.addEventListener("resize",Ls),Qt.set(i,t)}function ir(i){Qt.delete(i),Qt.size||window.removeEventListener("resize",Ls)}function sr(i,t,e){const s=i.canvas,n=s&&si(s);if(!n)return;const o=Bi((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),er(i,o),a}function hi(i,t,e){e&&e.disconnect(),t==="resize"&&ir(i)}function nr(i,t,e){const s=i.canvas,n=Bi(o=>{i.ctx!==null&&e(Qa(o,i))},i);return Ga(s,t,n),n}class or extends Cs{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(qa(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Se])return!1;const s=e[Se].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[Se],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:Ja,detach:tr,resize:sr}[e]||nr;n[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:hi,detach:hi,resize:hi}[e]||Za)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return ra(t,e,s,n)}isAttached(t){const e=t&&si(t);return!!(e&&e.isConnected)}}function ar(i){return!ii()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Xa:or}class pt{constructor(){D(this,"x");D(this,"y");D(this,"active",!1);D(this,"options");D(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return Vt(this.x)&&Vt(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}}D(pt,"defaults",{}),D(pt,"defaultRoutes");function rr(i,t){const e=i.options.ticks,s=lr(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?hr(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return dr(t,c,o,a/n),c;const h=cr(o,t,n);if(a>0){let d,f;const u=a>1?Math.round((l-r)/(a-1)):null;for(De(t,c,h,I(u)?0:r-u,r),d=0,f=a-1;d<f;d++)De(t,c,h,o[d],o[d+1]);return De(t,c,h,l,I(u)?t.length:l+u),c}return De(t,c,h),c}function lr(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 cr(i,t,e){const s=fr(i),n=t.length/e;if(!s)return Math.max(n,1);const o=io(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 hr(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function dr(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 De(i,t,e,s,n){const o=C(s,0),a=Math.min(C(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 fr(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 ur=i=>i==="left"?"right":i==="right"?"left":i,Is=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Fs=(i,t)=>Math.min(t||i,i);function Rs(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 gr(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 pr(i,t){L(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 Jt(i){return i.drawTicks?i.tickLength:0}function zs(i,t){if(!i.display)return 0;const e=V(i.font,t),s=J(i.padding);return(E(i.text)?i.text.length:1)*e.lineHeight+s.height}function mr(i,t){return kt(i,{scale:t,type:"scale"})}function br(i,t,e){return kt(i,{tick:e,index:t,type:"tick"})}function _r(i,t,e){let s=Hi(i);return(e&&t!=="right"||!e&&t==="right")&&(s=ur(s)),s}function xr(i,t,e,s){const{top:n,left:o,bottom:a,right:r,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,f,u,m;const g=a-n,p=r-o;if(i.isHorizontal()){if(u=U(s,o,r),O(e)){const b=Object.keys(e)[0],x=e[b];m=h[b].getPixelForValue(x)+g-t}else e==="center"?m=(c.bottom+c.top)/2+g-t:m=Is(i,e,t);f=r-o}else{if(O(e)){const b=Object.keys(e)[0],x=e[b];u=h[b].getPixelForValue(x)-p+t}else e==="center"?u=(c.left+c.right)/2-p+t:u=Is(i,e,t);m=U(s,a,n),d=e==="left"?-Q:Q}return{titleX:u,titleY:m,maxWidth:f,rotation:d}}class Rt extends pt{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=et(t,Number.POSITIVE_INFINITY),e=et(e,Number.NEGATIVE_INFINITY),s=et(s,Number.POSITIVE_INFINITY),n=et(n,Number.NEGATIVE_INFINITY),{min:et(t,s),max:et(e,n),minDefined:W(t),maxDefined:W(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:et(e,et(s,e)),max:et(s,et(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(){F(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=Ho(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?Rs(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=rr(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(){F(this.options.afterUpdate,[this])}beforeSetDimensions(){F(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(){F(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),F(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){F(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=F(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){F(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){F(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=Fs(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,f=h.highest.height,u=K(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/s:u/(s-1),d+6>r&&(r=u/(s-(t.offset?.5:1)),l=this.maxHeight-Jt(t.grid)-e.padding-zs(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),a=ao(Math.min(Math.asin(K((h.highest.height+6)/r,-1,1)),Math.asin(K(l/c,-1,1))-Math.asin(K(f/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){F(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){F(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=zs(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=Jt(o)+l):(t.height=this.maxHeight,t.width=Jt(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:f}=this._getLabelSizes(),u=s.padding*2,m=_t(this.labelRotation),g=Math.cos(m),p=Math.sin(m);if(r){const b=s.mirror?0:p*d.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:g*d.width+p*f.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,p,g)}}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 f=0,u=0;l?c?(f=n*t.width,u=s*e.height):(f=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,u=e.width/2),this.paddingLeft=Math.max((f-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-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(){F(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=Rs(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/Fs(e,s));let c=0,h=0,d,f,u,m,g,p,b,x,v,k,_;for(d=0;d<e;d+=l){if(m=t[d].label,g=this._resolveTickFontOptions(d),n.font=p=g.string,b=o[p]=o[p]||{data:{},gc:[]},x=g.lineHeight,v=k=0,!I(m)&&!E(m))v=Ui(n,b.data,b.gc,v,m),k=x;else if(E(m))for(f=0,u=m.length;f<u;++f)_=m[f],!I(_)&&!E(_)&&(v=Ui(n,b.data,b.gc,v,_),k+=x);a.push(v),r.push(k),c=Math.max(v,c),h=Math.max(k,h)}pr(o,e);const S=a.indexOf(c),w=r.indexOf(h),y=M=>({width:a[M]||0,height:r[M]||0});return{first:y(0),last:y(e-1),widest:y(S),highest:y(w),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 co(this._alignToPixels?vt(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=br(this.getContext(),t,s))}return this.$context||(this.$context=mr(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=_t(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),f=Jt(o),u=[],m=r.setContext(this.getContext()),g=m.display?m.width:0,p=g/2,b=function(B){return vt(s,B,g)};let x,v,k,_,S,w,y,M,T,P,A,Y;if(a==="top")x=b(this.bottom),w=this.bottom-f,M=x-p,P=b(t.top)+p,Y=t.bottom;else if(a==="bottom")x=b(this.top),P=t.top,Y=b(t.bottom)-p,w=x+p,M=this.top+f;else if(a==="left")x=b(this.right),S=this.right-f,y=x-p,T=b(t.left)+p,A=t.right;else if(a==="right")x=b(this.left),T=t.left,A=b(t.right)-p,S=x+p,y=this.left+f;else if(e==="x"){if(a==="center")x=b((t.top+t.bottom)/2+.5);else if(O(a)){const B=Object.keys(a)[0],q=a[B];x=b(this.chart.scales[B].getPixelForValue(q))}P=t.top,Y=t.bottom,w=x+p,M=w+f}else if(e==="y"){if(a==="center")x=b((t.left+t.right)/2);else if(O(a)){const B=Object.keys(a)[0],q=a[B];x=b(this.chart.scales[B].getPixelForValue(q))}S=x-p,y=S-f,T=t.left,A=t.right}const ot=C(n.ticks.maxTicksLimit,d),z=Math.max(1,Math.ceil(d/ot));for(v=0;v<d;v+=z){const B=this.getContext(v),q=o.setContext(B),ze=r.setContext(B),Ee=q.lineWidth,zt=q.color,Be=ze.dash||[],Et=ze.dashOffset,ie=q.tickWidth,Pt=q.tickColor,se=q.tickBorderDash||[],Ct=q.tickBorderDashOffset;k=gr(this,v,l),k!==void 0&&(_=vt(s,k,Ee),c?S=y=T=A=_:w=M=P=Y=_,u.push({tx1:S,ty1:w,tx2:y,ty2:M,x1:T,y1:P,x2:A,y2:Y,width:Ee,color:zt,borderDash:Be,borderDashOffset:Et,tickWidth:ie,tickColor:Pt,tickBorderDash:se,tickBorderDashOffset:Ct}))}return this._ticksLength=d,this._borderValue=x,u}_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,f=Jt(s.grid),u=f+h,m=d?-h:u,g=-_t(this.labelRotation),p=[];let b,x,v,k,_,S,w,y,M,T,P,A,Y="middle";if(n==="top")S=this.bottom-m,w=this._getXAxisLabelAlignment();else if(n==="bottom")S=this.top+m,w=this._getXAxisLabelAlignment();else if(n==="left"){const z=this._getYAxisLabelAlignment(f);w=z.textAlign,_=z.x}else if(n==="right"){const z=this._getYAxisLabelAlignment(f);w=z.textAlign,_=z.x}else if(e==="x"){if(n==="center")S=(t.top+t.bottom)/2+u;else if(O(n)){const z=Object.keys(n)[0],B=n[z];S=this.chart.scales[z].getPixelForValue(B)+u}w=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-u;else if(O(n)){const z=Object.keys(n)[0],B=n[z];_=this.chart.scales[z].getPixelForValue(B)}w=this._getYAxisLabelAlignment(f).textAlign}e==="y"&&(l==="start"?Y="top":l==="end"&&(Y="bottom"));const ot=this._getLabelSizes();for(b=0,x=r.length;b<x;++b){v=r[b],k=v.label;const z=o.setContext(this.getContext(b));y=this.getPixelForTick(b)+o.labelOffset,M=this._resolveTickFontOptions(b),T=M.lineHeight,P=E(k)?k.length:1;const B=P/2,q=z.color,ze=z.textStrokeColor,Ee=z.textStrokeWidth;let zt=w;a?(_=y,w==="inner"&&(b===x-1?zt=this.options.reverse?"left":"right":b===0?zt=this.options.reverse?"right":"left":zt="center"),n==="top"?c==="near"||g!==0?A=-P*T+T/2:c==="center"?A=-ot.highest.height/2-B*T+T:A=-ot.highest.height+T/2:c==="near"||g!==0?A=T/2:c==="center"?A=ot.highest.height/2-B*T:A=ot.highest.height-P*T,d&&(A*=-1),g!==0&&!z.showLabelBackdrop&&(_+=T/2*Math.sin(g))):(S=y,A=(1-P)*T/2);let Be;if(z.showLabelBackdrop){const Et=J(z.backdropPadding),ie=ot.heights[b],Pt=ot.widths[b];let se=A-Et.top,Ct=0-Et.left;switch(Y){case"middle":se-=ie/2;break;case"bottom":se-=ie;break}switch(w){case"center":Ct-=Pt/2;break;case"right":Ct-=Pt;break;case"inner":b===x-1?Ct-=Pt:b>0&&(Ct-=Pt/2);break}Be={left:Ct,top:se,width:Pt+Et.width,height:ie+Et.height,color:z.backdropColor}}p.push({label:k,font:M,textOffset:A,options:{rotation:g,color:q,strokeColor:ze,strokeWidth:Ee,textAlign:zt,textBaseline:Y,translation:[_,S],backdrop:Be}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-_t(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,f;this.isHorizontal()?(c=vt(t,this.left,a)-a/2,h=vt(t,this.right,r)+r/2,d=f=l):(d=vt(t,this.top,a)-a/2,f=vt(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,f),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&ue(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;pe(s,c,0,h,l,r)}n&&ge(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=V(s.font),a=J(s.padding),r=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||O(e)?(l+=a.bottom,E(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:f}=xr(this,l,e,r);pe(t,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:f,textAlign:_r(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=C(t.grid&&t.grid.z,-1),n=C(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Rt.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 V(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Pe{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;kr(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,yr(t,a,s),this.override&&R.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 R[n]&&(delete R[n][s],this.override&&delete yt[s])}}function yr(i,t,e){const s=Ht(Object.create(null),[e?R.get(e):{},R.get(t),i.defaults]);R.set(t,s),i.defaultRoutes&&vr(t,i.defaultRoutes),i.descriptors&&R.describe(t,i.descriptors)}function vr(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(".");R.route(o,n,l,r)})}function kr(i){return"id"in i&&"defaults"in i}class wr{constructor(){this.controllers=new Pe(Kt,"datasets",!0),this.elements=new Pe(pt,"elements"),this.plugins=new Pe(Object,"plugins"),this.scales=new Pe(Rt,"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):L(n,a=>{const r=s||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,s){const n=$e(t);F(s["before"+n],[],s),e[t](s),F(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 st=new wr;class Sr{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(F(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=C(s.options&&s.options.plugins,{}),o=Mr(s);return n===!1&&!e?[]:Pr(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 Mr(i){const t={},e=[],s=Object.keys(st.plugins.items);for(let o=0;o<s.length;o++)e.push(st.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 Dr(i,t){return!t&&i===!1?null:i===!0?{}:i}function Pr(i,{plugins:t,localIds:e},s,n){const o=[],a=i.getContext();for(const r of t){const l=r.id,c=Dr(s[l],n);c!==null&&o.push({plugin:r,options:Cr(i.config,{plugin:r,local:e[l]},c,a)})}return o}function Cr(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 di(i,t){const e=R.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Or(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function Tr(i,t){return i===t?"_index_":"_value_"}function Es(i){if(i==="x"||i==="y"||i==="r")return i}function Ar(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function fi(i,...t){if(Es(i))return i;for(const e of t){const s=e.axis||Ar(e.position)||i.length>1&&Es(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Bs(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function Lr(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 Bs(i,"x",e[0])||Bs(i,"y",e[0])}return{}}function Ir(i,t){const e=yt[i.type]||{scales:{}},s=t.scales||{},n=di(i.type,t),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!O(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=fi(a,r,Lr(a,i),R.scales[r.type]),c=Tr(l,n),h=e.scales||{};o[a]=Wt(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||di(r,t),h=(yt[r]||{}).scales||{};Object.keys(h).forEach(d=>{const f=Or(d,l),u=a[f+"AxisID"]||f;o[u]=o[u]||Object.create(null),Wt(o[u],[{axis:f},s[u],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];Wt(r,[R.scales[r.type],R.scale])}),o}function Hs(i){const t=i.options||(i.options={});t.plugins=C(t.plugins,{}),t.scales=Ir(i,t)}function Ws(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Fr(i){return i=i||{},i.data=Ws(i.data),Hs(i),i}const Ns=new Map,Vs=new Set;function Ce(i,t){let e=Ns.get(i);return e||(e=t(),Ns.set(i,e),Vs.add(e)),e}const te=(i,t,e)=>{const s=ce(t,e);s!==void 0&&i.add(s)};class Rr{constructor(t){this._config=Fr(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=Ws(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(),Hs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ce(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ce(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ce(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ce(`${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=>te(l,t,d))),h.forEach(d=>te(l,n,d)),h.forEach(d=>te(l,yt[o]||{},d)),h.forEach(d=>te(l,R,d)),h.forEach(d=>te(l,qe,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Vs.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,yt[e]||{},R.datasets[e]||{},{type:e},R,qe]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=js(this._resolverCache,t,n);let l=a;if(Er(a,e)){o.$shared=!1,s=ft(s)?s():s;const c=this.createResolver(t,s,r);l=Lt(a,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=js(this._resolverCache,t,s);return O(e)?Lt(o,e,void 0,n):o}}function js(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:Je(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}const zr=i=>O(i)&&Object.getOwnPropertyNames(i).some(t=>ft(i[t]));function Er(i,t){const{isScriptable:e,isIndexable:s}=Gi(i);for(const n of t){const o=e(n),a=s(n),r=(a||o)&&i[n];if(o&&(ft(r)||zr(r))||a&&E(r))return!0}return!1}var Br="4.5.1";const Hr=["top","bottom","left","right","chartArea"];function $s(i,t){return i==="top"||i==="bottom"||Hr.indexOf(i)===-1&&t==="x"}function Ys(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Us(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),F(e&&e.onComplete,[i],t)}function Wr(i){const t=i.chart,e=t.options.animation;F(e&&e.onProgress,[i],t)}function Xs(i){return ii()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Oe={},Ks=i=>{const t=Xs(i);return Object.values(Oe).filter(e=>e.canvas===t).pop()};function Nr(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 Vr(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}class ct{static register(...t){st.add(...t),qs()}static unregister(...t){st.remove(...t),qs()}constructor(t,e){const s=this.config=new Rr(e),n=Xs(t),o=Ks(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||ar(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=Xn(),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 Sr,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=po(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Oe[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}lt.listen(this,"complete",Us),lt.listen(this,"progress",Wr),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 st}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ss(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Xi(this.canvas,this.ctx),this}stop(){return lt.stop(this),this}resize(t,e){lt.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,ss(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),F(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};L(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=fi(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),L(o,a=>{const r=a.options,l=r.id,c=fi(l,r),h=C(r.type,a.dtype);(r.position===void 0||$s(r.position,c)!==$s(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 f=st.getScale(h);d=new f({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(r,t)}),L(n,(a,r)=>{a||delete s[r]}),L(s,a=>{gt.configure(this,a,a.options),gt.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(Ys("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s<n;s++){const o=e[s];let 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||di(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=st.getController(r),{datasetElementType:c,dataElementType:h}=R.datasets[r];Object.assign(l,{dataElementType:st.getElement(h),datasetElementType:c&&st.getElement(c)}),a.controller=new l(this,s),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){L(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),f=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(f),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=s.layout.autoPadding?a:0,this._updateLayout(a),n||L(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ys("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){L(this.scales,t=>{gt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Oi(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;Nr(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(!Oi(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;gt.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],L(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,ft(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&&(lt.has(this)?this.attached&&!lt.running(this)&&lt.start(this):(this.draw(),Us({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const 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=us(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&ue(e,n),t.controller.draw(),n&&ge(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return Yt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Ha.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=kt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);he(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(),lt.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(),Xi(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Oe[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)};L(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(){L(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},L(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}});!re(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=Jn(t),c=Vr(t,this._lastEvent,s,l);s&&(this._lastEvent=null,F(o.onHover,[t,r,this],this),l&&F(o.onClick,[t,r,this],this));const h=!re(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)}}D(ct,"defaults",R),D(ct,"instances",Oe),D(ct,"overrides",yt),D(ct,"registry",st),D(ct,"version",Br),D(ct,"getChart",Ks);function qs(){return L(ct.instances,i=>i._plugins.invalidate())}function Gs(i,t,e=t){i.lineCap=C(e.borderCapStyle,t.borderCapStyle),i.setLineDash(C(e.borderDash,t.borderDash)),i.lineDashOffset=C(e.borderDashOffset,t.borderDashOffset),i.lineJoin=C(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=C(e.borderWidth,t.borderWidth),i.strokeStyle=C(e.borderColor,t.borderColor)}function jr(i,t,e){i.lineTo(e.x,e.y)}function $r(i){return i.stepped?Oo:i.tension||i.cubicInterpolationMode==="monotone"?To:jr}function Zs(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 Yr(i,t,e,s){const{points:n,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Zs(n,e,s),h=$r(o);let{move:d=!0,reverse:f}=s||{},u,m,g;for(u=0;u<=c;++u)m=n[(r+(f?c-u:u))%a],!m.skip&&(d?(i.moveTo(m.x,m.y),d=!1):h(i,g,m,f,o.stepped),g=m);return l&&(m=n[(r+(f?c:0))%a],h(i,g,m,f,o.stepped)),!!l}function Ur(i,t,e,s){const n=t.points,{count:o,start:a,ilen:r}=Zs(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,d=0,f,u,m,g,p,b;const x=k=>(a+(c?r-k:k))%o,v=()=>{g!==p&&(i.lineTo(h,p),i.lineTo(h,g),i.lineTo(h,b))};for(l&&(u=n[x(0)],i.moveTo(u.x,u.y)),f=0;f<=r;++f){if(u=n[x(f)],u.skip)continue;const k=u.x,_=u.y,S=k|0;S===m?(_<g?g=_:_>p&&(p=_),h=(d*h+k)/++d):(v(),i.lineTo(k,_),m=S,d=0,g=p=_),b=_}v()}function ui(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Ur:Yr}function Xr(i){return i.stepped?ca:i.tension||i.cubicInterpolationMode==="monotone"?ha:Mt}function Kr(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Gs(i,t.options),i.stroke(n)}function qr(i,t,e,s){const{segments:n,options:o}=t,a=ui(t);for(const r of n)Gs(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Gr=typeof Path2D=="function";function Zr(i,t,e,s){Gr&&!t.options.segment?Kr(i,t,e,s):qr(i,t,e,s)}class mt extends pt{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;ea(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=ma(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=hs(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=Xr(s);let c,h;for(c=0,h=a.length;c<h;++c){const{start:d,end:f}=a[c],u=o[d],m=o[f];if(u===m){r.push(u);continue}const g=Math.abs((n-u[e])/(m[e]-u[e])),p=l(u,m,g,s.stepped);p[e]=t[e],r.push(p)}return r.length===1?r[0]:r}pathSegment(t,e,s){return ui(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=ui(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(),Zr(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}D(mt,"id","line"),D(mt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),D(mt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),D(mt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Qs(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class Te extends pt{constructor(e){super();D(this,"parsed");D(this,"skip");D(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.options,{x:a,y:r}=this.getProps(["x","y"],n);return Math.pow(e-a,2)+Math.pow(s-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,s){return Qs(this,e,"x",s)}inYRange(e,s){return Qs(this,e,"y",s)}getCenterPoint(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}size(e){e=e||this.options||{};let s=e.radius||0;s=Math.max(s,s&&e.hoverRadius||0);const n=s&&e.borderWidth||0;return(s+n)*2}draw(e,s){const n=this.options;this.skip||n.radius<.1||!Yt(this,s,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,Ze(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}D(Te,"id","point"),D(Te,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),D(Te,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Qr(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=Ae(l,c,n);const h=gi(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=hs(t,h);for(const f of d){const u=gi(e,o[f.start],o[f.end],f.loop),m=cs(r,n,u);for(const g of m)a.push({source:g,target:f,start:{[e]:Js(h,u,"start",Math.max)},end:{[e]:Js(h,u,"end",Math.min)}})}}return a}function gi(i,t,e,s){if(s)return;let n=t[i],o=e[i];return i==="angle"&&(n=it(n),o=it(o)),{property:i,start:n,end:o}}function Jr(i,t){const{x:e=null,y:s=null}=i||{},n=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Ae(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 Ae(i,t,e){for(;t>i;t--){const s=e[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function Js(i,t,e,s){return i&&t?s(i[e],t[e]):i?i[e]:t?t[e]:0}function tn(i,t){let e=[],s=!1;return E(i)?(s=!0,e=i):e=Jr(i,t),e.length?new mt({points:e,options:{tension:0},_loop:s,_fullLoop:s}):null}function en(i){return i&&i.fill!==!1}function tl(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(!W(n))return n;if(a=i[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function el(i,t,e){const s=ol(i);if(O(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return W(n)&&Math.floor(n)===n?il(s[0],t,n,e):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function il(i,t,e,s){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=s?!1:e}function sl(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:O(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function nl(i,t,e){let s;return i==="start"?s=e:i==="end"?s=t.options.reverse?t.min:t.max:O(i)?s=i.value:s=t.getBaseValue(),s}function ol(i){const t=i.options,e=t.fill;let s=C(e&&e.target,e);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function al(i){const{scale:t,index:e,line:s}=i,n=[],o=s.segments,a=s.points,r=rl(t,e);r.push(tn({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++)ll(n,a[h],r)}return new mt({points:n,options:{}})}function rl(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 ll(i,t,e){const s=[];for(let n=0;n<e.length;n++){const o=e[n],{first:a,last:r,point:l}=cl(o,t,"x");if(!(!l||a&&r)){if(a)s.unshift(l);else if(i.push(l),!r)break}}i.push(...s)}function cl(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],f=a[h.end][e];if(At(n,d,f)){r=n===d,l=n===f;break}}return{first:r,last:l,point:s}}class sn{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:Z},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 hl(i){const{chart:t,fill:e,line:s}=i;if(W(e))return dl(t,e);if(e==="stack")return al(i);if(e==="shape")return!0;const n=fl(i);return n instanceof sn?n:tn(n,s)}function dl(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function fl(i){return(i.scale||{}).getPointPositionForValue?gl(i):ul(i)}function ul(i){const{scale:t={},fill:e}=i,s=sl(e,t);if(W(s)){const n=t.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function gl(i){const{scale:t,fill:e}=i,s=t.options,n=t.getLabels().length,o=s.reverse?t.max:t.min,a=nl(e,t,o),r=[];if(s.grid.circular){const l=t.getPointPositionForValue(0,o);return new sn({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 pi(i,t,e){const s=hl(t),{chart:n,index:o,line:a,scale:r,axis:l}=t,c=a.options,h=c.fill,d=c.backgroundColor,{above:f=d,below:u=d}=h||{},m=n.getDatasetMeta(o),g=us(n,m);s&&a.points.length&&(ue(i,e),pl(i,{line:a,target:s,above:f,below:u,area:e,scale:r,axis:l,clip:g}),ge(i))}function pl(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"?(nn(i,s,a.top),mi(i,{line:e,target:s,color:n,scale:r,property:c,clip:l}),i.restore(),i.save(),nn(i,s,a.bottom)):c==="y"&&(on(i,s,a.left),mi(i,{line:e,target:s,color:o,scale:r,property:c,clip:l}),i.restore(),i.save(),on(i,s,a.right),h=n)),mi(i,{line:e,target:s,color:h,scale:r,property:c,clip:l}),i.restore()}function nn(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[Ae(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 on(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[Ae(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 mi(i,t){const{line:e,target:s,property:n,color:o,scale:a,clip:r}=t,l=Qr(e,s,n);for(const{source:c,target:h,start:d,end:f}of l){const{style:{backgroundColor:u=o}={}}=c,m=s!==!0;i.save(),i.fillStyle=u,ml(i,a,r,m&&gi(n,d,f)),i.beginPath();const g=!!e.pathSegment(i,c);let p;if(m){g?i.closePath():an(i,s,f,n);const b=!!s.pathSegment(i,h,{move:g,reverse:!0});p=g&&b,p||an(i,s,d,n)}i.closePath(),i.fill(p?"evenodd":"nonzero"),i.restore()}}function ml(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 an(i,t,e,s){const n=t.interpolate(e,s);n&&i.lineTo(n.x,n.y)}var bl={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 mt&&(l={visible:i.isDatasetVisible(a),index:a,fill:el(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=tl(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&&pi(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;en(o)&&pi(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const s=t.meta.$filler;!en(s)||e.drawTime!=="beforeDatasetDraw"||pi(i.ctx,s,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const rn=(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)}},_l=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class ln extends pt{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=F(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=V(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=rn(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 f=-1,u=-h;return this.legendItems.forEach((m,g)=>{const p=s+e/2+o.measureText(m.text).width;(g===0||c[c.length-1]+p+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,u+=h,f++),l[g]={left:0,top:u,row:f,width:p,height:n},c[c.length-1]+=p+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,f=0,u=0,m=0,g=0;return this.legendItems.forEach((p,b)=>{const{itemWidth:x,itemHeight:v}=xl(s,e,o,p,n);b>0&&u+v+2*r>h&&(d+=f+r,c.push({width:f,height:u}),m+=f+r,g++,f=u=0),l[b]={left:m,top:u,col:g,width:x,height:v},f=Math.max(f,x),u+=v+r}),d+=f,c.push({width:f,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,a=Ft(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=U(s,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=U(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=U(s,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=U(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;ue(t,this),this._draw(),ge(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:a}=t,r=R.color,l=Ft(t.rtl,this.left,this.width),c=V(a.font),{padding:h}=a,d=c.size,f=d/2;let u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:m,boxHeight:g,itemHeight:p}=rn(a,d),b=function(S,w,y){if(isNaN(m)||m<=0||isNaN(g)||g<0)return;n.save();const M=C(y.lineWidth,1);if(n.fillStyle=C(y.fillStyle,r),n.lineCap=C(y.lineCap,"butt"),n.lineDashOffset=C(y.lineDashOffset,0),n.lineJoin=C(y.lineJoin,"miter"),n.lineWidth=M,n.strokeStyle=C(y.strokeStyle,r),n.setLineDash(C(y.lineDash,[])),a.usePointStyle){const T={radius:g*Math.SQRT2/2,pointStyle:y.pointStyle,rotation:y.rotation,borderWidth:M},P=l.xPlus(S,m/2),A=w+f;Ki(n,T,P,A,a.pointStyleWidth&&m)}else{const T=w+Math.max((d-g)/2,0),P=l.leftForLtr(S,m),A=Ut(y.borderRadius);n.beginPath(),Object.values(A).some(Y=>Y!==0)?Qe(n,{x:P,y:T,w:m,h:g,radius:A}):n.rect(P,T,m,g),n.fill(),M!==0&&n.stroke()}n.restore()},x=function(S,w,y){pe(n,y.text,S,w+p/2,c,{strikethrough:y.hidden,textAlign:l.textAlign(y.textAlign)})},v=this.isHorizontal(),k=this._computeTitleHeight();v?u={x:U(o,this.left+h,this.right-s[0]),y:this.top+h+k,line:0}:u={x:this.left+h,y:U(o,this.top+k+h,this.bottom-e[0].height),line:0},os(this.ctx,t.textDirection);const _=p+h;this.legendItems.forEach((S,w)=>{n.strokeStyle=S.fontColor,n.fillStyle=S.fontColor;const y=n.measureText(S.text).width,M=l.textAlign(S.textAlign||(S.textAlign=a.textAlign)),T=m+f+y;let P=u.x,A=u.y;l.setWidth(this.width),v?w>0&&P+T+h>this.right&&(A=u.y+=_,u.line++,P=u.x=U(o,this.left+h,this.right-s[u.line])):w>0&&A+_>this.bottom&&(P=u.x=P+e[u.line].width+h,u.line++,A=u.y=U(o,this.top+k+h,this.bottom-e[u.line].height));const Y=l.x(P);if(b(Y,A,S),P=mo(M,P+m+f,v?P+T:this.right,t.rtl),x(l.x(P),A,S),v)u.x+=T+h;else if(typeof S.text!="string"){const ot=c.lineHeight;u.y+=cn(S,ot)+h}else u.y+=_}),as(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=V(e.font),n=J(e.padding);if(!e.display)return;const o=Ft(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,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=U(t.align,d,this.right-f);else{const m=this.columnSizes.reduce((g,p)=>Math.max(g,p.height),0);h=c+U(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const u=U(r,d,d+f);a.textAlign=o.textAlign(Hi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,pe(a,e.text,u,h,s)}_computeTitleHeight(){const t=this.options.title,e=V(t.font),s=J(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(!kl(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=_l(n,s);n&&!o&&F(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&F(e.onHover,[t,s,this],this)}else s&&F(e.onClick,[t,s,this],this)}}function xl(i,t,e,s,n){const o=yl(s,i,t,e),a=vl(n,s,t.lineHeight);return{itemWidth:o,itemHeight:a}}function yl(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 vl(i,t,e){let s=i;return typeof t.text!="string"&&(s=cn(t,e)),s}function cn(i,t){const e=i.text?i.text.length:0;return t*e}function kl(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var wl={id:"legend",_element:ln,start(i,t,e){const s=i.legend=new ln({ctx:i.ctx,options:e,chart:i});gt.configure(i,s,e),gt.addBox(i,s)},stop(i){gt.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;gt.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=J(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)}}};const ee={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=Ye(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 nt(i,t){return t&&(E(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function ht(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
`)>-1?i.split(`
`):i}function Sl(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 hn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=V(t.bodyFont),c=V(t.titleFont),h=V(t.footerFont),d=o.length,f=n.length,u=s.length,m=J(t.padding);let g=m.height,p=0,b=s.reduce((k,_)=>k+_.before.length+_.lines.length+_.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const k=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=u*k+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let x=0;const v=function(k){p=Math.max(p,e.measureText(k).width+x)};return e.save(),e.font=c.string,L(i.title,v),e.font=l.string,L(i.beforeBody.concat(i.afterBody),v),x=t.displayColors?a+2+t.boxPadding:0,L(s,k=>{L(k.before,v),L(k.lines,v),L(k.after,v)}),x=0,e.font=h.string,L(i.footer,v),e.restore(),p+=m.width,{width:p,height:g}}function Ml(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function Dl(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 Pl(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"),Dl(c,i,t,e)&&(c="center"),c}function dn(i,t,e){const s=e.yAlign||t.yAlign||Ml(i,e);return{xAlign:e.xAlign||t.xAlign||Pl(i,t,e,s),yAlign:s}}function Cl(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Ol(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function fn(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:f,bottomRight:u}=Ut(a);let m=Cl(t,r);const g=Ol(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(h,f)+n:r==="right"&&(m+=Math.max(d,u)+n),{x:K(m,0,s.width-t.width),y:K(g,0,s.height-t.height)}}function Le(i,t,e){const s=J(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function un(i){return nt([],ht(i))}function Tl(i,t,e){return kt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function gn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const pn={beforeTitle:rt,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:rt,beforeBody:rt,beforeLabel:rt,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:rt,afterBody:rt,beforeFooter:rt,footer:rt,afterFooter:rt};function j(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?pn[t].call(e,s):n}class bi extends pt{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 ps(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Tl(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=j(s,"beforeTitle",this,t),o=j(s,"title",this,t),a=j(s,"afterTitle",this,t);let r=[];return r=nt(r,ht(n)),r=nt(r,ht(o)),r=nt(r,ht(a)),r}getBeforeBody(t,e){return un(j(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return L(t,o=>{const a={before:[],lines:[],after:[]},r=gn(s,o);nt(a.before,ht(j(r,"beforeLabel",this,o))),nt(a.lines,j(r,"label",this,o)),nt(a.after,ht(j(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return un(j(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=j(s,"beforeFooter",this,t),o=j(s,"footer",this,t),a=j(s,"afterFooter",this,t);let r=[];return r=nt(r,ht(n)),r=nt(r,ht(o)),r=nt(r,ht(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(Sl(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,f)=>t.filter(h,d,f,s))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,s))),L(r,h=>{const d=gn(t.callbacks,h);n.push(j(d,"labelColor",this,h)),o.push(j(d,"labelPointStyle",this,h)),a.push(j(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=ee[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=hn(this,s),c=Object.assign({},r,l),h=dn(this.chart,s,c),d=fn(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}=Ut(r),{x:f,y:u}=t,{width:m,height:g}=e;let p,b,x,v,k,_;return o==="center"?(k=u+g/2,n==="left"?(p=f,b=p-a,v=k+a,_=k-a):(p=f+m,b=p+a,v=k-a,_=k+a),x=p):(n==="left"?b=f+Math.max(l,h)+a:n==="right"?b=f+m-Math.max(c,d)-a:b=this.caretX,o==="top"?(v=u,k=v-a,p=b-a,x=b+a):(v=u+g,k=v+a,p=b+a,x=b-a),_=v),{x1:p,x2:b,x3:x,y1:v,y2:k,y3:_}}drawTitle(t,e,s){const n=this.title,o=n.length;let a,r,l;if(o){const c=Ft(s.rtl,this.x,this.width);for(t.x=Le(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",a=V(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=V(o.bodyFont),d=Le(this,"left",o),f=n.x(d),u=l<h.lineHeight?(h.lineHeight-l)/2:0,m=e.y+u;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},p=n.leftForLtr(f,c)+c/2,b=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ze(t,g,p,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Ze(t,g,p,b)}else{t.lineWidth=O(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 g=n.leftForLtr(f,c),p=n.leftForLtr(n.xPlus(f,1),c-2),b=Ut(a.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Qe(t,{x:g,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Qe(t,{x:p,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,m,c,l),t.strokeRect(g,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(p,m+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=V(s.bodyFont);let f=d.lineHeight,u=0;const m=Ft(s.rtl,this.x,this.width),g=function(y){e.fillText(y,m.x(t.x+u),t.y+f/2),t.y+=f+o},p=m.textAlign(a);let b,x,v,k,_,S,w;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Le(this,p,s),e.fillStyle=s.bodyColor,L(this.beforeBody,g),u=r&&p!=="right"?a==="center"?c/2+h:c+2+h:0,k=0,S=n.length;k<S;++k){for(b=n[k],x=this.labelTextColors[k],e.fillStyle=x,L(b.before,g),v=b.lines,r&&v.length&&(this._drawColorBox(e,t,k,m,s),f=Math.max(d.lineHeight,l)),_=0,w=v.length;_<w;++_)g(v[_]),f=d.lineHeight;L(b.after,g)}u=0,f=d.lineHeight,L(this.afterBody,g),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let a,r;if(o){const l=Ft(s.rtl,this.x,this.width);for(t.x=Le(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",a=V(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:f,bottomLeft:u,bottomRight:m}=Ut(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-f,l),e.quadraticCurveTo(r+c,l,r+c,l+f),a==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(r+c,l+h-m),e.quadraticCurveTo(r+c,l+h,r+c-m,l+h),a==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(r+u,l+h),e.quadraticCurveTo(r,l+h,r,l+h-u),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=ee[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=hn(this,t),l=Object.assign({},a,this._size),c=dn(e,t,l),h=fn(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=J(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),os(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),as(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=!re(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||!re(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=ee[o.position].call(this,t,e);return a!==!1&&(s!==a.x||n!==a.y)}}D(bi,"positioners",ee);var Al={id:"tooltip",_element:bi,positioners:ee,afterInit(i,t,e){e&&(i.tooltip=new bi({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:pn},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Ll=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Il(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Ll(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Fl=(i,t)=>i===null?null:K(Math.round(i),0,t);function mn(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class _i extends Rt{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:Il(s,t,C(e,t),this._addedLabels),Fl(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 mn.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}}D(_i,"id","category"),D(_i,"defaults",{ticks:{callback:mn}});function Rl(i,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=i,u=o||1,m=h-1,{min:g,max:p}=t,b=!I(a),x=!I(r),v=!I(c),k=(p-g)/(d+1);let _=Li((p-g)/m/u)*u,S,w,y,M;if(_<1e-14&&!b&&!x)return[{value:g},{value:p}];M=Math.ceil(p/_)-Math.floor(g/_),M>m&&(_=Li(M*_/m/u)*u),I(l)||(S=Math.pow(10,l),_=Math.ceil(_*S)/S),n==="ticks"?(w=Math.floor(g/_)*_,y=Math.ceil(p/_)*_):(w=g,y=p),b&&x&&o&&no((r-a)/o,_/1e3)?(M=Math.round(Math.min((r-a)/_,h)),_=(r-a)/M,w=a,y=r):v?(w=b?a:w,y=x?r:y,M=c-1,_=(y-w)/M):(M=(y-w)/_,Nt(M,Math.round(M),_/1e3)?M=Math.round(M):M=Math.ceil(M));const T=Math.max(Ii(_),Ii(w));S=Math.pow(10,I(l)?T:l),w=Math.round(w*S)/S,y=Math.round(y*S)/S;let P=0;for(b&&(f&&w!==a?(e.push({value:a}),w<a&&P++,Nt(Math.round((w+P*_)*S)/S,a,bn(a,k,i))&&P++):w<a&&P++);P<M;++P){const A=Math.round((w+P*_)*S)/S;if(x&&A>r)break;e.push({value:A})}return x&&f&&y!==r?e.length&&Nt(e[e.length-1].value,r,bn(r,k,i))?e[e.length-1].value=r:e.push({value:r}):(!x||y===r)&&e.push({value:y}),e}function bn(i,t,{horizontal:e,minRotation:s}){const n=_t(s),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class zl extends Rt{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=Tt(n),c=Tt(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=Rl(n,o);return t.bounds==="ticks"&&oo(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 $i(t,this.chart.options.locale,this.options.ticks.format)}}class xi extends zl{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=W(t)?t:0,this.max=W(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=_t(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}}D(xi,"id","linear"),D(xi,"defaults",{ticks:{callback:Yi.formatters.numeric}});const Ie={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}},$=Object.keys(Ie);function _n(i,t){return i-t}function xn(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)),W(a)||(a=typeof s=="string"?e.parse(a,s):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(Vt(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function yn(i,t,e,s){const n=$.length;for(let o=$.indexOf(i);o<n-1;++o){const a=Ie[$[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=s)return $[o]}return $[n-1]}function El(i,t,e,s,n){for(let o=$.length-1;o>=$.indexOf(e);o--){const a=$[o];if(Ie[a].common&&i._adapter.diff(n,s,a)>=t-1)return a}return $[e?$.indexOf(e):0]}function Bl(i){for(let t=$.indexOf(i)+1,e=$.length;t<e;++t)if(Ie[$[t]].common)return $[t]}function vn(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=Ue(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function Hl(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 kn(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:Hl(i,s,n,e)}class Fe extends Rt{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 Fa._date(t.adapters.date);n.init(e),Wt(s.displayFormats,n.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:xn(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:n,max:o,minDefined: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=W(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=W(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=fo(n,o,a);return this._unit=e.unit||(s.autoSkip?yn(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):El(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Bl(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),kn(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=K(e,0,a),s=K(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||yn(o.minUnit,e,s,this._getLabelCapacity(e)),r=C(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Vt(l)||l===!0,h={};let d=e,f,u;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 m=n.ticks.source==="data"&&this.getDataTimestamps();for(f=d,u=0;f<s;f=+t.add(f,r,a),u++)vn(h,f,m);return(f===s||n.bounds==="ticks"||u===1)&&vn(h,f,m),Object.keys(h).sort(_n).map(g=>+g)}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 F(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],f=s[e],u=c&&d&&f&&f.major;return this._adapter.format(t,n||(u?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=_t(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,kn(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(xn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return go(t.sort(_n))}}D(Fe,"id","time"),D(Fe,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Re(i,t,e){let s=0,n=i.length-1,o,a,r,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=xt(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}=xt(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 wn extends Fe{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Re(e,this.min),this._tableRange=Re(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let 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(Re(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Re(this._table,s*this._tableRange+this._minPos,!0)}}D(wn,"id","timeseries"),D(wn,"defaults",Fe.defaults);function Wl(i,t,e,s,n,o,a,r){var l=typeof i=="function"?i.options:i;return t&&(l.render=t,l.staticRenderFns=e,l._compiled=!0),{exports:i,options:l}}ct.register(ve,mt,Te,xi,_i,bl,Al,wl);const Sn=["#4271ae","#c82829","#8959a8","#4d9a0f","#f5871f","#3e999f","#718c00","#a3685a","#525252","#eab700"],Nl={props:{analyticsData:{type:Object,default:()=>({})}},data(){return{startDate:"",endDate:"",data:this.analyticsData||{},chart:null,users:[],selectedEmails:[],selectedPages:[]}},computed:{hasData(){return this.data&&this.data.totalVisits>0},pagesPerSession(){var i;return(i=this.data)!=null&&i.uniqueSessions?(this.data.totalVisits/this.data.uniqueSessions).toFixed(1):"0"},userOptions(){return this.users.map(i=>({value:i.email,text:i.label}))},pageOptions(){var i;return(i=this.data)!=null&&i.visitsByPage?Object.keys(this.data.visitsByPage).map(t=>({value:t,text:t})).sort((t,e)=>t.text.localeCompare(e.text)):[]}},watch:{analyticsData(i){this.data=i||{},this.renderChart()}},mounted(){this.setDefaultDates(),this.fetchData()},beforeUnmount(){this.destroyChart()},methods:{setDefaultDates(){const i=new Date,t=new Date(i);t.setDate(t.getDate()-30),this.endDate=i.toISOString().split("T")[0],this.startDate=t.toISOString().split("T")[0]},onUserSelectionChange(i){this.selectedEmails=i,this.fetchData()},onPageSelectionChange(i){this.selectedPages=i,this.fetchData()},async fetchData(){const i=new URLSearchParams;this.startDate&&i.set("startDate",this.startDate),this.endDate&&i.set("endDate",this.endDate),this.selectedEmails.length&&i.set("emails",this.selectedEmails.join(",")),this.selectedPages.length&&i.set("pageNames",this.selectedPages.join(","));try{const e=await(await fetch(`/analytics-data.json?${i}`)).json();console.log(e.data),e.status==="success"&&(this.data=e.data),e.users&&!this.users.length&&(this.users=e.users),this.renderChart()}catch(t){console.error("Analytics fetch error:",t),this.renderChart()}},destroyChart(){this.chart&&(this.chart.destroy(),this.chart=null)},formatDateFR(i){const[t,e,s]=i.split("-");return`${s}/${e}/${t}`},renderChart(){var a;this.destroyChart();const i=this.$refs.chartCanvas;if(!i||!((a=this.data)!=null&&a.visitsByDay))return;const t=Object.keys(this.data.visitsByDay);if(!t.length)return;const e=t.map(r=>this.formatDateFR(r)),s=this.selectedPages.length===0&&this.data.visitsByDayByPage;let n,o;if(s)n=Object.keys(this.data.visitsByDayByPage).map((l,c)=>{const h=Sn[c%Sn.length],d=t.map(f=>{var u;return((u=this.data.visitsByDayByPage[l])==null?void 0:u[f])||0});return{label:l,data:d,borderColor:h,backgroundColor:"transparent",fill:!1,tension:.3,pointRadius:2,pointHoverRadius:4,borderWidth:2}}),o=Math.max(...n.flatMap(l=>l.data));else{const r=Object.values(this.data.visitsByDay);n=[{label:"Visites",data:r,borderColor:"#4271ae",backgroundColor:"rgba(66, 113, 174, 0.1)",fill:!0,tension:.3,pointRadius:3,pointHoverRadius:5}],o=Math.max(...r)}this.chart=new ct(i,{type:"line",data:{labels:e,datasets:n},options:{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",intersect:!1},legend:{display:s,position:"bottom",labels:{boxWidth:12,padding:12}}},scales:{y:{beginAtZero:!0,max:o+3,ticks:{precision:0}}}}})}}};var Vl=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-analytics-dashboard"},[e("div",{staticClass:"k-analytics-filters"},[e("div",{staticClass:"k-analytics-date-filter"},[t._m(0),e("div",{staticClass:"k-date-inputs-wrapper"},[e("label",[t._v(" Du "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.startDate,expression:"startDate"}],attrs:{type:"date"},domProps:{value:t.startDate},on:{change:t.fetchData,input:function(s){s.target.composing||(t.startDate=s.target.value)}}})]),e("label",[t._v(" Au "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.endDate,expression:"endDate"}],attrs:{type:"date"},domProps:{value:t.endDate},on:{change:t.fetchData,input:function(s){s.target.composing||(t.endDate=s.target.value)}}})])])]),e("div",{staticClass:"k-analytics-user-filter"},[e("k-multiselect-field",{attrs:{options:t.userOptions,value:t.selectedEmails,label:"Filtrer par utilisateur(s)",search:"true",name:"user"},on:{input:t.onUserSelectionChange}})],1),e("div",{staticClass:"k-analytics-page-filter"},[e("k-multiselect-field",{attrs:{options:t.pageOptions,value:t.selectedPages,label:"Filtrer par page(s)",search:"true",name:"page"},on:{input:t.onPageSelectionChange}})],1)]),t.hasData?[e("div",{staticClass:"k-analytics-grid"},[e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Sessions uniques")]),e("div",{staticClass:"k-analytics-metric"},[t._v(t._s(t.data.uniqueSessions))])]),e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Pages vues")]),e("div",{staticClass:"k-analytics-metric"},[t._v(t._s(t.data.totalVisits))])]),e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Pages / session")]),e("div",{staticClass:"k-analytics-metric"},[t._v(t._s(t.pagesPerSession))])])]),e("div",{staticClass:"k-analytics-chart-container"},[e("h3",[t._v("Visites par jour")]),e("canvas",{ref:"chartCanvas"})]),t.data.visitsByPage&&Object.keys(t.data.visitsByPage).length?e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Pages les plus visitées")]),e("ul",{staticClass:"k-analytics-list"},t._l(t.data.visitsByPage,function(s,n){return e("li",{key:n},[e("span",{staticClass:"k-analytics-list-label"},[t._v(t._s(n))]),e("span",{staticClass:"k-analytics-list-value"},[t._v(t._s(s))])])}),0)]):t._e()]:e("div",{staticClass:"k-analytics-empty"},[e("p",[t._v("Aucune donnée à afficher")])])],2)},jl=[function(){var i=this,t=i._self._c;return t("header",{staticClass:"k-field-header"},[t("label",{staticClass:"k-label k-field-label",attrs:{title:"Filtrer par dates"}},[t("span",{staticClass:"k-label-text"},[i._v("Filtrer par dates ")])])])}],$l=Wl(Nl,Vl,jl);const Yl=$l.exports;window.panel.plugin("adrienpayet/analytics",{fields:{"analytics-dashboard":Yl}})})();