react-doctor-cli-dev 1.0.7 โ 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/dist/db.js +33 -11
- package/backend/dist/index.js +29 -3
- package/backend/dist/routes/reports.js +106 -55
- package/backend/public/assets/index-BpODc0fS.css +1 -0
- package/backend/public/assets/index-zKyZPsv1.js +118 -0
- package/backend/public/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/backend/public/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/backend/public/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/backend/public/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/backend/public/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/backend/public/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/backend/public/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/backend/public/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/backend/public/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/backend/public/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/backend/public/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/backend/public/assets/tajawal-arabic-300-normal-Bq0yWa0Z.woff +0 -0
- package/backend/public/assets/tajawal-arabic-300-normal-By07C9pa.woff2 +0 -0
- package/backend/public/assets/tajawal-arabic-400-normal-CyCXRvzh.woff2 +0 -0
- package/backend/public/assets/tajawal-arabic-400-normal-DCQxawbB.woff +0 -0
- package/backend/public/assets/tajawal-arabic-500-normal-BZ8ojJNu.woff2 +0 -0
- package/backend/public/assets/tajawal-arabic-500-normal-CbVEaYEW.woff +0 -0
- package/backend/public/assets/tajawal-arabic-700-normal-9L7Zusdl.woff +0 -0
- package/backend/public/assets/tajawal-arabic-700-normal-D2-eand5.woff2 +0 -0
- package/backend/public/assets/tajawal-latin-300-normal-C0-xR3ms.woff +0 -0
- package/backend/public/assets/tajawal-latin-300-normal-CeEKeOxZ.woff2 +0 -0
- package/backend/public/assets/tajawal-latin-400-normal-BVNSOH3d.woff2 +0 -0
- package/backend/public/assets/tajawal-latin-400-normal-BdYcZznU.woff +0 -0
- package/backend/public/assets/tajawal-latin-500-normal-CoYeBiSI.woff2 +0 -0
- package/backend/public/assets/tajawal-latin-500-normal-DU9v6xgj.woff +0 -0
- package/backend/public/assets/tajawal-latin-700-normal-BypgxfGb.woff2 +0 -0
- package/backend/public/assets/tajawal-latin-700-normal-CV3bxpHe.woff +0 -0
- package/backend/public/favicon.svg +1 -0
- package/backend/public/icons.svg +24 -0
- package/backend/public/index.html +254 -0
- package/backend/src/db.ts +42 -18
- package/backend/src/index.ts +31 -3
- package/backend/src/routes/reports.ts +141 -52
- package/cli/dist/commands/full.js +82 -48
- package/cli/src/commands/full.ts +161 -115
- package/dashboard/index.html +253 -0
- package/dashboard/package-lock.json +913 -0
- package/dashboard/package.json +19 -0
- package/dashboard/public/favicon.svg +1 -0
- package/dashboard/public/icons.svg +24 -0
- package/dashboard/src/api.js +107 -0
- package/dashboard/src/assets/hero.png +0 -0
- package/dashboard/src/assets/javascript.svg +1 -0
- package/dashboard/src/assets/vite.svg +1 -0
- package/dashboard/src/css/main.css +441 -0
- package/dashboard/src/data.js +202 -0
- package/dashboard/src/main.js +53 -0
- package/dashboard/src/pages.js +797 -0
- package/dashboard/src/router.js +77 -0
- package/dashboard/src/utils.js +163 -0
- package/dashboard/vite.config.js +19 -0
- package/data/screenshots/5--fcp.png +0 -0
- package/data/screenshots/5--fullLoad.png +0 -0
- package/data/screenshots/5-docs-fullLoad.png +0 -0
- package/data/screenshots/5-white-fullLoad.png +0 -0
- package/data/screenshots/6--fcp.png +0 -0
- package/data/screenshots/6--fullLoad.png +0 -0
- package/data/screenshots/6-docs-fullLoad.png +0 -0
- package/data/screenshots/6-white-fullLoad.png +0 -0
- package/package.json +4 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){return e+.5|0}var t=(e,t,n)=>Math.max(Math.min(e,n),t);function n(n){return t(e(n*2.55),0,255)}function r(n){return t(e(n*255),0,255)}function i(n){return t(e(n/2.55)/100,0,1)}function a(n){return t(e(n*100),0,100)}var o={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},s=[...`0123456789ABCDEF`],c=e=>s[e&15],l=e=>s[(e&240)>>4]+s[e&15],u=e=>(e&240)>>4==(e&15),d=e=>u(e.r)&&u(e.g)&&u(e.b)&&u(e.a);function f(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&o[e[1]]*17,g:255&o[e[2]]*17,b:255&o[e[3]]*17,a:t===5?o[e[4]]*17:255}:(t===7||t===9)&&(n={r:o[e[1]]<<4|o[e[2]],g:o[e[3]]<<4|o[e[4]],b:o[e[5]]<<4|o[e[6]],a:t===9?o[e[7]]<<4|o[e[8]]:255})),n}var p=(e,t)=>e<255?t(e):``;function m(e){var t=d(e)?c:l;return e?`#`+t(e.r)+t(e.g)+t(e.b)+p(e.a,t):void 0}var h=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function g(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function _(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function v(e,t,n){let r=g(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function y(e,t,n,r,i){return e===i?(t-n)/r+(t<n?6:0):t===i?(n-e)/r+2:(e-t)/r+4}function b(e){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c,l;return i!==a&&(l=i-a,c=o>.5?l/(2-i-a):l/(i+a),s=y(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function x(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(r)}function S(e,t,n){return x(g,e,t,n)}function C(e,t,n){return x(v,e,t,n)}function w(e,t,n){return x(_,e,t,n)}function T(e){return(e%360+360)%360}function E(e){let t=h.exec(e),i=255,a;if(!t)return;t[5]!==a&&(i=t[6]?n(+t[5]):r(+t[5]));let o=T(+t[2]),s=t[3]/100,c=t[4]/100;return a=t[1]===`hwb`?C(o,s,c):t[1]===`hsv`?w(o,s,c):S(o,s,c),{r:a[0],g:a[1],b:a[2],a:i}}function D(e,t){var n=b(e);n[0]=T(n[0]+t),n=S(n),e.r=n[0],e.g=n[1],e.b=n[2]}function ee(e){if(!e)return;let t=b(e),n=t[0],r=a(t[1]),o=a(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${o}%, ${i(e.a)})`:`hsl(${n}, ${r}%, ${o}%)`}var O={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`},te={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 ne(){let e={},t=Object.keys(te),n=Object.keys(O),r,i,a,o,s;for(r=0;r<t.length;r++){for(o=s=t[r],i=0;i<n.length;i++)a=n[i],s=s.replace(a,O[a]);a=parseInt(te[o],16),e[s]=[a>>16&255,a>>8&255,a&255]}return e}var re;function ie(e){re||(re=ne(),re.transparent=[0,0,0,0]);let t=re[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var ae=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function oe(e){let r=ae.exec(e),i=255,a,o,s;if(r){if(r[7]!==a){let e=+r[7];i=r[8]?n(e):t(e*255,0,255)}return a=+r[1],o=+r[3],s=+r[5],a=255&(r[2]?n(a):t(a,0,255)),o=255&(r[4]?n(o):t(o,0,255)),s=255&(r[6]?n(s):t(s,0,255)),{r:a,g:o,b:s,a:i}}}function se(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${i(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var ce=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,le=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function ue(e,t,n){let a=le(i(e.r)),o=le(i(e.g)),s=le(i(e.b));return{r:r(ce(a+n*(le(i(t.r))-a))),g:r(ce(o+n*(le(i(t.g))-o))),b:r(ce(s+n*(le(i(t.b))-s))),a:e.a+n*(t.a-e.a)}}function de(e,t,n){if(e){let r=b(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=S(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function fe(e,t){return e&&Object.assign(t||{},e)}function pe(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=r(e[3]))):(t=fe(e,{r:0,g:0,b:0,a:1}),t.a=r(t.a)),t}function me(e){return e.charAt(0)===`r`?oe(e):E(e)}var he=class t{constructor(e){if(e instanceof t)return e;let n=typeof e,r;n===`object`?r=pe(e):n===`string`&&(r=f(e)||ie(e)||me(e)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=fe(this._rgb);return e&&(e.a=i(e.a)),e}set rgb(e){this._rgb=pe(e)}rgbString(){return this._valid?se(this._rgb):void 0}hexString(){return this._valid?m(this._rgb):void 0}hslString(){return this._valid?ee(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=ue(this._rgb,e._rgb,t)),this}clone(){return new t(this.rgb)}alpha(e){return this._rgb.a=r(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let t=this._rgb;return t.r=t.g=t.b=e(t.r*.3+t.g*.59+t.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return de(this._rgb,2,e),this}darken(e){return de(this._rgb,2,-e),this}saturate(e){return de(this._rgb,1,e),this}desaturate(e){return de(this._rgb,1,-e),this}rotate(e){return D(this._rgb,e),this}};function ge(){}var _e=(()=>{let e=0;return()=>e++})();function k(e){return e==null}function A(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function j(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function M(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function N(e,t){return M(e)?e:t}function P(e,t){return e===void 0?t:e}var ve=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/t,ye=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function F(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function I(e,t,n,r){let i,a,o;if(A(e))if(a=e.length,r)for(i=a-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;i<a;i++)t.call(n,e[i],i);else if(j(e))for(o=Object.keys(e),a=o.length,i=0;i<a;i++)t.call(n,e[o[i]],o[i])}function be(e,t){let n,r,i,a;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(i=e[n],a=t[n],i.datasetIndex!==a.datasetIndex||i.index!==a.index)return!1;return!0}function xe(e){if(A(e))return e.map(xe);if(j(e)){let t=Object.create(null),n=Object.keys(e),r=n.length,i=0;for(;i<r;++i)t[n[i]]=xe(e[n[i]]);return t}return e}function Se(e){return[`__proto__`,`prototype`,`constructor`].indexOf(e)===-1}function Ce(e,t,n,r){if(!Se(e))return;let i=t[e],a=n[e];j(i)&&j(a)?we(i,a,r):t[e]=xe(a)}function we(e,t,n){let r=A(t)?t:[t],i=r.length;if(!j(e))return e;n||={};let a=n.merger||Ce,o;for(let t=0;t<i;++t){if(o=r[t],!j(o))continue;let i=Object.keys(o);for(let t=0,r=i.length;t<r;++t)a(i[t],e,o,n)}return e}function Te(e,t){return we(e,t,{merger:Ee})}function Ee(e,t,n){if(!Se(e))return;let r=t[e],i=n[e];j(r)&&j(i)?Te(r,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=xe(i))}var De={"":e=>e,x:e=>e.x,y:e=>e.y};function Oe(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function ke(e){let t=Oe(e);return e=>{for(let n of t){if(n===``)break;e&&=e[n]}return e}}function Ae(e,t){return(De[t]||(De[t]=ke(t)))(e)}function je(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Me=e=>e!==void 0,Ne=e=>typeof e==`function`,Pe=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function Fe(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var L=Math.PI,R=2*L,Ie=R+L,Le=1/0,Re=L/180,z=L/2,ze=L/4,Be=L*2/3,Ve=Math.log10,B=Math.sign;function He(e,t,n){return Math.abs(e-t)<n}function Ue(e){let t=Math.round(e);e=He(e,t,e/1e3)?t:e;let n=10**Math.floor(Ve(e)),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function We(e){let t=[],n=Math.sqrt(e),r;for(r=1;r<n;r++)e%r===0&&(t.push(r),t.push(e/r));return n===(n|0)&&t.push(n),t.sort((e,t)=>e-t).pop(),t}function Ge(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function Ke(e){return!Ge(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function qe(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function Je(e,t,n){let r,i,a;for(r=0,i=e.length;r<i;r++)a=e[r][n],isNaN(a)||(t.min=Math.min(t.min,a),t.max=Math.max(t.max,a))}function V(e){return L/180*e}function Ye(e){return 180/L*e}function Xe(e){if(!M(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Ze(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r),a=Math.atan2(r,n);return a<-.5*L&&(a+=R),{angle:a,distance:i}}function Qe(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function $e(e,t){return(e-t+Ie)%R-L}function H(e){return(e%R+R)%R}function et(e,t,n,r){let i=H(e),a=H(t),o=H(n),s=H(a-i),c=H(o-i),l=H(i-a),u=H(i-o);return i===a||i===o||r&&a===o||s>c&&l<u}function U(e,t,n){return Math.max(t,Math.min(n,e))}function tt(e){return U(e,-32768,32767)}function nt(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function rt(e,t,n){n||=(n=>e[n]<t);let r=e.length-1,i=0,a;for(;r-i>1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var it=(e,t,n,r)=>rt(e,n,r?r=>{let i=e[r][t];return i<n||i===n&&e[r+1][t]===n}:r=>e[r][t]<n),at=(e,t,n)=>rt(e,n,r=>e[r][t]>=n);function ot(e,t,n){let r=0,i=e.length;for(;r<i&&e[r]<t;)r++;for(;i>r&&e[i-1]>n;)i--;return r>0||i<e.length?e.slice(r,i):e}var st=[`push`,`pop`,`shift`,`splice`,`unshift`];function ct(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),st.forEach(t=>{let n=`_onData`+je(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function lt(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(st.forEach(t=>{delete e[t]}),delete e._chartjs)}function ut(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var dt=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function ft(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,dt.call(window,()=>{r=!1,e.apply(t,n)}))}}function pt(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var mt=e=>e===`start`?`left`:e===`end`?`right`:`center`,W=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,ht=(e,t,n,r)=>e===(r?`left`:`right`)?n:e===`center`?(t+n)/2:t;function gt(e,t,n){let r=t.length,i=0,a=r;if(e._sorted){let{iScale:o,vScale:s,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=o.axis,{min:d,max:f,minDefined:p,maxDefined:m}=o.getUserBounds();if(p){if(i=Math.min(it(c,u,d).lo,n?r:it(t,u,o.getPixelForValue(d)).lo),l){let e=c.slice(0,i+1).reverse().findIndex(e=>!k(e[s.axis]));i-=Math.max(0,e)}i=U(i,0,r-1)}if(m){let e=Math.max(it(c,o.axis,f,!0).hi+1,n?0:it(t,u,o.getPixelForValue(f),!0).hi+1);if(l){let t=c.slice(e-1).findIndex(e=>!k(e[s.axis]));e+=Math.max(0,t)}a=U(e,i,r)-i}else a=r-i}return{start:i,count:a}}function _t(e){let{xScale:t,yScale:n,_scaleRanges:r}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=i,!0;let a=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,i),a}var vt=e=>e===0||e===1,yt=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*R/n)),bt=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*R/n)+1,xt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*z)+1,easeOutSine:e=>Math.sin(e*z),easeInOutSine:e=>-.5*(Math.cos(L*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>vt(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>vt(e)?e:yt(e,.075,.3),easeOutElastic:e=>vt(e)?e:bt(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return vt(e)?e:e<.5?.5*yt(e*2,t,n):.5+.5*bt(e*2-1,t,n)},easeInBack(e){return e*e*(2.70158*e-1.70158)},easeOutBack(e){return--e*e*(2.70158*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-xt.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?xt.easeInBounce(e*2)*.5:xt.easeOutBounce(e*2-1)*.5+.5};function St(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function Ct(e){return St(e)?e:new he(e)}function wt(e){return St(e)?e:new he(e).saturate(.5).darken(.1).hexString()}var Tt=[`x`,`y`,`borderWidth`,`radius`,`tension`],Et=[`color`,`borderColor`,`backgroundColor`];function Dt(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:Et},numbers:{type:`number`,properties:Tt}}),e.describe(`animations`,{_fallback:`animation`}),e.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:e=>e|0}}}})}function Ot(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var kt=new Map;function At(e,t){t||={};let n=e+JSON.stringify(t),r=kt.get(n);return r||(r=new Intl.NumberFormat(e,t),kt.set(n,r)),r}function jt(e,t,n){return At(t,n).format(e)}var Mt={values(e){return A(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=Nt(e,n)}let o=Ve(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),jt(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(Ve(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Mt.numeric.call(this,e,t,n):``}};function Nt(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Pt={formatters:Mt};function Ft(e){e.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:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.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:Pt.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var It=Object.create(null),Lt=Object.create(null);function Rt(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;t<r;++t){let r=n[t];e=e[r]||(e[r]=Object.create(null))}return e}function zt(e,t,n){return typeof t==`string`?we(Rt(e,t),n):we(Rt(e,``),t)}var G=new class{constructor(e,t){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=e=>e.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=(e,t)=>wt(t.backgroundColor),this.hoverBorderColor=(e,t)=>wt(t.borderColor),this.hoverColor=(e,t)=>wt(t.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(e),this.apply(t)}set(e,t){return zt(this,e,t)}get(e){return Rt(this,e)}describe(e,t){return zt(Lt,e,t)}override(e,t){return zt(It,e,t)}route(e,t,n,r){let i=Rt(this,e),a=Rt(this,n),o=`_`+t;Object.defineProperties(i,{[o]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return j(e)?Object.assign({},t,e):P(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[Dt,Ot,Ft]);function Bt(e){return!e||k(e.size)||k(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function Vt(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function Ht(e,t,n,r){r||={};let i=r.data=r.data||{},a=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},a=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let o=0,s=n.length,c,l,u,d,f;for(c=0;c<s;c++)if(d=n[c],d!=null&&!A(d))o=Vt(e,i,a,o,d);else if(A(d))for(l=0,u=d.length;l<u;l++)f=d[l],f!=null&&!A(f)&&(o=Vt(e,i,a,o,f));e.restore();let p=a.length/2;if(p>n.length){for(c=0;c<p;c++)delete i[a[c]];a.splice(0,p)}return o}function Ut(e,t,n){let r=e.currentDevicePixelRatio,i=n===0?0:Math.max(n/2,.5);return Math.round((t-i)*r)/r+i}function Wt(e,t){!t&&!e||(t||=e.getContext(`2d`),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Gt(e,t,n,r){Kt(e,t,n,r,null)}function Kt(e,t,n,r,i){let a,o,s,c,l,u,d,f,p=t.pointStyle,m=t.rotation,h=t.radius,g=(m||0)*Re;if(p&&typeof p==`object`&&(a=p.toString(),a===`[object HTMLImageElement]`||a===`[object HTMLCanvasElement]`)){e.save(),e.translate(n,r),e.rotate(g),e.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),e.restore();return}if(!(isNaN(h)||h<=0)){switch(e.beginPath(),p){default:i?e.ellipse(n,r,i/2,h,0,0,R):e.arc(n,r,h,0,R),e.closePath();break;case`triangle`:u=i?i/2:h,e.moveTo(n+Math.sin(g)*u,r-Math.cos(g)*h),g+=Be,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*h),g+=Be,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*h),e.closePath();break;case`rectRounded`:l=h*.516,c=h-l,o=Math.cos(g+ze)*c,d=Math.cos(g+ze)*(i?i/2-l:c),s=Math.sin(g+ze)*c,f=Math.sin(g+ze)*(i?i/2-l:c),e.arc(n-d,r-s,l,g-L,g-z),e.arc(n+f,r-o,l,g-z,g),e.arc(n+d,r+s,l,g,g+z),e.arc(n-f,r+o,l,g+z,g+L),e.closePath();break;case`rect`:if(!m){c=Math.SQRT1_2*h,u=i?i/2:c,e.rect(n-u,r-c,2*u,2*c);break}g+=ze;case`rectRot`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+f,r-o),e.lineTo(n+d,r+s),e.lineTo(n-f,r+o),e.closePath();break;case`crossRot`:g+=ze;case`cross`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o);break;case`star`:d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o),g+=ze,d=Math.cos(g)*(i?i/2:h),o=Math.cos(g)*h,s=Math.sin(g)*h,f=Math.sin(g)*(i?i/2:h),e.moveTo(n-d,r-s),e.lineTo(n+d,r+s),e.moveTo(n+f,r-o),e.lineTo(n-f,r+o);break;case`line`:o=i?i/2:Math.cos(g)*h,s=Math.sin(g)*h,e.moveTo(n-o,r-s),e.lineTo(n+o,r+s);break;case`dash`:e.moveTo(n,r),e.lineTo(n+Math.cos(g)*(i?i/2:h),r+Math.sin(g)*h);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function qt(e,t,n){return n||=.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Jt(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function Yt(e){e.restore()}function Xt(e,t,n,r,i){if(!t)return e.lineTo(n.x,n.y);if(i===`middle`){let r=(t.x+n.x)/2;e.lineTo(r,t.y),e.lineTo(r,n.y)}else i===`after`==!!r?e.lineTo(n.x,t.y):e.lineTo(t.x,n.y);e.lineTo(n.x,n.y)}function Zt(e,t,n,r){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(r?t.cp1x:t.cp2x,r?t.cp1y:t.cp2y,r?n.cp2x:n.cp1x,r?n.cp2y:n.cp1y,n.x,n.y)}function Qt(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),k(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function $t(e,t,n,r,i){if(i.strikethrough||i.underline){let a=e.measureText(r),o=t-a.actualBoundingBoxLeft,s=t+a.actualBoundingBoxRight,c=n-a.actualBoundingBoxAscent,l=n+a.actualBoundingBoxDescent,u=i.strikethrough?(c+l)/2:l;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(o,u),e.lineTo(s,u),e.stroke()}}function en(e,t){let n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function tn(e,t,n,r,i,a={}){let o=A(t)?t:[t],s=a.strokeWidth>0&&a.strokeColor!==``,c,l;for(e.save(),e.font=i.string,Qt(e,a),c=0;c<o.length;++c)l=o[c],a.backdrop&&en(e,a.backdrop),s&&(a.strokeColor&&(e.strokeStyle=a.strokeColor),k(a.strokeWidth)||(e.lineWidth=a.strokeWidth),e.strokeText(l,n,r,a.maxWidth)),e.fillText(l,n,r,a.maxWidth),$t(e,n,r,l,a),r+=Number(i.lineHeight);e.restore()}function nn(e,t){let{x:n,y:r,w:i,h:a,radius:o}=t;e.arc(n+o.topLeft,r+o.topLeft,o.topLeft,1.5*L,L,!0),e.lineTo(n,r+a-o.bottomLeft),e.arc(n+o.bottomLeft,r+a-o.bottomLeft,o.bottomLeft,L,z,!0),e.lineTo(n+i-o.bottomRight,r+a),e.arc(n+i-o.bottomRight,r+a-o.bottomRight,o.bottomRight,z,0,!0),e.lineTo(n+i,r+o.topRight),e.arc(n+i-o.topRight,r+o.topRight,o.topRight,0,-z,!0),e.lineTo(n+o.topLeft,r)}var rn=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,an=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function on(e,t){let n=(``+e).match(rn);if(!n||n[1]===`normal`)return t*1.2;switch(e=+n[2],n[3]){case`px`:return e;case`%`:e/=100;break}return t*e}var sn=e=>+e||0;function cn(e,t){let n={},r=j(t),i=r?Object.keys(t):t,a=j(e)?r?n=>P(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=sn(a(e));return n}function ln(e){return cn(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function un(e){return cn(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function K(e){let t=ln(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function q(e,t){e||={},t||=G.font;let n=P(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=P(e.style,t.style);r&&!(``+r).match(an)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:P(e.family,t.family),lineHeight:on(P(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:P(e.weight,t.weight),string:``};return i.string=Bt(i),i}function dn(e,t,n,r){let i=!0,a,o,s;for(a=0,o=e.length;a<o;++a)if(s=e[a],s!==void 0&&(t!==void 0&&typeof s==`function`&&(s=s(t),i=!1),n!==void 0&&A(s)&&(s=s[n%s.length],i=!1),s!==void 0))return r&&!i&&(r.cacheable=!1),s}function fn(e,t,n){let{min:r,max:i}=e,a=ye(t,(i-r)/2),o=(e,t)=>n&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function pn(e,t){return Object.assign(Object.create(e),t)}function mn(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=An(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>mn([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return yn(n,r,()=>kn(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return jn(e).includes(t)},ownKeys(e){return jn(e)},set(e,t,n){let r=e._storage||=i();return e[t]=r[t]=n,delete e._keys,!0}})}function hn(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:gn(e,r),setContext:t=>hn(e,t,n,r),override:i=>hn(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return yn(e,t,()=>bn(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function gn(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:Ne(n)?n:()=>n,isIndexable:Ne(r)?r:()=>r}}var _n=(e,t)=>e?e+je(t):t,vn=(e,t)=>j(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function yn(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function bn(e,t,n){let{_proxy:r,_context:i,_subProxy:a,_descriptors:o}=e,s=r[t];return Ne(s)&&o.isScriptable(t)&&(s=xn(t,s,e,n)),A(s)&&s.length&&(s=Sn(t,s,e,o.isIndexable)),vn(t,s)&&(s=hn(s,i,a&&a[t],o)),s}function xn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),vn(e,c)&&(c=En(i._scopes,i,e,c)),c}function Sn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_descriptors:s}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(j(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let c of n){let n=En(r,i,e,c);t.push(hn(n,a,o&&o[e],s))}}return t}function Cn(e,t,n){return Ne(e)?e(t,n):e}var wn=(e,t)=>e===!0?t:typeof e==`string`?Ae(t,e):void 0;function Tn(e,t,n,r,i){for(let a of t){let t=wn(n,a);if(t){e.add(t);let a=Cn(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function En(e,t,n,r){let i=t._rootScopes,a=Cn(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=Dn(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=Dn(s,o,a,c,r),c===null)?!1:mn(Array.from(s),[``],i,a,()=>On(t,n,r))}function Dn(e,t,n,r,i){for(;n;)n=Tn(e,t,n,r,i);return n}function On(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return A(i)&&j(n)?n:i||{}}function kn(e,t,n,r){let i;for(let a of t)if(i=An(_n(a,e),n),i!==void 0)return vn(e,i)?En(n,r,e,i):i}function An(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function jn(e){let t=e._keys;return t||=e._keys=Mn(e._scopes),t}function Mn(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}function Nn(e,t,n,r){let{iScale:i}=e,{key:a=`r`}=this._parsing,o=Array(r),s,c,l,u;for(s=0,c=r;s<c;++s)l=s+n,u=t[l],o[s]={r:i.parse(Ae(u,a),l)};return o}var Pn=2**-52||1e-14,Fn=(e,t)=>t<e.length&&!e[t].skip&&e[t],In=e=>e===`x`?`y`:`x`;function Ln(e,t,n,r){let i=e.skip?t:e,a=t,o=n.skip?t:n,s=Qe(a,i),c=Qe(o,a),l=s/(s+c),u=c/(s+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;let d=r*l,f=r*u;return{previous:{x:a.x-d*(o.x-i.x),y:a.y-d*(o.y-i.y)},next:{x:a.x+f*(o.x-i.x),y:a.y+f*(o.y-i.y)}}}function Rn(e,t,n){let r=e.length,i,a,o,s,c,l=Fn(e,0);for(let u=0;u<r-1;++u)if(c=l,l=Fn(e,u+1),!(!c||!l)){if(He(t[u],0,Pn)){n[u]=n[u+1]=0;continue}i=n[u]/t[u],a=n[u+1]/t[u],s=i**2+a**2,!(s<=9)&&(o=3/Math.sqrt(s),n[u]=i*o*t[u],n[u+1]=a*o*t[u])}}function zn(e,t,n=`x`){let r=In(n),i=e.length,a,o,s,c=Fn(e,0);for(let l=0;l<i;++l){if(o=s,s=c,c=Fn(e,l+1),!s)continue;let i=s[n],u=s[r];o&&(a=(i-o[n])/3,s[`cp1${n}`]=i-a,s[`cp1${r}`]=u-a*t[l]),c&&(a=(c[n]-i)/3,s[`cp2${n}`]=i+a,s[`cp2${r}`]=u+a*t[l])}}function Bn(e,t=`x`){let n=In(t),r=e.length,i=Array(r).fill(0),a=Array(r),o,s,c,l=Fn(e,0);for(o=0;o<r;++o)if(s=c,c=l,l=Fn(e,o+1),c){if(l){let e=l[t]-c[t];i[o]=e===0?0:(l[n]-c[n])/e}a[o]=s?l?B(i[o-1])===B(i[o])?(i[o-1]+i[o])/2:0:i[o-1]:i[o]}Rn(e,i,a),zn(e,a,t)}function Vn(e,t,n){return Math.max(Math.min(e,n),t)}function Hn(e,t){let n,r,i,a,o,s=qt(e[0],t);for(n=0,r=e.length;n<r;++n)o=a,a=s,s=n<r-1&&qt(e[n+1],t),a&&(i=e[n],o&&(i.cp1x=Vn(i.cp1x,t.left,t.right),i.cp1y=Vn(i.cp1y,t.top,t.bottom)),s&&(i.cp2x=Vn(i.cp2x,t.left,t.right),i.cp2y=Vn(i.cp2y,t.top,t.bottom)))}function Un(e,t,n,r,i){let a,o,s,c;if(t.spanGaps&&(e=e.filter(e=>!e.skip)),t.cubicInterpolationMode===`monotone`)Bn(e,i);else{let n=r?e[e.length-1]:e[0];for(a=0,o=e.length;a<o;++a)s=e[a],c=Ln(n,s,e[Math.min(a+1,o-+!r)%o],t.tension),s.cp1x=c.previous.x,s.cp1y=c.previous.y,s.cp2x=c.next.x,s.cp2y=c.next.y,n=s}t.capBezierPoints&&Hn(e,n)}function Wn(){return typeof window<`u`&&typeof document<`u`}function Gn(e){let t=e.parentNode;return t&&t.toString()===`[object ShadowRoot]`&&(t=t.host),t}function Kn(e,t,n){let r;return typeof e==`string`?(r=parseInt(e,10),e.indexOf(`%`)!==-1&&(r=r/100*t.parentNode[n])):r=e,r}var qn=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Jn(e,t){return qn(e).getPropertyValue(t)}var Yn=[`top`,`right`,`bottom`,`left`];function Xn(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=Yn[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var Zn=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Qn(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(Zn(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function $n(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=qn(n),a=i.boxSizing===`border-box`,o=Xn(i,`padding`),s=Xn(i,`border`,`width`),{x:c,y:l,box:u}=Qn(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function er(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&Gn(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=qn(a),s=Xn(o,`border`,`width`),c=Xn(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=Kn(o.maxWidth,a,`clientWidth`),i=Kn(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||Le,maxHeight:i||Le}}var tr=e=>Math.round(e*10)/10;function nr(e,t,n,r){let i=qn(e),a=Xn(i,`margin`),o=Kn(i.maxWidth,e,`clientWidth`)||Le,s=Kn(i.maxHeight,e,`clientHeight`)||Le,c=er(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=Xn(i,`border`,`width`),t=Xn(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=tr(Math.min(l,o,c.maxWidth)),u=tr(Math.min(u,s,c.maxHeight)),l&&!u&&(u=tr(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=tr(Math.floor(u*r))),{width:l,height:u}}function rr(e,t,n){let r=t||1,i=tr(e.height*r),a=tr(e.width*r);e.height=tr(e.height),e.width=tr(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var ir=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};Wn()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function ar(e,t){let n=Jn(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function or(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function sr(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r===`middle`?n<.5?e.y:t.y:r===`after`?n<1?e.y:t.y:n>0?t.y:e.y}}function cr(e,t,n,r){let i={x:e.cp2x,y:e.cp2y},a={x:t.cp1x,y:t.cp1y},o=or(e,i,n),s=or(i,a,n),c=or(a,t,n);return or(or(o,s,n),or(s,c,n),n)}var lr=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},ur=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function dr(e,t,n){return e?lr(t,n):ur()}function fr(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function pr(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function mr(e){return e===`angle`?{between:et,compare:$e,normalize:H}:{between:nt,compare:(e,t)=>e-t,normalize:e=>e}}function hr({start:e,end:t,count:n,loop:r,style:i}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:i}}function gr(e,t,n){let{property:r,start:i,end:a}=n,{between:o,normalize:s}=mr(r),c=t.length,{start:l,end:u,loop:d}=e,f,p;if(d){for(l+=c,u+=c,f=0,p=c;f<p&&o(s(t[l%c][r]),i,a);++f)l--,u--;l%=c,u%=c}return u<l&&(u+=c),{start:l,end:u,loop:d,style:e.style}}function _r(e,t,n){if(!n)return[e];let{property:r,start:i,end:a}=n,o=t.length,{compare:s,between:c,normalize:l}=mr(r),{start:u,end:d,loop:f,style:p}=gr(e,t,n),m=[],h=!1,g=null,_,v,y,b=()=>c(i,y,_)&&s(i,y)!==0,x=()=>s(a,_)===0||c(a,y,_),S=()=>h||b(),C=()=>!h||x();for(let e=u,n=u;e<=d;++e)v=t[e%o],!v.skip&&(_=l(v[r]),_!==y&&(h=c(_,i,a),g===null&&S()&&(g=s(_,i)===0?e:n),g!==null&&C()&&(m.push(hr({start:g,end:e,loop:f,count:o,style:p})),g=null),n=e,y=_));return g!==null&&m.push(hr({start:g,end:d,loop:f,count:o,style:p})),m}function vr(e,t){let n=[],r=e.segments;for(let i=0;i<r.length;i++){let a=_r(r[i],e.points,t);a.length&&n.push(...a)}return n}function yr(e,t,n,r){let i=0,a=t-1;if(n&&!r)for(;i<t&&!e[i].skip;)i++;for(;i<t&&e[i].skip;)i++;for(i%=t,n&&(a+=i);a>i&&e[a%t].skip;)a--;return a%=t,{start:i,end:a}}function br(e,t,n,r){let i=e.length,a=[],o=t,s=e[t],c;for(c=t+1;c<=n;++c){let n=e[c%i];n.skip||n.stop?s.skip||(r=!1,a.push({start:t%i,end:(c-1)%i,loop:r}),t=o=n.stop?c:null):(o=c,s.skip&&(t=c)),s=n}return o!==null&&a.push({start:t%i,end:o%i,loop:r}),a}function xr(e,t){let n=e.points,r=e.options.spanGaps,i=n.length;if(!i)return[];let a=!!e._loop,{start:o,end:s}=yr(n,i,a,r);return r===!0?Sr(e,[{start:o,end:s,loop:a}],n,t):Sr(e,br(n,o,s<o?s+i:s,!!e._fullLoop&&o===0&&s===i-1),n,t)}function Sr(e,t,n,r){return!r||!r.setContext||!n?t:Cr(e,t,n,r)}function Cr(e,t,n,r){let i=e._chart.getContext(),a=wr(e.options),{_datasetIndex:o,options:{spanGaps:s}}=e,c=n.length,l=[],u=a,d=t[0].start,f=d;function p(e,t,r,i){let a=s?-1:1;if(e!==t){for(e+=c;n[e%c].skip;)e-=a;for(;n[t%c].skip;)t+=a;e%c!==t%c&&(l.push({start:e%c,end:t%c,loop:r,style:i}),u=i,d=t%c)}}for(let e of t){d=s?d:e.start;let t=n[d%c],a;for(f=d+1;f<=e.end;f++){let s=n[f%c];a=wr(r.setContext(pn(i,{type:`segment`,p0:t,p1:s,p0DataIndex:(f-1)%c,p1DataIndex:f%c,datasetIndex:o}))),Tr(a,u)&&p(d,f-1,e.loop,u),t=s,u=a}d<f-1&&p(d,f-1,e.loop,u)}return l}function wr(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Tr(e,t){if(!t)return!1;let n=[],r=function(e,t){return St(t)?(n.includes(t)||n.push(t),n.indexOf(t)):t};return JSON.stringify(e,r)!==JSON.stringify(t,r)}function Er(e,t,n){return e.options.clip?e[n]:t[n]}function Dr(e,t){let{xScale:n,yScale:r}=e;return n&&r?{left:Er(n,t,`left`),right:Er(n,t,`right`),top:Er(r,t,`top`),bottom:Er(r,t,`bottom`)}:t}function Or(e,t){let n=t._clip;if(n.disabled)return!1;let r=Dr(t,e.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:r.bottom+(n.bottom===!0?0:n.bottom)}}var kr=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let i=t.listeners[r],a=t.duration;i.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||=(this._running=!0,dt.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},Ar=`transparent`,jr={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=Ct(e||Ar),i=r.valid&&Ct(t||Ar);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Mr=class{constructor(e,t,n,r){let i=t[n];r=dn([e.to,r,i,e.from]);let a=dn([e.from,i,r]);this._active=!0,this._fn=e.fn||jr[e.type||typeof a],this._easing=xt[e.easing]||xt.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=dn([e.to,t,r,e.from]),this._from=dn([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t<n),!this._active){this._target[r]=o,this._notify(!0);return}if(t<0){this._target[r]=i;return}s=t/n%2,s=a&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||=[];return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}},Nr=class{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!j(e))return;let t=Object.keys(G.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{let i=e[r];if(!j(i))return;let a={};for(let e of t)a[e]=i[e];(A(i.properties)&&i.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=Fr(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&Pr(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||={},a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Mr(d,e,c,l),r.push(u)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return kr.add(this._chart,n),!0}};function Pr(e,t){let n=[],r=Object.keys(t);for(let t=0;t<r.length;t++){let i=e[r[t]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function Fr(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Ir(e,t){let n=e&&e.options||{},r=n.reverse,i=n.min===void 0?t:0,a=n.max===void 0?t:0;return{start:r?a:i,end:r?i:a}}function Lr(e,t,n){if(n===!1)return!1;let r=Ir(e,n),i=Ir(t,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function Rr(e){let t,n,r,i;return j(e)?(t=e.top,n=e.right,r=e.bottom,i=e.left):t=n=r=i=e,{top:t,right:n,bottom:r,left:i,disabled:e===!1}}function zr(e,t){let n=[],r=e._getSortedDatasetMetas(t),i,a;for(i=0,a=r.length;i<a;++i)n.push(r[i].index);return n}function Br(e,t,n,r={}){let i=e.keys,a=r.mode===`single`,o,s,c,l;if(t===null)return;let u=!1;for(o=0,s=i.length;o<s;++o){if(c=+i[o],c===n){if(u=!0,r.all)continue;break}l=e.values[c],M(l)&&(a||t===0||B(t)===B(l))&&(t+=l)}return!u&&!r.all?0:t}function Vr(e,t){let{iScale:n,vScale:r}=t,i=n.axis===`x`?`x`:`y`,a=r.axis===`x`?`x`:`y`,o=Object.keys(e),s=Array(o.length),c,l,u;for(c=0,l=o.length;c<l;++c)u=o[c],s[c]={[i]:u,[a]:e[u]};return s}function Hr(e,t){let n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Ur(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Wr(e){let{min:t,max:n,minDefined:r,maxDefined:i}=e.getUserBounds();return{min:r?t:-1/0,max:i?n:1/0}}function Gr(e,t,n){let r=e[t]||(e[t]={});return r[n]||(r[n]={})}function Kr(e,t,n,r){for(let i of t.getMatchingVisibleMetas(r).reverse()){let t=e[i.index];if(n&&t>0||!n&&t<0)return i.index}return null}function qr(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||={},{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=Ur(a,o,r),d=t.length,f;for(let e=0;e<d;++e){let n=t[e],{[c]:a,[l]:d}=n,p=n._stacks||={};f=p[l]=Gr(i,u,a),f[s]=d,f._top=Kr(f,o,!0,r.type),f._bottom=Kr(f,o,!1,r.type);let m=f._visualValues||={};m[s]=d}}function Jr(e,t){let n=e.scales;return Object.keys(n).filter(e=>n[e].axis===t).shift()}function Yr(e,t){return pn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function Xr(e,t,n){return pn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function Zr(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t||=e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var Qr=e=>e===`reset`||e===`none`,$r=(e,t)=>t?e:Object.assign({},e),ei=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:zr(n,!0),values:null},ti=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,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(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Hr(e.vScale,e),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(e){this.index!==e&&Zr(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=P(n.xAxisID,Jr(e,`x`)),a=t.yAxisID=P(n.yAxisID,Jr(e,`y`)),o=t.rAxisID=P(n.rAxisID,Jr(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&<(this._data,this),e._stacked&&Zr(e)}_dataCheck(){let e=this.getDataset(),t=e.data||=[],n=this._data;if(j(t)){let e=this._cachedMeta;this._data=Vr(t,e)}else if(n!==t){if(n){lt(n,this);let e=this._cachedMeta;Zr(e),e._parsed=[]}t&&Object.isExtensible(t)&&ct(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=Hr(t.vScale,t),t.stack!==n.stack&&(r=!0,Zr(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(qr(this,t._parsed),t._stacked=Hr(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length?!0:n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=A(r[e])?this.parseArrayData(n,r,e,t):j(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]<c[o];for(l=0;l<t;++l)n._parsed[l+e]=u=d[l],s&&(i()&&(s=!1),c=u);n._sorted=s}a&&qr(this,d)}parsePrimitiveData(e,t,n,r){let{iScale:i,vScale:a}=e,o=i.axis,s=a.axis,c=i.getLabels(),l=i===a,u=Array(r),d,f,p;for(d=0,f=r;d<f;++d)p=d+n,u[d]={[o]:l||i.parse(c[p],p),[s]:a.parse(t[p],p)};return u}parseArrayData(e,t,n,r){let{xScale:i,yScale:a}=e,o=Array(r),s,c,l,u;for(s=0,c=r;s<c;++s)l=s+n,u=t[l],o[s]={x:i.parse(u[0],l),y:a.parse(u[1],l)};return o}parseObjectData(e,t,n,r){let{xScale:i,yScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=Array(r),l,u,d,f;for(l=0,u=r;l<u;++l)d=l+n,f=t[d],c[l]={x:i.parse(Ae(f,o),d),y:a.parse(Ae(f,s),d)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){let r=this.chart,i=this._cachedMeta,a=t[e.axis];return Br({keys:zr(r,!0),values:t._stacks[e.axis]._visualValues},a,i.index,{mode:n})}updateRangeFromParsed(e,t,n,r){let i=n[t.axis],a=i===null?NaN:i,o=r&&n._stacks[t.axis];r&&o&&(r.values=o,a=Br(r,i,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,t){let n=this._cachedMeta,r=n._parsed,i=n._sorted&&e===n.iScale,a=r.length,o=this._getOtherScale(e),s=ei(t,n,this.chart),c={min:1/0,max:-1/0},{min:l,max:u}=Wr(o),d,f;function p(){f=r[d];let t=f[o.axis];return!M(f[e.axis])||l>t||u<t}for(d=0;d<a&&!(!p()&&(this.updateRangeFromParsed(c,e,f,s),i));++d);if(i){for(d=a-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r<i;++r)a=t[r][e.axis],M(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(e){let t=this._cachedMeta,n=t.iScale,r=t.vScale,i=this.getParsed(e);return{label:n?``+n.getLabelForValue(i[n.axis]):``,value:r?``+r.getLabelForValue(i[r.axis]):``}}_update(e){let t=this._cachedMeta;this.update(e||`default`),t._clip=Rr(P(this.options.clip,Lr(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){let e=this._ctx,t=this.chart,n=this._cachedMeta,r=n.data||[],i=t.chartArea,a=[],o=this._drawStart||0,s=this._drawCount||r.length-o,c=this.options.drawActiveElementsOnTop,l;for(n.dataset&&n.dataset.draw(e,i,o,s),l=o;l<o+s;++l){let t=r[l];t.hidden||(t.active&&c?a.push(t):t.draw(e,i))}for(l=0;l<a.length;++l)a[l].draw(e,i)}getStyle(e,t){let n=t?`active`:`default`;return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){let r=this.getDataset(),i;if(e>=0&&e<this._cachedMeta.data.length){let t=this._cachedMeta.data[e];i=t.$context||=Xr(this.getContext(),e,t),i.parsed=this.getParsed(e),i.raw=r.data[e],i.index=i.dataIndex=e}else i=this.$context||=Yr(this.chart.getContext(),this.index),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!t,i.mode=n,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t=`default`,n){let r=t===`active`,i=this._cachedDataOpts,a=e+`-`+t,o=i[a],s=this.enableOptionSharing&&Me(n);if(o)return $r(o,s);let c=this.chart.config,l=c.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,`hover`,e,``]:[e,``],d=c.getOptionScopes(this.getDataset(),l),f=Object.keys(G.elements[e]),p=c.resolveNamedOptions(d,f,()=>this.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze($r(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Nr(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||=Object.assign({},e)}includeOptions(e,t){return!t||Qr(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){Qr(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!Qr(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i<r&&this._removeElements(i,r-i)}_insertElements(e,t,n=!0){let r=this._cachedMeta,i=r.data,a=e+t,o,s=e=>{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;o<a;++o)i[o]=new this.dataElementType;this._parsing&&s(r._parsed),this.parse(e,t),n&&this.updateElements(i,e,t,`reset`)}updateElements(e,t,n,r){}_removeElements(e,t){let n=this._cachedMeta;if(this._parsing){let r=n._parsed.splice(e,t);n._stacked&&Zr(n,r)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{let[t,n,r]=e;this[t](n,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){let e=arguments.length;this._sync([`_insertElements`,this.getDataset().data.length-e,e])}_onDataPop(){this._sync([`_removeElements`,this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync([`_removeElements`,0,1])}_onDataSplice(e,t){t&&this._sync([`_removeElements`,e,t]);let n=arguments.length-2;n&&this._sync([`_insertElements`,e,n])}_onDataUnshift(){this._sync([`_insertElements`,0,arguments.length])}};function ni(e,t){if(!e._cache.$bar){let n=e.getMatchingVisibleMetas(t),r=[];for(let t=0,i=n.length;t<i;t++)r=r.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=ut(r.sort((e,t)=>e-t))}return e._cache.$bar}function ri(e){let t=e.iScale,n=ni(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(Me(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i<a;++i)o=t.getPixelForValue(n[i]),c();for(s=void 0,i=0,a=t.ticks.length;i<a;++i)o=t.getPixelForTick(i),c();return r}function ii(e,t,n,r){let i=n.barThickness,a,o;return k(i)?(a=t.min*n.categoryPercentage,o=n.barPercentage):(a=i*r,o=1),{chunk:a/r,ratio:o,start:t.pixels[e]-a/2}}function ai(e,t,n,r){let i=t.pixels,a=i[e],o=e>0?i[e-1]:null,s=e<i.length-1?i[e+1]:null,c=n.categoryPercentage;o===null&&(o=a-(s===null?t.end-t.start:s-a)),s===null&&(s=a+a-o);let l=a-(a-Math.min(o,s))/2*c;return{chunk:Math.abs(s-o)/2*c/r,ratio:n.barPercentage,start:l}}function oi(e,t,n,r){let i=n.parse(e[0],r),a=n.parse(e[1],r),o=Math.min(i,a),s=Math.max(i,a),c=o,l=s;Math.abs(o)>Math.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function si(e,t,n,r){return A(e)?oi(e,t,n,r):t[n.axis]=n.parse(e,r),t}function ci(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l<u;++l)f=t[l],d={},d[i.axis]=s||i.parse(o[l],l),c.push(si(f,d,a,l));return c}function li(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function ui(e,t,n){return e===0?(t.isHorizontal()?1:-1)*(t.min>=n?1:-1):B(e)}function di(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.base<e.y,n=`bottom`,r=`top`),t?(i=`end`,a=`start`):(i=`start`,a=`end`),{start:n,end:r,reverse:t,top:i,bottom:a}}function fi(e,t,n,r){let i=t.borderSkipped,a={};if(!i){e.borderSkipped=a;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:o,end:s,reverse:c,top:l,bottom:u}=di(e);i===`middle`&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?i=l:(n._bottom||0)===r?i=u:(a[pi(u,o,s,c)]=!0,i=l)),a[pi(i,o,s,c)]=!0,e.borderSkipped=a}function pi(e,t,n,r){return r?(e=mi(e,t,n),e=hi(e,n,t)):e=hi(e,t,n),e}function mi(e,t,n){return e===t?n:e===n?t:e}function hi(e,t,n){return e===`start`?t:e===`end`?n:e}function gi(e,{inflateAmount:t},n){e.inflateAmount=t===`auto`?n===1?.33:0:t}var _i=class extends ti{static id=`bar`;static defaults={datasetElementType:!1,dataElementType:`bar`,categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:`number`,properties:[`x`,`y`,`base`,`width`,`height`]}}};static overrides={scales:{_index_:{type:`category`,offset:!0,grid:{offset:!0}},_value_:{type:`linear`,beginAtZero:!0}}};parsePrimitiveData(e,t,n,r){return ci(e,t,n,r)}parseArrayData(e,t,n,r){return ci(e,t,n,r)}parseObjectData(e,t,n,r){let{iScale:i,vScale:a}=e,{xAxisKey:o=`x`,yAxisKey:s=`y`}=this._parsing,c=i.axis===`x`?o:s,l=a.axis===`x`?o:s,u=[],d,f,p,m;for(d=n,f=n+r;d<f;++d)m=t[d],p={},p[i.axis]=i.parse(Ae(m,c),d),u.push(si(Ae(m,l),p,a,d));return u}updateRangeFromParsed(e,t,n,r){super.updateRangeFromParsed(e,t,n,r);let i=n._custom;i&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(e){let{iScale:t,vScale:n}=this._cachedMeta,r=this.getParsed(e),i=r._custom,a=li(i)?`[`+i.start+`, `+i.end+`]`:``+n.getLabelForValue(r[n.axis]);return{label:``+t.getLabelForValue(r[t.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();let e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){let t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{index:a,_cachedMeta:{vScale:o}}=this,s=o.getBasePixel(),c=o.isHorizontal(),l=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(t,r);for(let f=t;f<t+n;f++){let t=this.getParsed(f),n=i||k(t[o.axis])?{base:s,head:s}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,l),m=(t._stacks||{})[o.axis],h={horizontal:c,base:n.base,enableBorderRadius:!m||li(t._custom)||a===m._top||a===m._bottom,x:c?n.head:p.center,y:c?p.center:n.head,height:c?p.size:Math.abs(n.size),width:c?Math.abs(n.size):p.size};d&&(h.options=u||this.resolveDataElementOptions(f,e[f].active?`active`:r));let g=h.options||e[f].options;fi(h,g,m,a),gi(h,g,l.ratio),this.updateElement(e[f],f,h,r)}}_getStacks(e,t){let{iScale:n}=this._cachedMeta,r=n.getMatchingVisibleMetas(this._type).filter(e=>e.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(k(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[P(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i<a;++i)r.push(n.getPixelForValue(this.getParsed(i)[n.axis],i));let o=e.barThickness;return{min:o||ri(t),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:o?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){let{_cachedMeta:{vScale:t,_stacked:n,index:r},options:{base:i,minBarLength:a}}=this,o=i||0,s=this.getParsed(e),c=s._custom,l=li(c),u=s[t.axis],d=0,f=n?this.applyStack(t,s,n):u,p,m;f!==u&&(d=f-u,f=u),l&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&&B(u)!==B(c.barEnd)&&(d=0),d+=u);let h=!k(i)&&!l?i:d,g=t.getPixelForValue(h);if(p=this.chart.getDataVisibility(e)?t.getPixelForValue(d+f):g,m=p-g,Math.abs(m)<a){m=ui(m,t,o)*a,u===o&&(g-=m/2);let e=t.getPixelForDecimal(0),i=t.getPixelForDecimal(1);g=Math.max(Math.min(g,Math.max(e,i)),Math.min(e,i)),p=g+m,n&&!l&&(s._stacks[t.axis]._visualValues[r]=t.getValueForPixel(p)-t.getValueForPixel(g))}if(g===t.getPixelForValue(o)){let e=B(m)*t.getLineWidthForValue(o)/2;g+=e,m-=e}return{size:m,base:g,head:p,center:p+m/2}}_calculateBarIndexPixels(e,t){let n=t.scale,r=this.options,i=r.skipNull,a=P(r.maxBarThickness,1/0),o,s,c=this._getAxisCount();if(t.grouped){let n=i?this._getStackCount(e):t.stackCount,l=r.barThickness===`flex`?ai(e,t,r,n*c):ii(e,t,r,n*c),u=this.chart.options.indexAxis===`x`?this.getDataset().xAxisID:this.getDataset().yAxisID,d=this._getAxis().indexOf(P(u,this.getFirstScaleIdForIndexAxis())),f=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+d;o=l.start+l.chunk*f+l.chunk/2,s=Math.min(a,l.chunk*l.ratio)}else o=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(a,t.min*t.ratio);return{base:o-s/2,head:o+s/2,center:o,size:s}}draw(){let e=this._cachedMeta,t=e.vScale,n=e.data,r=n.length,i=0;for(;i<r;++i)this.getParsed(i)[t.axis]!==null&&!n[i].hidden&&n[i].draw(this._ctx)}},vi=class extends ti{static id=`bubble`;static defaults={datasetElementType:!1,dataElementType:`point`,animations:{numbers:{type:`number`,properties:[`x`,`y`,`borderWidth`,`radius`]}}};static overrides={scales:{x:{type:`linear`},y:{type:`linear`}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(e,t,n,r){let i=super.parsePrimitiveData(e,t,n,r);for(let e=0;e<i.length;e++)i[e]._custom=this.resolveDataElementOptions(e+n).radius;return i}parseArrayData(e,t,n,r){let i=super.parseArrayData(e,t,n,r);for(let e=0;e<i.length;e++){let r=t[n+e];i[e]._custom=P(r[2],this.resolveDataElementOptions(e+n).radius)}return i}parseObjectData(e,t,n,r){let i=super.parseObjectData(e,t,n,r);for(let e=0;e<i.length;e++){let r=t[n+e];i[e]._custom=P(r&&r.r&&+r.r,this.resolveDataElementOptions(e+n).radius)}return i}getMaxOverflow(){let e=this._cachedMeta.data,t=0;for(let n=e.length-1;n>=0;--n)t=Math.max(t,e[n].size(this.resolveDataElementOptions(n))/2);return t>0&&t}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y),c=a._custom;return{label:n[e]||``,value:`(`+o+`, `+s+(c?`, `+c:``)+`)`}}update(e){let t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:s,includeOptions:c}=this._getSharedOptions(t,r),l=a.axis,u=o.axis;for(let d=t;d<t+n;d++){let t=e[d],n=!i&&this.getParsed(d),f={},p=f[l]=i?a.getPixelForDecimal(.5):a.getPixelForValue(n[l]),m=f[u]=i?o.getBasePixel():o.getPixelForValue(n[u]);f.skip=isNaN(p)||isNaN(m),c&&(f.options=s||this.resolveDataElementOptions(d,t.active?`active`:r),i&&(f.options.radius=0)),this.updateElement(t,d,f,r)}}resolveDataElementOptions(e,t){let n=this.getParsed(e),r=super.resolveDataElementOptions(e,t);r.$shared&&(r=Object.assign({},r,{$shared:!1}));let i=r.radius;return t!==`active`&&(r.radius=0),r.radius+=P(n&&n._custom,i),r}};function yi(e,t,n){let r=1,i=1,a=0,o=0;if(t<R){let s=e,c=s+t,l=Math.cos(s),u=Math.sin(s),d=Math.cos(c),f=Math.sin(c),p=(e,t,r)=>et(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>et(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p(z,u,f),_=m(L,l,d),v=m(L+z,u,f);r=(h-_)/2,i=(g-v)/2,a=-(h+_)/2,o=-(g+v)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}var bi=class extends ti{static id=`doughnut`;static defaults={datasetElementType:!1,dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:`number`,properties:[`circumference`,`endAngle`,`innerRadius`,`outerRadius`,`startAngle`,`x`,`y`,`offset`,`borderWidth`,`spacing`]}},cutout:`50%`,rotation:0,circumference:360,radius:`100%`,spacing:0,indexAxis:`r`};static descriptors={_scriptable:e=>e!==`spacing`,_indexable:e=>e!==`spacing`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let i=e=>+n[e];if(j(n[e])){let{key:e=`value`}=this._parsing;i=t=>+Ae(n[t],e)}let a,o;for(a=e,o=e+t;a<o;++a)r._parsed[a]=i(a)}}_getRotation(){return V(this.options.rotation-90)}_getCircumference(){return V(this.options.circumference)}_getRotationExtents(){let e=R,t=-R;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let r=this.chart.getDatasetMeta(n).controller,i=r._getRotation(),a=r._getCircumference();e=Math.min(e,i),t=Math.max(t,i+a)}return{rotation:e,circumference:t-e}}update(e){let{chartArea:t}=this.chart,n=this._cachedMeta,r=n.data,i=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(t.width,t.height)-i)/2,0),o=Math.min(ve(this.options.cutout,a),1),s=this._getRingWeight(this.index),{circumference:c,rotation:l}=this._getRotationExtents(),{ratioX:u,ratioY:d,offsetX:f,offsetY:p}=yi(l,c,o),m=(t.width-i)/u,h=(t.height-i)/d,g=Math.max(Math.min(m,h)/2,0),_=ye(this.options.radius,g),v=(_-Math.max(_*o,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*_,this.offsetY=p*_,n.total=this.calculateTotal(),this.outerRadius=_-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*s,0),this.updateElements(r,0,r.length,e)}_circumference(e,t){let n=this.options,r=this._cachedMeta,i=this._getCircumference();return t&&n.animation.animateRotate||!this.chart.getDataVisibility(e)||r._parsed[e]===null||r.data[e].hidden?0:this.calculateCircumference(r._parsed[e]*i/R)}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.chartArea,s=a.options.animation,c=(o.left+o.right)/2,l=(o.top+o.bottom)/2,u=i&&s.animateScale,d=u?0:this.innerRadius,f=u?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(t,r),h=this._getRotation(),g;for(g=0;g<t;++g)h+=this._circumference(g,i);for(g=t;g<t+n;++g){let t=this._circumference(g,i),n=e[g],a={x:c+this.offsetX,y:l+this.offsetY,startAngle:h,endAngle:h+t,circumference:t,outerRadius:f,innerRadius:d};m&&(a.options=p||this.resolveDataElementOptions(g,n.active?`active`:r)),h+=t,this.updateElement(n,g,a,r)}}calculateTotal(){let e=this._cachedMeta,t=e.data,n=0,r;for(r=0;r<t.length;r++){let i=e._parsed[r];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(r)&&!t[r].hidden&&(n+=Math.abs(i))}return n}calculateCircumference(e){let t=this._cachedMeta.total;return t>0&&!isNaN(e)?Math.abs(e)/t*R:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=jt(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;r<i;++r)if(n.isDatasetVisible(r)){a=n.getDatasetMeta(r),e=a.data,o=a.controller;break}}if(!e)return 0;for(r=0,i=e.length;r<i;++r)s=o.resolveDataElementOptions(r),s.borderAlign!==`inner`&&(t=Math.max(t,s.borderWidth||0,s.hoverBorderWidth||0));return t}getMaxOffset(e){let t=0;for(let n=0,r=e.length;n<r;++n){let e=this.resolveDataElementOptions(n);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let n=0;n<e;++n)this.chart.isDatasetVisible(n)&&(t+=this._getRingWeight(n));return t}_getRingWeight(e){return Math.max(P(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},xi=class extends ti{static id=`line`;static defaults={datasetElementType:`line`,dataElementType:`point`,showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:`category`},_value_:{type:`linear`}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){let t=this._cachedMeta,{dataset:n,data:r=[],_dataset:i}=t,a=this.chart._animationsDisabled,{start:o,count:s}=gt(t,r,a);this._drawStart=o,this._drawCount=s,_t(t)&&(o=0,s=r.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!i._decimated,n.points=r;let c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},e),this.updateElements(r,o,s,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,{sharedOptions:l,includeOptions:u}=this._getSharedOptions(t,r),d=a.axis,f=o.axis,{spanGaps:p,segment:m}=this.options,h=Ke(p)?p:1/0,g=this.chart._animationsDisabled||i||r===`none`,_=t+n,v=e.length,y=t>0&&this.getParsed(t-1);for(let n=0;n<v;++n){let p=e[n],v=g?p:{};if(n<t||n>=_){v.skip=!0;continue}let b=this.getParsed(n),x=k(b[f]),S=v[d]=a.getPixelForValue(b[d],n),C=v[f]=i||x?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,b,s):b[f],n);v.skip=isNaN(S)||isNaN(C)||x,v.stop=n>0&&Math.abs(b[d]-y[d])>h,m&&(v.parsed=b,v.raw=c.data[n]),u&&(v.options=l||this.resolveDataElementOptions(n,p.active?`active`:r)),g||this.updateElement(p,n,v,r),y=b}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}},Si=class extends ti{static id=`polarArea`;static defaults={dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:`number`,properties:[`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`]}},indexAxis:`r`,startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:n,color:r}}=e.legend.options;return t.labels.map((t,i)=>{let a=e.getDatasetMeta(0).controller.getStyle(i);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(i),index:i}})}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}},scales:{r:{type:`radialLinear`,angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=jt(t._parsed[e].r,n.options.locale);return{label:r[e]||``,value:i}}parseObjectData(e,t,n,r){return Nn.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){let e=this._cachedMeta,t={min:1/0,max:-1/0};return e.data.forEach((e,n)=>{let r=this.getParsed(n).r;!isNaN(r)&&this.chart.getDataVisibility(n)&&(r<t.min&&(t.min=r),r>t.max&&(t.max=r))}),t}_updateRadius(){let e=this.chart,t=e.chartArea,n=e.options,r=Math.min(t.right-t.left,t.bottom-t.top),i=Math.max(r/2,0),a=(i-Math.max(n.cutoutPercentage?i/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.options.animation,s=this._cachedMeta.rScale,c=s.xCenter,l=s.yCenter,u=s.getIndexAngle(0)-.5*L,d=u,f,p=360/this.countVisibleElements();for(f=0;f<t;++f)d+=this._computeAngle(f,r,p);for(f=t;f<t+n;f++){let t=e[f],n=d,m=d+this._computeAngle(f,r,p),h=a.getDataVisibility(f)?s.getDistanceFromCenterForValue(this.getParsed(f).r):0;d=m,i&&(o.animateScale&&(h=0),o.animateRotate&&(n=m=u));let g={x:c,y:l,innerRadius:0,outerRadius:h,startAngle:n,endAngle:m,options:this.resolveDataElementOptions(f,t.active?`active`:r)};this.updateElement(t,f,g,r)}}countVisibleElements(){let e=this._cachedMeta,t=0;return e.data.forEach((e,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,n){return this.chart.getDataVisibility(e)?V(this.resolveDataElementOptions(e,t).angle||n):0}},Ci=Object.freeze({__proto__:null,BarController:_i,BubbleController:vi,DoughnutController:bi,LineController:xi,PieController:class extends bi{static id=`pie`;static defaults={cutout:0,rotation:0,circumference:360,radius:`100%`}},PolarAreaController:Si,RadarController:class extends ti{static id=`radar`;static defaults={datasetElementType:`line`,dataElementType:`point`,indexAxis:`r`,showLine:!0,elements:{line:{fill:`start`}}};static overrides={aspectRatio:1,scales:{r:{type:`radialLinear`}}};getLabelAndValue(e){let t=this._cachedMeta.vScale,n=this.getParsed(e);return{label:t.getLabels()[e],value:``+t.getLabelForValue(n[t.axis])}}parseObjectData(e,t,n,r){return Nn.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta,n=t.dataset,r=t.data||[],i=t.iScale.getLabels();if(n.points=r,e!==`resize`){let t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);let a={_loop:!0,_fullLoop:i.length===r.length,options:t};this.updateElement(n,void 0,a,e)}this.updateElements(r,0,r.length,e)}updateElements(e,t,n,r){let i=this._cachedMeta.rScale,a=r===`reset`;for(let o=t;o<t+n;o++){let t=e[o],n=this.resolveDataElementOptions(o,t.active?`active`:r),s=i.getPointPositionForValue(o,this.getParsed(o).r),c=a?i.xCenter:s.x,l=a?i.yCenter:s.y,u={x:c,y:l,angle:s.angle,skip:isNaN(c)||isNaN(l),options:n};this.updateElement(t,o,u,r)}}},ScatterController:class extends ti{static id=`scatter`;static defaults={datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1};static overrides={interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}};getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y);return{label:n[e]||``,value:`(`+o+`, `+s+`)`}}update(e){let t=this._cachedMeta,{data:n=[]}=t,r=this.chart._animationsDisabled,{start:i,count:a}=gt(t,n,r);if(this._drawStart=i,this._drawCount=a,_t(t)&&(i=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:i,_dataset:a}=t;i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=n;let o=this.resolveDatasetElementOptions(e);o.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:o},e)}else this.datasetElementType&&=(delete t.dataset,!1);this.updateElements(n,i,a,e)}addElements(){let{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement(`line`)),super.addElements()}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,l=this.resolveDataElementOptions(t,r),u=this.getSharedOptions(l),d=this.includeOptions(r,u),f=a.axis,p=o.axis,{spanGaps:m,segment:h}=this.options,g=Ke(m)?m:1/0,_=this.chart._animationsDisabled||i||r===`none`,v=t>0&&this.getParsed(t-1);for(let l=t;l<t+n;++l){let t=e[l],n=this.getParsed(l),m=_?t:{},y=k(n[p]),b=m[f]=a.getPixelForValue(n[f],l),x=m[p]=i||y?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,n,s):n[p],l);m.skip=isNaN(b)||isNaN(x)||y,m.stop=l>0&&Math.abs(n[f]-v[f])>g,h&&(m.parsed=n,m.raw=c.data[l]),d&&(m.options=u||this.resolveDataElementOptions(l,t.active?`active`:r)),_||this.updateElement(t,l,m,r),v=n}this.updateSharedOptions(u,r,l)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}}});function wi(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Ti={_date:class e{static override(t){Object.assign(e.prototype,t)}options;constructor(e){this.options=e||{}}init(){}formats(){return wi()}parse(){return wi()}format(){return wi()}add(){return wi()}diff(){return wi()}startOf(){return wi()}endOf(){return wi()}}};function Ei(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?at:it;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!k(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!k(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Di(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e<n;++e){let{index:n,data:s}=a[e],{lo:c,hi:l}=Ei(a[e],t,o,i);for(let e=c;e<=l;++e){let t=s[e];t.skip||r(t,n,e)}}}function Oi(e){let t=e.indexOf(`x`)!==-1,n=e.indexOf(`y`)!==-1;return function(e,r){let i=t?Math.abs(e.x-r.x):0,a=n?Math.abs(e.y-r.y):0;return Math.sqrt(i**2+a**2)}}function ki(e,t,n,r,i){let a=[];return!i&&!e.isPointInArea(t)||Di(e,n,t,function(n,o,s){!i&&!qt(n,e.chartArea,0)||n.inRange(t.x,t.y,r)&&a.push({element:n,datasetIndex:o,index:s})},!0),a}function Ai(e,t,n,r){let i=[];function a(e,n,a){let{startAngle:o,endAngle:s}=e.getProps([`startAngle`,`endAngle`],r),{angle:c}=Ze(e,{x:t.x,y:t.y});et(c,o,s)&&i.push({element:e,datasetIndex:n,index:a})}return Di(e,n,t,a),i}function ji(e,t,n,r,i,a){let o=[],s=Oi(n),c=1/0;function l(n,l,u){let d=n.inRange(t.x,t.y,i);if(r&&!d)return;let f=n.getCenterPoint(i);if(!(a||e.isPointInArea(f))&&!d)return;let p=s(t,f);p<c?(o=[{element:n,datasetIndex:l,index:u}],c=p):p===c&&o.push({element:n,datasetIndex:l,index:u})}return Di(e,n,t,l),o}function Mi(e,t,n,r,i,a){return!a&&!e.isPointInArea(t)?[]:n===`r`&&!r?Ai(e,t,n,i):ji(e,t,n,r,i,a)}function Ni(e,t,n,r,i){let a=[],o=n===`x`?`inXRange`:`inYRange`,s=!1;return Di(e,n,t,(e,r,c)=>{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s||=e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Pi={evaluateInteractionItems:Di,modes:{index(e,t,n,r){let i=$n(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?ki(e,i,a,r,o):Mi(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=$n(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?ki(e,i,a,r,o):Mi(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point(e,t,n,r){return ki(e,$n(t,e),n.axis||`xy`,r,n.includeInvisible||!1)},nearest(e,t,n,r){let i=$n(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1;return Mi(e,i,a,n.intersect,r,o)},x(e,t,n,r){return Ni(e,$n(t,e),`x`,n.intersect,r)},y(e,t,n,r){return Ni(e,$n(t,e),`y`,n.intersect,r)}}},Fi=[`left`,`top`,`right`,`bottom`];function Ii(e,t){return e.filter(e=>e.pos===t)}function Li(e,t){return e.filter(e=>Fi.indexOf(e.pos)===-1&&e.box.axis===t)}function Ri(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function zi(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;n<r;++n)i=e[n],{position:a,options:{stack:o,stackWeight:s=1}}=i,t.push({index:n,box:i,pos:a,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&a+o,stackWeight:s});return t}function Bi(e){let t={};for(let n of e){let{stack:e,pos:r,stackWeight:i}=n;if(!e||!Fi.includes(r))continue;let a=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return t}function Vi(e,t){let n=Bi(e),{vBoxMaxWidth:r,hBoxMaxHeight:i}=t,a,o,s;for(a=0,o=e.length;a<o;++a){s=e[a];let{fullSize:o}=s.box,c=n[s.stack],l=c&&s.stackWeight/c.weight;s.horizontal?(s.width=l?l*r:o&&t.availableWidth,s.height=i):(s.width=r,s.height=l?l*i:o&&t.availableHeight)}return n}function Hi(e){let t=zi(e),n=Ri(t.filter(e=>e.box.fullSize),!0),r=Ri(Ii(t,`left`),!0),i=Ri(Ii(t,`right`)),a=Ri(Ii(t,`top`),!0),o=Ri(Ii(t,`bottom`)),s=Li(t,`x`),c=Li(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Ii(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function Ui(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function Wi(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Gi(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!j(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&Wi(o,a.getPadding());let s=Math.max(0,t.outerWidth-Ui(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-Ui(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function Ki(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function qi(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function Ji(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a<o;++a){s=e[a],c=s.box,c.update(s.width||t.w,s.height||t.h,qi(s.horizontal,t));let{same:o,other:d}=Gi(t,n,s,r);l|=o&&i.length,u||=d,c.fullSize||i.push(s)}return l&&Ji(i,t,n,r)||u}function Yi(e,t,n,r,i){e.top=n,e.left=t,e.right=t+r,e.bottom=n+i,e.width=r,e.height=i}function Xi(e,t,n,r){let i=n.padding,{x:a,y:o}=t;for(let s of e){let e=s.box,c=r[s.stack]||{count:1,placed:0,weight:1},l=s.stackWeight/c.weight||1;if(s.horizontal){let r=t.w*l,a=c.size||e.height;Me(c.start)&&(o=c.start),e.fullSize?Yi(e,i.left,o,n.outerWidth-i.right-i.left,a):Yi(e,t.left+c.placed,o,r,a),c.start=o,c.placed+=r,o=e.bottom}else{let r=t.h*l,o=c.size||e.width;Me(c.start)&&(a=c.start),e.fullSize?Yi(e,a,i.top,o,n.outerHeight-i.bottom-i.top):Yi(e,a,t.top+c.placed,o,r),c.start=a,c.placed+=r,a=e.right}}t.x=a,t.y=o}var J={addBox(e,t){e.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)}}]},e.boxes.push(t)},removeBox(e,t){let n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;let i=K(e.options.layout.padding),a=Math.max(t-i.width,0),o=Math.max(n-i.height,0),s=Hi(e.boxes),c=s.vertical,l=s.horizontal;I(e.boxes,e=>{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);Wi(f,K(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=Vi(c.concat(l),d);Ji(s.fullSize,p,d,m),Ji(c,p,d,m),Ji(l,p,d,m)&&Ji(c,p,d,m),Ki(p),Xi(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,Xi(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},I(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},Zi=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n||=e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},Qi=class extends Zi{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},$i=`$chartjs`,ea={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},ta=e=>e===null||e===``;function na(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[$i]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,ta(i)){let t=ar(e,`width`);t!==void 0&&(e.width=t)}if(ta(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=ar(e,`height`);t!==void 0&&(e.height=t)}return e}var ra=ir?{passive:!0}:!1;function ia(e,t,n){e&&e.addEventListener(t,n,ra)}function aa(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,ra)}function oa(e,t){let n=ea[e.type]||e.type,{x:r,y:i}=$n(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function sa(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function ca(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=sa(n.addedNodes,r),t&&=!sa(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function la(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=sa(n.removedNodes,r),t&&=!sa(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var ua=new Map,da=0;function fa(){let e=window.devicePixelRatio;e!==da&&(da=e,ua.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function pa(e,t){ua.size||window.addEventListener(`resize`,fa),ua.set(e,t)}function ma(e){ua.delete(e),ua.size||window.removeEventListener(`resize`,fa)}function ha(e,t,n){let r=e.canvas,i=r&&Gn(r);if(!i)return;let a=ft((e,t)=>{let r=i.clientWidth;n(e,t),r<i.clientWidth&&n()},window),o=new ResizeObserver(e=>{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),pa(e,a),o}function ga(e,t,n){n&&n.disconnect(),t===`resize`&&ma(e)}function _a(e,t,n){let r=e.canvas,i=ft(t=>{e.ctx!==null&&n(oa(t,e))},e);return ia(r,t,i),i}var va=class extends Zi{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(na(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[$i])return!1;let n=t[$i].initial;[`height`,`width`].forEach(e=>{let r=n[e];k(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[$i],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||={};r[t]=({attach:ca,detach:la,resize:ha}[t]||_a)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||={},r=n[t];r&&(({attach:ga,detach:ga,resize:ga}[t]||aa)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return nr(e,t,n,r)}isAttached(e){let t=e&&Gn(e);return!!(t&&t.isConnected)}};function ya(e){return!Wn()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?Qi:va}var ba=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return Ke(this.x)&&Ke(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};function xa(e,t){let n=e.options.ticks,r=Sa(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?wa(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Ta(t,l,a,o/i),l;let u=Ca(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Ea(t,l,u,k(r)?0:s-r,s),e=0,n=o-1;e<n;e++)Ea(t,l,u,a[e],a[e+1]);return Ea(t,l,u,c,k(r)?t.length:c+r),l}return Ea(t,l,u),l}function Sa(e){let t=e.options.offset,n=e._tickSize(),r=e._length/n+ +!t,i=e._maxLength/n;return Math.floor(Math.min(r,i))}function Ca(e,t,n){let r=Da(e),i=t.length/n;if(!r)return Math.max(i,1);let a=We(r);for(let e=0,t=a.length-1;e<t;e++){let t=a[e];if(t>i)return t}return Math.max(i,1)}function wa(e){let t=[],n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function Ta(e,t,n,r){let i=0,a=n[0],o;for(r=Math.ceil(r),o=0;o<e.length;o++)o===a&&(t.push(e[o]),i++,a=n[i*r])}function Ea(e,t,n,r,i){let a=P(r,0),o=Math.min(P(i,e.length),e.length),s=0,c,l,u;for(n=Math.ceil(n),i&&(c=i-r,n=c/Math.floor(c/n)),u=a;u<0;)s++,u=Math.round(a+s*n);for(l=Math.max(a,0);l<o;l++)l===u&&(t.push(e[l]),s++,u=Math.round(a+s*n))}function Da(e){let t=e.length,n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}var Oa=e=>e===`left`?`right`:e===`right`?`left`:e,ka=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,Aa=(e,t)=>Math.min(t||e,e);function ja(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;a<i;a+=r)n.push(e[Math.floor(a)]);return n}function Ma(e,t,n){let r=e.ticks.length,i=Math.min(t,r-1),a=e._startPixel,o=e._endPixel,s=1e-6,c=e.getPixelForTick(i),l;if(!(n&&(l=r===1?Math.max(c-a,o-c):t===0?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(i-1))/2,c+=i<t?l:-l,c<a-s||c>o+s)))return c}function Na(e,t){I(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;i<r;++i)delete e.data[n[i]];n.splice(0,r)}})}function Pa(e){return e.drawTicks?e.tickLength:0}function Fa(e,t){if(!e.display)return 0;let n=q(e.font,t),r=K(e.padding);return(A(e.text)?e.text.length:1)*n.lineHeight+r.height}function Ia(e,t){return pn(e,{scale:t,type:`scale`})}function La(e,t,n){return pn(e,{tick:n,index:t,type:`tick`})}function Ra(e,t,n){let r=mt(e);return(n&&t!==`right`||!n&&t===`right`)&&(r=Oa(r)),r}function za(e,t,n,r){let{top:i,left:a,bottom:o,right:s,chart:c}=e,{chartArea:l,scales:u}=c,d=0,f,p,m,h=o-i,g=s-a;if(e.isHorizontal()){if(p=W(r,a,s),j(n)){let e=Object.keys(n)[0],r=n[e];m=u[e].getPixelForValue(r)+h-t}else m=n===`center`?(l.bottom+l.top)/2+h-t:ka(e,n,t);f=s-a}else{if(j(n)){let e=Object.keys(n)[0],r=n[e];p=u[e].getPixelForValue(r)-g+t}else p=n===`center`?(l.left+l.right)/2-g+t:ka(e,n,t);m=W(r,o,i),d=n===`left`?-z:z}return{titleX:p,titleY:m,maxWidth:f,rotation:d}}var Ba=class e extends ba{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=N(e,1/0),t=N(t,-1/0),n=N(n,1/0),r=N(r,-1/0),{min:N(e,n),max:N(t,r),minDefined:M(e),maxDefined:M(t)}}getMinMax(e){let{min:t,max:n,minDefined:r,maxDefined:i}=this.getUserBounds(),a;if(r&&i)return{min:t,max:n};let o=this.getMatchingVisibleMetas();for(let s=0,c=o.length;s<c;++s)a=o[s].controller.getMinMax(this,e),r||(t=Math.min(t,a.min)),i||(n=Math.max(n,a.max));return t=i&&t>n?n:t,n=r&&t>n?t:n,{min:N(t,N(n,t)),max:N(n,N(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||=this._computeLabelItems(e)}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){F(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||=(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=fn(this,i,r),!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o<this.ticks.length;this._convertTicksToLabels(s?ja(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source===`auto`)&&(this.ticks=xa(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,n;this.isHorizontal()?(t=this.left,n=this.right):(t=this.top,n=this.bottom,e=!e),this._startPixel=t,this._endPixel=n,this._reversePixels=e,this._length=n-t,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(e){this.chart.notifyPlugins(e,this.getContext()),F(this.options[e],[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(e){let t=this.options.ticks,n,r,i;for(n=0,r=e.length;n<r;n++)i=e[n],i.label=F(t.callback,[i.value,n,e],this)}afterTickToLabelConversion(){F(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){F(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,t=e.ticks,n=Aa(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,i=t.maxRotation,a=r,o,s,c;if(!this._isVisible()||!t.display||r>=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=U(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-Pa(e.grid)-t.padding-Fa(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=Ye(Math.min(Math.asin(U((l.highest.height+6)/o,-1,1)),Math.asin(U(s/c,-1,1))-Math.asin(U(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){F(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){F(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=Fa(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=Pa(i)+a):(e.height=this.maxHeight,e.width=Pa(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=V(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+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(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t<n;t++)k(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,n=this.ticks;t<n.length&&(n=ja(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){let{ctx:r,_longestTextCache:i}=this,a=[],o=[],s=Math.floor(t/Aa(t,n)),c=0,l=0,u,d,f,p,m,h,g,_,v,y,b;for(u=0;u<t;u+=s){if(p=e[u].label,m=this._resolveTickFontOptions(u),r.font=h=m.string,g=i[h]=i[h]||{data:{},gc:[]},_=m.lineHeight,v=y=0,!k(p)&&!A(p))v=Vt(r,g.data,g.gc,v,p),y=_;else if(A(p))for(d=0,f=p.length;d<f;++d)b=p[d],!k(b)&&!A(b)&&(v=Vt(r,g.data,g.gc,v,b),y+=_);a.push(v),o.push(y),c=Math.max(v,c),l=Math.max(y,l)}Na(i,t);let x=a.indexOf(c),S=o.indexOf(l),C=e=>({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return tt(this._alignToPixels?Ut(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&e<t.length){let n=t[e];return n.$context||=La(this.getContext(),e,n)}return this.$context||=Ia(this.chart.getContext(),this)}_tickSize(){let e=this.options.ticks,t=V(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),i=this._getLabelSizes(),a=e.autoSkipPadding||0,o=i?i.widest.width+a:0,s=i?i.highest.height+a:0;return this.isHorizontal()?s*n>o*r?o/n:s/r:s*r<o*n?s/n:o/r}_isVisible(){let e=this.options.display;return e===`auto`?this.getMatchingVisibleMetas().length>0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+ +!!s,u=Pa(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return Ut(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(j(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(j(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let ee=P(r.ticks.maxTicksLimit,l),O=Math.max(1,Math.ceil(l/ee));for(_=0;_<l;_+=O){let e=this.getContext(_),t=i.setContext(e),r=o.setContext(e),a=t.lineWidth,l=t.color,u=r.dash||[],f=r.dashOffset,p=t.tickWidth,m=t.tickColor,h=t.tickBorderDash||[],g=t.tickBorderDashOffset;v=Ma(this,_,s),v!==void 0&&(y=Ut(n,v,a),c?b=S=w=E=y:x=C=T=D=y,d.push({tx1:b,ty1:x,tx2:S,ty2:C,x1:w,y1:T,x2:E,y2:D,width:a,color:l,borderDash:u,borderDashOffset:f,tickWidth:p,tickColor:m,tickBorderDash:h,tickBorderDashOffset:g}))}return this._ticksLength=l,this._borderValue=g,d}_computeLabelItems(e){let t=this.axis,n=this.options,{position:r,ticks:i}=n,a=this.isHorizontal(),o=this.ticks,{align:s,crossAlign:c,padding:l,mirror:u}=i,d=Pa(n.grid),f=d+l,p=u?-l:f,m=-V(this.labelRotation),h=[],g,_,v,y,b,x,S,C,w,T,E,D,ee=`middle`;if(r===`top`)x=this.bottom-p,S=this._getXAxisLabelAlignment();else if(r===`bottom`)x=this.top+p,S=this._getXAxisLabelAlignment();else if(r===`left`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(r===`right`){let e=this._getYAxisLabelAlignment(d);S=e.textAlign,b=e.x}else if(t===`x`){if(r===`center`)x=(e.top+e.bottom)/2+f;else if(j(r)){let e=Object.keys(r)[0],t=r[e];x=this.chart.scales[e].getPixelForValue(t)+f}S=this._getXAxisLabelAlignment()}else if(t===`y`){if(r===`center`)b=(e.left+e.right)/2-f;else if(j(r)){let e=Object.keys(r)[0],t=r[e];b=this.chart.scales[e].getPixelForValue(t)}S=this._getYAxisLabelAlignment(d).textAlign}t===`y`&&(s===`start`?ee=`top`:s===`end`&&(ee=`bottom`));let O=this._getLabelSizes();for(g=0,_=o.length;g<_;++g){v=o[g],y=v.label;let e=i.setContext(this.getContext(g));C=this.getPixelForTick(g)+i.labelOffset,w=this._resolveTickFontOptions(g),T=w.lineHeight,E=A(y)?y.length:1;let t=E/2,n=e.color,s=e.textStrokeColor,l=e.textStrokeWidth,d=S;a?(b=C,S===`inner`&&(d=g===_-1?this.options.reverse?`left`:`right`:g===0?this.options.reverse?`right`:`left`:`center`),D=r===`top`?c===`near`||m!==0?-E*T+T/2:c===`center`?-O.highest.height/2-t*T+T:-O.highest.height+T/2:c===`near`||m!==0?T/2:c===`center`?O.highest.height/2-t*T:O.highest.height-E*T,u&&(D*=-1),m!==0&&!e.showLabelBackdrop&&(b+=T/2*Math.sin(m))):(x=C,D=(1-E)*T/2);let f;if(e.showLabelBackdrop){let t=K(e.backdropPadding),n=O.heights[g],r=O.widths[g],i=D-t.top,a=0-t.left;switch(ee){case`middle`:i-=n/2;break;case`bottom`:i-=n;break}switch(S){case`center`:a-=r/2;break;case`right`:a-=r;break;case`inner`:g===_-1?a-=r:g>0&&(a-=r/2);break}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:ee,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-V(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||=this._computeGridLineItems(e),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i<a;++i){let e=r[i];t.drawOnChartArea&&o({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&o({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){let{chart:e,ctx:t,options:{border:n,grid:r}}=this,i=n.setContext(this.getContext()),a=n.display?i.width:0;if(!a)return;let o=r.setContext(this.getContext(0)).lineWidth,s=this._borderValue,c,l,u,d;this.isHorizontal()?(c=Ut(e,this.left,a)-a/2,l=Ut(e,this.right,o)+o/2,u=d=s):(u=Ut(e,this.top,a)-a/2,d=Ut(e,this.bottom,o)+o/2,c=l=s),t.save(),t.lineWidth=i.width,t.strokeStyle=i.color,t.beginPath(),t.moveTo(c,u),t.lineTo(l,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;let t=this.ctx,n=this._computeLabelArea();n&&Jt(t,n);let r=this.getLabelItems(e);for(let e of r){let n=e.options,r=e.font,i=e.label,a=e.textOffset;tn(t,i,0,a,r,n)}n&&Yt(t)}drawTitle(){let{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;let i=q(n.font),a=K(n.padding),o=n.align,s=i.lineHeight/2;t===`bottom`||t===`center`||j(t)?(s+=a.bottom,A(n.text)&&(s+=i.lineHeight*(n.text.length-1))):s+=a.top;let{titleX:c,titleY:l,maxWidth:u,rotation:d}=za(this,s,t,o);tn(e,n.text,0,0,i,{color:n.color,maxWidth:u,rotation:d,textAlign:Ra(o,t,r),textBaseline:`middle`,translation:[c,l]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let t=this.options,n=t.ticks&&t.ticks.z||0,r=P(t.grid&&t.grid.z,-1),i=P(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:n,draw:e=>{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i<a;++i){let a=t[i];a[n]===this.id&&(!e||a.type===e)&&r.push(a)}return r}_resolveTickFontOptions(e){return q(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},Va=class{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let t=Object.getPrototypeOf(e),n;Wa(t)&&(n=this.register(t));let r=this.items,i=e.id,a=this.scope+`.`+i;if(!i)throw Error(`class does not have id: `+e);return i in r?a:(r[i]=e,Ha(e,a,n),this.override&&G.override(e.id,e.overrides),a)}get(e){return this.items[e]}unregister(e){let t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in G[r]&&(delete G[r][n],this.override&&delete It[n])}};function Ha(e,t,n){let r=we(Object.create(null),[n?G.get(n):{},G.get(t),e.defaults]);G.set(t,r),e.defaultRoutes&&Ua(t,e.defaultRoutes),e.descriptors&&G.describe(t,e.descriptors)}function Ua(e,t){Object.keys(t).forEach(n=>{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);G.route(a,i,c,s)})}function Wa(e){return`id`in e&&`defaults`in e}var Y=new class{constructor(){this.controllers=new Va(ti,`datasets`,!0),this.elements=new Va(ba,`elements`),this.plugins=new Va(Object,`plugins`),this.scales=new Va(Ba,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):I(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=je(e);F(n[`before`+r],[],n),t[e](n),F(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){let r=t.get(e);if(r===void 0)throw Error(`"`+e+`" is not a registered `+n+`.`);return r}},Ga=class{constructor(){this._init=void 0}notify(e,t,n,r){if(t===`beforeInit`&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,`install`)),this._init===void 0)return;let i=r?this._descriptors(e).filter(r):this._descriptors(e),a=this._notify(i,e,t,n);return t===`afterDestroy`&&(this._notify(i,e,`stop`),this._notify(this._init,e,`uninstall`),this._init=void 0),a}_notify(e,t,n,r){r||={};for(let i of e){let e=i.plugin,a=e[n];if(F(a,[t,r,i.options],e)===!1&&r.cancelable)return!1}return!0}invalidate(){k(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let n=e&&e.config,r=P(n.options&&n.options.plugins,{}),i=Ka(n);return r===!1&&!t?[]:Ja(e,i,r,t)}_notifyStateChanges(e){let t=this._oldCache||[],n=this._cache,r=(e,t)=>e.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function Ka(e){let t={},n=[],r=Object.keys(Y.plugins.items);for(let e=0;e<r.length;e++)n.push(Y.getPlugin(r[e]));let i=e.plugins||[];for(let e=0;e<i.length;e++){let r=i[e];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function qa(e,t){return!t&&e===!1?null:e===!0?{}:e}function Ja(e,{plugins:t,localIds:n},r,i){let a=[],o=e.getContext();for(let s of t){let t=s.id,c=qa(r[t],i);c!==null&&a.push({plugin:s,options:Ya(e.config,{plugin:s,local:n[t]},c,o)})}return a}function Ya(e,{plugin:t,local:n},r,i){let a=e.pluginScopeKeys(t),o=e.getOptionScopes(r,a);return n&&t.defaults&&o.push(t.defaults),e.createResolver(o,i,[``],{scriptable:!1,indexable:!1,allKeys:!0})}function Xa(e,t){let n=G.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||`x`}function Za(e,t){let n=e;return e===`_index_`?n=t:e===`_value_`&&(n=t===`x`?`y`:`x`),n}function Qa(e,t){return e===t?`_index_`:`_value_`}function $a(e){if(e===`x`||e===`y`||e===`r`)return e}function eo(e){if(e===`top`||e===`bottom`)return`x`;if(e===`left`||e===`right`)return`y`}function to(e,...t){if($a(e))return e;for(let n of t){let t=n.axis||eo(n.position)||e.length>1&&$a(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function no(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function ro(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return no(e,`x`,n[0])||no(e,`y`,n[0])}return{}}function io(e,t){let n=It[e.type]||{scales:{}},r=t.scales||{},i=Xa(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!j(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=to(t,o,ro(t,e),G.scales[o.type]),c=Qa(s,i),l=n.scales||{};a[t]=Te(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||Xa(i,t),s=(It[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=Za(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),Te(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];Te(t,[G.scales[t.type],G.scale])}),a}function ao(e){let t=e.options||={};t.plugins=P(t.plugins,{}),t.scales=io(e,t)}function oo(e){return e||={},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function so(e){return e||={},e.data=oo(e.data),ao(e),e}var co=new Map,lo=new Set;function uo(e,t){let n=co.get(e);return n||(n=t(),co.set(e,n),lo.add(n)),n}var fo=(e,t,n)=>{let r=Ae(t,n);r!==void 0&&e.add(r)},po=class{constructor(e){this._config=so(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=oo(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),ao(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return uo(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return uo(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return uo(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return uo(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>fo(s,e,t))),t.forEach(e=>fo(s,r,e)),t.forEach(e=>fo(s,It[i]||{},e)),t.forEach(e=>fo(s,G,e)),t.forEach(e=>fo(s,Lt,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),lo.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,It[t]||{},G.datasets[t]||{},{type:t},G,Lt]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=mo(this._resolverCache,e,r),s=a;if(go(a,t)){i.$shared=!1,n=Ne(n)?n():n;let t=this.createResolver(e,n,o);s=hn(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=mo(this._resolverCache,e,n);return j(t)?hn(i,t,void 0,r):i}};function mo(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:mn(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}var ho=e=>j(e)&&Object.getOwnPropertyNames(e).some(t=>Ne(e[t]));function go(e,t){let{isScriptable:n,isIndexable:r}=gn(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(Ne(o)||ho(o))||a&&A(o))return!0}return!1}var _o=`4.5.1`,vo=[`top`,`bottom`,`left`,`right`,`chartArea`];function yo(e,t){return e===`top`||e===`bottom`||vo.indexOf(e)===-1&&t===`x`}function bo(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function xo(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),F(n&&n.onComplete,[e],t)}function So(e){let t=e.chart,n=t.options.animation;F(n&&n.onProgress,[e],t)}function Co(e){return Wn()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var wo={},To=e=>{let t=Co(e);return Object.values(wo).filter(e=>e.canvas===t).pop()};function Eo(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function Do(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var Oo=class{static defaults=G;static instances=wo;static overrides=It;static registry=Y;static version=_o;static getChart=To;static register(...e){Y.add(...e),ko()}static unregister(...e){Y.remove(...e),ko()}constructor(e,t){let n=this.config=new po(t),r=Co(e),i=To(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(ya(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=_e(),this.ctx=o,this.canvas=s,this.width=l,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 Ga,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=pt(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],wo[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}kr.listen(this,`complete`,xo),kr.listen(this,`progress`,So),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return k(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Y}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():rr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return Wt(this.canvas,this.ctx),this}stop(){return kr.stop(this),this}resize(e,t){kr.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,rr(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),F(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){I(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=to(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),I(i,t=>{let i=t.options,a=i.id,o=to(a,i),s=P(i.type,t.dtype);(i.position===void 0||yo(i.position,o)!==yo(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(Y.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),I(r,(e,t)=>{e||delete n[t]}),I(n,e=>{J.configure(this,e,e.options),J.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(bo(`order`,`index`))}_removeUnreferencedMetasets(){let{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n<r;n++){let r=t[n],i=this.getDatasetMeta(n),a=r.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(n),i=this.getDatasetMeta(n)),i.type=a,i.indexAxis=r.indexAxis||Xa(a,this.options),i.order=r.order||0,i.index=n,i.label=``+r.label,i.visible=this.isDatasetVisible(n),i.controller)i.controller.updateIndex(n),i.controller.linkScales();else{let t=Y.getController(a),{datasetElementType:r,dataElementType:o}=G.datasets[a];Object.assign(t,{dataElementType:Y.getElement(o),datasetElementType:r&&Y.getElement(r)}),i.controller=new t(this,n),e.push(i.controller)}}return this._updateMetasets(),e}_resetElements(){I(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e<t;e++){let{controller:t}=this.getDatasetMeta(e),n=!r&&i.indexOf(t)===-1;t.buildOrUpdateElements(n),a=Math.max(+t.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),r||I(i,e=>{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(bo(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){I(this.scales,e=>{J.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!Pe(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)Eo(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;e<t;e++)if(!Pe(r,n(e)))return;return Array.from(r).map(e=>e.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;J.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],I(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,Ne(e)?e({datasetIndex:t}):e);this.notifyPlugins(`afterDatasetsUpdate`,{mode:e})}}_updateDataset(e,t){let n=this.getDatasetMeta(e),r={meta:n,index:e,mode:t,cancelable:!0};this.notifyPlugins(`beforeDatasetUpdate`,r)!==!1&&(n.controller._update(t),r.cancelable=!1,this.notifyPlugins(`afterDatasetUpdate`,r))}render(){this.notifyPlugins(`beforeRender`,{cancelable:!0})!==!1&&(kr.has(this)?this.attached&&!kr.running(this)&&kr.start(this):(this.draw(),xo({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){let{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins(`beforeDraw`,{cancelable:!0})===!1)return;let t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins(`afterDraw`)}_getSortedDatasetMetas(e){let t=this._sortedMetasets,n=[],r,i;for(r=0,i=t.length;r<i;++r){let i=t[r];(!e||i.visible)&&n.push(i)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins(`beforeDatasetsDraw`,{cancelable:!0})===!1)return;let e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=Or(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&Jt(t,r),e.controller.draw(),r&&Yt(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return qt(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Pi.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||=pn(null,{chart:this,type:`chart`})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);Me(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),kr.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins(`beforeDestroy`);let{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Wt(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete wo[this.id],this.notifyPlugins(`afterDestroy`)}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let e=this._listeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};I(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||={};let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){I(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},I(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o<s;++o){a=e[o];let t=a&&this.getDatasetMeta(a.datasetIndex).controller;t&&t[r+`HoverStyle`](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){let t=this._active||[],n=e.map(({datasetIndex:e,index:t})=>{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});be(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=Fe(e),c=Do(e,this._lastEvent,n,s);n&&(this._lastEvent=null,F(i.onHover,[e,o,this],this),s&&F(i.onClick,[e,o,this],this));let l=!be(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};function ko(){return I(Oo.instances,e=>e._plugins.invalidate())}function Ao(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,H(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,H(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*H(r-n));if(u===`round`)e.arc(i,a,t,n-L/2,r+L/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+L/2)+i,c=-o*Math.sin(n+L/2)+a,l=o*Math.cos(r+L/2)+i,u=o*Math.sin(r+L/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function jo(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+z,r-z),e.closePath(),e.clip()}function Mo(e){return cn(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function No(e,t,n,r){let i=Mo(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return U(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:U(i.innerStart,0,o),innerEnd:U(i.innerEnd,0,o)}}function Po(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Fo(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-l,0),f=u>0?u+r+n+l:0,p=0,m=i-c;if(r){let e=((u>0?u-r:0)+(d>0?d-r:0))/2;p=(m-(e===0?m:m*e/(e+r)))/2}let h=(m-Math.max(.001,m*d-n/L)/d)/2,g=c+h+p,_=i-h-p,{outerStart:v,outerEnd:y,innerStart:b,innerEnd:x}=No(t,f,d,_-g),S=d-v,C=d-y,w=g+v/S,T=_-y/C,E=f+b,D=f+x,ee=g+b/E,O=_-x/D;if(e.beginPath(),a){let t=(w+T)/2;if(e.arc(o,s,d,w,t),e.arc(o,s,d,t,T),y>0){let t=Po(C,T,o,s);e.arc(t.x,t.y,y,T,_+z)}let n=Po(D,_,o,s);if(e.lineTo(n.x,n.y),x>0){let t=Po(D,O,o,s);e.arc(t.x,t.y,x,_+z,O+Math.PI)}let r=(_-x/f+(g+b/f))/2;if(e.arc(o,s,f,_-x/f,r,!0),e.arc(o,s,f,r,g+b/f,!0),b>0){let t=Po(E,ee,o,s);e.arc(t.x,t.y,b,ee+Math.PI,g-z)}let i=Po(S,g,o,s);if(e.lineTo(i.x,i.y),v>0){let t=Po(S,w,o,s);e.arc(t.x,t.y,v,g-z,w)}}else{e.moveTo(o,s);let t=Math.cos(w)*d+o,n=Math.sin(w)*d+s;e.lineTo(t,n);let r=Math.cos(T)*d+o,i=Math.sin(T)*d+s;e.lineTo(r,i)}e.closePath()}function Io(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){Fo(e,t,n,r,c,i);for(let t=0;t<a;++t)e.fill();isNaN(s)||(c=o+(s%R||R))}return Fo(e,t,n,r,c,i),e.fill(),c}function Lo(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s,options:c}=t,{borderWidth:l,borderJoinStyle:u,borderDash:d,borderDashOffset:f,borderRadius:p}=c,m=c.borderAlign===`inner`;if(!l)return;e.setLineDash(d||[]),e.lineDashOffset=f,m?(e.lineWidth=l*2,e.lineJoin=u||`round`):(e.lineWidth=l,e.lineJoin=u||`bevel`);let h=t.endAngle;if(a){Fo(e,t,n,r,h,i);for(let t=0;t<a;++t)e.stroke();isNaN(s)||(h=o+(s%R||R))}m&&jo(e,t,h),c.selfJoin&&h-o>=L&&p===0&&u!==`miter`&&Ao(e,t,h),a||(Fo(e,t,n,r,h,i),e.stroke())}var Ro=class extends ba{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=Ze(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),u=(this.options.spacing+this.options.borderWidth)/2,d=P(l,o-a),f=et(r,a,o)&&a!==o,p=d>=R||f,m=nt(i,s+u,c+u);return p&&m}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>R?Math.floor(n/R):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(L,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,Io(e,this,s,i,a),Lo(e,this,s,i,a),e.restore()}};function zo(e,t,n=t){e.lineCap=P(n.borderCapStyle,t.borderCapStyle),e.setLineDash(P(n.borderDash,t.borderDash)),e.lineDashOffset=P(n.borderDashOffset,t.borderDashOffset),e.lineJoin=P(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=P(n.borderWidth,t.borderWidth),e.strokeStyle=P(n.borderColor,t.borderColor)}function Bo(e,t,n){e.lineTo(n.x,n.y)}function Vo(e){return e.stepped?Xt:e.tension||e.cubicInterpolationMode===`monotone`?Zt:Bo}function Ho(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=i<o&&a<o||i>s&&a>s;return{count:r,start:c,loop:t.loop,ilen:l<c&&!u?r+l-c:l-c}}function Uo(e,t,n,r){let{points:i,options:a}=t,{count:o,start:s,loop:c,ilen:l}=Ho(i,n,r),u=Vo(a),{move:d=!0,reverse:f}=r||{},p,m,h;for(p=0;p<=l;++p)m=i[(s+(f?l-p:p))%o],!m.skip&&(d?(e.moveTo(m.x,m.y),d=!1):u(e,h,m,f,a.stepped),h=m);return c&&(m=i[(s+(f?l:0))%o],u(e,h,m,f,a.stepped)),!!c}function Wo(e,t,n,r){let i=t.points,{count:a,start:o,ilen:s}=Ho(i,n,r),{move:c=!0,reverse:l}=r||{},u=0,d=0,f,p,m,h,g,_,v=e=>(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(n<h?h=n:n>g&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function Go(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?Wo:Uo}function Ko(e){return e.stepped?sr:e.tension||e.cubicInterpolationMode===`monotone`?cr:or}function qo(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),zo(e,t.options),e.stroke(i)}function Jo(e,t,n,r){let{segments:i,options:a}=t,o=Go(t);for(let s of i)zo(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}var Yo=typeof Path2D==`function`;function Xo(e,t,n,r){Yo&&!t.options.segment?qo(e,t,n,r):Jo(e,t,n,r)}var Zo=class extends ba{static id=`line`;static defaults={borderCapStyle:`butt`,borderDash:[],borderDashOffset:0,borderJoinStyle:`miter`,borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:`default`,fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`&&e!==`fill`};constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,t){let n=this.options;if((n.tension||n.cubicInterpolationMode===`monotone`)&&!n.stepped&&!this._pointsUpdated){let r=n.spanGaps?this._loop:this._fullLoop;Un(this._points,n,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||=xr(this,this.options.segment)}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let n=this.options,r=e[t],i=this.points,a=vr(this,{property:t,start:r,end:r});if(!a.length)return;let o=[],s=Ko(n),c,l;for(c=0,l=a.length;c<l;++c){let{start:l,end:u}=a[c],d=i[l],f=i[u];if(d===f){o.push(d);continue}let p=s(d,f,Math.abs((r-d[t])/(f[t]-d[t])),n.stepped);p[t]=e[t],o.push(p)}return o.length===1?o[0]:o}pathSegment(e,t,n){return Go(this)(e,this,t,n)}path(e,t,n){let r=this.segments,i=Go(this),a=this._loop;t||=0,n||=this.points.length-t;for(let o of r)a&=i(e,this,o,{start:t,end:t+n-1});return!!a}draw(e,t,n,r){let i=this.options||{};(this.points||[]).length&&i.borderWidth&&(e.save(),Xo(e,this,n,r),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function Qo(e,t,n,r){let i=e.options,{[n]:a}=e.getProps([n],r);return Math.abs(t-a)<i.radius+i.hitRadius}var $o=class extends ba{static id=`point`;parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:`circle`,radius:3,rotation:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,n){let r=this.options,{x:i,y:a}=this.getProps([`x`,`y`],n);return(e-i)**2+(t-a)**2<(r.hitRadius+r.radius)**2}inXRange(e,t){return Qo(this,e,`x`,t)}inYRange(e,t){return Qo(this,e,`y`,t)}getCenterPoint(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}size(e){e=e||this.options||{};let t=e.radius||0;t=Math.max(t,t&&e.hoverRadius||0);let n=t&&e.borderWidth||0;return(t+n)*2}draw(e,t){let n=this.options;this.skip||n.radius<.1||!qt(this,t,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,Gt(e,n,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};function es(e,t){let{x:n,y:r,base:i,width:a,height:o}=e.getProps([`x`,`y`,`base`,`width`,`height`],t),s,c,l,u,d;return e.horizontal?(d=o/2,s=Math.min(n,i),c=Math.max(n,i),l=r-d,u=r+d):(d=a/2,s=n-d,c=n+d,l=Math.min(r,i),u=Math.max(r,i)),{left:s,top:l,right:c,bottom:u}}function ts(e,t,n,r){return e?0:U(t,n,r)}function ns(e,t,n){let r=e.options.borderWidth,i=e.borderSkipped,a=ln(r);return{t:ts(i.top,a.top,0,n),r:ts(i.right,a.right,0,t),b:ts(i.bottom,a.bottom,0,n),l:ts(i.left,a.left,0,t)}}function rs(e,t,n){let{enableBorderRadius:r}=e.getProps([`enableBorderRadius`]),i=e.options.borderRadius,a=un(i),o=Math.min(t,n),s=e.borderSkipped,c=r||j(i);return{topLeft:ts(!c||s.top||s.left,a.topLeft,0,o),topRight:ts(!c||s.top||s.right,a.topRight,0,o),bottomLeft:ts(!c||s.bottom||s.left,a.bottomLeft,0,o),bottomRight:ts(!c||s.bottom||s.right,a.bottomRight,0,o)}}function is(e){let t=es(e),n=t.right-t.left,r=t.bottom-t.top,i=ns(e,n/2,r/2),a=rs(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:a},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,a.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(i.b,i.r))}}}}function as(e,t,n,r){let i=t===null,a=n===null,o=e&&!(i&&a)&&es(e,r);return o&&(i||nt(t,o.left,o.right))&&(a||nt(n,o.top,o.bottom))}function os(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function ss(e,t){e.rect(t.x,t.y,t.w,t.h)}function cs(e,t,n={}){let r=e.x===n.x?0:-t,i=e.y===n.y?0:-t,a=(e.x+e.w===n.x+n.w?0:t)-r,o=(e.y+e.h===n.y+n.h?0:t)-i;return{x:e.x+r,y:e.y+i,w:e.w+a,h:e.h+o,radius:e.radius}}var ls=Object.freeze({__proto__:null,ArcElement:Ro,BarElement:class extends ba{static id=`bar`;static defaults={borderSkipped:`start`,borderWidth:0,borderRadius:0,inflateAmount:`auto`,pointStyle:void 0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){let{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:i,outer:a}=is(this),o=os(a.radius)?nn:ss;e.save(),(a.w!==i.w||a.h!==i.h)&&(e.beginPath(),o(e,cs(a,t,i)),e.clip(),o(e,cs(i,-t,a)),e.fillStyle=n,e.fill(`evenodd`)),e.beginPath(),o(e,cs(i,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return as(this,e,t,n)}inXRange(e,t){return as(this,e,null,t)}inYRange(e,t){return as(this,null,e,t)}getCenterPoint(e){let{x:t,y:n,base:r,horizontal:i}=this.getProps([`x`,`y`,`base`,`horizontal`],e);return{x:i?(t+r)/2:t,y:i?n:(n+r)/2}}getRange(e){return e===`x`?this.width/2:this.height/2}},LineElement:Zo,PointElement:$o}),us=[`rgb(54, 162, 235)`,`rgb(255, 99, 132)`,`rgb(255, 159, 64)`,`rgb(255, 205, 86)`,`rgb(75, 192, 192)`,`rgb(153, 102, 255)`,`rgb(201, 203, 207)`],ds=us.map(e=>e.replace(`rgb(`,`rgba(`).replace(`)`,`, 0.5)`));function fs(e){return us[e%us.length]}function ps(e){return ds[e%ds.length]}function ms(e,t){return e.borderColor=fs(t),e.backgroundColor=ps(t),++t}function hs(e,t){return e.backgroundColor=e.data.map(()=>fs(t++)),t}function gs(e,t){return e.backgroundColor=e.data.map(()=>ps(t++)),t}function _s(e){let t=0;return(n,r)=>{let i=e.getDatasetMeta(r).controller;i instanceof bi?t=hs(n,t):i instanceof Si?t=gs(n,t):i&&(t=ms(n,t))}}function vs(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function ys(e){return e&&(e.borderColor||e.backgroundColor)}function bs(){return G.borderColor!==`rgba(0,0,0,0.1)`||G.backgroundColor!==`rgba(0,0,0,0.1)`}var xs={id:`colors`,defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;let{data:{datasets:r},options:i}=e.config,{elements:a}=i,o=vs(r)||ys(i)||a&&vs(a)||bs();if(!n.forceOverride&&o)return;let s=_s(e);r.forEach(s)}};function Ss(e,t,n,r,i){let a=i.samples||r;if(a>=n)return e.slice(t,t+n);let o=[],s=(n-2)/(a-2),c=0,l=t+n-1,u=t,d,f,p,m,h;for(o[c++]=e[u],d=0;d<a-2;d++){let r=0,i=0,a,l=Math.floor((d+1)*s)+1+t,g=Math.min(Math.floor((d+2)*s)+1,n)+t,_=g-l;for(a=l;a<g;a++)r+=e[a].x,i+=e[a].y;r/=_,i/=_;let v=Math.floor(d*s)+1+t,y=Math.min(Math.floor((d+1)*s)+1,n)+t,{x:b,y:x}=e[u];for(p=m=-1,a=v;a<y;a++)m=.5*Math.abs((b-r)*(e[a].y-x)-(b-e[a].x)*(i-x)),m>p&&(p=m,f=e[a],h=a);o[c++]=f,u=h}return o[c++]=e[l],o}function Cs(e,t,n,r){let i=0,a=0,o,s,c,l,u,d,f,p,m,h,g=[],_=t+n-1,v=e[t].x,y=e[_].x-v;for(o=t;o<t+n;++o){s=e[o],c=(s.x-v)/y*r,l=s.y;let t=c|0;if(t===u)l<m?(m=l,d=o):l>h&&(h=l,f=o),i=(a*i+s.x)/++a;else{let n=o-1;if(!k(d)&&!k(f)){let t=Math.min(d,f),r=Math.max(d,f);t!==p&&t!==n&&g.push({...e[t],x:i}),r!==p&&r!==n&&g.push({...e[r],x:i})}o>0&&n!==p&&g.push(e[n]),g.push(s),u=t,a=0,m=h=l,d=f=p=o}}return g}function ws(e){if(e._decimated){let t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Ts(e){e.data.datasets.forEach(e=>{ws(e)})}function Es(e,t){let n=t.length,r=0,i,{iScale:a}=e,{min:o,max:s,minDefined:c,maxDefined:l}=a.getUserBounds();return c&&(r=U(it(t,a.axis,o).lo,0,n-1)),i=l?U(it(t,a.axis,s).hi+1,r,n)-r:n-r,{start:r,count:i}}var Ds={id:`decimation`,defaults:{algorithm:`min-max`,enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){Ts(e);return}let r=e.width;e.data.datasets.forEach((t,i)=>{let{_data:a,indexAxis:o}=t,s=e.getDatasetMeta(i),c=a||t.data;if(dn([o,e.options.indexAxis])===`y`||!s.controller.supportsDecimation)return;let l=e.scales[s.xAxisID];if(l.type!==`linear`&&l.type!==`time`||e.options.parsing)return;let{start:u,count:d}=Es(s,c);if(d<=(n.threshold||4*r)){ws(t);return}k(a)&&(t._data=c,delete t.data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(e){this._data=e}}));let f;switch(n.algorithm){case`lttb`:f=Ss(c,u,d,r,n);break;case`min-max`:f=Cs(c,u,d,r);break;default:throw Error(`Unsupported decimation algorithm '${n.algorithm}'`)}t._decimated=f})},destroy(e){Ts(e)}};function Os(e,t,n){let r=e.segments,i=e.points,a=t.points,o=[];for(let e of r){let{start:r,end:s}=e;s=js(r,s,i);let c=ks(n,i[r],i[s],e.loop);if(!t.segments){o.push({source:e,target:c,start:i[r],end:i[s]});continue}let l=vr(t,c);for(let t of l){let r=ks(n,a[t.start],a[t.end],t.loop),s=_r(e,i,r);for(let e of s)o.push({source:e,target:t,start:{[n]:Ms(c,r,`start`,Math.max)},end:{[n]:Ms(c,r,`end`,Math.min)}})}}return o}function ks(e,t,n,r){if(r)return;let i=t[e],a=n[e];return e===`angle`&&(i=H(i),a=H(a)),{property:e,start:i,end:a}}function As(e,t){let{x:n=null,y:r=null}=e||{},i=t.points,a=[];return t.segments.forEach(({start:e,end:t})=>{t=js(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function js(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function Ms(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function Ns(e,t){let n=[],r=!1;return A(e)?(r=!0,n=e):n=As(e,t),n.length?new Zo({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Ps(e){return e&&e.fill!==!1}function Fs(e,t,n){let r=e[t].fill,i=[t],a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!M(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function Is(e,t,n){let r=Bs(e);if(j(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return M(i)&&Math.floor(i)===i?Ls(r[0],t,i,n):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(r)>=0&&r}function Ls(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function Rs(e,t){let n=null;return e===`start`?n=t.bottom:e===`end`?n=t.top:j(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function zs(e,t,n){let r;return r=e===`start`?n:e===`end`?t.options.reverse?t.min:t.max:j(e)?e.value:t.getBaseValue(),r}function Bs(e){let t=e.options,n=t.fill,r=P(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?`origin`:r}function Vs(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=Hs(t,n);s.push(Ns({x:null,y:t.bottom},r));for(let e=0;e<a.length;e++){let t=a[e];for(let e=t.start;e<=t.end;e++)Us(i,o[e],s)}return new Zo({points:i,options:{}})}function Hs(e,t){let n=[],r=e.getMatchingVisibleMetas(`line`);for(let e=0;e<r.length;e++){let i=r[e];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function Us(e,t,n){let r=[];for(let i=0;i<n.length;i++){let a=n[i],{first:o,last:s,point:c}=Ws(a,t,`x`);if(!(!c||o&&s)){if(o)r.unshift(c);else if(e.push(c),!s)break}}e.push(...r)}function Ws(e,t,n){let r=e.interpolate(t,n);if(!r)return{};let i=r[n],a=e.segments,o=e.points,s=!1,c=!1;for(let e=0;e<a.length;e++){let t=a[e],r=o[t.start][n],l=o[t.end][n];if(nt(i,r,l)){s=i===r,c=i===l;break}}return{first:s,last:c,point:r}}var Gs=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,n){let{x:r,y:i,radius:a}=this;return t||={start:0,end:R},e.arc(r,i,a,t.end,t.start,!0),!n.bounds}interpolate(e){let{x:t,y:n,radius:r}=this,i=e.angle;return{x:t+Math.cos(i)*r,y:n+Math.sin(i)*r,angle:i}}};function Ks(e){let{chart:t,fill:n,line:r}=e;if(M(n))return qs(t,n);if(n===`stack`)return Vs(e);if(n===`shape`)return!0;let i=Js(e);return i instanceof Gs?i:Ns(i,r)}function qs(e,t){let n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function Js(e){return(e.scale||{}).getPointPositionForValue?Xs(e):Ys(e)}function Ys(e){let{scale:t={},fill:n}=e,r=Rs(n,t);if(M(r)){let e=t.isHorizontal();return{x:e?r:null,y:e?null:r}}return null}function Xs(e){let{scale:t,fill:n}=e,r=t.options,i=t.getLabels().length,a=r.reverse?t.max:t.min,o=zs(n,t,a),s=[];if(r.grid.circular){let e=t.getPointPositionForValue(0,a);return new Gs({x:e.x,y:e.y,radius:t.getDistanceFromCenterForValue(o)})}for(let e=0;e<i;++e)s.push(t.getPointPositionForValue(e,o));return s}function Zs(e,t,n){let r=Ks(t),{chart:i,index:a,line:o,scale:s,axis:c}=t,l=o.options,u=l.fill,d=l.backgroundColor,{above:f=d,below:p=d}=u||{},m=Or(i,i.getDatasetMeta(a));r&&o.points.length&&(Jt(e,n),Qs(e,{line:o,target:r,above:f,below:p,area:n,scale:s,axis:c,clip:m}),Yt(e))}function Qs(e,t){let{line:n,target:r,above:i,below:a,area:o,scale:s,clip:c}=t,l=n._loop?`angle`:t.axis;e.save();let u=a;a!==i&&(l===`x`?($s(e,r,o.top),tc(e,{line:n,target:r,color:i,scale:s,property:l,clip:c}),e.restore(),e.save(),$s(e,r,o.bottom)):l===`y`&&(ec(e,r,o.left),tc(e,{line:n,target:r,color:a,scale:s,property:l,clip:c}),e.restore(),e.save(),ec(e,r,o.right),u=i)),tc(e,{line:n,target:r,color:u,scale:s,property:l,clip:c}),e.restore()}function $s(e,t,n){let{segments:r,points:i}=t,a=!0,o=!1;e.beginPath();for(let s of r){let{start:r,end:c}=s,l=i[r],u=i[js(r,c,i)];a?(e.moveTo(l.x,l.y),a=!1):(e.lineTo(l.x,n),e.lineTo(l.x,l.y)),o=!!t.pathSegment(e,s,{move:o}),o?e.closePath():e.lineTo(u.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function ec(e,t,n){let{segments:r,points:i}=t,a=!0,o=!1;e.beginPath();for(let s of r){let{start:r,end:c}=s,l=i[r],u=i[js(r,c,i)];a?(e.moveTo(l.x,l.y),a=!1):(e.lineTo(n,l.y),e.lineTo(l.x,l.y)),o=!!t.pathSegment(e,s,{move:o}),o?e.closePath():e.lineTo(n,u.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function tc(e,t){let{line:n,target:r,property:i,color:a,scale:o,clip:s}=t,c=Os(n,r,i);for(let{source:t,target:l,start:u,end:d}of c){let{style:{backgroundColor:c=a}={}}=t,f=r!==!0;e.save(),e.fillStyle=c,nc(e,o,s,f&&ks(i,u,d)),e.beginPath();let p=!!n.pathSegment(e,t),m;if(f){p?e.closePath():rc(e,r,d,i);let t=!!r.pathSegment(e,l,{move:p,reverse:!0});m=p&&t,m||rc(e,r,u,i)}e.closePath(),e.fill(m?`evenodd`:`nonzero`),e.restore()}}function nc(e,t,n,r){let i=t.chart.chartArea,{property:a,start:o,end:s}=r||{};if(a===`x`||a===`y`){let t,r,c,l;a===`x`?(t=o,r=i.top,c=s,l=i.bottom):(t=i.left,r=o,c=i.right,l=s),e.beginPath(),n&&(t=Math.max(t,n.left),c=Math.min(c,n.right),r=Math.max(r,n.top),l=Math.min(l,n.bottom)),e.rect(t,r,c-t,l-r),e.clip()}}function rc(e,t,n,r){let i=t.interpolate(n,r);i&&e.lineTo(i.x,i.y)}var ic={id:`filler`,afterDatasetsUpdate(e,t,n){let r=(e.data.datasets||[]).length,i=[],a,o,s,c;for(o=0;o<r;++o)a=e.getDatasetMeta(o),s=a.dataset,c=null,s&&s.options&&s instanceof Zo&&(c={visible:e.isDatasetVisible(o),index:o,fill:Is(s,o,r),chart:e,axis:a.controller.options.indexAxis,scale:a.vScale,line:s}),a.$filler=c,i.push(c);for(o=0;o<r;++o)c=i[o],!(!c||c.fill===!1)&&(c.fill=Fs(i,o,n.propagate))},beforeDraw(e,t,n){let r=n.drawTime===`beforeDraw`,i=e.getSortedVisibleDatasetMetas(),a=e.chartArea;for(let t=i.length-1;t>=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&Zs(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;Ps(n)&&Zs(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;!Ps(r)||n.drawTime!==`beforeDatasetDraw`||Zs(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}},ac=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},oc=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,sc=class extends ba{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,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(){let e=this.options.labels||{},t=F(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=q(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=ac(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=cc(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=dr(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=W(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=W(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=W(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=W(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;Jt(e,this),this._draw(),Yt(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:a}=e,o=G.color,s=dr(e.rtl,this.left,this.width),c=q(a.font),{padding:l}=a,u=c.size,d=u/2,f;this.drawTitle(),r.textAlign=s.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:h}=ac(a,u),g=function(e,t,n){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;r.save();let i=P(n.lineWidth,1);if(r.fillStyle=P(n.fillStyle,o),r.lineCap=P(n.lineCap,`butt`),r.lineDashOffset=P(n.lineDashOffset,0),r.lineJoin=P(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=P(n.strokeStyle,o),r.setLineDash(P(n.lineDash,[])),a.usePointStyle)Kt(r,{radius:m*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},s.xPlus(e,p/2),t+d,a.pointStyleWidth&&p);else{let a=t+Math.max((u-m)/2,0),o=s.leftForLtr(e,p),c=un(n.borderRadius);r.beginPath(),Object.values(c).some(e=>e!==0)?nn(r,{x:o,y:a,w:p,h:m,radius:c}):r.rect(o,a,p,m),r.fill(),i!==0&&r.stroke()}r.restore()},_=function(e,t,n){tn(r,n.text,e,t+h/2,c,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();f=v?{x:W(i,this.left+l,this.right-n[0]),y:this.top+l+y,line:0}:{x:this.left+l,y:W(i,this.top+y+l,this.bottom-t[0].height),line:0},fr(this.ctx,e.textDirection);let b=h+l;this.legendItems.forEach((o,u)=>{r.strokeStyle=o.fontColor,r.fillStyle=o.fontColor;let m=r.measureText(o.text).width,h=s.textAlign(o.textAlign||=a.textAlign),x=p+d+m,S=f.x,C=f.y;if(s.setWidth(this.width),v?u>0&&S+x+l>this.right&&(C=f.y+=b,f.line++,S=f.x=W(i,this.left+l,this.right-n[f.line])):u>0&&C+b>this.bottom&&(S=f.x=S+t[f.line].width+l,f.line++,C=f.y=W(i,this.top+y+l,this.bottom-t[f.line].height)),g(s.x(S),C,o),S=ht(h,S+p+d,v?S+x:this.right,e.rtl),_(s.x(S),C,o),v)f.x+=x+l;else if(typeof o.text!=`string`){let e=c.lineHeight;f.y+=dc(o,e)+l}else f.y+=b}),pr(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=q(t.font),r=K(t.padding);if(!t.display)return;let i=dr(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=W(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+W(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=W(o,u,u+d);a.textAlign=i.textAlign(mt(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,tn(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=q(e.font),n=K(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(nt(e,this.left,this.right)&&nt(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;n<i.length;++n)if(r=i[n],nt(e,r.left,r.left+r.width)&&nt(t,r.top,r.top+r.height))return this.legendItems[n]}return null}handleEvent(e){let t=this.options;if(!fc(e.type,t))return;let n=this._getLegendItemAt(e.x,e.y);if(e.type===`mousemove`||e.type===`mouseout`){let r=this._hoveredItem,i=oc(r,n);r&&!i&&F(t.onLeave,[e,r,this],this),this._hoveredItem=n,n&&!i&&F(t.onHover,[e,n,this],this)}else n&&F(t.onClick,[e,n,this],this)}};function cc(e,t,n,r,i){return{itemWidth:lc(r,e,t,n),itemHeight:uc(i,r,t.lineHeight)}}function lc(e,t,n,r){let i=e.text;return i&&typeof i!=`string`&&(i=i.reduce((e,t)=>e.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function uc(e,t,n){let r=e;return typeof t.text!=`string`&&(r=dc(t,n)),r}function dc(e,t){return t*(e.text?e.text.length:0)}function fc(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var pc={id:`legend`,_element:sc,start(e,t,n){let r=e.legend=new sc({ctx:e.ctx,options:n,chart:e});J.configure(e,r,n),J.addBox(e,r)},stop(e){J.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;J.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=K(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}},mc=class extends ba{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let r=A(n.text)?n.text.length:1;this._padding=K(n.padding);let i=r*q(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){let e=this.options.position;return e===`top`||e===`bottom`}_drawArgs(e){let{top:t,left:n,bottom:r,right:i,options:a}=this,o=a.align,s=0,c,l,u;return this.isHorizontal()?(l=W(o,n,i),u=t+e,c=i-n):(a.position===`left`?(l=n+e,u=W(o,r,t),s=L*-.5):(l=i-e,u=W(o,t,r),s=L*.5),c=r-t),{titleX:l,titleY:u,maxWidth:c,rotation:s}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=q(t.font),r=n.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:o,rotation:s}=this._drawArgs(r);tn(e,t.text,0,0,n,{color:t.color,maxWidth:o,rotation:s,textAlign:mt(t.align),textBaseline:`middle`,translation:[i,a]})}};function hc(e,t){let n=new mc({ctx:e.ctx,options:t,chart:e});J.configure(e,n,t),J.addBox(e,n),e.titleBlock=n}var gc={id:`title`,_element:mc,start(e,t,n){hc(e,n)},stop(e){let t=e.titleBlock;J.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){let r=e.titleBlock;J.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},_c=new WeakMap,vc={id:`subtitle`,start(e,t,n){let r=new mc({ctx:e.ctx,options:n,chart:e});J.configure(e,r,n),J.addBox(e,r),_c.set(e,r)},stop(e){J.removeBox(e,_c.get(e)),_c.delete(e)},beforeUpdate(e,t,n){let r=_c.get(e);J.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`normal`},fullSize:!0,padding:0,position:`top`,text:``,weight:1500},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},yc={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;t<n;++t){let n=e[t].element;if(n&&n.hasValue()){let e=n.tooltipPosition();r.add(e.x),i+=e.y,++a}}return a===0||r.size===0?!1:{x:[...r].reduce((e,t)=>e+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a<o;++a){let n=e[a].element;if(n&&n.hasValue()){let e=Qe(t,n.getCenterPoint());e<i&&(i=e,s=n)}}if(s){let e=s.tooltipPosition();n=e.x,r=e.y}return{x:n,y:r}}};function X(e,t){return t&&(A(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function bc(e){return(typeof e==`string`||e instanceof String)&&e.indexOf(`
|
|
2
|
+
`)>-1?e.split(`
|
|
3
|
+
`):e}function xc(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Sc(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=q(t.bodyFont),l=q(t.titleFont),u=q(t.footerFont),d=a.length,f=i.length,p=r.length,m=K(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,I(e.title,y),n.font=c.string,I(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,I(r,e=>{I(e.before,y),I(e.lines,y),I(e.after,y)}),v=0,n.font=u.string,I(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function Cc(e,t){let{y:n,height:r}=t;return n<r/2?`top`:n>e.height-r/2?`bottom`:`center`}function wc(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function Tc(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),wc(l,e,t,n)&&(l=`center`),l}function Ec(e,t,n){let r=n.yAlign||t.yAlign||Cc(e,n);return{xAlign:n.xAlign||t.xAlign||Tc(e,t,n,r),yAlign:r}}function Dc(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function Oc(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function kc(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=un(o),m=Dc(t,s),h=Oc(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:U(m,0,r.width-t.width),y:U(h,0,r.height-t.height)}}function Ac(e,t,n){let r=K(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function jc(e){return X([],bc(e))}function Mc(e,t,n){return pn(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function Nc(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var Pc={beforeTitle:ge,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return``},afterTitle:ge,beforeBody:ge,beforeLabel:ge,label(e){if(this&&this.options&&this.options.mode===`dataset`)return e.label+`: `+e.formattedValue||e.formattedValue;let t=e.dataset.label||``;t&&(t+=`: `);let n=e.formattedValue;return k(n)||(t+=n),t},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:ge,afterBody:ge,beforeFooter:ge,footer:ge,afterFooter:ge};function Z(e,t,n,r){let i=e[t].call(n,r);return i===void 0?Pc[t].call(n,r):i}var Fc=class extends ba{static positioners=yc;constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,i=new Nr(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||=Mc(this.chart.getContext(),this,this._tooltipItems)}getTitle(e,t){let{callbacks:n}=t,r=Z(n,`beforeTitle`,this,e),i=Z(n,`title`,this,e),a=Z(n,`afterTitle`,this,e),o=[];return o=X(o,bc(r)),o=X(o,bc(i)),o=X(o,bc(a)),o}getBeforeBody(e,t){return jc(Z(t.callbacks,`beforeBody`,this,e))}getBody(e,t){let{callbacks:n}=t,r=[];return I(e,e=>{let t={before:[],lines:[],after:[]},i=Nc(n,e);X(t.before,bc(Z(i,`beforeLabel`,this,e))),X(t.lines,Z(i,`label`,this,e)),X(t.after,bc(Z(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return jc(Z(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Z(n,`beforeFooter`,this,e),i=Z(n,`footer`,this,e),a=Z(n,`afterFooter`,this,e),o=[];return o=X(o,bc(r)),o=X(o,bc(i)),o=X(o,bc(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;s<c;++s)o.push(xc(this.chart,t[s]));return e.filter&&(o=o.filter((t,r,i)=>e.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),I(o,t=>{let n=Nc(e.callbacks,t);r.push(Z(n,`labelColor`,this,t)),i.push(Z(n,`labelPointStyle`,this,t)),a.push(Z(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=yc[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=Sc(this,n),o=Object.assign({},e,t),s=Ec(this.chart,n,o),c=kc(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=un(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=dr(n.rtl,this.x,this.width);for(e.x=Ac(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=q(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;s<i;++s)t.fillText(r[s],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,s+1===i&&(e.y+=n.titleMarginBottom-o)}}_drawColorBox(e,t,n,r,i){let a=this.labelColors[n],o=this.labelPointStyles[n],{boxHeight:s,boxWidth:c}=i,l=q(i.bodyFont),u=Ac(this,`left`,i),d=r.x(u),f=s<l.lineHeight?(l.lineHeight-s)/2:0,p=t.y+f;if(i.usePointStyle){let t={radius:Math.min(c,s)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},n=r.leftForLtr(d,c)+c/2,l=p+s/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,Gt(e,t,n,l),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,Gt(e,t,n,l)}else{e.lineWidth=j(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;let t=r.leftForLtr(d,c),n=r.leftForLtr(r.xPlus(d,1),c-2),o=un(a.borderRadius);Object.values(o).some(e=>e!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,nn(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),nn(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=q(n.bodyFont),d=u.lineHeight,f=0,p=dr(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=Ac(this,h,n),t.fillStyle=n.bodyColor,I(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y<x;++y){for(g=r[y],_=this.labelTextColors[y],t.fillStyle=_,I(g.before,m),v=g.lines,o&&v.length&&(this._drawColorBox(t,e,y,p,n),d=Math.max(u.lineHeight,s)),b=0,S=v.length;b<S;++b)m(v[b]),d=u.lineHeight;I(g.after,m)}f=0,d=u.lineHeight,I(this.afterBody,m),e.y-=i}drawFooter(e,t,n){let r=this.footer,i=r.length,a,o;if(i){let s=dr(n.rtl,this.x,this.width);for(e.x=Ac(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline=`middle`,a=q(n.footerFont),t.fillStyle=n.footerColor,t.font=a.string,o=0;o<i;++o)t.fillText(r[o],s.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){let{xAlign:i,yAlign:a}=this,{x:o,y:s}=e,{width:c,height:l}=n,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=un(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(o+u,s),a===`top`&&this.drawCaret(e,t,n,r),t.lineTo(o+c-d,s),t.quadraticCurveTo(o+c,s,o+c,s+d),a===`center`&&i===`right`&&this.drawCaret(e,t,n,r),t.lineTo(o+c,s+l-p),t.quadraticCurveTo(o+c,s+l,o+c-p,s+l),a===`bottom`&&this.drawCaret(e,t,n,r),t.lineTo(o+f,s+l),t.quadraticCurveTo(o,s+l,o,s+l-f),a===`center`&&i===`left`&&this.drawCaret(e,t,n,r),t.lineTo(o,s+u),t.quadraticCurveTo(o,s,o+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=yc[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=Sc(this,e),o=Object.assign({},n,this._size),s=Ec(t,e,o),c=kc(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=K(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),fr(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),pr(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!be(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!be(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=yc[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}},Ic=Object.freeze({__proto__:null,Colors:xs,Decimation:Ds,Filler:ic,Legend:pc,SubTitle:vc,Title:gc,Tooltip:{id:`tooltip`,_element:Fc,positioners:yc,afterInit(e,t,n){n&&(e.tooltip=new Fc({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,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:(e,t)=>t.bodyFont.size,boxWidth:(e,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:Pc},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]}}),Lc=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Rc(e,t,n,r){let i=e.indexOf(t);return i===-1?Lc(e,t,n,r):i===e.lastIndexOf(t)?i:n}var zc=(e,t)=>e===null?null:U(Math.round(e),0,t);function Bc(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var Vc=class extends Ba{static id=`category`;static defaults={ticks:{callback:Bc}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let t=this._addedLabels;if(t.length){let e=this.getLabels();for(let{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(k(e))return null;let n=this.getLabels();return t=isFinite(t)&&n[t]===e?t:Rc(n,e,P(t,e),this._addedLabels),zc(t,n.length-1)}determineDataLimits(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),{min:n,max:r}=this.getMinMax(!0);this.options.bounds===`ticks`&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){let e=this.min,t=this.max,n=this.options.offset,r=[],i=this.getLabels();i=e===0&&t===i.length-1?i:i.slice(e,t+1),this._valueRange=Math.max(i.length-+!n,1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return Bc.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!=`number`&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function Hc(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!k(a),_=!k(o),v=!k(c),y=(h-m)/(u+1),b=Ue((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=Ue(w*b/p/f)*f),k(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&qe((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=He(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(Xe(b),Xe(S));x=10**(k(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),S<a&&E++,He(Math.round((S+E*b)*x)/x,a,Uc(a,y,e))&&E++):S<a&&E++);E<w;++E){let e=Math.round((S+E*b)*x)/x;if(_&&e>o)break;n.push({value:e})}return _&&d&&C!==o?n.length&&He(n[n.length-1].value,o,Uc(o,y,e))?n[n.length-1].value=o:n.push({value:o}):(!_||C===o)&&n.push({value:C}),n}function Uc(e,t,{horizontal:n,minRotation:r}){let i=V(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var Wc=class extends Ba{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return k(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=B(r),t=B(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e||=11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=Hc({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&Je(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return jt(e,this.chart.options.locale,this.options.ticks.format)}},Gc=class extends Wc{static id=`linear`;static defaults={ticks:{callback:Pt.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=M(e)?e:0,this.max=M(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=V(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}},Kc=e=>Math.floor(Ve(e)),qc=(e,t)=>10**(Kc(e)+t);function Jc(e){return e/10**Kc(e)==1}function Yc(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function Xc(e,t){let n=Kc(t-e);for(;Yc(e,t,n)>10;)n++;for(;Yc(e,t,n)<10;)n--;return Math.min(n,Kc(e))}function Zc(e,{min:t,max:n}){t=N(e.min,t);let r=[],i=Kc(t),a=Xc(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=N(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f<n;)r.push({value:f,major:Jc(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=N(e.max,f);return r.push({value:p,major:Jc(p),significand:d}),r}var Qc=class extends Ba{static id=`logarithmic`;static defaults={ticks:{callback:Pt.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=Wc.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return M(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=M(e)?Math.max(0,e):null,this.max=M(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!M(this._userMin)&&(this.min=e===qc(this.min,0)?qc(this.min,-1):qc(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(qc(n,-1)),a(qc(r,1)))),n<=0&&i(qc(r,-1)),r<=0&&a(qc(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=Zc({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&Je(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:jt(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=Ve(e),this._valueRange=Ve(this.max)-Ve(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Ve(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}};function $c(e){let t=e.ticks;if(t.display&&e.display){let e=K(t.backdropPadding);return P(t.font&&t.font.size,G.font.size)+e.height}return 0}function el(e,t,n){return n=A(n)?n:[n],{w:Ht(e,t.string,n),h:n.length*t.lineHeight}}function tl(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:e<r||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function nl(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?L/a:0;for(let c=0;c<a;c++){let a=o.setContext(e.getPointLabelContext(c));i[c]=a.padding;let l=e.getPointPosition(c,e.drawingArea+i[c],s),u=q(a.font),d=el(e.ctx,u,e._pointLabels[c]);r[c]=d;let f=H(e.getIndexAngle(c)+s),p=Math.round(Ye(f));rl(n,t,f,tl(p,l.x,d.w,0,180),tl(p,l.y,d.h,90,270))}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=ol(e,r,i)}function rl(e,t,n,r,i){let a=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n)),s=0,c=0;r.start<t.l?(s=(t.l-r.start)/a,e.l=Math.min(e.l,t.l-s)):r.end>t.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.start<t.t?(c=(t.t-i.start)/o,e.t=Math.min(e.t,t.t-c)):i.end>t.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function il(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(Ye(H(c.angle+z))),u=ll(c.y,s.h,l),d=sl(l),f=cl(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function al(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(qt({x:n,y:r},t)||qt({x:n,y:a},t)||qt({x:i,y:r},t)||qt({x:i,y:a},t))}function ol(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:$c(a)/2,additionalAngle:o?L/i:0},l;for(let a=0;a<i;a++){c.padding=n[a],c.size=t[a];let i=il(e,a,c);r.push(i),s===`auto`&&(i.visible=al(i,l),i.visible&&(l=i))}return r}function sl(e){return e===0||e===180?`center`:e<180?`left`:`right`}function cl(e,t,n){return n===`right`?e-=t:n===`center`&&(e-=t/2),e}function ll(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function ul(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!k(s)){let n=un(t.borderRadius),c=K(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),nn(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function dl(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));ul(n,a,t);let o=q(a.font),{x:s,y:c,textAlign:l}=t;tn(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function fl(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,R);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a<r;a++)n=e.getPointPosition(a,t),i.lineTo(n.x,n.y)}}function pl(e,t,n,r,i){let a=e.ctx,o=t.circular,{color:s,lineWidth:c}=t;!o&&!r||!s||!c||n<0||(a.save(),a.strokeStyle=s,a.lineWidth=c,a.setLineDash(i.dash||[]),a.lineDashOffset=i.dashOffset,a.beginPath(),fl(e,n,o,r),a.closePath(),a.stroke(),a.restore())}function ml(e,t,n){return pn(e,{label:n,index:t,type:`pointLabel`})}var hl=class extends Wc{static id=`radialLinear`;static defaults={display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Pt.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`};static descriptors={angleLines:{_fallback:`grid`}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=K($c(this.options)/2),t=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(t,n)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=M(e)&&!isNaN(e)?e:0,this.max=M(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/$c(this.options))}generateTickLabels(e){Wc.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{let n=F(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?nl(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=R/(this._pointLabels.length||1),n=this.options.startAngle||0;return H(e*t+V(n))}getDistanceFromCenterForValue(e){if(k(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(k(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){let n=t[e];return ml(this.getContext(),e,n)}}getPointPosition(e,t,n=0){let r=this.getIndexAngle(e)-z+n;return{x:Math.cos(r)*t+this.xCenter,y:Math.sin(r)*t+this.yCenter,angle:r}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:n,right:r,bottom:i}=this._pointLabelItems[e];return{left:t,top:n,right:r,bottom:i}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),fl(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,t=this.options,{angleLines:n,grid:r,border:i}=t,a=this._pointLabels.length,o,s,c;if(t.pointLabels.display&&dl(this,a),r.display&&this.ticks.forEach((e,t)=>{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);pl(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=q(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=K(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}tn(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}},gl={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}},Q=Object.keys(gl);function _l(e,t){return e-t}function vl(e,t){if(k(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),M(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(Ke(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function yl(e,t,n,r){let i=Q.length;for(let a=Q.indexOf(e);a<i-1;++a){let e=gl[Q[a]],i=e.steps?e.steps:2**53-1;if(e.common&&Math.ceil((n-t)/(i*e.size))<=r)return Q[a]}return Q[i-1]}function bl(e,t,n,r,i){for(let a=Q.length-1;a>=Q.indexOf(n);a--){let n=Q[a];if(gl[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return Q[n?Q.indexOf(n):0]}function xl(e){for(let t=Q.indexOf(e)+1,n=Q.length;t<n;++t)if(gl[Q[t]].common)return Q[t]}function Sl(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:r,hi:i}=rt(n,t),a=n[r]>=t?n[r]:n[i];e[a]=!0}}function Cl(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function wl(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o<a;++o)s=t[o],i[s]=o,r.push({value:s,major:!1});return a===0||!n?r:Cl(e,r,i,n)}var Tl=class extends Ba{static id=`time`;static defaults={bounds:`data`,adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:`millisecond`,displayFormats:{}},ticks:{source:`auto`,callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit=`day`,this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){let n=e.time||={},r=this._adapter=new Ti._date(e.adapters.date);r.init(t),Te(n.displayFormats,r.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:vl(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,t=this._adapter,n=e.time.unit||`day`,{min:r,max:i,minDefined:a,maxDefined:o}=this.getUserBounds();function s(e){!a&&!isNaN(e.min)&&(r=Math.min(r,e.min)),!o&&!isNaN(e.max)&&(i=Math.max(i,e.max))}(!a||!o)&&(s(this._getLabelBounds()),(e.bounds!==`ticks`||e.ticks.source!==`labels`)&&s(this.getMinMax(!1))),r=M(r)&&!isNaN(r)?r:+t.startOf(Date.now(),n),i=M(i)&&!isNaN(i)?i:+t.endOf(Date.now(),n)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){let e=this.getLabelTimestamps(),t=1/0,n=-1/0;return e.length&&(t=e[0],n=e[e.length-1]),{min:t,max:n}}buildTicks(){let e=this.options,t=e.time,n=e.ticks,r=n.source===`labels`?this.getLabelTimestamps():this._generate();e.bounds===`ticks`&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);let i=this.min,a=this.max,o=ot(r,i,a);return this._unit=t.unit||(n.autoSkip?yl(t.minUnit,this.min,this.max,this._getLabelCapacity(i)):bl(this,o.length,t.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit===`year`?void 0:xl(this._unit),this.initOffsets(r),e.reverse&&o.reverse(),wl(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=U(t,0,a),n=U(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||yl(i.minUnit,t,n,this._getLabelCapacity(t)),o=P(r.ticks.stepSize,1),s=a===`week`?i.isoWeekday:!1,c=Ke(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d<n;d=+e.add(d,o,a),f++)Sl(l,d,p);return(d===n||r.bounds===`ticks`||f===1)&&Sl(l,d,p),Object.keys(l).sort(_l).map(e=>+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return F(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t<n;++t)r=e[t],r.label=this._tickFormatFunction(r.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let t=this._offsets,n=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+n)*t.factor)}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+n*(this.max-this.min)}_getLabelSize(e){let t=this.options.ticks,n=this.ctx.measureText(e).width,r=V(this.isHorizontal()?t.maxRotation:t.minRotation),i=Math.cos(r),a=Math.sin(r),o=this._resolveTickFontOptions(0).size;return{w:n*i+o*a,h:n*a+o*i}}_getLabelCapacity(e){let t=this.options.time,n=t.displayFormats,r=n[t.unit]||n.millisecond,i=this._tickFormatFunction(e,0,wl(this,[e],this._majorUnit),r),a=this._getLabelSize(i),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t<n;++t)e=e.concat(r[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){let e=this._cache.labels||[],t,n;if(e.length)return e;let r=this.getLabels();for(t=0,n=r.length;t<n;++t)e.push(vl(this,r[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return ut(e.sort(_l))}};function El(e,t,n){let r=0,i=e.length-1,a,o,s,c;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=it(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=it(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}var Dl=class extends Tl{static id=`timeseries`;static defaults=Tl.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=El(t,this.min),this._tableRange=El(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a<o;++a)c=e[a],c>=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;a<o;++a)l=r[a+1],s=r[a-1],c=r[a],Math.round((l+s)/2)!==c&&i.push({time:c,pos:a/(o-1)});return i}_generate(){let e=this.min,t=this.max,n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(t)||n.length===1)&&n.push(t),n.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(El(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return El(this._table,n*this._tableRange+this._minPos,!0)}},Ol=[Ci,ls,Ic,Object.freeze({__proto__:null,CategoryScale:Vc,LinearScale:Gc,LogarithmicScale:Qc,RadialLinearScale:hl,TimeScale:Tl,TimeSeriesScale:Dl})],$={projectName:`my-react-app`,analyzedAt:`2025-03-29T09:24:25.438Z`,performanceScore:62,static:{timestamp:`2025-03-29T09:24:20.000Z`,grade:`C`,componentCount:14,filesAnalyzed:14,filesFailed:0,issues:[{id:`console-log-1`,component:`App`,file:`src/App.jsx`,line:12,severity:`warning`,message:`console.log() left in production code`,suggestion:`Remove or replace with a proper logging library`},{id:`console-log-2`,component:`UserList`,file:`src/components/UserList.jsx`,line:8,severity:`warning`,message:`console.log() left in production code`,suggestion:`Remove or replace with a proper logging library`},{id:`large-comp-1`,component:`Dashboard`,file:`src/pages/Dashboard.jsx`,line:1,severity:`critical`,message:`Component is 487 lines โ too large to maintain or optimize`,suggestion:`Split into smaller focused components`},{id:`inline-fn-1`,component:`UserCard`,file:`src/components/UserCard.jsx`,line:34,severity:`warning`,message:`Inline arrow function passed as prop causes re-renders`,suggestion:`Extract to a named callback with useCallback`},{id:`inline-fn-2`,component:`FilterBar`,file:`src/components/FilterBar.jsx`,line:22,severity:`warning`,message:`Inline arrow function passed as prop causes re-renders`,suggestion:`Extract to a named callback with useCallback`},{id:`inline-style-1`,component:`Header`,file:`src/components/Header.jsx`,line:18,severity:`info`,message:`Inline style object recreated on every render`,suggestion:`Move to a CSS class or useMemo`},{id:`missing-key-1`,component:`UserList`,file:`src/components/UserList.jsx`,line:41,severity:`critical`,message:`List items rendered without unique key prop`,suggestion:`Add a stable unique key prop to each list element`},{id:`missing-memo-1`,component:`UserCard`,file:`src/components/UserCard.jsx`,line:1,severity:`warning`,message:`Component re-renders on every parent update (not memoized)`,suggestion:`Wrap with React.memo() to prevent unnecessary re-renders`},{id:`missing-memo-2`,component:`Sidebar`,file:`src/components/Sidebar.jsx`,line:1,severity:`warning`,message:`Component re-renders on every parent update (not memoized)`,suggestion:`Wrap with React.memo() to prevent unnecessary re-renders`},{id:`effect-loop-1`,component:`DataFetcher`,file:`src/components/DataFetcher.jsx`,line:19,severity:`critical`,message:`useEffect dependency array contains an object โ causes infinite loop`,suggestion:`Wrap the object in useMemo or extract primitive deps`},{id:`dead-code-1`,component:`OldWidget`,file:`src/components/OldWidget.jsx`,line:1,severity:`info`,message:`Component is defined but never imported`,suggestion:`Delete the file or add it to the component tree`},{id:`prop-drilling-1`,component:`App`,file:`src/App.jsx`,line:44,severity:`info`,message:`Prop 'userId' passed through 4 component levels`,suggestion:`Move to React Context or a state manager like Zustand`}]},runtime:{"/::desktop":{url:`http://localhost:5173/`,deviceType:`desktop`,timestamp:`2025-03-29T09:24:22.000Z`,performanceScore:71,cpuThrottling:1,networkThrottle:`No throttle`,metrics:{lcp:2180,fcp:820,cls:.04,inp:95,ttfb:310},rerenders:{App:3,Dashboard:8,UserCard:22,Sidebar:3,Header:2},commitDurations:[12.4,8.2,34.1,6.8,15.3,9.1,42.7],renderTime:1240,stats:{domNodes:1420,jsHeapMB:`38.4`,payloadMB:`2.1`,topOffender:{name:`lodash.js`,size:68400}},errors:[{type:`warning`,message:`Each child in a list should have a unique 'key' prop.`,source:`console`}],screenshots:[{label:`fcp`,dataUrl:`/screenshots/1-desktop-fcp.png`,takenAt:820},{label:`fullLoad`,dataUrl:`/screenshots/1-desktop-fullLoad.png`,takenAt:2800}]},"/::mobile":{url:`http://localhost:5173/`,deviceType:`mobile`,timestamp:`2025-03-29T09:24:23.500Z`,performanceScore:53,cpuThrottling:4,networkThrottle:`Slow 3G`,metrics:{lcp:4150,fcp:1620,cls:.09,inp:245,ttfb:680},rerenders:{App:3,Dashboard:8,UserCard:22,Sidebar:3,Header:2},commitDurations:[22.1,18.4,67.3,14.5,28.7],renderTime:2180,stats:{domNodes:1420,jsHeapMB:`38.4`,payloadMB:`2.1`,topOffender:{name:`lodash.js`,size:68400}},errors:[{type:`warning`,message:`Each child in a list should have a unique 'key' prop.`,source:`console`},{type:`error`,message:`Cannot read properties of undefined (reading 'map')`,source:`pageerror`}],screenshots:[{label:`fcp`,dataUrl:`/screenshots/1-mobile-fcp.png`,takenAt:1620},{label:`fullLoad`,dataUrl:`/screenshots/1-mobile-fullLoad.png`,takenAt:4800}]},"/about::desktop":{url:`http://localhost:5173/about`,deviceType:`desktop`,timestamp:`2025-03-29T09:24:24.200Z`,performanceScore:91,cpuThrottling:1,networkThrottle:`No throttle`,metrics:{lcp:960,fcp:420,cls:.01,inp:48,ttfb:210},rerenders:{App:1,Header:1,Footer:1},commitDurations:[4.2,3.8,5.1],renderTime:380,stats:{domNodes:320,jsHeapMB:`12.1`,payloadMB:`0.8`,topOffender:null},errors:[],screenshots:[{label:`fcp`,dataUrl:`/screenshots/1-about-fcp.png`,takenAt:420},{label:`fullLoad`,dataUrl:`/screenshots/1-about-fullLoad.png`,takenAt:1100}]}},suggestions:[{id:`missing-list-keys`,title:`Add key props to list items`,description:`React uses key props to efficiently reconcile list updates. Without keys, React re-renders every list item on every change, causing severe performance degradation for long lists.`,severity:`critical`,affectedComponent:`UserList`,fix:`Add key={item.id} to each list element in UserList.jsx line 41`},{id:`effect-infinite-loop`,title:`useEffect dependency causes infinite loop`,description:`An object in the useEffect dependency array is recreated on every render, causing the effect to run endlessly and hammering your API.`,severity:`critical`,affectedComponent:`DataFetcher`,fix:`Wrap the dep object in useMemo, or extract primitive values as deps`},{id:`large-component`,title:`Split oversized Dashboard component`,description:`The Dashboard component is 487 lines โ far beyond the recommended 150-200 line limit. Large components are harder to memoize, test, and tree-shake.`,severity:`critical`,affectedComponent:`Dashboard`,fix:`Extract into DashboardHeader, DashboardMetrics, and DashboardTable sub-components`},{id:`slow-lcp-mobile`,title:`LCP too high on mobile (4.15s)`,description:`Largest Contentful Paint on mobile is 4.15s โ well above the 2.5s target. The main culprit is likely an unoptimised hero image or render-blocking resource.`,severity:`critical`,affectedComponent:null,fix:`Use lazy loading for hero images, preload critical assets, and check for render-blocking scripts`},{id:`inline-callbacks`,title:`Extract inline callback props`,description:`Inline arrow functions as props create a new function reference every render, causing child components that use React.memo to re-render unnecessarily.`,severity:`warning`,affectedComponent:`UserCard`,fix:`Extract to useCallback(fn, [deps]) in the parent component`},{id:`missing-memo`,title:`Memoize pure components`,description:`UserCard and Sidebar re-render on every parent update even when their props haven't changed. Wrapping them with React.memo will prevent this.`,severity:`warning`,affectedComponent:`UserCard, Sidebar`,fix:`export default React.memo(UserCard)`},{id:`console-logs`,title:`Remove console.log statements`,description:`console.log calls in App.jsx and UserList.jsx will ship to production, slowing serialisation and leaking internal data to users' browsers.`,severity:`warning`,affectedComponent:`App, UserList`,fix:`Delete console.log calls or replace with a conditional logger`},{id:`high-inp-mobile`,title:`INP too high on mobile (245ms)`,description:`Interaction to Next Paint on mobile is 245ms, above the 200ms target. Long tasks are blocking the main thread after user interactions.`,severity:`warning`,affectedComponent:null,fix:`Break long tasks with scheduler.postTask or setTimeout(0), defer non-critical work`},{id:`excessive-rerenders`,title:`Dashboard component re-renders 8 times`,description:`React Profiler captured 8 commits on Dashboard during a single page load. This suggests state or context updates are cascading unnecessarily.`,severity:`warning`,affectedComponent:`Dashboard`,fix:`Use React DevTools Profiler to identify which state change triggers each commit`},{id:`inline-styles`,title:`Avoid inline style objects`,description:`Inline style objects in Header are recreated on every render. While minor, at scale these small allocations add up.`,severity:`info`,affectedComponent:`Header`,fix:`Move static styles to a CSS class; dynamic styles to useMemo`},{id:`prop-drilling`,title:`Reduce prop drilling depth`,description:`userId is passed through 4 levels of components. This makes refactoring painful and means every intermediate component re-renders when userId changes.`,severity:`info`,affectedComponent:`App`,fix:`Create a UserContext and consume it with useContext where needed`}]},kl=[{id:1,project:`my-react-app`,score:62,grade:`C`,analyzed_at:`2025-03-29T09:24:25.438Z`,created_at:`2025-03-29T09:24:26.000Z`},{id:2,project:`my-react-app`,score:71,grade:`C+`,analyzed_at:`2025-03-27T14:11:00.000Z`,created_at:`2025-03-27T14:11:01.000Z`},{id:3,project:`my-react-app`,score:55,grade:`D`,analyzed_at:`2025-03-25T08:45:00.000Z`,created_at:`2025-03-25T08:45:01.000Z`},{id:4,project:`portfolio-site`,score:94,grade:`A`,analyzed_at:`2025-03-24T19:30:00.000Z`,created_at:`2025-03-24T19:30:01.000Z`},{id:5,project:`portfolio-site`,score:88,grade:`B+`,analyzed_at:`2025-03-22T11:00:00.000Z`,created_at:`2025-03-22T11:00:01.000Z`},{id:6,project:`admin-panel`,score:48,grade:`D`,analyzed_at:`2025-03-21T16:20:00.000Z`,created_at:`2025-03-21T16:20:01.000Z`},{id:7,project:`admin-panel`,score:37,grade:`F`,analyzed_at:`2025-03-19T10:05:00.000Z`,created_at:`2025-03-19T10:05:01.000Z`},{id:8,project:`my-react-app`,score:44,grade:`D`,analyzed_at:`2025-03-17T08:00:00.000Z`,created_at:`2025-03-17T08:00:01.000Z`},{id:9,project:`landing-page`,score:97,grade:`A+`,analyzed_at:`2025-03-16T13:45:00.000Z`,created_at:`2025-03-16T13:45:01.000Z`},{id:10,project:`landing-page`,score:92,grade:`A`,analyzed_at:`2025-03-14T09:20:00.000Z`,created_at:`2025-03-14T09:20:01.000Z`},{id:11,project:`ecommerce-app`,score:58,grade:`D+`,analyzed_at:`2025-03-13T15:30:00.000Z`,created_at:`2025-03-13T15:30:01.000Z`},{id:12,project:`ecommerce-app`,score:63,grade:`C`,analyzed_at:`2025-03-11T11:10:00.000Z`,created_at:`2025-03-11T11:10:01.000Z`}],Al=(()=>{let e=`http://localhost:3000`;async function t(t,n={}){let r=`${e}${t}`,i={"Content-Type":`application/json`},a=await fetch(r,{...n,headers:{...i,...n.headers||{}}});if(!a.ok){let e=null;try{e=await a.json()}catch{}let t=e?.error||e?.message||a.statusText;throw Error(`API ${a.status}: ${t}`)}return a.json()}async function n(){return t(`/health`)}async function r(){return t(`/api/reports`)}async function i(e){let n=await t(`/api/reports/${e}`);try{let r=await t(`/api/reports/${e}/screenshots`);if(r&&r.screenshots&&r.screenshots.length>0){let e={};for(let t of r.screenshots){let n=t.route||``;e[n]||(e[n]=[]),e[n].push({label:t.label,takenAt:t.taken_at||t.takenAt,dataUrl:t.data_url||t.dataUrl})}for(let[t,r]of Object.entries(e))n.runtime&&n.runtime[t]&&(n.runtime[t].screenshots=r);console.log(`๐ธ Loaded ${r.screenshots.length} screenshots from API`)}}catch{console.warn(`No screenshots found for this report`)}return n}async function a(e){return t(`/api/reports/project/${encodeURIComponent(e)}`)}async function o(e){return t(`/api/reports/upload`,{method:`POST`,headers:{"x-api-key":`react-doctor-secret-key-change-this`},body:JSON.stringify(e)})}async function s(){let{reports:e}=await r();if(!e||e.length===0)throw Error(`No reports found in the database`);return i(e[0].id)}return{healthCheck:n,listReports:r,getReport:i,getReportsByProject:a,uploadReport:o,getLatestReport:s,BASE_URL:e}})();function jl(e){return e>=90?`var(--green)`:e>=75?`var(--blue)`:e>=50?`var(--orange)`:`var(--red)`}function Ml(e){let t=e?e[0]:`N`;return t===`A`?`grade-a`:t===`B`?`grade-b`:t===`C`?`grade-c`:`grade-d`}function Nl(e){return{critical:`๐ด`,warning:`๐ `,info:`๐ต`}[e]||`โช`}function Pl(e){return`<span class="badge ${e}">${Nl(e)} ${e}</span>`}var Fl={lcp:[2500,4e3],fcp:[1800,3e3],ttfb:[800,1800],inp:[200,500],cls:[.1,.25],render:[2e3,4e3]};function Il(e,t){let[n,r]=Fl[e]||[1/0,1/0];return t<=n?`good`:t<=r?`warn`:`bad`}function Ll(e,t){let n=Il(e,t);return n===`good`?`var(--green)`:n===`warn`?`var(--orange)`:`var(--red)`}function Rl(e,t){let n={lcp:5e3,fcp:4e3,ttfb:2500,inp:600,cls:.35,render:6e3}[e]||100;return Math.min(t/n*100,100).toFixed(1)}function zl(e){return e==null?`โ`:e>=1e3?(e/1e3).toFixed(2)+`s`:e.toFixed(0)+`ms`}function Bl(e){return typeof e==`number`?e.toFixed(3):`โ`}function Vl(e){if(!e)return`โ`;let t=new Date(e);return t.toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`,year:`numeric`})+` `+t.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`})}function Hl(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Ul(e,t=140,n=10){let r=(t-n)/2,i=t/2,a=2*Math.PI*r,o=Math.min(Math.max(e/100,0),1),s;return s=e>=90?`#3FB950`:e>=75?`#58A6FF`:e>=50?`#F0883E`:`#FF7B72`,`
|
|
4
|
+
<div class="score-ring" style="width:${t}px;height:${t}px;position:relative;flex-shrink:0;">
|
|
5
|
+
<svg width="${t}" height="${t}" viewBox="0 0 ${t} ${t}" style="transform:rotate(-90deg);display:block;">
|
|
6
|
+
<circle
|
|
7
|
+
cx="${i}" cy="${i}" r="${r}"
|
|
8
|
+
fill="none"
|
|
9
|
+
stroke="#1C2333"
|
|
10
|
+
stroke-width="${n}" />
|
|
11
|
+
<circle
|
|
12
|
+
cx="${i}" cy="${i}" r="${r}"
|
|
13
|
+
fill="none"
|
|
14
|
+
stroke="${s}"
|
|
15
|
+
stroke-width="${n}"
|
|
16
|
+
stroke-linecap="round"
|
|
17
|
+
stroke-dasharray="${a}"
|
|
18
|
+
stroke-dashoffset="${a*(1-o)}"
|
|
19
|
+
style="transition: stroke-dashoffset 1.4s cubic-bezier(.4,0,.2,1);" />
|
|
20
|
+
</svg>
|
|
21
|
+
<div style="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;pointer-events:none;width:100%;z-index:10;">
|
|
22
|
+
<div style="font-size:2.4rem;font-weight:700;font-family:'JetBrains Mono',monospace;line-height:1;color:${s};text-shadow:0 0 20px rgba(0,0,0,0.5);">${Math.round(e)}</div>
|
|
23
|
+
<div style="font-size:0.7rem;font-weight:600;color:#8B949E;margin-top:2px;">/ 100</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
`}function Wl(e,t,n){let r=t===`cls`?Bl(n):zl(n),i=Ll(t,n);return`
|
|
27
|
+
<div class="vital-row">
|
|
28
|
+
<div class="vital-row-head">
|
|
29
|
+
<span class="vname">${e}</span>
|
|
30
|
+
<span class="vval" style="color:${i}">${r}</span>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="vital-track">
|
|
33
|
+
<div class="vital-fill" style="width:${Rl(t,n)}%;background:${i}"></div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>`}function Gl(e,t){let n=document.getElementById(`lightbox`),r=n.querySelector(`img`);r&&(r.src=e);let i=document.getElementById(`lb-caption`);i&&(i.textContent=t||``),n.classList.add(`open`)}function Kl(){document.getElementById(`lightbox`).classList.remove(`open`)}function ql(e){if(e.static&&e.runtime&&e.suggestions)return e;let t=e.performanceScore||e.score||0;return{projectName:e.project||e.projectName||`Unknown`,analyzedAt:e.analyzedAt||e.analyzed_at||new Date().toISOString(),performanceScore:t,score:t,overallScore:t,static:e.static||{issues:e.issues||[],grade:e.grade||`N/A`,componentCount:e.componentCount||0,filesAnalyzed:e.filesAnalyzed||0},runtime:e.runtime||{},suggestions:e.suggestions||[]}}var Jl=!1;async function Yl(){if(Jl)return;Jl=!0;let e;try{e=ql(await Al.getLatestReport()),console.log(`๐ Overview loaded:`,e)}catch(t){console.warn(`โ ๏ธ Using static fallback:`,t.message),e=$}let t=e.static||{issues:[],grade:`N/A`},n=e=>document.getElementById(e),r=e.performanceScore||e.score||e.overallScore||0,i=n(`ov-score-ring`);i&&(i.innerHTML=Ul(r,148,11));let a=t.grade||`N/A`,o=Ml(a),s=n(`ov-grade`);s&&(s.innerHTML=`<span class="badge ${o}">${a}</span>`);let c=t.issues||[],l=e.suggestions||[],u=l.filter(e=>e.severity===`critical`).length,d=l.filter(e=>e.severity===`warning`).length,f=n(`ov-summary`);f&&(f.textContent=`Score: ${r}/100 ยท Analyzed ${t.filesAnalyzed||0} files ยท ${t.componentCount||0} components ยท ${u} critical issue${u===1?``:`s`} ยท ${d} warnings`);let p=n(`ov-project`);p&&(p.textContent=e.projectName||e.project||`Unknown`);let m=n(`ov-analyzed`);m&&(m.textContent=Vl(e.analyzedAt||e.analyzed_at));let h=e.runtime||{},g=Object.values(h),_=g.length?g.reduce((e,t)=>e+(t.metrics?.lcp||0),0)/g.length:0,v=g.length?g.reduce((e,t)=>e+(t.metrics?.fcp||0),0)/g.length:0,y=g.length?g.reduce((e,t)=>e+(t.metrics?.cls||0),0)/g.length:0,b=c.length;function x(e,t,n,r){let i=t===`none`?`blue`:Il(t,n),a=document.getElementById(e);if(!a)return;a.className=`stat-tile ${i}`;let o=a.querySelector(`.stat-value`);o&&(o.className=`stat-value ${i===`good`?`good`:i===`warn`?`warn`:i===`bad`?`bad`:`blue`}`,o.textContent=r)}x(`tile-lcp`,`lcp`,_,zl(_)),x(`tile-fcp`,`fcp`,v,zl(v)),x(`tile-cls`,`cls`,y,Bl(y)),x(`tile-issues`,`none`,0,b);let S=document.getElementById(`tile-issues`);if(S){let e=u>0?`bad`:d>0?`warn`:`good`;S.className=`stat-tile ${e}`;let t=S.querySelector(`.stat-value`);t&&(t.className=`stat-value ${e}`)}let C=n(`ov-suggestions`);if(C){let e=l.slice(0,3);C.innerHTML=e.length?e.map(Su).join(``):`<div style="color:var(--text3);padding:12px;text-align:center;">No suggestions available</div>`}let w=n(`ov-routes`);if(w){let e=Object.entries(h);e.length===0?w.innerHTML=`<div style="color:var(--text3);padding:12px;text-align:center;">No runtime data available</div>`:w.innerHTML=`
|
|
36
|
+
<table class="rd-table">
|
|
37
|
+
<thead><tr>
|
|
38
|
+
<th>Route</th><th>Device</th><th>Score</th>
|
|
39
|
+
<th>LCP</th><th>FCP</th><th>CLS</th><th>Errors</th>
|
|
40
|
+
</tr></thead>
|
|
41
|
+
<tbody>${e.map(([e,t])=>{let[n,r]=e.split(`::`),i=t.performanceScore||0,a=jl(i),o=t.metrics||{},s=t.errors||[];return`<tr>
|
|
42
|
+
<td class="mono">${n||`/`}</td>
|
|
43
|
+
<td><span class="badge info">${r||`desktop`}</span></td>
|
|
44
|
+
<td class="score-cell" style="color:${a}">${i}</td>
|
|
45
|
+
<td>${zl(o.lcp||0)}</td>
|
|
46
|
+
<td>${zl(o.fcp||0)}</td>
|
|
47
|
+
<td><span class="badge ${Il(`cls`,o.cls||0)}">${Bl(o.cls||0)}</span></td>
|
|
48
|
+
<td>${s.length>0?`<span class="badge critical">${s.length}</span>`:`<span class="badge good">0</span>`}</td>
|
|
49
|
+
</tr>`}).join(``)}</tbody>
|
|
50
|
+
</table>`}}var Xl=!1,Zl=null;async function Ql(){if(Xl)return;Xl=!0;let e;try{e=ql(await Al.getLatestReport()),Zl=e,console.log(`๐ Vitals loaded:`,e)}catch(t){console.warn(`โ ๏ธ Using static fallback for vitals:`,t.message),e=$,Zl=e}let t=e.runtime||{},n=Object.entries(t);if(n.length===0){let e=document.getElementById(`vitals-tabs`);e&&(e.innerHTML=`<div style="color:var(--text3);padding:12px;">No runtime data available</div>`);return}let r=n.map(([e])=>e),i=r[0],a=document.getElementById(`vitals-tabs`);a&&(a.innerHTML=r.map((e,t)=>{let[n,r]=e.split(`::`);return`<button class="route-tab${t===0?` active`:``}" data-key="${e}">${n||`/`} <span style="opacity:.6">[${r||`desktop`}]</span></button>`}).join(``),a.querySelectorAll(`.route-tab`).forEach(e=>{e.addEventListener(`click`,()=>{a.querySelectorAll(`.route-tab`).forEach(e=>e.classList.remove(`active`)),e.classList.add(`active`),i=e.dataset.key,eu(i)})})),$l(n),eu(i)}function $l(e){let t=document.getElementById(`vitals-chart`);if(!t)return;let n=e.map(([e])=>{let[t,n]=e.split(`::`);return t||`/`}),r=[`lcp`,`fcp`,`ttfb`],i=[`#C778DD`,`#00FFC2`,`#58A6FF`],a=[`LCP (ms)`,`FCP (ms)`,`TTFB (ms)`];t._chart&&t._chart.destroy(),t._chart=new Oo(t,{type:`bar`,data:{labels:n,datasets:r.map((t,n)=>({label:a[n],data:e.map(([,e])=>e.metrics?.[t]||0),backgroundColor:i[n]+`33`,borderColor:i[n],borderWidth:1.5,borderRadius:4}))},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{labels:{color:`#8B949E`,font:{family:`Inter`,size:11}}}},scales:{x:{ticks:{color:`#6E7681`,font:{size:10}},grid:{color:`#21262D`}},y:{ticks:{color:`#6E7681`},grid:{color:`#21262D`}}}}})}function eu(e){let t=((Zl||$).runtime||{})[e];if(!t){let e=document.getElementById(`vitals-bars`);e&&(e.innerHTML=`<div style="color:var(--text3);padding:12px;">No data for this route</div>`);return}let n=t.metrics||{},r=document.getElementById(`vitals-bars`);r&&(r.innerHTML=[Wl(`Largest Contentful Paint (LCP)`,`lcp`,n.lcp||0),Wl(`First Contentful Paint (FCP)`,`fcp`,n.fcp||0),Wl(`Time to First Byte (TTFB)`,`ttfb`,n.ttfb||0),Wl(`Interaction to Next Paint (INP)`,`inp`,n.inp||0),Wl(`Cumulative Layout Shift (CLS)`,`cls`,n.cls||0),Wl(`Render Time (Total)`,`render`,t.renderTime||0)].join(``));let i=t.stats||{},a=document.getElementById(`vitals-meta`);a&&(a.innerHTML=`
|
|
51
|
+
<span class="badge info">${t.deviceType||`desktop`}</span>
|
|
52
|
+
<span style="color:var(--text3);font-size:.75rem">CPU ร${t.cpuThrottling||1}</span>
|
|
53
|
+
<span style="color:var(--text3);font-size:.75rem">${t.networkThrottle||`No throttle`}</span>
|
|
54
|
+
<span style="color:var(--teal);font-size:.75rem;font-weight:bold">โฑ Render ${zl(t.renderTime||0)}</span>
|
|
55
|
+
<span style="color:var(--text3);font-size:.75rem">${i.domNodes||0} DOM nodes</span>
|
|
56
|
+
<span style="color:var(--text3);font-size:.75rem">${i.jsHeapMB||`โ`} MB heap</span>`);let o=t.performanceScore||0,s=jl(o),c=document.getElementById(`vitals-score`);c&&(c.innerHTML=`<span style="font-family:'JetBrains Mono',monospace;font-size:1.6rem;font-weight:700;color:${s}">${o}</span>
|
|
57
|
+
<span style="color:var(--text3);font-size:.78rem">/ 100</span>`);let l=Object.entries(t.rerenders||{}).sort((e,t)=>t[1]-e[1]),u=document.getElementById(`vitals-rerenders`);u&&(u.innerHTML=l.length===0?`<div style="color:var(--text3);padding:8px 0">No re-render data available</div>`:`
|
|
58
|
+
<table class="rd-table">
|
|
59
|
+
<thead><tr><th>Component</th><th>Re-renders</th></tr></thead>
|
|
60
|
+
<tbody>${l.map(([e,t])=>`
|
|
61
|
+
<tr>
|
|
62
|
+
<td class="mono">${e}</td>
|
|
63
|
+
<td><span style="color:${t>10?`var(--red)`:t>5?`var(--orange)`:`var(--green)`};font-family:'JetBrains Mono',monospace;font-weight:600">${t}</span></td>
|
|
64
|
+
</tr>`).join(``)}
|
|
65
|
+
</tbody>
|
|
66
|
+
</table>`);let d=t.errors||[],f=document.getElementById(`vitals-errors`);f&&(f.innerHTML=d.length===0?`<div style="color:var(--text3);font-size:.82rem;padding:8px 0">โ
No JS errors or React warnings captured</div>`:d.map(e=>`
|
|
67
|
+
<div style="display:flex;gap:10px;align-items:flex-start;padding:8px 0;border-bottom:1px solid var(--border)">
|
|
68
|
+
<span class="badge ${e.type===`error`?`critical`:`warning`}">${e.type||`warning`}</span>
|
|
69
|
+
<span style="font-size:.78rem;font-family:'JetBrains Mono',monospace;color:var(--text2);word-break:break-word">${e.message}</span>
|
|
70
|
+
</div>`).join(``)),Cu(`vitals-filmstrip`,t.screenshots||[],e)}var tu=8,nu=`all`,ru=1,iu=!1,au=[];async function ou(){if(iu)return;iu=!0;try{au=ql(await Al.getLatestReport()).static?.issues||[],console.log(`๐ Issues loaded:`,au.length)}catch(e){console.warn(`โ ๏ธ Using static fallback for issues:`,e.message),au=$.static?.issues||[]}let e=document.querySelectorAll(`#issues-filters .filter-btn`);e.forEach(t=>{t.addEventListener(`click`,()=>{e.forEach(e=>e.classList.remove(`active`)),t.classList.add(`active`),nu=t.dataset.filter,ru=1,su()})}),su()}function su(){let e=au,t=nu===`all`?e:e.filter(e=>e.severity===nu),n=Math.ceil(t.length/tu)||1,r=t.slice((ru-1)*tu,ru*tu),i=document.getElementById(`issues-table`);if(!i)return;e.length===0?i.innerHTML=`<div style="color:var(--text3);padding:12px;text-align:center;">No issues found</div>`:i.innerHTML=`
|
|
71
|
+
<table class="rd-table">
|
|
72
|
+
<thead><tr>
|
|
73
|
+
<th>Severity</th>
|
|
74
|
+
<th>Component</th>
|
|
75
|
+
<th>File</th>
|
|
76
|
+
<th>Line</th>
|
|
77
|
+
<th>Issue</th>
|
|
78
|
+
<th>Fix</th>
|
|
79
|
+
</tr></thead>
|
|
80
|
+
<tbody>${r.map(e=>`
|
|
81
|
+
<tr>
|
|
82
|
+
<td>${Pl(e.severity)}</td>
|
|
83
|
+
<td class="mono">${e.component||`โ`}</td>
|
|
84
|
+
<td class="file">${e.file||`โ`}</td>
|
|
85
|
+
<td class="mono" style="color:var(--text3)">${e.line||`โ`}</td>
|
|
86
|
+
<td style="color:var(--text);font-size:.8rem">${e.message}</td>
|
|
87
|
+
<td style="font-size:.76rem;color:var(--text2)">${e.suggestion||`โ`}</td>
|
|
88
|
+
</tr>`).join(``)}
|
|
89
|
+
</tbody>
|
|
90
|
+
</table>`;let a={all:e.length};[`critical`,`warning`,`info`].forEach(t=>a[t]=e.filter(e=>e.severity===t).length),document.querySelectorAll(`#issues-filters .filter-btn`).forEach(e=>{let t=e.dataset.filter,n=e.querySelector(`.nav-badge`);n||(n=document.createElement(`span`),n.className=`nav-badge`,e.appendChild(n)),n.textContent=a[t]||0}),wu(`issues-pagination`,ru,n,e=>{ru=e,su()})}var cu=`all`,lu=1,uu=!1,du=5,fu=[];async function pu(){if(!uu){uu=!0;try{fu=ql(await Al.getLatestReport()).suggestions||[],console.log(`๐ Suggestions loaded:`,fu.length)}catch(e){console.warn(`โ ๏ธ Using static fallback for suggestions:`,e.message),fu=$.suggestions||[]}document.querySelectorAll(`#sug-filters .filter-btn`).forEach(e=>{e.addEventListener(`click`,()=>{document.querySelectorAll(`#sug-filters .filter-btn`).forEach(e=>e.classList.remove(`active`)),e.classList.add(`active`),cu=e.dataset.filter,lu=1,mu()})}),mu()}}function mu(){let e=fu,t=cu===`all`?e:e.filter(e=>e.severity===cu),n=Math.ceil(t.length/du)||1,r=t.slice((lu-1)*du,lu*du),i=document.getElementById(`sug-list`);if(!i)return;e.length===0?i.innerHTML=`<div style="color:var(--text3);padding:12px;text-align:center;">No suggestions available</div>`:i.innerHTML=r.map(Su).join(``),wu(`sug-pagination`,lu,n,e=>{lu=e,mu()});let a={};[`critical`,`warning`,`info`].forEach(t=>a[t]=e.filter(e=>e.severity===t).length);let o=document.getElementById(`sug-counts`);o&&(o.innerHTML=`<span class="badge critical">๐ด ${a.critical||0} critical</span>
|
|
91
|
+
<span class="badge warning">๐ ${a.warning||0} warnings</span>
|
|
92
|
+
<span class="badge info">๐ต ${a.info||0} info</span>`)}var hu=6,gu=1,_u=!1,vu=[];async function yu(){if(!_u){_u=!0;try{vu=(await Al.listReports()).reports||[],console.log(`๐ History loaded:`,vu.length)}catch(e){console.warn(`โ ๏ธ Using static fallback for history:`,e.message),vu=kl}bu(),xu()}}function bu(){let e=Math.ceil(vu.length/hu)||1,t=vu.slice((gu-1)*hu,gu*hu),n=document.getElementById(`hist-table`);n&&(vu.length===0?n.innerHTML=`<div style="color:var(--text3);padding:12px;text-align:center;">No history available</div>`:n.innerHTML=`
|
|
93
|
+
<table class="rd-table">
|
|
94
|
+
<thead><tr>
|
|
95
|
+
<th>#</th><th>Project</th><th>Score</th><th>Grade</th>
|
|
96
|
+
<th>Analyzed</th><th>Saved</th>
|
|
97
|
+
</tr></thead>
|
|
98
|
+
<tbody>${t.map(e=>{let t=jl(e.score),n=Ml(e.grade);return`<tr style="cursor:pointer" onclick="alert('Open report #${e.id}')">
|
|
99
|
+
<td class="mono" style="color:var(--text3)">${e.id}</td>
|
|
100
|
+
<td><span class="mono">${e.project}</span></td>
|
|
101
|
+
<td class="score-cell" style="color:${t}">${e.score}</td>
|
|
102
|
+
<td><span class="badge ${n}">${e.grade}</span></td>
|
|
103
|
+
<td style="font-size:.78rem">${Vl(e.analyzed_at)}</td>
|
|
104
|
+
<td style="font-size:.75rem;color:var(--text3)">${Hl(e.created_at)}</td>
|
|
105
|
+
</tr>`}).join(``)}</tbody>
|
|
106
|
+
</table>`,wu(`hist-pagination`,gu,e,e=>{gu=e,bu()}))}function xu(){let e=document.getElementById(`hist-chart`);if(!e||vu.length===0)return;let t=vu[0]?.project||`Unknown Project`,n=document.querySelector(`#page-history .card:first-child .card-title`);n&&(n.textContent=`Score Trend โ ${t}`);let r=vu.filter(e=>e.project===t).reverse();r.length!==0&&(e._chart&&e._chart.destroy(),e._chart=new Oo(e,{type:`line`,data:{labels:r.map(e=>Vl(e.analyzed_at).split(` `)[0]),datasets:[{label:`Performance Score`,data:r.map(e=>e.score),borderColor:`#C778DD`,backgroundColor:`rgba(199,120,221,0.08)`,borderWidth:2,pointBackgroundColor:`#C778DD`,pointRadius:4,fill:!0,tension:.4}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{labels:{color:`#8B949E`,font:{size:11}}}},scales:{x:{ticks:{color:`#6E7681`,font:{size:10}},grid:{color:`#21262D`}},y:{min:0,max:100,ticks:{color:`#6E7681`},grid:{color:`#21262D`}}}}}))}function Su(e){let t={critical:`๐ด`,warning:`๐ `,info:`๐ต`}[e.severity]||`โช`;return`
|
|
107
|
+
<div class="suggestion-card">
|
|
108
|
+
<div class="sug-icon ${e.severity}">${t}</div>
|
|
109
|
+
<div class="sug-body">
|
|
110
|
+
<div class="sug-title">
|
|
111
|
+
${e.title||`Untitled suggestion`}
|
|
112
|
+
<span class="badge ${e.severity}">${e.severity}</span>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="sug-desc">${e.description||`No description`}</div>
|
|
115
|
+
<div class="sug-fix">${e.fix||`No fix provided`}</div>
|
|
116
|
+
${e.affectedComponent?`<div class="sug-component">${e.affectedComponent}</div>`:``}
|
|
117
|
+
</div>
|
|
118
|
+
</div>`}function Cu(e,t,n){let r=document.getElementById(e);if(!r)return;if(r.innerHTML=``,!t||t.length===0){r.innerHTML=`<div class="film-placeholder"><span>๐ธ No screenshots<br>captured</span></div>`;return}let i=t.filter(e=>!(!e.dataUrl||e.dataUrl.startsWith(`__PENDING__`)||e.dataUrl===`null`||e.dataUrl===`undefined`)),a=new Set,o=i.filter(e=>{let t=e.label||`screenshot`;return a.has(t)?!1:(a.add(t),!0)});if(o.length===0){r.innerHTML=`<div class="film-placeholder"><span>๐ธ No valid screenshots<br>available</span></div>`;return}o.forEach((e,t)=>{let i=document.createElement(`div`);i.className=`film-frame`;let a=document.createElement(`img`);a.className=`film-img`;let o=e.label||`screenshot-${t}`,s=e.takenAt||0;if(e.dataUrl&&e.dataUrl.startsWith(`data:image`))a.src=e.dataUrl,a.alt=`${o} screenshot`;else if(e.dataUrl&&e.dataUrl.startsWith(`http`))a.src=e.dataUrl,a.alt=`${o} screenshot`;else if(e.dataUrl&&e.dataUrl.startsWith(`/screenshots/`))a.src=e.dataUrl,a.alt=`${o} screenshot`;else{let e=`${o} ${zl(s)}`;a.src=`https://placehold.co/420x256/1C2333/8B949E?text=${encodeURIComponent(e)}`,a.alt=`${o} (placeholder)`}a.addEventListener(`click`,()=>{e.dataUrl&&(e.dataUrl.startsWith(`data:image`)||e.dataUrl.startsWith(`http`)||e.dataUrl.startsWith(`/screenshots/`))?Gl(e.dataUrl.startsWith(`/screenshots/`)?window.location.origin+e.dataUrl:e.dataUrl,`${n} โ ${o} @ ${zl(s)}`):alert(`๐ธ ${o}\nโฑ Taken at: ${zl(s)}\n\n(Image not available)`)});let c=document.createElement(`div`);c.className=`film-label`,c.textContent=o;let l=document.createElement(`div`);l.className=`film-time`,l.textContent=zl(s),i.append(a,c,l),r.appendChild(i)})}function wu(e,t,n,r){let i=document.getElementById(e);if(!i||n<=1){i&&(i.innerHTML=``);return}let a=document.createElement(`div`);a.className=`pagination`;function o(e,t,n,i){let a=document.createElement(`button`);return a.className=`page-btn`+(i?` active`:``),a.textContent=e,n?a.disabled=!0:a.addEventListener(`click`,()=>r(t)),a}a.appendChild(o(`Prev`,t-1,t===1,!1));for(let e=1;e<=n;e++){if(n>7&&Math.abs(e-t)>2&&e!==1&&e!==n){if(e===2||e===n-1){let e=document.createElement(`span`);e.className=`page-info`,e.textContent=`โฆ`,a.appendChild(e)}continue}a.appendChild(o(String(e),e,!1,e===t))}a.appendChild(o(`Next`,t+1,t===n,!1));let s=document.createElement(`span`);s.className=`page-info`,s.textContent=`${t} / ${n}`,a.appendChild(s),i.innerHTML=``,i.appendChild(a)}var Tu={overview:{id:`page-overview`,init:Yl},vitals:{id:`page-vitals`,init:Ql},issues:{id:`page-issues`,init:ou},suggestions:{id:`page-suggestions`,init:pu},history:{id:`page-history`,init:yu}},Eu=null;async function Du(e){let t=Tu[e]||Tu.overview;if(Eu===e)return;Eu=e,document.querySelectorAll(`.page-content`).forEach(e=>e.classList.remove(`active`));let n=document.getElementById(t.id);n&&n.classList.add(`active`),document.querySelectorAll(`.nav-item`).forEach(t=>{t.classList.toggle(`active`,t.dataset.route===e)});let r={overview:[`Overview`,`Performance summary`],vitals:[`Web Vitals`,`Core Web Vitals per route & device`],issues:[`Code Issues`,`Static analysis results`],suggestions:[`Suggestions`,`Rule engine recommendations`],history:[`History`,`Previous analysis runs`]},[i,a]=r[e]||r.overview;document.getElementById(`topbar-title`).textContent=i,document.getElementById(`topbar-sub`).textContent=a;try{await t.init()}catch(e){console.error(`Error initializing page:`,e)}}function Ou(){document.querySelectorAll(`.nav-item[data-route]`).forEach(e=>{e.addEventListener(`click`,()=>{window.location.hash=e.dataset.route})}),window.addEventListener(`hashchange`,()=>{Du(location.hash.replace(`#`,``)||`overview`)}),document.getElementById(`lightbox`).addEventListener(`click`,e=>{e.target===e.currentTarget&&Kl()}),document.getElementById(`lb-close`).addEventListener(`click`,Kl),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&Kl()}),Du(location.hash.replace(`#`,``)||`overview`)}Oo.register(...Ol);async function ku(){try{let e=await Al.getLatestReport();document.getElementById(`nav-score`).textContent=e.performanceScore,document.getElementById(`nav-issues-count`).textContent=e.static.issues.length,document.getElementById(`nav-sug-count`).textContent=e.suggestions.length,document.getElementById(`sidebar-project`).textContent=e.project,document.getElementById(`sidebar-date`).textContent=Vl(e.analyzedAt);let{reports:t}=await Al.listReports();document.getElementById(`nav-hist-count`).textContent=t.length}catch(e){console.warn(`โ ๏ธ Using static fallback data for sidebar:`,e.message),document.getElementById(`nav-score`).textContent=$.performanceScore,document.getElementById(`nav-issues-count`).textContent=$.static.issues.length,document.getElementById(`nav-sug-count`).textContent=$.suggestions.length,document.getElementById(`nav-hist-count`).textContent=kl.length,document.getElementById(`sidebar-project`).textContent=$.projectName,document.getElementById(`sidebar-date`).textContent=Vl($.analyzedAt)}}function Au(){document.getElementById(`topbar-time`).textContent=new Date().toLocaleTimeString(`en-GB`)}Au(),setInterval(Au,1e3),ku().then(()=>{Ou()});
|