mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-07-24 05:56:59 +00:00
20 lines
197 KiB
JavaScript
20 lines
197 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/peerShareLinkModal-qnsW_7dL.js","assets/index-ChIZkWnM.js","assets/index-C1jOb5RQ.css","assets/dayjs.min-nlYZplm6.js","assets/vue-datepicker-BqiBEeSB.js","assets/localeText-B2YJV6FD.js","assets/peerShareLinkModal-B5PnDn1q.css","assets/peerJobs-BOyF_5dv.js","assets/schedulePeerJob-DSwY3UVZ.js","assets/schedulePeerJob--V7cpve7.css","assets/peerJobs-voXURBEt.css","assets/peerQRCode-DUJVvuUn.js","assets/browser-CjSdxGTc.js","assets/peerConfigurationFile-04r_7ZIU.js","assets/peerConfigurationFile-Dma_bQR7.css","assets/peerSettings-B_tOmYh0.js","assets/peerSettings-DCod994Y.css","assets/peerSearchBar-DGGMYA9w.js","assets/peerSearchBar-5knTmb8D.css","assets/peerJobsAllModal-CfdUcdt8.js","assets/peerJobsLogsModal-mgEtYGm3.js","assets/editConfiguration-BUCsBeAe.js","assets/editConfiguration-C_hKRy6y.css","assets/selectPeers-BJjPrLQo.js","assets/selectPeers-Wjnh8YUZ.css","assets/peerAddModal-BZ0JlLvf.js","assets/bulkAdd-BnWpvCv1.js","assets/bulkAdd-Cbr1ZA0z.css"])))=>i.map(i=>d[i]);
|
|
import{J as un,K as fn,L as bi,M as fo,r as K,o as Di,N as go,H as be,O as _i,P as po,Q as gn,D as ei,s as Ti,p as It,a as D,c as I,b,d as T,A as G,t as B,e as H,g as Gt,_ as Pe,W as pn,G as pt,z as ue,F as Xt,h as xi,j as _e,R as mo,U as bo,n as St,w as Et,T as Ai,f as $t,i as $,k as yi,V as rt,X as at,Y as _o,m as xo,v as yo,S as vo,Z as wo}from"./index-ChIZkWnM.js";import{_ as So}from"./protocolBadge-Bh2EvhJg.js";import{L as j}from"./localeText-B2YJV6FD.js";import{d as ko}from"./dayjs.min-nlYZplm6.js";/*!
|
|
* @kurkle/color v0.3.2
|
|
* https://github.com/kurkle/color#readme
|
|
* (c) 2023 Jukka Kurkela
|
|
* Released under the MIT License
|
|
*/function Ce(i){return i+.5|0}const vt=(i,t,e)=>Math.max(Math.min(i,e),t);function le(i){return vt(Ce(i*2.55),0,255)}function kt(i){return vt(Ce(i*255),0,255)}function xt(i){return vt(Ce(i/2.55)/100,0,1)}function Ki(i){return vt(Ce(i*100),0,100)}const it={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},vi=[..."0123456789ABCDEF"],Mo=i=>vi[i&15],Po=i=>vi[(i&240)>>4]+vi[i&15],Le=i=>(i&240)>>4===(i&15),Co=i=>Le(i.r)&&Le(i.g)&&Le(i.b)&&Le(i.a);function Oo(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&it[i[1]]*17,g:255&it[i[2]]*17,b:255&it[i[3]]*17,a:t===5?it[i[4]]*17:255}:(t===7||t===9)&&(e={r:it[i[1]]<<4|it[i[2]],g:it[i[3]]<<4|it[i[4]],b:it[i[5]]<<4|it[i[6]],a:t===9?it[i[7]]<<4|it[i[8]]:255})),e}const Do=(i,t)=>i<255?t(i):"";function To(i){var t=Co(i)?Mo:Po;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Do(i.a,t):void 0}const Ao=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function mn(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function Lo(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function Ro(i,t,e){const s=mn(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function Io(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function Li(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=Io(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Ri(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(kt)}function Ii(i,t,e){return Ri(mn,i,t,e)}function Eo(i,t,e){return Ri(Ro,i,t,e)}function Fo(i,t,e){return Ri(Lo,i,t,e)}function bn(i){return(i%360+360)%360}function zo(i){const t=Ao.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?le(+t[5]):kt(+t[5]));const n=bn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Eo(n,o,r):t[1]==="hsv"?s=Fo(n,o,r):s=Ii(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function Bo(i,t){var e=Li(i);e[0]=bn(e[0]+t),e=Ii(e),i.r=e[0],i.g=e[1],i.b=e[2]}function $o(i){if(!i)return;const t=Li(i),e=t[0],s=Ki(t[1]),n=Ki(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${xt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const qi={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"},Gi={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 Ho(){const i={},t=Object.keys(Gi),e=Object.keys(qi);let s,n,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],n=0;n<e.length;n++)o=e[n],a=a.replace(o,qi[o]);o=parseInt(Gi[r],16),i[a]=[o>>16&255,o>>8&255,o&255]}return i}let Re;function No(i){Re||(Re=Ho(),Re.transparent=[0,0,0,0]);const t=Re[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Wo=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Vo(i){const t=Wo.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?le(r):vt(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?le(s):vt(s,0,255)),n=255&(t[4]?le(n):vt(n,0,255)),o=255&(t[6]?le(o):vt(o,0,255)),{r:s,g:n,b:o,a:e}}}function jo(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${xt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const oi=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Ut=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Uo(i,t,e){const s=Ut(xt(i.r)),n=Ut(xt(i.g)),o=Ut(xt(i.b));return{r:kt(oi(s+e*(Ut(xt(t.r))-s))),g:kt(oi(n+e*(Ut(xt(t.g))-n))),b:kt(oi(o+e*(Ut(xt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Ie(i,t,e){if(i){let s=Li(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ii(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function _n(i,t){return i&&Object.assign(t||{},i)}function Ji(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=kt(i[3]))):(t=_n(i,{r:0,g:0,b:0,a:1}),t.a=kt(t.a)),t}function Yo(i){return i.charAt(0)==="r"?Vo(i):zo(i)}class xe{constructor(t){if(t instanceof xe)return t;const e=typeof t;let s;e==="object"?s=Ji(t):e==="string"&&(s=Oo(t)||No(t)||Yo(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=_n(this._rgb);return t&&(t.a=xt(t.a)),t}set rgb(t){this._rgb=Ji(t)}rgbString(){return this._valid?jo(this._rgb):void 0}hexString(){return this._valid?To(this._rgb):void 0}hslString(){return this._valid?$o(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Uo(this._rgb,t._rgb,e)),this}clone(){return new xe(this.rgb)}alpha(t){return this._rgb.a=kt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Ce(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ie(this._rgb,2,t),this}darken(t){return Ie(this._rgb,2,-t),this}saturate(t){return Ie(this._rgb,1,t),this}desaturate(t){return Ie(this._rgb,1,-t),this}rotate(t){return Bo(this._rgb,t),this}}/*!
|
|
* Chart.js v4.4.4
|
|
* https://www.chartjs.org
|
|
* (c) 2024 Chart.js Contributors
|
|
* Released under the MIT License
|
|
*/function mt(){}const Xo=(()=>{let i=0;return()=>i++})();function F(i){return i===null||typeof i>"u"}function V(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function R(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function nt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function ht(i,t){return nt(i)?i:t}function L(i,t){return typeof i>"u"?t:i}const Ko=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function z(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function E(i,t,e,s){let n,o,r;if(V(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(R(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function qe(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function Ge(i){if(V(i))return i.map(Ge);if(R(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=Ge(i[e[n]]);return t}return i}function xn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function qo(i,t,e,s){if(!xn(i))return;const n=t[i],o=e[i];R(n)&&R(o)?ye(n,o,s):t[i]=Ge(o)}function ye(i,t,e){const s=V(t)?t:[t],n=s.length;if(!R(i))return i;e=e||{};const o=e.merger||qo;let r;for(let a=0;a<n;++a){if(r=s[a],!R(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],i,r,e)}return i}function fe(i,t){return ye(i,t,{merger:Go})}function Go(i,t,e){if(!xn(i))return;const s=t[i],n=e[i];R(s)&&R(n)?fe(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=Ge(n))}const Qi={"":i=>i,x:i=>i.x,y:i=>i.y};function Jo(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function Qo(i){const t=Jo(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Jt(i,t){return(Qi[t]||(Qi[t]=Qo(t)))(i)}function Ei(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ve=i=>typeof i<"u",Mt=i=>typeof i=="function",Zi=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Zo(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const U=Math.PI,ft=2*U,tr=ft+U,Je=Number.POSITIVE_INFINITY,er=U/180,lt=U/2,Dt=U/4,ts=U*2/3,wi=Math.log10,gt=Math.sign;function ge(i,t,e){return Math.abs(i-t)<e}function es(i){const t=Math.round(i);i=ge(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(wi(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function ir(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s===0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function we(i){return!isNaN(parseFloat(i))&&isFinite(i)}function sr(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function nr(i,t,e){let s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Ft(i){return i*(U/180)}function or(i){return i*(180/U)}function is(i){if(!nt(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function rr(i,t){const e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);let o=Math.atan2(s,e);return o<-.5*U&&(o+=ft),{angle:o,distance:n}}function Si(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function ar(i,t){return(i-t+tr)%ft-U}function yt(i){return(i%ft+ft)%ft}function yn(i,t,e,s){const n=yt(i),o=yt(t),r=yt(e),a=yt(o-n),l=yt(r-n),c=yt(n-o),h=yt(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function tt(i,t,e){return Math.max(t,Math.min(e,i))}function lr(i){return tt(i,-32768,32767)}function zt(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Fi(i,t,e){e=e||(r=>i[r]<t);let s=i.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const Bt=(i,t,e,s)=>Fi(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),cr=(i,t,e)=>Fi(i,e,s=>i[s][t]>=e);function hr(i,t,e){let s=0,n=i.length;for(;s<n&&i[s]<t;)s++;for(;n>s&&i[n-1]>e;)n--;return s>0||n<i.length?i.slice(s,n):i}const vn=["push","pop","shift","splice","unshift"];function dr(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),vn.forEach(e=>{const s="_onData"+Ei(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function ss(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(vn.forEach(o=>{delete i[o]}),delete i._chartjs)}function wn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Sn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function kn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Sn.call(window,()=>{s=!1,i.apply(t,e)}))}}function ur(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const zi=i=>i==="start"?"left":i==="end"?"right":"center",X=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,fr=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function gr(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(n=tt(Math.min(Bt(a,l,c).lo,e?s:Bt(t,l,r.getPixelForValue(c)).lo),0,s-1)),d?o=tt(Math.max(Bt(a,r.axis,h,!0).hi+1,e?0:Bt(t,l,r.getPixelForValue(h),!0).hi+1),n,s)-n:o=s-n}return{start:n,count:o}}function pr(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const Ee=i=>i===0||i===1,ns=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*ft/e)),os=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*ft/e)+1,pe={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*lt)+1,easeOutSine:i=>Math.sin(i*lt),easeInOutSine:i=>-.5*(Math.cos(U*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Ee(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Ee(i)?i:ns(i,.075,.3),easeOutElastic:i=>Ee(i)?i:os(i,.075,.3),easeInOutElastic(i){return Ee(i)?i:i<.5?.5*ns(i*2,.1125,.45):.5+.5*os(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-pe.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?pe.easeInBounce(i*2)*.5:pe.easeOutBounce(i*2-1)*.5+.5};function Bi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function rs(i){return Bi(i)?i:new xe(i)}function ri(i){return Bi(i)?i:new xe(i).saturate(.5).darken(.1).hexString()}const mr=["x","y","borderWidth","radius","tension"],br=["color","borderColor","backgroundColor"];function _r(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:br},numbers:{type:"number",properties:mr}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function xr(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const as=new Map;function yr(i,t){t=t||{};const e=i+JSON.stringify(t);let s=as.get(e);return s||(s=new Intl.NumberFormat(i,t),as.set(e,s)),s}function Mn(i,t,e){return yr(t,e).format(i)}const Pn={values(i){return V(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=vr(i,e)}const r=wi(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Mn(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(wi(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?Pn.numeric.call(this,i,t,e):""}};function vr(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Cn={formatters:Pn};function wr(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Cn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Nt=Object.create(null),ki=Object.create(null);function me(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;s<n;++s){const o=e[s];i=i[o]||(i[o]=Object.create(null))}return i}function ai(i,t,e){return typeof t=="string"?ye(me(i,t),e):ye(me(i,""),t)}class Sr{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>ri(n.backgroundColor),this.hoverBorderColor=(s,n)=>ri(n.borderColor),this.hoverColor=(s,n)=>ri(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ai(this,t,e)}get(t){return me(this,t)}describe(t,e){return ai(ki,t,e)}override(t,e){return ai(Nt,t,e)}route(t,e,s,n){const o=me(this,t),r=me(this,s),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[n];return R(l)?Object.assign({},c,l):L(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var W=new Sr({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[_r,xr,wr]);function kr(i){return!i||F(i.size)||F(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function ls(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function Tt(i,t,e){const s=i.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*s)/s+n}function cs(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Mi(i,t,e,s){On(i,t,e,s,null)}function On(i,t,e,s,n){let o,r,a,l,c,h,u,d;const f=t.pointStyle,g=t.rotation,m=t.radius;let p=(g||0)*er;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(p),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(m)||m<=0)){switch(i.beginPath(),f){default:n?i.ellipse(e,s,n/2,m,0,0,ft):i.arc(e,s,m,0,ft),i.closePath();break;case"triangle":h=n?n/2:m,i.moveTo(e+Math.sin(p)*h,s-Math.cos(p)*m),p+=ts,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*m),p+=ts,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*m),i.closePath();break;case"rectRounded":c=m*.516,l=m-c,r=Math.cos(p+Dt)*l,u=Math.cos(p+Dt)*(n?n/2-c:l),a=Math.sin(p+Dt)*l,d=Math.sin(p+Dt)*(n?n/2-c:l),i.arc(e-u,s-a,c,p-U,p-lt),i.arc(e+d,s-r,c,p-lt,p),i.arc(e+u,s+a,c,p,p+lt),i.arc(e-d,s+r,c,p+lt,p+U),i.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*m,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}p+=Dt;case"rectRot":u=Math.cos(p)*(n?n/2:m),r=Math.cos(p)*m,a=Math.sin(p)*m,d=Math.sin(p)*(n?n/2:m),i.moveTo(e-u,s-a),i.lineTo(e+d,s-r),i.lineTo(e+u,s+a),i.lineTo(e-d,s+r),i.closePath();break;case"crossRot":p+=Dt;case"cross":u=Math.cos(p)*(n?n/2:m),r=Math.cos(p)*m,a=Math.sin(p)*m,d=Math.sin(p)*(n?n/2:m),i.moveTo(e-u,s-a),i.lineTo(e+u,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r);break;case"star":u=Math.cos(p)*(n?n/2:m),r=Math.cos(p)*m,a=Math.sin(p)*m,d=Math.sin(p)*(n?n/2:m),i.moveTo(e-u,s-a),i.lineTo(e+u,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r),p+=Dt,u=Math.cos(p)*(n?n/2:m),r=Math.cos(p)*m,a=Math.sin(p)*m,d=Math.sin(p)*(n?n/2:m),i.moveTo(e-u,s-a),i.lineTo(e+u,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r);break;case"line":r=n?n/2:Math.cos(p)*m,a=Math.sin(p)*m,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(p)*(n?n/2:m),s+Math.sin(p)*m);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function Se(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function $i(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Hi(i){i.restore()}function Mr(i,t,e,s,n){if(!t)return i.lineTo(e.x,e.y);if(n==="middle"){const o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else n==="after"!=!!s?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function Pr(i,t,e,s){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?e.cp2x:e.cp1x,s?e.cp2y:e.cp1y,e.x,e.y)}function Cr(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),F(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function Or(i,t,e,s,n){if(n.strikethrough||n.underline){const o=i.measureText(s),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=n.decorationWidth||2,i.moveTo(r,h),i.lineTo(a,h),i.stroke()}}function Dr(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function ke(i,t,e,s,n,o={}){const r=V(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,Cr(i,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Dr(i,o.backdrop),a&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),F(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,s,o.maxWidth)),i.fillText(c,e,s,o.maxWidth),Or(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function Qe(i,t){const{x:e,y:s,w:n,h:o,radius:r}=t;i.arc(e+r.topLeft,s+r.topLeft,r.topLeft,1.5*U,U,!0),i.lineTo(e,s+o-r.bottomLeft),i.arc(e+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,U,lt,!0),i.lineTo(e+n-r.bottomRight,s+o),i.arc(e+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,lt,0,!0),i.lineTo(e+n,s+r.topRight),i.arc(e+n-r.topRight,s+r.topRight,r.topRight,0,-lt,!0),i.lineTo(e+r.topLeft,s)}const Tr=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Ar=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Lr(i,t){const e=(""+i).match(Tr);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}const Rr=i=>+i||0;function Dn(i,t){const e={},s=R(t),n=s?Object.keys(t):t,o=R(i)?s?r=>L(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=Rr(o(r));return e}function Tn(i){return Dn(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Kt(i){return Dn(i,["topLeft","topRight","bottomLeft","bottomRight"])}function ot(i){const t=Tn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function q(i,t){i=i||{},t=t||W.font;let e=L(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=L(i.style,t.style);s&&!(""+s).match(Ar)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:L(i.family,t.family),lineHeight:Lr(L(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:L(i.weight,t.weight),string:""};return n.string=kr(n),n}function Fe(i,t,e,s){let n,o,r;for(n=0,o=i.length;n<o;++n)if(r=i[n],r!==void 0&&r!==void 0)return r}function Ir(i,t,e){const{min:s,max:n}=i,o=Ko(t,(n-s)/2),r=(a,l)=>e&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function Wt(i,t){return Object.assign(Object.create(i),t)}function Ni(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=In("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>Ni([a,...i],t,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Ln(a,l,()=>Wr(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return ds(a).includes(l)},ownKeys(a){return ds(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function Qt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:An(i,s),setContext:o=>Qt(i,o,e,s),override:o=>Qt(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Ln(o,r,()=>Fr(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function An(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:Mt(e)?e:()=>e,isIndexable:Mt(s)?s:()=>s}}const Er=(i,t)=>i?i+Ei(t):t,Wi=(i,t)=>R(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ln(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function Fr(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return Mt(a)&&r.isScriptable(t)&&(a=zr(t,a,i,e)),V(a)&&a.length&&(a=Br(t,a,i,r.isIndexable)),Wi(t,a)&&(a=Qt(a,n,o&&o[t],r)),a}function zr(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||s);return a.delete(i),Wi(i,l)&&(l=Vi(n._scopes,n,i,l)),l}function Br(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(R(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const u=Vi(c,n,i,h);t.push(Qt(u,o,r&&r[i],a))}}return t}function Rn(i,t,e){return Mt(i)?i(t,e):i}const $r=(i,t)=>i===!0?t:typeof i=="string"?Jt(t,i):void 0;function Hr(i,t,e,s,n){for(const o of t){const r=$r(e,o);if(r){i.add(r);const a=Rn(r._fallback,e,n);if(typeof a<"u"&&a!==e&&a!==s)return a}else if(r===!1&&typeof s<"u"&&e!==s)return null}return!1}function Vi(i,t,e,s){const n=t._rootScopes,o=Rn(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=hs(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=hs(a,r,o,l,s),l===null)?!1:Ni(Array.from(a),[""],n,o,()=>Nr(t,e,s))}function hs(i,t,e,s,n){for(;e;)e=Hr(i,t,e,s,n);return e}function Nr(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return V(n)&&R(e)?e:n||{}}function Wr(i,t,e,s){let n;for(const o of t)if(n=In(Er(o,i),e),typeof n<"u")return Wi(i,n)?Vi(e,s,i,n):n}function In(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function ds(i){let t=i._keys;return t||(t=i._keys=Vr(i._scopes)),t}function Vr(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const jr=Number.EPSILON||1e-14,Zt=(i,t)=>t<i.length&&!i[t].skip&&i[t],En=i=>i==="x"?"y":"x";function Ur(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=Si(o,n),l=Si(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const u=s*c,d=s*h;return{previous:{x:o.x-u*(r.x-n.x),y:o.y-u*(r.y-n.y)},next:{x:o.x+d*(r.x-n.x),y:o.y+d*(r.y-n.y)}}}function Yr(i,t,e){const s=i.length;let n,o,r,a,l,c=Zt(i,0);for(let h=0;h<s-1;++h)if(l=c,c=Zt(i,h+1),!(!l||!c)){if(ge(t[h],0,jr)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],a=Math.pow(n,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),e[h]=n*r*t[h],e[h+1]=o*r*t[h])}}function Xr(i,t,e="x"){const s=En(e),n=i.length;let o,r,a,l=Zt(i,0);for(let c=0;c<n;++c){if(r=a,a=l,l=Zt(i,c+1),!a)continue;const h=a[e],u=a[s];r&&(o=(h-r[e])/3,a[`cp1${e}`]=h-o,a[`cp1${s}`]=u-o*t[c]),l&&(o=(l[e]-h)/3,a[`cp2${e}`]=h+o,a[`cp2${s}`]=u+o*t[c])}}function Kr(i,t="x"){const e=En(t),s=i.length,n=Array(s).fill(0),o=Array(s);let r,a,l,c=Zt(i,0);for(r=0;r<s;++r)if(a=l,l=c,c=Zt(i,r+1),!!l){if(c){const h=c[t]-l[t];n[r]=h!==0?(c[e]-l[e])/h:0}o[r]=a?c?gt(n[r-1])!==gt(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}Yr(i,n,o),Xr(i,o,t)}function ze(i,t,e){return Math.max(Math.min(i,e),t)}function qr(i,t){let e,s,n,o,r,a=Se(i[0],t);for(e=0,s=i.length;e<s;++e)r=o,o=a,a=e<s-1&&Se(i[e+1],t),o&&(n=i[e],r&&(n.cp1x=ze(n.cp1x,t.left,t.right),n.cp1y=ze(n.cp1y,t.top,t.bottom)),a&&(n.cp2x=ze(n.cp2x,t.left,t.right),n.cp2y=ze(n.cp2y,t.top,t.bottom)))}function Gr(i,t,e,s,n){let o,r,a,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Kr(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,r=i.length;o<r;++o)a=i[o],l=Ur(c,a,i[Math.min(o+1,r-(s?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&qr(i,e)}function ji(){return typeof window<"u"&&typeof document<"u"}function Ui(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ze(i,t,e){let s;return typeof i=="string"?(s=parseInt(i,10),i.indexOf("%")!==-1&&(s=s/100*t.parentNode[e])):s=i,s}const ii=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function Jr(i,t){return ii(i).getPropertyValue(t)}const Qr=["top","right","bottom","left"];function Ht(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Qr[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Zr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function ta(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(Zr(n,o,i.target))a=n,l=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Lt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=ii(e),o=n.boxSizing==="border-box",r=Ht(n,"padding"),a=Ht(n,"border","width"),{x:l,y:c,box:h}=ta(i,e),u=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-u)/f*e.width/s),y:Math.round((c-d)/g*e.height/s)}}function ea(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&Ui(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=ii(o),l=Ht(a,"border","width"),c=Ht(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=Ze(a.maxWidth,o,"clientWidth"),n=Ze(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||Je,maxHeight:n||Je}}const Be=i=>Math.round(i*10)/10;function ia(i,t,e,s){const n=ii(i),o=Ht(n,"margin"),r=Ze(n.maxWidth,i,"clientWidth")||Je,a=Ze(n.maxHeight,i,"clientHeight")||Je,l=ea(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const d=Ht(n,"border","width"),f=Ht(n,"padding");c-=f.width+d.width,h-=f.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Be(Math.min(c,r,l.maxWidth)),h=Be(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Be(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Be(Math.floor(h*s))),{width:c,height:h}}function us(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(i.currentDevicePixelRatio=s,r.height=n,r.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const sa=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};ji()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function fs(i,t){const e=Jr(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Rt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function na(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function oa(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Rt(i,n,e),a=Rt(n,o,e),l=Rt(o,t,e),c=Rt(r,a,e),h=Rt(a,l,e);return Rt(c,h,e)}const ra=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},aa=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function qt(i,t,e){return i?ra(t,e):aa()}function Fn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function zn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Bn(i){return i==="angle"?{between:yn,compare:ar,normalize:yt}:{between:zt,compare:(t,e)=>t-e,normalize:t=>t}}function gs({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function la(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=Bn(s),l=t.length;let{start:c,end:h,loop:u}=i,d,f;if(u){for(c+=l,h+=l,d=0,f=l;d<f&&r(a(t[c%l][s]),n,o);++d)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:u,style:i.style}}function ca(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,r=t.length,{compare:a,between:l,normalize:c}=Bn(s),{start:h,end:u,loop:d,style:f}=la(i,t,e),g=[];let m=!1,p=null,_,y,k;const M=()=>l(n,k,_)&&a(n,k)!==0,v=()=>a(o,_)===0||l(o,k,_),O=()=>m||M(),C=()=>!m||v();for(let P=h,S=h;P<=u;++P)y=t[P%r],!y.skip&&(_=c(y[s]),_!==k&&(m=l(_,n,o),p===null&&O()&&(p=a(_,n)===0?P:S),p!==null&&C()&&(g.push(gs({start:p,end:P,loop:d,count:r,style:f})),p=null),S=P,k=_));return p!==null&&g.push(gs({start:p,end:u,loop:d,count:r,style:f})),g}function ha(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=ca(s[n],i.points,t);o.length&&e.push(...o)}return e}function da(i,t,e,s){let n=0,o=t-1;if(e&&!s)for(;n<t&&!i[n].skip;)n++;for(;n<t&&i[n].skip;)n++;for(n%=t,e&&(o+=n);o>n&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function ua(i,t,e,s){const n=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%n,end:r%n,loop:s}),o}function fa(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=da(e,n,o,s);if(s===!0)return ps(i,[{start:r,end:a,loop:o}],e,t);const l=a<r?a+n:a,c=!!i._fullLoop&&r===0&&a===n-1;return ps(i,ua(e,r,l,c),e,t)}function ps(i,t,e,s){return!s||!s.setContext||!e?t:ga(i,t,e,s)}function ga(i,t,e,s){const n=i._chart.getContext(),o=ms(i.options),{_datasetIndex:r,options:{spanGaps:a}}=i,l=e.length,c=[];let h=o,u=t[0].start,d=u;function f(g,m,p,_){const y=a?-1:1;if(g!==m){for(g+=l;e[g%l].skip;)g-=y;for(;e[m%l].skip;)m+=y;g%l!==m%l&&(c.push({start:g%l,end:m%l,loop:p,style:_}),h=_,u=m%l)}}for(const g of t){u=a?u:g.start;let m=e[u%l],p;for(d=u+1;d<=g.end;d++){const _=e[d%l];p=ms(s.setContext(Wt(n,{type:"segment",p0:m,p1:_,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),pa(p,h)&&f(u,d-1,g.loop,h),m=_,h=p}u<d-1&&f(u,d-1,g.loop,h)}return c}function ms(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function pa(i,t){if(!t)return!1;const e=[],s=function(n,o){return Bi(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,s)!==JSON.stringify(t,s)}/*!
|
|
* Chart.js v4.4.4
|
|
* https://www.chartjs.org
|
|
* (c) 2024 Chart.js Contributors
|
|
* Released under the MIT License
|
|
*/class ma{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Sn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var bt=new ma;const bs="transparent",ba={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=rs(i||bs),n=s.valid&&rs(t||bs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class _a{constructor(t,e,s,n){const o=e[s];n=Fe([t.to,n,o,t.from]);const r=Fe([t.from,o,n]);this._active=!0,this._fn=t.fn||ba[t.type||typeof r],this._easing=pe[t.easing]||pe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Fe([t.to,e,n,t.from]),this._from=Fe([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][e]()}}class $n{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!R(t))return;const e=Object.keys(W.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!R(o))return;const r={};for(const a of e)r[a]=o[a];(V(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=ya(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&xa(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let u=o[c];const d=s.get(c);if(u)if(d&&u.active()){u.update(d,h,a);continue}else u.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=u=new _a(d,t,c,h),n.push(u)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return bt.add(this._chart,s),!0}}function xa(i,t){const e=[],s=Object.keys(t);for(let n=0;n<s.length;n++){const o=i[s[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function ya(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function _s(i,t){const e=i&&i.options||{},s=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:s?o:n,end:s?n:o}}function va(i,t,e){if(e===!1)return!1;const s=_s(i,e),n=_s(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function wa(i){let t,e,s,n;return R(i)?(t=i.top,e=i.right,s=i.bottom,n=i.left):t=e=s=n=i,{top:t,right:e,bottom:s,left:n,disabled:i===!1}}function Hn(i,t){const e=[],s=i._getSortedDatasetMetas(t);let n,o;for(n=0,o=s.length;n<o;++n)e.push(s[n].index);return e}function xs(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let r,a,l,c;if(t!==null){for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===e){if(s.all)continue;break}c=i.values[l],nt(c)&&(o||t===0||gt(t)===gt(c))&&(t+=c)}return t}}function Sa(i,t){const{iScale:e,vScale:s}=t,n=e.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(i),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[n]:h,[o]:i[h]};return a}function ys(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function ka(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Ma(i){const{min:t,max:e,minDefined:s,maxDefined:n}=i.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function Pa(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function vs(i,t,e,s){for(const n of t.getMatchingVisibleMetas(s).reverse()){const o=i[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function ws(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=ka(o,r,s),u=t.length;let d;for(let f=0;f<u;++f){const g=t[f],{[l]:m,[c]:p}=g,_=g._stacks||(g._stacks={});d=_[c]=Pa(n,h,m),d[a]=p,d._top=vs(d,r,!0,s.type),d._bottom=vs(d,r,!1,s.type);const y=d._visualValues||(d._visualValues={});y[a]=p}}function li(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function Ca(i,t){return Wt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Oa(i,t,e){return Wt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function se(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const ci=i=>i==="reset"||i==="none",Ss=(i,t)=>t?i:Object.assign({},i),Da=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Hn(e,!0),values:null};class Yi{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ys(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&se(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(u,d,f,g)=>u==="x"?d:u==="r"?g:f,o=e.xAxisID=L(s.xAxisID,li(t,"x")),r=e.yAxisID=L(s.yAxisID,li(t,"y")),a=e.rAxisID=L(s.rAxisID,li(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,r,a),h=e.vAxisID=n(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ss(this._data,this),t._stacked&&se(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(R(e)){const n=this._cachedMeta;this._data=Sa(e,n)}else if(s!==e){if(s){ss(s,this);const n=this._cachedMeta;se(n),n._parsed=[]}e&&Object.isExtensible(e)&&dr(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=ys(e.vScale,e),e.stack!==s.stack&&(n=!0,se(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&ws(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,u,d;if(this._parsing===!1)s._parsed=n,s._sorted=!0,d=n;else{V(n[t])?d=this.parseArrayData(s,n,t,e):R(n[t])?d=this.parseObjectData(s,n,t,e):d=this.parsePrimitiveData(s,n,t,e);const f=()=>u[a]===null||c&&u[a]<c[a];for(h=0;h<e;++h)s._parsed[h+t]=u=d[h],l&&(f()&&(l=!1),c=u);s._sorted=l}r&&ws(this,d)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,u=new Array(n);let d,f,g;for(d=0,f=n;d<f;++d)g=d+s,u[d]={[a]:h||o.parse(c[g],g),[l]:r.parse(e[g],g)};return u}parseArrayData(t,e,s,n){const{xScale:o,yScale:r}=t,a=new Array(n);let l,c,h,u;for(l=0,c=n;l<c;++l)h=l+s,u=e[h],a[l]={x:o.parse(u[0],h),y:r.parse(u[1],h)};return a}parseObjectData(t,e,s,n){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,u,d,f;for(h=0,u=n;h<u;++h)d=h+s,f=e[d],c[h]={x:o.parse(Jt(f,a),d),y:r.parse(Jt(f,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const n=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:Hn(n,!0),values:e._stacks[t.axis]._visualValues};return xs(a,r,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let r=o===null?NaN:o;const a=n&&s._stacks[e.axis];n&&a&&(n.values=a,r=xs(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,r=n.length,a=this._getOtherScale(t),l=Da(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=Ma(a);let d,f;function g(){f=n[d];const m=f[a.axis];return!nt(f[t.axis])||h>m||u<m}for(d=0;d<r&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n][t.axis],nt(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,s=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=wa(L(this.options.clip,va(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,s=this._cachedMeta,n=s.data||[],o=e.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||n.length-a,c=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,a,l),h=a;h<a+l;++h){const u=n[h];u.hidden||(u.active&&c?r.push(u):u.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,e){const s=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,e,s){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Oa(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Ca(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",s){const n=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],l=this.enableOptionSharing&&ve(s);if(a)return Ss(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),u=n?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),h),f=Object.keys(W.elements[t]),g=()=>this.getContext(s,n,e),m=c.resolveNamedOptions(d,f,g,u);return m.$shared&&(m.$shared=l,o[r]=Object.freeze(Ss(m,l))),m}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),u);l=h.createResolver(d,this.getContext(t,s,e))}const c=new $n(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ci(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){ci(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!ci(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,s=!0){const n=this._cachedMeta,o=n.data,r=t+e;let a;const l=c=>{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),s&&this.updateElements(o,t,e,"reset")}updateElements(t,e,s,n){}_removeElements(t,e){const s=this._cachedMeta;if(this._parsing){const n=s._parsed.splice(t,e);s._stacked&&se(s,n)}s.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,s,n]=t;this[e](s,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Ta(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let s=[];for(let n=0,o=e.length;n<o;n++)s=s.concat(e[n].controller.getAllParsedValues(i));i._cache.$bar=wn(s.sort((n,o)=>n-o))}return i._cache.$bar}function Aa(i){const t=i.iScale,e=Ta(t,i.type);let s=t._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(ve(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=e.length;n<o;++n)r=t.getPixelForValue(e[n]),l();for(a=void 0,n=0,o=t.ticks.length;n<o;++n)r=t.getPixelForTick(n),l();return s}function La(i,t,e,s){const n=e.barThickness;let o,r;return F(n)?(o=t.min*e.categoryPercentage,r=e.barPercentage):(o=n*s,r=1),{chunk:o/s,ratio:r,start:t.pixels[i]-o/2}}function Ra(i,t,e,s){const n=t.pixels,o=n[i];let r=i>0?n[i-1]:null,a=i<n.length-1?n[i+1]:null;const l=e.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/s,ratio:e.barPercentage,start:c}}function Ia(i,t,e,s){const n=e.parse(i[0],s),o=e.parse(i[1],s),r=Math.min(n,o),a=Math.max(n,o);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function Nn(i,t,e,s){return V(i)?Ia(i,t,e,s):t[e.axis]=e.parse(i,s),t}function ks(i,t,e,s){const n=i.iScale,o=i.vScale,r=n.getLabels(),a=n===o,l=[];let c,h,u,d;for(c=e,h=e+s;c<h;++c)d=t[c],u={},u[n.axis]=a||n.parse(r[c],c),l.push(Nn(d,u,o,c));return l}function hi(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function Ea(i,t,e){return i!==0?gt(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Fa(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.base<i.y,e="bottom",s="top"),t?(n="end",o="start"):(n="start",o="end"),{start:e,end:s,reverse:t,top:n,bottom:o}}function za(i,t,e,s){let n=t.borderSkipped;const o={};if(!n){i.borderSkipped=o;return}if(n===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:l,top:c,bottom:h}=Fa(i);n==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=h:(o[Ms(h,r,a,l)]=!0,n=c)),o[Ms(n,r,a,l)]=!0,i.borderSkipped=o}function Ms(i,t,e,s){return s?(i=Ba(i,t,e),i=Ps(i,e,t)):i=Ps(i,t,e),i}function Ba(i,t,e){return i===t?e:i===e?t:i}function Ps(i,t,e){return i==="start"?t:i==="end"?e:i}function $a(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class Wn extends Yi{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,s,n){return ks(t,e,s,n)}parseArrayData(t,e,s,n){return ks(t,e,s,n)}parseObjectData(t,e,s,n){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,h=r.axis==="x"?a:l,u=[];let d,f,g,m;for(d=s,f=s+n;d<f;++d)m=e[d],g={},g[o.axis]=o.parse(Jt(m,c),d),u.push(Nn(Jt(m,h),g,r,d));return u}updateRangeFromParsed(t,e,s,n){super.updateRangeFromParsed(t,e,s,n);const o=s._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:s,vScale:n}=e,o=this.getParsed(t),r=o._custom,a=hi(r)?"["+r.start+", "+r.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,s,n){const o=n==="reset",{index:r,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,n);for(let f=e;f<e+s;f++){const g=this.getParsed(f),m=o||F(g[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,h),_=(g._stacks||{})[a.axis],y={horizontal:c,base:m.base,enableBorderRadius:!_||hi(g._custom)||r===_._top||r===_._bottom,x:c?m.head:p.center,y:c?p.center:m.head,height:c?p.size:Math.abs(m.size),width:c?Math.abs(m.size):p.size};d&&(y.options=u||this.resolveDataElementOptions(f,t[f].active?"active":n));const k=y.options||t[f].options;za(y,k,_,r),$a(y,k,h.ratio),this.updateElement(t[f],f,y,n)}}_getStacks(t,e){const{iScale:s}=this._cachedMeta,n=s.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[s.axis],c=h=>{const u=h._parsed.find(f=>f[s.axis]===l),d=u&&u[h.vScale.axis];if(F(d)||isNaN(d))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,r;for(o=0,r=e.data.length;o<r;++o)n.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const a=t.barThickness;return{min:a||Aa(e),pixels:n,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:s,index:n},options:{base:o,minBarLength:r}}=this,a=o||0,l=this.getParsed(t),c=l._custom,h=hi(c);let u=l[e.axis],d=0,f=s?this.applyStack(e,l,s):u,g,m;f!==u&&(d=f-u,f=u),h&&(u=c.barStart,f=c.barEnd-c.barStart,u!==0&>(u)!==gt(c.barEnd)&&(d=0),d+=u);const p=!F(o)&&!h?o:d;let _=e.getPixelForValue(p);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(d+f):g=_,m=g-_,Math.abs(m)<r){m=Ea(m,e,a)*r,u===a&&(_-=m/2);const y=e.getPixelForDecimal(0),k=e.getPixelForDecimal(1),M=Math.min(y,k),v=Math.max(y,k);_=Math.max(Math.min(_,v),M),g=_+m,s&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(g)-e.getValueForPixel(_))}if(_===e.getPixelForValue(a)){const y=gt(m)*e.getLineWidthForValue(a)/2;_+=y,m-=y}return{size:m,base:_,head:g,center:g+m/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,r=L(n.maxBarThickness,1/0);let a,l;if(e.grouped){const c=o?this._getStackCount(t):e.stackCount,h=n.barThickness==="flex"?Ra(t,e,n,c):La(t,e,n,c),u=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);a=h.start+h.chunk*u+h.chunk/2,l=Math.min(r,h.chunk*h.ratio)}else a=s.getPixelForValue(this.getParsed(t)[s.axis],t),l=Math.min(r,e.min*e.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,s=t.data,n=s.length;let o=0;for(;o<n;++o)this.getParsed(o)[e.axis]!==null&&!s[o].hidden&&s[o].draw(this._ctx)}}class Vn extends Yi{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:n=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=gr(e,n,r);this._drawStart=a,this._drawCount=l,pr(e)&&(a=0,l=n.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=n;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:c},t),this.updateElements(n,a,l,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,n),d=r.axis,f=a.axis,{spanGaps:g,segment:m}=this.options,p=we(g)?g:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||n==="none",y=e+s,k=t.length;let M=e>0&&this.getParsed(e-1);for(let v=0;v<k;++v){const O=t[v],C=_?O:{};if(v<e||v>=y){C.skip=!0;continue}const P=this.getParsed(v),S=F(P[f]),x=C[d]=r.getPixelForValue(P[d],v),w=C[f]=o||S?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,P,l):P[f],v);C.skip=isNaN(x)||isNaN(w)||S,C.stop=v>0&&Math.abs(P[d]-M[d])>p,m&&(C.parsed=P,C.raw=c.data[v]),u&&(C.options=h||this.resolveDataElementOptions(v,O.active?"active":n)),_||this.updateElement(O,v,C,n),M=P}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function At(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Xi{static override(t){Object.assign(Xi.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return At()}parse(){return At()}format(){return At()}add(){return At()}diff(){return At()}startOf(){return At()}endOf(){return At()}}var Ha={_date:Xi};function Na(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?cr:Bt;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const u=l(o,t,e-h),d=l(o,t,e+h);return{lo:u.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Oe(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:h}=o[a],{lo:u,hi:d}=Na(o[a],t,r,n);for(let f=u;f<=d;++f){const g=h[f];g.skip||s(g,c,f)}}}function Wa(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(s,n){const o=t?Math.abs(s.x-n.x):0,r=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function di(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||Oe(i,e,t,function(a,l,c){!n&&!Se(a,i.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Va(i,t,e,s){let n=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:u}=rr(r,{x:t.x,y:t.y});yn(u,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return Oe(i,e,t,o),n}function ja(i,t,e,s,n,o){let r=[];const a=Wa(e);let l=Number.POSITIVE_INFINITY;function c(h,u,d){const f=h.inRange(t.x,t.y,n);if(s&&!f)return;const g=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(g))&&!f)return;const p=a(t,g);p<l?(r=[{element:h,datasetIndex:u,index:d}],l=p):p===l&&r.push({element:h,datasetIndex:u,index:d})}return Oe(i,e,t,c),r}function ui(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?Va(i,t,e,n):ja(i,t,e,s,n,o)}function Cs(i,t,e,s,n){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return Oe(i,e,t,(l,c,h)=>{l[r]&&l[r](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,n))}),s&&!a?[]:o}var Ua={evaluateInteractionItems:Oe,modes:{index(i,t,e,s){const n=Lt(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?di(i,n,o,s,r):ui(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,u=c.data[h];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Lt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?di(i,n,o,s,r):ui(i,n,o,!1,s,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(i,t,e,s){const n=Lt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return di(i,n,o,s,r)},nearest(i,t,e,s){const n=Lt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return ui(i,n,o,e.intersect,s,r)},x(i,t,e,s){const n=Lt(t,i);return Cs(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=Lt(t,i);return Cs(i,n,"y",e.intersect,s)}}};const jn=["left","top","right","bottom"];function ne(i,t){return i.filter(e=>e.pos===t)}function Os(i,t){return i.filter(e=>jn.indexOf(e.pos)===-1&&e.box.axis===t)}function oe(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Ya(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:r,stackWeight:a=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return t}function Xa(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!jn.includes(n))continue;const r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Ka(i,t){const e=Xa(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];const{fullSize:l}=a.box,c=e[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*s:l&&t.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:l&&t.availableHeight)}return e}function qa(i){const t=Ya(i),e=oe(t.filter(c=>c.box.fullSize),!0),s=oe(ne(t,"left"),!0),n=oe(ne(t,"right")),o=oe(ne(t,"top"),!0),r=oe(ne(t,"bottom")),a=Os(t,"x"),l=Os(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:ne(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Ds(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Un(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Ga(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!R(n)){e.size&&(i[n]-=e.size);const u=s[e.stack]||{size:0,count:1};u.size=Math.max(u.size,e.horizontal?o.height:o.width),e.size=u.size/u.count,i[n]+=e.size}o.getPadding&&Un(r,o.getPadding());const a=Math.max(0,t.outerWidth-Ds(r,i,"left","right")),l=Math.max(0,t.outerHeight-Ds(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Ja(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Qa(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function ce(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o<r;++o){a=i[o],l=a.box,l.update(a.width||t.w,a.height||t.h,Qa(a.horizontal,t));const{same:u,other:d}=Ga(t,e,a,s);c|=u&&n.length,h=h||d,l.fullSize||n.push(a)}return c&&ce(n,t,e,s)||h}function $e(i,t,e,s,n){i.top=e,i.left=t,i.right=t+s,i.bottom=e+n,i.width=s,i.height=n}function Ts(i,t,e,s){const n=e.padding;let{x:o,y:r}=t;for(const a of i){const l=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const u=t.w*h,d=c.size||l.height;ve(c.start)&&(r=c.start),l.fullSize?$e(l,n.left,r,e.outerWidth-n.right-n.left,d):$e(l,t.left+c.placed,r,u,d),c.start=r,c.placed+=u,r=l.bottom}else{const u=t.h*h,d=c.size||l.width;ve(c.start)&&(o=c.start),l.fullSize?$e(l,o,n.top,d,e.outerHeight-n.bottom-n.top):$e(l,o,t.top+c.placed,d,u),c.start=o,c.placed+=u,o=l.right}}t.x=o,t.y=r}var st={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,s){if(!i)return;const n=ot(i.options.layout.padding),o=Math.max(t-n.width,0),r=Math.max(e-n.height,0),a=qa(i.boxes),l=a.vertical,c=a.horizontal;E(i.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const h=l.reduce((m,p)=>p.box.options&&p.box.options.display===!1?m:m+1,0)||1,u=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},n);Un(d,ot(s));const f=Object.assign({maxPadding:d,w:o,h:r,x:n.left,y:n.top},n),g=Ka(l.concat(c),u);ce(a.fullSize,f,u,g),ce(l,f,u,g),ce(c,f,u,g)&&ce(l,f,u,g),Ja(f),Ts(a.leftAndTop,f,u,g),f.x+=f.w,f.y+=f.h,Ts(a.rightAndBottom,f,u,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},E(a.chartArea,m=>{const p=m.box;Object.assign(p,i.chartArea),p.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Yn{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class Za extends Yn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ye="$chartjs",tl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},As=i=>i===null||i==="";function el(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Ye]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",As(n)){const o=fs(i,"width");o!==void 0&&(i.width=o)}if(As(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=fs(i,"height");o!==void 0&&(i.height=o)}return i}const Xn=sa?{passive:!0}:!1;function il(i,t,e){i&&i.addEventListener(t,e,Xn)}function sl(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Xn)}function nl(i,t){const e=tl[i.type]||i.type,{x:s,y:n}=Lt(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ti(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function ol(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ti(a.addedNodes,s),r=r&&!ti(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function rl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ti(a.removedNodes,s),r=r&&!ti(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Me=new Map;let Ls=0;function Kn(){const i=window.devicePixelRatio;i!==Ls&&(Ls=i,Me.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function al(i,t){Me.size||window.addEventListener("resize",Kn),Me.set(i,t)}function ll(i){Me.delete(i),Me.size||window.removeEventListener("resize",Kn)}function cl(i,t,e){const s=i.canvas,n=s&&Ui(s);if(!n)return;const o=kn((a,l)=>{const c=n.clientWidth;e(a,l),c<n.clientWidth&&e()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),al(i,o),r}function fi(i,t,e){e&&e.disconnect(),t==="resize"&&ll(i)}function hl(i,t,e){const s=i.canvas,n=kn(o=>{i.ctx!==null&&e(nl(o,i))},i);return il(s,t,n),n}class dl extends Yn{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(el(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Ye])return!1;const s=e[Ye].initial;["height","width"].forEach(o=>{const r=s[o];F(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ye],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:ol,detach:rl,resize:cl}[e]||hl;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:fi,detach:fi,resize:fi}[e]||sl)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return ia(t,e,s,n)}isAttached(t){const e=t&&Ui(t);return!!(e&&e.isConnected)}}function ul(i){return!ji()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Za:dl}class Pt{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return we(this.x)&&we(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}function fl(i,t){const e=i.options.ticks,s=gl(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?ml(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return bl(t,c,o,r/n),c;const h=pl(o,t,n);if(r>0){let u,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(He(t,c,h,F(f)?0:a-f,a),u=0,d=r-1;u<d;u++)He(t,c,h,o[u],o[u+1]);return He(t,c,h,l,F(f)?t.length:l+f),c}return He(t,c,h),c}function gl(i){const t=i.options.offset,e=i._tickSize(),s=i._length/e+(t?0:1),n=i._maxLength/e;return Math.floor(Math.min(s,n))}function pl(i,t,e){const s=_l(i),n=t.length/e;if(!s)return Math.max(n,1);const o=ir(s);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>n)return l}return Math.max(n,1)}function ml(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function bl(i,t,e,s){let n=0,o=e[0],r;for(s=Math.ceil(s),r=0;r<i.length;r++)r===o&&(t.push(i[r]),n++,o=e[n*s])}function He(i,t,e,s,n){const o=L(s,0),r=Math.min(L(n,i.length),i.length);let a=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-s,e=l/Math.floor(l/e)),h=o;h<0;)a++,h=Math.round(o+a*e);for(c=Math.max(o,0);c<r;c++)c===h&&(t.push(i[c]),a++,h=Math.round(o+a*e))}function _l(i){const t=i.length;let e,s;if(t<2)return!1;for(s=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==s)return!1;return s}const xl=i=>i==="left"?"right":i==="right"?"left":i,Rs=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Is=(i,t)=>Math.min(t||i,i);function Es(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o<n;o+=s)e.push(i[Math.floor(o)]);return e}function yl(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,r=i._endPixel,a=1e-6;let l=i.getPixelForTick(n),c;if(!(e&&(s===1?c=Math.max(l-o,r-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-a||l>r+a)))return l}function vl(i,t){E(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;o<n;++o)delete e.data[s[o]];s.splice(0,n)}})}function re(i){return i.drawTicks?i.tickLength:0}function Fs(i,t){if(!i.display)return 0;const e=q(i.font,t),s=ot(i.padding);return(V(i.text)?i.text.length:1)*e.lineHeight+s.height}function wl(i,t){return Wt(i,{scale:t,type:"scale"})}function Sl(i,t,e){return Wt(i,{tick:e,index:t,type:"tick"})}function kl(i,t,e){let s=zi(i);return(e&&t!=="right"||!e&&t==="right")&&(s=xl(s)),s}function Ml(i,t,e,s){const{top:n,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:h}=l;let u=0,d,f,g;const m=r-n,p=a-o;if(i.isHorizontal()){if(f=X(s,o,a),R(e)){const _=Object.keys(e)[0],y=e[_];g=h[_].getPixelForValue(y)+m-t}else e==="center"?g=(c.bottom+c.top)/2+m-t:g=Rs(i,e,t);d=a-o}else{if(R(e)){const _=Object.keys(e)[0],y=e[_];f=h[_].getPixelForValue(y)-p+t}else e==="center"?f=(c.left+c.right)/2-p+t:f=Rs(i,e,t);g=X(s,r,n),u=e==="left"?-lt:lt}return{titleX:f,titleY:g,maxWidth:d,rotation:u}}class te extends Pt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:s,_suggestedMax:n}=this;return t=ht(t,Number.POSITIVE_INFINITY),e=ht(e,Number.NEGATIVE_INFINITY),s=ht(s,Number.POSITIVE_INFINITY),n=ht(n,Number.NEGATIVE_INFINITY),{min:ht(t,s),max:ht(e,n),minDefined:nt(t),maxDefined:nt(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:e,max:s};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),n||(e=Math.min(e,r.min)),o||(s=Math.max(s,r.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:ht(e,ht(s,e)),max:ht(s,ht(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){z(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Ir(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Es(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=fl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,s;this.isHorizontal()?(e=this.left,s=this.right):(e=this.top,s=this.bottom,t=!t),this._startPixel=e,this._endPixel=s,this._reversePixels=t,this._length=s-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){z(this.options.afterUpdate,[this])}beforeSetDimensions(){z(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(){z(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),z(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){z(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s],o.label=z(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){z(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){z(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=Is(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let r=n,a,l,c;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),u=h.widest.width,d=h.highest.height,f=tt(this.chart.width-u,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),u+6>a&&(a=f/(s-(t.offset?.5:1)),l=this.maxHeight-re(t.grid)-e.padding-Fs(t.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),r=or(Math.min(Math.asin(tt((h.highest.height+6)/a,-1,1)),Math.asin(tt(l/c,-1,1))-Math.asin(tt(d/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){z(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){z(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Fs(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=re(o)+l):(t.height=this.maxHeight,t.width=re(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:u,highest:d}=this._getLabelSizes(),f=s.padding*2,g=Ft(this.labelRotation),m=Math.cos(g),p=Math.sin(g);if(a){const _=s.mirror?0:p*u.width+m*d.height;t.height=Math.min(this.maxHeight,t.height+_+f)}else{const _=s.mirror?0:m*u.width+p*d.height;t.width=Math.min(this.maxWidth,t.width+_+f)}this._calculatePadding(c,h,p,m)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=n*t.width,f=s*e.height):(d=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-u+r)*this.width/(this.width-u),0)}else{let h=e.height/2,u=t.height/2;o==="start"?(h=0,u=t.height):o==="end"&&(h=e.height,u=0),this.paddingTop=h+r,this.paddingBottom=u+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){z(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e<s;e++)F(t[e].label)&&(t.splice(e,1),s--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let s=this.ticks;e<s.length&&(s=Es(s,e)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,s){const{ctx:n,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(e/Is(e,s));let c=0,h=0,u,d,f,g,m,p,_,y,k,M,v;for(u=0;u<e;u+=l){if(g=t[u].label,m=this._resolveTickFontOptions(u),n.font=p=m.string,_=o[p]=o[p]||{data:{},gc:[]},y=m.lineHeight,k=M=0,!F(g)&&!V(g))k=ls(n,_.data,_.gc,k,g),M=y;else if(V(g))for(d=0,f=g.length;d<f;++d)v=g[d],!F(v)&&!V(v)&&(k=ls(n,_.data,_.gc,k,v),M+=y);r.push(k),a.push(M),c=Math.max(k,c),h=Math.max(M,h)}vl(o,e);const O=r.indexOf(c),C=a.indexOf(h),P=S=>({width:r[S]||0,height:a[S]||0});return{first:P(0),last:P(e-1),widest:P(O),highest:P(C),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return lr(this._alignToPixels?Tt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const s=e[t];return s.$context||(s.$context=Sl(this.getContext(),t,s))}return this.$context||(this.$context=wl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Ft(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*n?a/s:l/n:l*n<a*s?l/s:a/n}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),d=re(o),f=[],g=a.setContext(this.getContext()),m=g.display?g.width:0,p=m/2,_=function(Y){return Tt(s,Y,m)};let y,k,M,v,O,C,P,S,x,w,A,J;if(r==="top")y=_(this.bottom),C=this.bottom-d,S=y-p,w=_(t.top)+p,J=t.bottom;else if(r==="bottom")y=_(this.top),w=t.top,J=_(t.bottom)-p,C=y+p,S=this.top+d;else if(r==="left")y=_(this.right),O=this.right-d,P=y-p,x=_(t.left)+p,A=t.right;else if(r==="right")y=_(this.left),x=t.left,A=_(t.right)-p,O=y+p,P=this.left+d;else if(e==="x"){if(r==="center")y=_((t.top+t.bottom)/2+.5);else if(R(r)){const Y=Object.keys(r)[0],et=r[Y];y=_(this.chart.scales[Y].getPixelForValue(et))}w=t.top,J=t.bottom,C=y+p,S=C+d}else if(e==="y"){if(r==="center")y=_((t.left+t.right)/2);else if(R(r)){const Y=Object.keys(r)[0],et=r[Y];y=_(this.chart.scales[Y].getPixelForValue(et))}O=y-p,P=O-d,x=t.left,A=t.right}const ct=L(n.ticks.maxTicksLimit,u),N=Math.max(1,Math.ceil(u/ct));for(k=0;k<u;k+=N){const Y=this.getContext(k),et=o.setContext(Y),De=a.setContext(Y),Te=et.lineWidth,Vt=et.color,Ae=De.dash||[],jt=De.dashOffset,ee=et.tickWidth,Ct=et.tickColor,ie=et.tickBorderDash||[],Ot=et.tickBorderDashOffset;M=yl(this,k,l),M!==void 0&&(v=Tt(s,M,Te),c?O=P=x=A=v:C=S=w=J=v,f.push({tx1:O,ty1:C,tx2:P,ty2:S,x1:x,y1:w,x2:A,y2:J,width:Te,color:Vt,borderDash:Ae,borderDashOffset:jt,tickWidth:ee,tickColor:Ct,tickBorderDash:ie,tickBorderDashOffset:Ot}))}return this._ticksLength=u,this._borderValue=y,f}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:u}=o,d=re(s.grid),f=d+h,g=u?-h:f,m=-Ft(this.labelRotation),p=[];let _,y,k,M,v,O,C,P,S,x,w,A,J="middle";if(n==="top")O=this.bottom-g,C=this._getXAxisLabelAlignment();else if(n==="bottom")O=this.top+g,C=this._getXAxisLabelAlignment();else if(n==="left"){const N=this._getYAxisLabelAlignment(d);C=N.textAlign,v=N.x}else if(n==="right"){const N=this._getYAxisLabelAlignment(d);C=N.textAlign,v=N.x}else if(e==="x"){if(n==="center")O=(t.top+t.bottom)/2+f;else if(R(n)){const N=Object.keys(n)[0],Y=n[N];O=this.chart.scales[N].getPixelForValue(Y)+f}C=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")v=(t.left+t.right)/2-f;else if(R(n)){const N=Object.keys(n)[0],Y=n[N];v=this.chart.scales[N].getPixelForValue(Y)}C=this._getYAxisLabelAlignment(d).textAlign}e==="y"&&(l==="start"?J="top":l==="end"&&(J="bottom"));const ct=this._getLabelSizes();for(_=0,y=a.length;_<y;++_){k=a[_],M=k.label;const N=o.setContext(this.getContext(_));P=this.getPixelForTick(_)+o.labelOffset,S=this._resolveTickFontOptions(_),x=S.lineHeight,w=V(M)?M.length:1;const Y=w/2,et=N.color,De=N.textStrokeColor,Te=N.textStrokeWidth;let Vt=C;r?(v=P,C==="inner"&&(_===y-1?Vt=this.options.reverse?"left":"right":_===0?Vt=this.options.reverse?"right":"left":Vt="center"),n==="top"?c==="near"||m!==0?A=-w*x+x/2:c==="center"?A=-ct.highest.height/2-Y*x+x:A=-ct.highest.height+x/2:c==="near"||m!==0?A=x/2:c==="center"?A=ct.highest.height/2-Y*x:A=ct.highest.height-w*x,u&&(A*=-1),m!==0&&!N.showLabelBackdrop&&(v+=x/2*Math.sin(m))):(O=P,A=(1-w)*x/2);let Ae;if(N.showLabelBackdrop){const jt=ot(N.backdropPadding),ee=ct.heights[_],Ct=ct.widths[_];let ie=A-jt.top,Ot=0-jt.left;switch(J){case"middle":ie-=ee/2;break;case"bottom":ie-=ee;break}switch(C){case"center":Ot-=Ct/2;break;case"right":Ot-=Ct;break;case"inner":_===y-1?Ot-=Ct:_>0&&(Ot-=Ct/2);break}Ae={left:Ot,top:ie,width:Ct+jt.width,height:ee+jt.height,color:N.backdropColor}}p.push({label:M,font:S,textOffset:A,options:{rotation:m,color:et,strokeColor:De,strokeWidth:Te,textAlign:Vt,textBaseline:J,translation:[v,O],backdrop:Ae}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Ft(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o<r;++o){const l=n[o];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;const a=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,u,d;this.isHorizontal()?(c=Tt(t,this.left,r)-r/2,h=Tt(t,this.right,a)+a/2,u=d=l):(u=Tt(t,this.top,r)-r/2,d=Tt(t,this.bottom,a)+a/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,u),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&$i(s,n);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,h=r.textOffset;ke(s,c,0,h,l,a)}n&&Hi(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=q(s.font),r=ot(s.padding),a=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||R(e)?(l+=r.bottom,V(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:u,rotation:d}=Ml(this,l,e,a);ke(t,s.text,0,0,o,{color:s.color,maxWidth:u,rotation:d,textAlign:kl(a,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,s=L(t.grid&&t.grid.z,-1),n=L(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==te.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o<r;++o){const a=e[o];a[s]===this.id&&(!t||a.type===t)&&n.push(a)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return q(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ne{constructor(t,e,s){this.type=t,this.scope=e,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let s;Ol(e)&&(s=this.register(e));const n=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,Pl(t,r,s),this.override&&W.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,s=t.id,n=this.scope;s in e&&delete e[s],n&&s in W[n]&&(delete W[n][s],this.override&&delete Nt[s])}}function Pl(i,t,e){const s=ye(Object.create(null),[e?W.get(e):{},W.get(t),i.defaults]);W.set(t,s),i.defaultRoutes&&Cl(t,i.defaultRoutes),i.descriptors&&W.describe(t,i.descriptors)}function Cl(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");W.route(o,n,l,a)})}function Ol(i){return"id"in i&&"defaults"in i}class Dl{constructor(){this.controllers=new Ne(Yi,"datasets",!0),this.elements=new Ne(Pt,"elements"),this.plugins=new Ne(Object,"plugins"),this.scales=new Ne(te,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):E(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=Ei(t);z(s["before"+n],[],s),e[t](s),z(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const s=this._typedRegistries[e];if(s.isForType(t))return s}return this.plugins}_get(t,e,s){const n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return n}}var ut=new Dl;class Tl{constructor(){this._init=[]}notify(t,e,s,n){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),r=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,s,n){n=n||{};for(const o of t){const r=o.plugin,a=r[s],l=[e,n,o.options];if(z(a,l,r)===!1&&n.cancelable)return!1}return!0}invalidate(){F(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const s=t&&t.config,n=L(s.options&&s.options.plugins,{}),o=Al(s);return n===!1&&!e?[]:Rl(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function Al(i){const t={},e=[],s=Object.keys(ut.plugins.items);for(let o=0;o<s.length;o++)e.push(ut.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const r=n[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function Ll(i,t){return!t&&i===!1?null:i===!0?{}:i}function Rl(i,{plugins:t,localIds:e},s,n){const o=[],r=i.getContext();for(const a of t){const l=a.id,c=Ll(s[l],n);c!==null&&o.push({plugin:a,options:Il(i.config,{plugin:a,local:e[l]},c,r)})}return o}function Il(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),r=i.getOptionScopes(s,o);return e&&t.defaults&&r.push(t.defaults),i.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Pi(i,t){const e=W.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function El(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function Fl(i,t){return i===t?"_index_":"_value_"}function zs(i){if(i==="x"||i==="y"||i==="r")return i}function zl(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function Ci(i,...t){if(zs(i))return i;for(const e of t){const s=e.axis||zl(e.position)||i.length>1&&zs(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Bs(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function Bl(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return Bs(i,"x",e[0])||Bs(i,"y",e[0])}return{}}function $l(i,t){const e=Nt[i.type]||{scales:{}},s=t.scales||{},n=Pi(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!R(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Ci(r,a,Bl(r,i),W.scales[a.type]),c=Fl(l,n),h=e.scales||{};o[r]=fe(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Pi(a,t),h=(Nt[a]||{}).scales||{};Object.keys(h).forEach(u=>{const d=El(u,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),fe(o[f],[{axis:d},s[f],h[u]])})}),Object.keys(o).forEach(r=>{const a=o[r];fe(a,[W.scales[a.type],W.scale])}),o}function qn(i){const t=i.options||(i.options={});t.plugins=L(t.plugins,{}),t.scales=$l(i,t)}function Gn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Hl(i){return i=i||{},i.data=Gn(i.data),qn(i),i}const $s=new Map,Jn=new Set;function We(i,t){let e=$s.get(i);return e||(e=t(),$s.set(i,e),Jn.add(e)),e}const ae=(i,t,e)=>{const s=Jt(t,e);s!==void 0&&i.add(s)};class Nl{constructor(t){this._config=Hl(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Gn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),qn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return We(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return We(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return We(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return We(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(u=>ae(l,t,u))),h.forEach(u=>ae(l,n,u)),h.forEach(u=>ae(l,Nt[o]||{},u)),h.forEach(u=>ae(l,W,u)),h.forEach(u=>ae(l,ki,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Jn.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Nt[e]||{},W.datasets[e]||{},{type:e},W,ki]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Hs(this._resolverCache,t,n);let l=r;if(Vl(r,e)){o.$shared=!1,s=Mt(s)?s():s;const c=this.createResolver(t,s,a);l=Qt(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Hs(this._resolverCache,t,s);return R(e)?Qt(o,e,void 0,n):o}}function Hs(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:Ni(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const Wl=i=>R(i)&&Object.getOwnPropertyNames(i).some(t=>Mt(i[t]));function Vl(i,t){const{isScriptable:e,isIndexable:s}=An(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(Mt(a)||Wl(a))||r&&V(a))return!0}return!1}var jl="4.4.4";const Ul=["top","bottom","left","right","chartArea"];function Ns(i,t){return i==="top"||i==="bottom"||Ul.indexOf(i)===-1&&t==="x"}function Ws(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Vs(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),z(e&&e.onComplete,[i],t)}function Yl(i){const t=i.chart,e=t.options.animation;z(e&&e.onProgress,[i],t)}function Qn(i){return ji()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Xe={},js=i=>{const t=Qn(i);return Object.values(Xe).filter(e=>e.canvas===t).pop()};function Xl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function Kl(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Ve(i,t,e){return i.options.clip?i[e]:t[e]}function ql(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Ve(e,t,"left"),right:Ve(e,t,"right"),top:Ve(s,t,"top"),bottom:Ve(s,t,"bottom")}:t}let si=class{static defaults=W;static instances=Xe;static overrides=Nt;static registry=ut;static version=jl;static getChart=js;static register(...t){ut.add(...t),Us()}static unregister(...t){ut.remove(...t),Us()}constructor(t,e){const s=this.config=new Nl(e),n=Qn(t),o=js(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||ul(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Xo(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Tl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ur(u=>this.update(u),r.resizeDelay||0),this._dataChanges=[],Xe[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}bt.listen(this,"complete",Vs),bt.listen(this,"progress",Yl),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return F(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ut}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():us(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return cs(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,e){bt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,us(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),z(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};E(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Ci(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),E(o,r=>{const a=r.options,l=a.id,c=Ci(l,a),h=L(a.type,r.dtype);(a.position===void 0||Ns(a.position,c)!==Ns(r.dposition))&&(a.position=r.dposition),n[l]=!0;let u=null;if(l in s&&s[l].type===h)u=s[l];else{const d=ut.getScale(h);u=new d({id:l,type:h,ctx:this.ctx,chart:this}),s[u.id]=u}u.init(a,t)}),E(n,(r,a)=>{r||delete s[a]}),E(s,r=>{st.configure(this,r,r.options),st.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;n<s;++n)this._destroyDatasetMeta(n);t.splice(e,s-e)}this._sortedMetasets=t.slice(0).sort(Ws("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s<n;s++){const o=e[s];let r=this.getDatasetMeta(s);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||Pi(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{const l=ut.getController(a),{datasetElementType:c,dataElementType:h}=W.datasets[a];Object.assign(l,{dataElementType:ut.getElement(h),datasetElementType:c&&ut.getElement(c)}),r.controller=new l(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){E(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:u}=this.getDatasetMeta(c),d=!n&&o.indexOf(u)===-1;u.buildOrUpdateElements(d),r=Math.max(+u.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),n||E(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ws("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){E(this.scales,t=>{st.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Zi(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;Xl(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;o<e;o++)if(!Zi(n,s(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;st.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],E(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e<s;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,s=this.data.datasets.length;e<s;++e)this._updateDataset(e,Mt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const s=this.getDatasetMeta(t),n={meta:s,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(s.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(bt.has(this)?this.attached&&!bt.running(this)&&bt.start(this):(this.draw(),Vs({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const r=e[n];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=ql(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&$i(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&Hi(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Se(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Ua.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=Wt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);ve(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),bt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),cs(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Xe[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,s=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};E(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){E(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},E(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[n+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!qe(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),l=Zo(t),c=Kl(t,this._lastEvent,s,l);s&&(this._lastEvent=null,z(o.onHover,[t,a,this],this),l&&z(o.onClick,[t,a,this],this));const h=!qe(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};function Us(){return E(si.instances,i=>i._plugins.invalidate())}function Zn(i,t,e=t){i.lineCap=L(e.borderCapStyle,t.borderCapStyle),i.setLineDash(L(e.borderDash,t.borderDash)),i.lineDashOffset=L(e.borderDashOffset,t.borderDashOffset),i.lineJoin=L(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=L(e.borderWidth,t.borderWidth),i.strokeStyle=L(e.borderColor,t.borderColor)}function Gl(i,t,e){i.lineTo(e.x,e.y)}function Jl(i){return i.stepped?Mr:i.tension||i.cubicInterpolationMode==="monotone"?Pr:Gl}function to(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,l=Math.max(n,r),c=Math.min(o,a),h=n<r&&o<r||n>a&&o>a;return{count:s,start:l,loop:t.loop,ilen:c<l&&!h?s+c-l:c-l}}function Ql(i,t,e,s){const{points:n,options:o}=t,{count:r,start:a,loop:l,ilen:c}=to(n,e,s),h=Jl(o);let{move:u=!0,reverse:d}=s||{},f,g,m;for(f=0;f<=c;++f)g=n[(a+(d?c-f:f))%r],!g.skip&&(u?(i.moveTo(g.x,g.y),u=!1):h(i,m,g,d,o.stepped),m=g);return l&&(g=n[(a+(d?c:0))%r],h(i,m,g,d,o.stepped)),!!l}function Zl(i,t,e,s){const n=t.points,{count:o,start:r,ilen:a}=to(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,u=0,d,f,g,m,p,_;const y=M=>(r+(c?a-M:M))%o,k=()=>{m!==p&&(i.lineTo(h,p),i.lineTo(h,m),i.lineTo(h,_))};for(l&&(f=n[y(0)],i.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=n[y(d)],f.skip)continue;const M=f.x,v=f.y,O=M|0;O===g?(v<m?m=v:v>p&&(p=v),h=(u*h+M)/++u):(k(),i.lineTo(M,v),g=O,u=0,m=p=v),_=v}k()}function Oi(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Zl:Ql}function tc(i){return i.stepped?na:i.tension||i.cubicInterpolationMode==="monotone"?oa:Rt}function ec(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Zn(i,t.options),i.stroke(n)}function ic(i,t,e,s){const{segments:n,options:o}=t,r=Oi(t);for(const a of n)Zn(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const sc=typeof Path2D=="function";function nc(i,t,e,s){sc&&!t.options.segment?ec(i,t,e,s):ic(i,t,e,s)}class oc extends Pt{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;Gr(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=fa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=ha(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=tc(s);let c,h;for(c=0,h=r.length;c<h;++c){const{start:u,end:d}=r[c],f=o[u],g=o[d];if(f===g){a.push(f);continue}const m=Math.abs((n-f[e])/(g[e]-f[e])),p=l(f,g,m,s.stepped);p[e]=t[e],a.push(p)}return a.length===1?a[0]:a}pathSegment(t,e,s){return Oi(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=Oi(this);let r=this._loop;e=e||0,s=s||this.points.length-e;for(const a of n)r&=o(t,this,a,{start:e,end:e+s-1});return!!r}draw(t,e,s,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),nc(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Ys(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class rc extends Pt{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,s){const n=this.options,{x:o,y:r}=this.getProps(["x","y"],s);return Math.pow(t-o,2)+Math.pow(e-r,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return Ys(this,t,"x",e)}inYRange(t,e){return Ys(this,t,"y",e)}getCenterPoint(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const s=e&&t.borderWidth||0;return(e+s)*2}draw(t,e){const s=this.options;this.skip||s.radius<.1||!Se(this,e,this.size(s)/2)||(t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.fillStyle=s.backgroundColor,Mi(t,s,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function eo(i,t){const{x:e,y:s,base:n,width:o,height:r}=i.getProps(["x","y","base","width","height"],t);let a,l,c,h,u;return i.horizontal?(u=r/2,a=Math.min(e,n),l=Math.max(e,n),c=s-u,h=s+u):(u=o/2,a=e-u,l=e+u,c=Math.min(s,n),h=Math.max(s,n)),{left:a,top:c,right:l,bottom:h}}function wt(i,t,e,s){return i?0:tt(t,e,s)}function ac(i,t,e){const s=i.options.borderWidth,n=i.borderSkipped,o=Tn(s);return{t:wt(n.top,o.top,0,e),r:wt(n.right,o.right,0,t),b:wt(n.bottom,o.bottom,0,e),l:wt(n.left,o.left,0,t)}}function lc(i,t,e){const{enableBorderRadius:s}=i.getProps(["enableBorderRadius"]),n=i.options.borderRadius,o=Kt(n),r=Math.min(t,e),a=i.borderSkipped,l=s||R(n);return{topLeft:wt(!l||a.top||a.left,o.topLeft,0,r),topRight:wt(!l||a.top||a.right,o.topRight,0,r),bottomLeft:wt(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:wt(!l||a.bottom||a.right,o.bottomRight,0,r)}}function cc(i){const t=eo(i),e=t.right-t.left,s=t.bottom-t.top,n=ac(i,e/2,s/2),o=lc(i,e/2,s/2);return{outer:{x:t.left,y:t.top,w:e,h:s,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function gi(i,t,e,s){const n=t===null,o=e===null,a=i&&!(n&&o)&&eo(i,s);return a&&(n||zt(t,a.left,a.right))&&(o||zt(e,a.top,a.bottom))}function hc(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function dc(i,t){i.rect(t.x,t.y,t.w,t.h)}function pi(i,t,e={}){const s=i.x!==e.x?-t:0,n=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-s,r=(i.y+i.h!==e.y+e.h?t:0)-n;return{x:i.x+s,y:i.y+n,w:i.w+o,h:i.h+r,radius:i.radius}}class uc extends Pt{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:r}=cc(this),a=hc(r.radius)?Qe:dc;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,pi(r,e,o)),t.clip(),a(t,pi(o,-e,r)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),a(t,pi(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,s){return gi(this,t,e,s)}inXRange(t,e){return gi(this,t,null,e)}inYRange(t,e){return gi(this,null,t,e)}getCenterPoint(t){const{x:e,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?s:(s+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}const Xs=(i,t)=>{let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},fc=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Ks extends Pt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=z(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=q(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Xs(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a;let u=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-h;return this.legendItems.forEach((g,m)=>{const p=s+e/2+o.measureText(g.text).width;(m===0||c[c.length-1]+p+2*a>r)&&(u+=h,c[c.length-(m>0?0:1)]=0,f+=h,d++),l[m]={left:0,top:f,row:d,width:p,height:n},c[c.length-1]+=p+a}),u}_fitCols(t,e,s,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let u=a,d=0,f=0,g=0,m=0;return this.legendItems.forEach((p,_)=>{const{itemWidth:y,itemHeight:k}=gc(s,e,o,p,n);_>0&&f+k+2*a>h&&(u+=d+a,c.push({width:d,height:f}),g+=d+a,m++,d=f=0),l[_]={left:g,top:f,col:m,width:y,height:k},d=Math.max(d,y),f+=k+a}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=qt(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=X(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=X(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+t+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=X(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=X(s,this.top+t+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;$i(t,this),this._draw(),Hi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=W.color,l=qt(t.rtl,this.left,this.width),c=q(r.font),{padding:h}=r,u=c.size,d=u/2;let f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:g,boxHeight:m,itemHeight:p}=Xs(r,u),_=function(O,C,P){if(isNaN(g)||g<=0||isNaN(m)||m<0)return;n.save();const S=L(P.lineWidth,1);if(n.fillStyle=L(P.fillStyle,a),n.lineCap=L(P.lineCap,"butt"),n.lineDashOffset=L(P.lineDashOffset,0),n.lineJoin=L(P.lineJoin,"miter"),n.lineWidth=S,n.strokeStyle=L(P.strokeStyle,a),n.setLineDash(L(P.lineDash,[])),r.usePointStyle){const x={radius:m*Math.SQRT2/2,pointStyle:P.pointStyle,rotation:P.rotation,borderWidth:S},w=l.xPlus(O,g/2),A=C+d;On(n,x,w,A,r.pointStyleWidth&&g)}else{const x=C+Math.max((u-m)/2,0),w=l.leftForLtr(O,g),A=Kt(P.borderRadius);n.beginPath(),Object.values(A).some(J=>J!==0)?Qe(n,{x:w,y:x,w:g,h:m,radius:A}):n.rect(w,x,g,m),n.fill(),S!==0&&n.stroke()}n.restore()},y=function(O,C,P){ke(n,P.text,O,C+p/2,c,{strikethrough:P.hidden,textAlign:l.textAlign(P.textAlign)})},k=this.isHorizontal(),M=this._computeTitleHeight();k?f={x:X(o,this.left+h,this.right-s[0]),y:this.top+h+M,line:0}:f={x:this.left+h,y:X(o,this.top+M+h,this.bottom-e[0].height),line:0},Fn(this.ctx,t.textDirection);const v=p+h;this.legendItems.forEach((O,C)=>{n.strokeStyle=O.fontColor,n.fillStyle=O.fontColor;const P=n.measureText(O.text).width,S=l.textAlign(O.textAlign||(O.textAlign=r.textAlign)),x=g+d+P;let w=f.x,A=f.y;l.setWidth(this.width),k?C>0&&w+x+h>this.right&&(A=f.y+=v,f.line++,w=f.x=X(o,this.left+h,this.right-s[f.line])):C>0&&A+v>this.bottom&&(w=f.x=w+e[f.line].width+h,f.line++,A=f.y=X(o,this.top+M+h,this.bottom-e[f.line].height));const J=l.x(w);if(_(J,A,O),w=fr(S,w+g+d,k?w+x:this.right,t.rtl),y(l.x(w),A,O),k)f.x+=x+h;else if(typeof O.text!="string"){const ct=c.lineHeight;f.y+=io(O,ct)+h}else f.y+=v}),zn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=q(e.font),n=ot(e.padding);if(!e.display)return;const o=qt(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,u=X(t.align,u,this.right-d);else{const g=this.columnSizes.reduce((m,p)=>Math.max(m,p.height),0);h=c+X(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=X(a,u,u+d);r.textAlign=o.textAlign(zi(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,ke(r,e.text,f,h,s)}_computeTitleHeight(){const t=this.options.title,e=q(t.font),s=ot(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(zt(t,this.left,this.right)&&zt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],zt(t,n.left,n.left+n.width)&&zt(e,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(t){const e=this.options;if(!bc(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=fc(n,s);n&&!o&&z(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&z(e.onHover,[t,s,this],this)}else s&&z(e.onClick,[t,s,this],this)}}function gc(i,t,e,s,n){const o=pc(s,i,t,e),r=mc(n,s,t.lineHeight);return{itemWidth:o,itemHeight:r}}function pc(i,t,e,s){let n=i.text;return n&&typeof n!="string"&&(n=n.reduce((o,r)=>o.length>r.length?o:r)),t+e.size/2+s.measureText(n).width}function mc(i,t,e){let s=i;return typeof t.text!="string"&&(s=io(t,e)),s}function io(i,t){const e=i.text?i.text.length:0;return t*e}function bc(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var _c={id:"legend",_element:Ks,start(i,t,e){const s=i.legend=new Ks({ctx:i.ctx,options:e,chart:i});st.configure(i,s,e),st.addBox(i,s)},stop(i){st.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;st.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=ot(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class so extends Pt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=V(s.text)?s.text.length:1;this._padding=ot(s.padding);const o=n*q(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:r}=this,a=r.align;let l=0,c,h,u;return this.isHorizontal()?(h=X(a,s,o),u=e+t,c=o-s):(r.position==="left"?(h=s+t,u=X(a,n,e),l=U*-.5):(h=o-t,u=X(a,e,n),l=U*.5),c=n-e),{titleX:h,titleY:u,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=q(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);ke(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:zi(e.align),textBaseline:"middle",translation:[r,a]})}}function xc(i,t){const e=new so({ctx:i.ctx,options:t,chart:i});st.configure(i,e,t),st.addBox(i,e),i.titleBlock=e}var yc={id:"title",_element:so,start(i,t,e){xc(i,e)},stop(i){const t=i.titleBlock;st.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;st.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const he={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o<r;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Si(t,c);h<n&&(n=h,a=l)}}if(a){const l=a.tooltipPosition();e=l.x,s=l.y}return{x:e,y:s}}};function dt(i,t){return t&&(V(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function _t(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
|
|
`)>-1?i.split(`
|
|
`):i}function vc(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function qs(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=q(t.bodyFont),c=q(t.titleFont),h=q(t.footerFont),u=o.length,d=n.length,f=s.length,g=ot(t.padding);let m=g.height,p=0,_=s.reduce((M,v)=>M+v.before.length+v.lines.length+v.after.length,0);if(_+=i.beforeBody.length+i.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),_){const M=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*M+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}d&&(m+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let y=0;const k=function(M){p=Math.max(p,e.measureText(M).width+y)};return e.save(),e.font=c.string,E(i.title,k),e.font=l.string,E(i.beforeBody.concat(i.afterBody),k),y=t.displayColors?r+2+t.boxPadding:0,E(s,M=>{E(M.before,k),E(M.lines,k),E(M.after,k)}),y=0,e.font=h.string,E(i.footer,k),e.restore(),p+=g.width,{width:p,height:m}}function wc(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function Sc(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function kc(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),Sc(c,i,t,e)&&(c="center"),c}function Gs(i,t,e){const s=e.yAlign||t.yAlign||wc(i,e);return{xAlign:e.xAlign||t.xAlign||kc(i,t,e,s),yAlign:s}}function Mc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Pc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Js(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=Kt(r);let g=Mc(t,a);const m=Pc(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,d)+n:a==="right"&&(g+=Math.max(u,f)+n),{x:tt(g,0,s.width-t.width),y:tt(m,0,s.height-t.height)}}function je(i,t,e){const s=ot(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function Qs(i){return dt([],_t(i))}function Cc(i,t,e){return Wt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Zs(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const no={beforeTitle:mt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return e[t.dataIndex]}return""},afterTitle:mt,beforeBody:mt,beforeLabel:mt,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return F(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:mt,afterBody:mt,beforeFooter:mt,footer:mt,afterFooter:mt};function Q(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?no[t].call(e,s):n}class tn extends Pt{static positioners=he;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new $n(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Cc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=Q(s,"beforeTitle",this,t),o=Q(s,"title",this,t),r=Q(s,"afterTitle",this,t);let a=[];return a=dt(a,_t(n)),a=dt(a,_t(o)),a=dt(a,_t(r)),a}getBeforeBody(t,e){return Qs(Q(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return E(t,o=>{const r={before:[],lines:[],after:[]},a=Zs(s,o);dt(r.before,_t(Q(a,"beforeLabel",this,o))),dt(r.lines,Q(a,"label",this,o)),dt(r.after,_t(Q(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return Qs(Q(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=Q(s,"beforeFooter",this,t),o=Q(s,"footer",this,t),r=Q(s,"afterFooter",this,t);let a=[];return a=dt(a,_t(n)),a=dt(a,_t(o)),a=dt(a,_t(r)),a}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(vc(this.chart,e[l]));return t.filter&&(a=a.filter((h,u,d)=>t.filter(h,u,d,s))),t.itemSort&&(a=a.sort((h,u)=>t.itemSort(h,u,s))),E(a,h=>{const u=Zs(t.callbacks,h);n.push(Q(u,"labelColor",this,h)),o.push(Q(u,"labelPointStyle",this,h)),r.push(Q(u,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=he[s.position].call(this,n,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const l=this._size=qs(this,s),c=Object.assign({},a,l),h=Gs(this.chart,s,c),u=Js(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:u}=Kt(a),{x:d,y:f}=t,{width:g,height:m}=e;let p,_,y,k,M,v;return o==="center"?(M=f+m/2,n==="left"?(p=d,_=p-r,k=M+r,v=M-r):(p=d+g,_=p+r,k=M-r,v=M+r),y=p):(n==="left"?_=d+Math.max(l,h)+r:n==="right"?_=d+g-Math.max(c,u)-r:_=this.caretX,o==="top"?(k=f,M=k-r,p=_-r,y=_+r):(k=f+m,M=k+r,p=_+r,y=_-r),v=k),{x1:p,x2:_,x3:y,y1:k,y2:M,y3:v}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=qt(s.rtl,this.x,this.width);for(t.x=je(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=q(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,e,s,n,o){const r=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,h=q(o.bodyFont),u=je(this,"left",o),d=n.x(u),f=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},p=n.leftForLtr(d,c)+c/2,_=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Mi(t,m,p,_),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Mi(t,m,p,_)}else{t.lineWidth=R(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const m=n.leftForLtr(d,c),p=n.leftForLtr(n.xPlus(d,1),c-2),_=Kt(r.borderRadius);Object.values(_).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Qe(t,{x:m,y:g,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Qe(t,{x:p,y:g+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,g,c,l),t.strokeRect(m,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(p,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=s,u=q(s.bodyFont);let d=u.lineHeight,f=0;const g=qt(s.rtl,this.x,this.width),m=function(P){e.fillText(P,g.x(t.x+f),t.y+d/2),t.y+=d+o},p=g.textAlign(r);let _,y,k,M,v,O,C;for(e.textAlign=r,e.textBaseline="middle",e.font=u.string,t.x=je(this,p,s),e.fillStyle=s.bodyColor,E(this.beforeBody,m),f=a&&p!=="right"?r==="center"?c/2+h:c+2+h:0,M=0,O=n.length;M<O;++M){for(_=n[M],y=this.labelTextColors[M],e.fillStyle=y,E(_.before,m),k=_.lines,a&&k.length&&(this._drawColorBox(e,t,M,g,s),d=Math.max(u.lineHeight,l)),v=0,C=k.length;v<C;++v)m(k[v]),d=u.lineHeight;E(_.after,m)}f=0,d=u.lineHeight,E(this.afterBody,m),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let r,a;if(o){const l=qt(s.rtl,this.x,this.width);for(t.x=je(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",r=q(s.footerFont),e.fillStyle=s.footerColor,e.font=r.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+s.footerSpacing}}drawBackground(t,e,s,n){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:h}=s,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:g}=Kt(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+u,l),r==="top"&&this.drawCaret(t,e,s,n),e.lineTo(a+c-d,l),e.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(a+c,l+h-g),e.quadraticCurveTo(a+c,l+h,a+c-g,l+h),r==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(a+f,l+h),e.quadraticCurveTo(a,l+h,a,l+h-f),r==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(a,l+u),e.quadraticCurveTo(a,l,a+u,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=he[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=qs(this,t),l=Object.assign({},r,this._size),c=Gs(e,t,l),h=Js(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=ot(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),Fn(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),zn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!qe(s,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,s),a=this._positionChanged(r,t),l=e||!qe(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,r=he[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}var Oc={id:"tooltip",_element:tn,positioners:he,afterInit(i,t,e){e&&(i.tooltip=new tn({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:no},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Dc=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Tc(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Dc(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Ac=(i,t)=>i===null?null:tt(Math.round(i),0,t);function en(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class Lc extends te{static id="category";static defaults={ticks:{callback:en}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const s=this.getLabels();for(const{index:n,label:o}of e)s[n]===o&&s.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(F(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:Tc(s,t,L(e,t),this._addedLabels),Ac(e,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),e||(n=this.getLabels().length-1)),this.min=s,this.max=n}buildTicks(){const t=this.min,e=this.max,s=this.options.offset,n=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=e;r++)n.push({value:r});return n}getLabelForValue(t){return en.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Rc(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:u,includeBounds:d}=i,f=o||1,g=h-1,{min:m,max:p}=t,_=!F(r),y=!F(a),k=!F(c),M=(p-m)/(u+1);let v=es((p-m)/g/f)*f,O,C,P,S;if(v<1e-14&&!_&&!y)return[{value:m},{value:p}];S=Math.ceil(p/v)-Math.floor(m/v),S>g&&(v=es(S*v/g/f)*f),F(l)||(O=Math.pow(10,l),v=Math.ceil(v*O)/O),n==="ticks"?(C=Math.floor(m/v)*v,P=Math.ceil(p/v)*v):(C=m,P=p),_&&y&&o&&sr((a-r)/o,v/1e3)?(S=Math.round(Math.min((a-r)/v,h)),v=(a-r)/S,C=r,P=a):k?(C=_?r:C,P=y?a:P,S=c-1,v=(P-C)/S):(S=(P-C)/v,ge(S,Math.round(S),v/1e3)?S=Math.round(S):S=Math.ceil(S));const x=Math.max(is(v),is(C));O=Math.pow(10,F(l)?x:l),C=Math.round(C*O)/O,P=Math.round(P*O)/O;let w=0;for(_&&(d&&C!==r?(e.push({value:r}),C<r&&w++,ge(Math.round((C+w*v)*O)/O,r,sn(r,M,i))&&w++):C<r&&w++);w<S;++w){const A=Math.round((C+w*v)*O)/O;if(y&&A>a)break;e.push({value:A})}return y&&d&&P!==a?e.length&&ge(e[e.length-1].value,a,sn(a,M,i))?e[e.length-1].value=a:e.push({value:a}):(!y||P===a)&&e.push({value:P}),e}function sn(i,t,{horizontal:e,minRotation:s}){const n=Ft(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class Ic extends te{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return F(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=e?n:l,a=l=>o=s?o:l;if(t){const l=gt(n),c=gt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Rc(n,o);return t.bounds==="ticks"&&nr(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Mn(t,this.chart.options.locale,this.options.ticks.format)}}class Ec extends Ic{static id="linear";static defaults={ticks:{callback:Cn.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=nt(t)?t:0,this.max=nt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=Ft(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const ni={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}},Z=Object.keys(ni);function nn(i,t){return i-t}function on(i,t){if(F(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),nt(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(we(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function rn(i,t,e,s){const n=Z.length;for(let o=Z.indexOf(i);o<n-1;++o){const r=ni[Z[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=s)return Z[o]}return Z[n-1]}function Fc(i,t,e,s,n){for(let o=Z.length-1;o>=Z.indexOf(e);o--){const r=Z[o];if(ni[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return Z[e?Z.indexOf(e):0]}function zc(i){for(let t=Z.indexOf(i)+1,e=Z.length;t<e;++t)if(ni[Z[t]].common)return Z[t]}function an(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=Fi(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function Bc(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=e[a],l>=0&&(t[l].major=!0);return t}function ln(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],n[a]=r,s.push({value:a,major:!1});return o===0||!e?s:Bc(i,s,n,e)}class cn extends te{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const s=t.time||(t.time={}),n=this._adapter=new Ha._date(t.adapters.date);n.init(e),fe(s.displayFormats,n.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:on(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:n,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=nt(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=nt(o)&&!isNaN(o)?o:+e.endOf(Date.now(),s)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],s=t[t.length-1]),{min:e,max:s}}buildTicks(){const t=this.options,e=t.time,s=t.ticks,n=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,r=this.max,a=hr(n,o,r);return this._unit=e.unit||(s.autoSkip?rn(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Fc(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:zc(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),ln(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=tt(e,0,r),s=tt(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||rn(o.minUnit,e,s,this._getLabelCapacity(e)),a=L(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=we(l)||l===!0,h={};let u=e,d,f;if(c&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,c?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(d=u,f=0;d<s;d=+t.add(d,a,r),f++)an(h,d,g);return(d===s||n.bounds==="ticks"||f===1)&&an(h,d,g),Object.keys(h).sort(nn).map(m=>+m)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return z(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],u=c&&a[c],d=s[e],f=c&&u&&d&&d.major;return this._adapter.format(t,n||(f?u:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e<s;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,n=Ft(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),r=Math.sin(n),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,n=s[e.unit]||s.millisecond,o=this._tickFormatFunction(t,0,ln(this,[t],this._majorUnit),n),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e<s;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,s;if(t.length)return t;const n=this.getLabels();for(e=0,s=n.length;e<s;++e)t.push(on(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return wn(t.sort(nn))}}function Ue(i,t,e){let s=0,n=i.length-1,o,r,a,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=Bt(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=Bt(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:l}=i[n]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class Ou extends cn{static id="timeseries";static defaults=cn.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ue(e,this.min),this._tableRange=Ue(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r<a;++r)c=t[r],c>=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;r<a;++r)h=n[r+1],l=n[r-1],c=n[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(e)||s.length===1)&&s.push(e),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Ue(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Ue(this._table,s*this._tableRange+this._minPos,!0)}}const oo={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},$c={ariaLabel:{type:String},ariaDescribedby:{type:String}},Hc={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...oo,...$c},Nc=fo[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function Yt(i){return gn(i)?_i(i):i}function Wc(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return gn(t)?new Proxy(i,{}):i}function Vc(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function ro(i,t){i.labels=t}function ao(i,t,e){const s=[];i.datasets=t.map(n=>{const o=i.datasets.find(r=>r[e]===n[e]);return!o||!n.data||s.includes(o)?{...n}:(s.push(o),Object.assign(o,n),o)})}function jc(i,t){const e={labels:[],datasets:[]};return ro(e,i.labels),ao(e,i.datasets,t),e}const Uc=un({props:Hc,setup(i,t){let{expose:e,slots:s}=t;const n=K(null),o=fn(null);e({chart:o});const r=()=>{if(!n.value)return;const{type:c,data:h,options:u,plugins:d,datasetIdKey:f}=i,g=jc(h,f),m=Wc(g,h);o.value=new si(n.value,{type:c,data:m,options:{...u},plugins:d})},a=()=>{const c=_i(o.value);c&&(i.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},i.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(i.updateMode)};return Di(r),go(a),be([()=>i.options,()=>i.data],(c,h)=>{let[u,d]=c,[f,g]=h;const m=_i(o.value);if(!m)return;let p=!1;if(u){const _=Yt(u),y=Yt(f);_&&_!==y&&(Vc(m,_),p=!0)}if(d){const _=Yt(d.labels),y=Yt(g.labels),k=Yt(d.datasets),M=Yt(g.datasets);_!==y&&(ro(m.config.data,_),p=!0),k&&k!==M&&(ao(m.config.data,k,i.datasetIdKey),p=!0)}p&&po(()=>{l(m)})},{deep:!0}),()=>bi("canvas",{role:"img",ariaLabel:i.ariaLabel,ariaDescribedby:i.ariaDescribedby,ref:n},[bi("p",{},[s.default?s.default():""])])}});function lo(i,t){return si.register(t),un({props:oo,setup(e,s){let{expose:n}=s;const o=fn(null),r=a=>{o.value=a?.chart};return n({chart:o}),()=>bi(Uc,Nc({ref:r},{type:i,...e}))}})}const Yc=lo("bar",Wn),hn=lo("line",Vn),Xc={class:"row gx-2 gy-2 mb-3"},Kc={class:"col-12"},qc={class:"card rounded-3 bg-transparent",style:{height:"270px"}},Gc={class:"card-header bg-transparent border-0"},Jc={class:"text-muted"},Qc={class:"card-body pt-1"},Zc={class:"col-sm col-lg-6"},th={class:"card rounded-3 bg-transparent",style:{height:"270px"}},eh={class:"card-header bg-transparent border-0 d-flex align-items-center"},ih={class:"text-muted"},sh={key:0,class:"text-primary fw-bold ms-auto"},nh={class:"card-body pt-1"},oh={class:"col-sm col-lg-6"},rh={class:"card rounded-3 bg-transparent",style:{height:"270px"}},ah={class:"card-header bg-transparent border-0 d-flex align-items-center"},lh={class:"text-muted"},ch={key:0,class:"text-success fw-bold ms-auto"},hh={class:"card-body pt-1"},dh={__name:"peerDataUsageCharts",props:{configurationPeers:Array,configurationInfo:Object},setup(i){si.register(oc,uc,Wn,Vn,Ec,_c,yc,Oc,Lc,rc);const t=i,e=K({timestamp:[],data:[]}),s=K({timestamp:[],data:[]}),n=ei(),o=K(void 0),r=async()=>{await Gt("/api/getWireguardConfigurationRealtimeTraffic",{configurationName:"wg1"},f=>{let g=ko().format("hh:mm:ss A");(f.data.sent!==0&&f.data.recv!==0||e.value.data.length>0&&s.value.data.length>0)&&(e.value.timestamp.push(g),e.value.data.push(f.data.sent),s.value.timestamp.push(g),s.value.data.push(f.data.recv))})},a=()=>{clearInterval(o.value),o.value=void 0,t.configurationInfo.Status&&(o.value=setInterval(()=>{r()},parseInt(n.Configuration.Server.dashboard_refresh_interval)))};Di(()=>{a()}),be(()=>t.configurationInfo.Status,()=>{a()}),be(()=>n.Configuration.Server.dashboard_refresh_interval,()=>{a()}),Ti(()=>{clearInterval(o.value),o.value=void 0});const l=It(()=>{let f=t.configurationPeers.filter(g=>g.cumu_data+g.total_data>0);return{labels:f.map(g=>g.name?g.name:`Untitled Peer - ${g.id}`),datasets:[{label:"Total Data Usage",data:f.map(g=>g.cumu_data+g.total_data),backgroundColor:f.map(g=>"#ffc107"),tooltip:{callbacks:{label:g=>`${g.formattedValue} GB`}}}]}}),c=It(()=>({labels:[...e.value.timestamp],datasets:[{label:"Data Sent",data:[...e.value.data],fill:!1,borderColor:"#198754",backgroundColor:"#198754",tension:0}]})),h=It(()=>({labels:[...s.value.timestamp],datasets:[{label:"Data Received",data:[...s.value.data],fill:!1,borderColor:"#0d6efd",backgroundColor:"#0d6efd",tension:0}]})),u=It(()=>({responsive:!0,plugins:{legend:{display:!1}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(f,g)=>`${Math.round((f+Number.EPSILON)*1e3)/1e3} GB`},grid:{display:!1}}}})),d=It(()=>({responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{label:f=>`${f.formattedValue} MB/s`}}},scales:{x:{ticks:{display:!1},grid:{display:!0}},y:{ticks:{callback:(f,g)=>`${Math.round((f+Number.EPSILON)*1e3)/1e3} MB/s`},grid:{display:!0}}}}));return(f,g)=>(D(),I("div",Xc,[b("div",Kc,[b("div",qc,[b("div",Gc,[b("small",Jc,[T(j,{t:"Peers Data Usage"})])]),b("div",Qc,[T(G(Yc),{data:l.value,options:u.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["data","options"])])])]),b("div",Zc,[b("div",th,[b("div",eh,[b("small",ih,[T(j,{t:"Real Time Received Data Usage"})]),s.value.data.length>0?(D(),I("small",sh,B(s.value.data[s.value.data.length-1])+" MB/s ",1)):H("",!0)]),b("div",nh,[T(G(hn),{options:d.value,data:h.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])]),b("div",oh,[b("div",rh,[b("div",ah,[b("small",lh,[T(j,{t:"Real Time Sent Data Usage"})]),e.value.data.length>0?(D(),I("small",ch,B(e.value.data[e.value.data.length-1])+" MB/s ",1)):H("",!0)]),b("div",hh,[T(G(hn),{options:d.value,data:c.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])])]))}},uh={name:"peerSearch",components:{LocaleText:j},setup(){const i=ei(),t=pn();return{store:i,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:pt("Status"),name:pt("Name"),allowed_ip:pt("Allowed IPs"),restricted:pt("Restricted")},interval:{5e3:pt("5 Seconds"),1e4:pt("10 Seconds"),3e4:pt("30 Seconds"),6e4:pt("1 Minutes")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{debounce(){this.searchStringTimeout?(clearTimeout(this.searchStringTimeout),this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)):this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)},updateSort(i){ue("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:i},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(i){ue("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:i},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){Gt(`/api/downloadAllPeers/${this.configuration.Name}`,{},i=>{console.log(i),window.wireguard.generateZipFiles(i,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return pt("Search Peers...")}}},fh={class:"d-flex flex-column gap-2 my-4"},gh={class:"d-flex gap-2 peerSearchContainer"},ph={class:"dropdown"},mh={"data-bs-toggle":"dropdown",class:"btn w-100 btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},bh={class:"badge text-bg-primary ms-2"},_h={class:"dropdown-menu rounded-3"},xh=["onClick"],yh={class:"ms-auto"},vh={key:0,class:"bi bi-check-circle-fill"},wh={class:"dropdown"},Sh={"data-bs-toggle":"dropdown",class:"btn btn-sm w-100 text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},kh={class:"badge text-bg-primary ms-2"},Mh={class:"dropdown-menu rounded-3"},Ph=["onClick"],Ch={class:"ms-auto"},Oh={key:0,class:"bi bi-check-circle-fill"};function Dh(i,t,e,s,n,o){const r=_e("LocaleText");return D(),I("div",fh,[b("div",gh,[b("div",ph,[b("button",mh,[t[4]||(t[4]=b("i",{class:"bi bi-sort-up me-2"},null,-1)),T(r,{t:"Sort By"}),b("span",bh,B(this.sort[s.store.Configuration.Server.dashboard_sort]),1)]),b("ul",_h,[(D(!0),I(Xt,null,xi(this.sort,(a,l)=>(D(),I("li",null,[b("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateSort(l)},[b("small",null,B(a),1),b("small",yh,[s.store.Configuration.Server.dashboard_sort===l?(D(),I("i",vh)):H("",!0)])],8,xh)]))),256))])]),b("div",wh,[b("button",Sh,[t[5]||(t[5]=b("i",{class:"bi bi-arrow-repeat me-2"},null,-1)),T(r,{t:"Refresh Interval"}),b("span",kh,B(this.interval[s.store.Configuration.Server.dashboard_refresh_interval]),1)]),b("ul",Mh,[(D(!0),I(Xt,null,xi(this.interval,(a,l)=>(D(),I("li",null,[b("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateRefreshInterval(l)},[b("small",null,B(a),1),b("small",Ch,[s.store.Configuration.Server.dashboard_refresh_interval===l?(D(),I("i",Oh)):H("",!0)])],8,Ph)]))),256))])]),b("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle ms-lg-auto",onClick:t[0]||(t[0]=a=>this.$emit("search"))},[t[6]||(t[6]=b("i",{class:"bi bi-search me-2"},null,-1)),T(r,{t:"Search"})]),b("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[1]||(t[1]=a=>this.downloadAllPeer())},[t[7]||(t[7]=b("i",{class:"bi bi-download me-2 me-lg-0 me-xl-2"},null,-1)),T(r,{t:"Download All",class:"d-sm-block d-lg-none d-xl-block"})]),b("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[2]||(t[2]=a=>this.$emit("selectPeers"))},[t[8]||(t[8]=b("i",{class:"bi bi-check2-all me-2 me-lg-0 me-xl-2"},null,-1)),T(r,{t:"Select Peers",class:"d-sm-block d-lg-none d-xl-block"})]),b("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[3]||(t[3]=a=>this.$emit("jobsAll")),type:"button","aria-expanded":"false"},[t[9]||(t[9]=b("i",{class:"bi bi-person-walking me-2 me-lg-0 me-xl-2"},null,-1)),T(r,{t:"Active Jobs",class:"d-sm-block d-lg-none d-xl-block"})])])])}const Th=Pe(uh,[["render",Dh],["__scopeId","data-v-2c7d446a"]]);function Ah(i){return mo()?(bo(i),!0):!1}function co(i){return typeof i=="function"?i():G(i)}const ho=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Lh=Object.prototype.toString,Rh=i=>Lh.call(i)==="[object Object]",Ke=()=>{},Ih=Eh();function Eh(){var i,t;return ho&&((i=window?.navigator)==null?void 0:i.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function de(i){var t;const e=co(i);return(t=e?.$el)!=null?t:e}const uo=ho?window:void 0;function mi(...i){let t,e,s,n;if(typeof i[0]=="string"||Array.isArray(i[0])?([e,s,n]=i,t=uo):[t,e,s,n]=i,!t)return Ke;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},a=(h,u,d,f)=>(h.addEventListener(u,d,f),()=>h.removeEventListener(u,d,f)),l=be(()=>[de(t),co(n)],([h,u])=>{if(r(),!h)return;const d=Rh(u)?{...u}:u;o.push(...e.flatMap(f=>s.map(g=>a(h,f,g,d))))},{immediate:!0,flush:"post"}),c=()=>{l(),r()};return Ah(c),c}let dn=!1;function Fh(i,t,e={}){const{window:s=uo,ignore:n=[],capture:o=!0,detectIframe:r=!1}=e;if(!s)return Ke;Ih&&!dn&&(dn=!0,Array.from(s.document.body.children).forEach(d=>d.addEventListener("click",Ke)),s.document.documentElement.addEventListener("click",Ke));let a=!0;const l=d=>n.some(f=>{if(typeof f=="string")return Array.from(s.document.querySelectorAll(f)).some(g=>g===d.target||d.composedPath().includes(g));{const g=de(f);return g&&(d.target===g||d.composedPath().includes(g))}}),h=[mi(s,"click",d=>{const f=de(i);if(!(!f||f===d.target||d.composedPath().includes(f))){if(d.detail===0&&(a=!l(d)),!a){a=!0;return}t(d)}},{passive:!0,capture:o}),mi(s,"pointerdown",d=>{const f=de(i);a=!l(d)&&!!(f&&!d.composedPath().includes(f))},{passive:!0}),r&&mi(s,"blur",d=>{setTimeout(()=>{var f;const g=de(i);((f=s.document.activeElement)==null?void 0:f.tagName)==="IFRAME"&&!g?.contains(s.document.activeElement)&&t(d)},0)})].filter(Boolean);return()=>h.forEach(d=>d())}const zh={key:0,class:"position-absolute d-block p-1 px-2 bg-body text-body rounded-3 border shadow"},Bh={__name:"peerSettingsDropdownTool",props:{icon:String,title:String},emits:["click"],setup(i,{emit:t}){const e=t,s=K(!1);return(n,o)=>(D(),I("a",{class:"dropdown-item text-center px-0 rounded-3 position-relative",role:"button",onMouseenter:o[0]||(o[0]=r=>s.value=!0),onMouseleave:o[1]||(o[1]=r=>s.value=!1),onClick:o[2]||(o[2]=r=>e("click"))},[b("i",{class:St(["me-auto bi",i.icon])},null,2),T(Ai,{name:"zoomReversed"},{default:Et(()=>[s.value?(D(),I("span",zh,[b("small",null,B(i.title),1)])):H("",!0)]),_:1})],32))}},$h=Pe(Bh,[["__scopeId","data-v-2d66aeb6"]]),Hh={name:"peerSettingsDropdown",components:{PeerSettingsDropdownTool:$h,LocaleText:j},setup(){return{dashboardStore:ei()}},props:{Peer:Object},data(){return{deleteBtnDisabled:!1,restrictBtnDisabled:!1,allowAccessBtnDisabled:!1,confirmDelete:!1}},methods:{downloadPeer(){Gt("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},i=>{if(i.status){const t=new Blob([i.data.file],{type:"text/plain"}),e=URL.createObjectURL(t),s=`${i.data.fileName}.conf`,n=document.createElement("a");n.href=e,n.download=s,n.click(),this.dashboardStore.newMessage("WGDashboard","Peer download started","success")}else this.dashboardStore.newMessage("Server",i.message,"danger")})},downloadQRCode(i){Gt("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},t=>{t.status?this.$emit(i,t.data.file):this.dashboardStore.newMessage("Server",t.message,"danger")})},deletePeer(){this.deleteBtnDisabled=!0,ue(`/api/deletePeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.deleteBtnDisabled=!1})},restrictPeer(){this.restrictBtnDisabled=!0,ue(`/api/restrictPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.restrictBtnDisabled=!1})},allowAccessPeer(){this.allowAccessBtnDisabled=!0,ue(`/api/allowAccessPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.allowAccessBtnDisabled=!1})}}},Nh={class:"dropdown-menu mt-2 shadow-lg d-block rounded-3",style:{"max-width":"200px"}},Wh={style:{"font-size":"0.8rem","padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Vh={class:"text-body d-flex"},jh={class:"ms-auto"},Uh={key:1},Yh={class:"w-100 dropdown-item text-muted",style:{"white-space":"break-spaces","font-size":"0.7rem"}},Xh={key:2},Kh={class:"d-flex",style:{"padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},qh={key:1,class:"confirmDelete"},Gh={style:{"white-space":"break-spaces"},class:"mb-2 d-block fw-bold"},Jh={class:"d-flex w-100 gap-2"},Qh=["disabled"],Zh=["disabled"],td={key:1};function ed(i,t,e,s,n,o){const r=_e("LocaleText"),a=_e("PeerSettingsDropdownTool");return D(),I("ul",Nh,[this.Peer.restricted?(D(),I("li",td,[b("a",{class:St(["dropdown-item d-flex text-warning",{disabled:this.allowAccessBtnDisabled}]),onClick:t[10]||(t[10]=l=>this.allowAccessPeer()),role:"button"},[t[22]||(t[22]=b("i",{class:"me-auto bi bi-unlock"},null,-1)),this.allowAccessBtnDisabled?(D(),$(r,{key:1,t:"Allowing Access..."})):(D(),$(r,{key:0,t:"Allow Access"}))],2)])):(D(),I(Xt,{key:0},[this.confirmDelete?(D(),I("li",qh,[b("p",Gh,[T(r,{t:"Are you sure to delete this peer?"})]),b("div",Jh,[b("button",{onClick:t[8]||(t[8]=l=>this.deletePeer()),disabled:this.deleteBtnDisabled,class:"flex-grow-1 ms-auto btn btn-sm bg-danger"},[T(r,{t:"Yes"})],8,Qh),b("button",{disabled:this.deleteBtnDisabled,onClick:t[9]||(t[9]=l=>this.confirmDelete=!1),class:"flex-grow-1 btn btn-sm bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle"},[T(r,{t:"No"})],8,Zh)])])):(D(),I(Xt,{key:0},[this.Peer.status==="running"?(D(),I(Xt,{key:0},[b("li",Wh,[b("span",Vh,[t[11]||(t[11]=b("i",{class:"bi bi-box-arrow-in-right"},null,-1)),b("span",jh,B(this.Peer.endpoint),1)])]),t[12]||(t[12]=b("li",null,[b("hr",{class:"dropdown-divider"})],-1))],64)):H("",!0),this.Peer.private_key?(D(),I("li",Xh,[t[13]||(t[13]=b("div",{class:"text-center text-muted"},null,-1)),b("div",Kh,[T(a,{icon:"bi-download",title:"Download",onClick:t[0]||(t[0]=l=>this.downloadPeer())}),T(a,{icon:"bi-qr-code",title:"QR Code",onClick:t[1]||(t[1]=l=>this.$emit("qrcode"))}),T(a,{icon:"bi-body-text",title:"Configuration File",onClick:t[2]||(t[2]=l=>this.$emit("configurationFile"))}),T(a,{icon:"bi-share",title:"Share",onClick:t[3]||(t[3]=l=>this.$emit("share"))})])])):(D(),I("li",Uh,[b("small",Yh,[T(r,{t:"Download & QR Code is not available due to no private key set for this peer"})])])),t[20]||(t[20]=b("li",null,[b("hr",{class:"dropdown-divider"})],-1)),b("li",null,[b("a",{class:"dropdown-item d-flex",role:"button",onClick:t[4]||(t[4]=l=>this.$emit("setting"))},[t[14]||(t[14]=b("i",{class:"me-auto bi bi-pen"},null,-1)),t[15]||(t[15]=$t()),T(r,{t:"Peer Settings"})])]),b("li",null,[b("a",{class:"dropdown-item d-flex",role:"button",onClick:t[5]||(t[5]=l=>this.$emit("jobs"))},[t[16]||(t[16]=b("i",{class:"me-auto bi bi-app-indicator"},null,-1)),t[17]||(t[17]=$t()),T(r,{t:"Schedule Jobs"})])]),t[21]||(t[21]=b("li",null,[b("hr",{class:"dropdown-divider"})],-1)),b("li",null,[b("a",{class:St(["dropdown-item d-flex text-warning",{disabled:this.restrictBtnDisabled}]),onClick:t[6]||(t[6]=l=>this.restrictPeer()),role:"button"},[t[18]||(t[18]=b("i",{class:"me-auto bi bi-lock"},null,-1)),this.restrictBtnDisabled?(D(),$(r,{key:1,t:"Restricting..."})):(D(),$(r,{key:0,t:"Restrict Access"}))],2)]),b("li",null,[b("a",{class:St(["dropdown-item d-flex fw-bold text-danger",{disabled:this.deleteBtnDisabled}]),onClick:t[7]||(t[7]=l=>this.confirmDelete=!0),role:"button"},[t[19]||(t[19]=b("i",{class:"me-auto bi bi-trash"},null,-1)),this.deleteBtnDisabled?(D(),$(r,{key:1,t:"Deleting..."})):(D(),$(r,{key:0,t:"Delete"}))],2)])],64))],64))])}const id=Pe(Hh,[["render",ed],["__scopeId","data-v-dc8f29f3"]]),sd={name:"peer",components:{LocaleText:j,PeerSettingsDropdown:id},props:{Peer:Object},data(){return{}},setup(){const i=K(null),t=K(!1);return Fh(i,e=>{t.value=!1}),{target:i,subMenuOpened:t}},computed:{getLatestHandshake(){return this.Peer.latest_handshake.includes(",")?this.Peer.latest_handshake.split(",")[0]:this.Peer.latest_handshake}}},nd={key:0,class:"card-header bg-transparent d-flex align-items-center gap-2 border-0"},od={style:{"font-size":"0.8rem"},class:"ms-auto d-flex gap-2"},rd={class:"text-primary"},ad={class:"text-success"},ld={key:0,class:"text-secondary"},cd={key:1,class:"border-0 card-header bg-transparent text-warning fw-bold",style:{"font-size":"0.8rem"}},hd={class:"card-body pt-1",style:{"font-size":"0.9rem"}},dd={class:"mb-1"},ud={class:"text-muted"},fd={class:"d-block"},gd={class:"text-muted"},pd={class:"d-block"},md={key:0},bd={class:"text-muted"},_d={class:"d-block"},xd={class:"d-flex align-items-end"};function yd(i,t,e,s,n,o){const r=_e("LocaleText"),a=_e("PeerSettingsDropdown");return D(),I("div",{class:St(["card shadow-sm rounded-3 peerCard",{"border-warning":e.Peer.restricted}])},[b("div",null,[e.Peer.restricted?(D(),I("div",cd,[t[12]||(t[12]=b("i",{class:"bi-lock-fill me-2"},null,-1)),T(r,{t:"Access Restricted"})])):(D(),I("div",nd,[b("div",{class:St(["dot ms-0",{active:e.Peer.status==="running"}])},null,2),b("div",od,[b("span",rd,[t[7]||(t[7]=b("i",{class:"bi bi-arrow-down"},null,-1)),b("strong",null,B((e.Peer.cumu_receive+e.Peer.total_receive).toFixed(4)),1),t[8]||(t[8]=$t(" GB "))]),b("span",ad,[t[9]||(t[9]=b("i",{class:"bi bi-arrow-up"},null,-1)),b("strong",null,B((e.Peer.cumu_sent+e.Peer.total_sent).toFixed(4)),1),t[10]||(t[10]=$t(" GB "))]),e.Peer.latest_handshake!=="No Handshake"?(D(),I("span",ld,[t[11]||(t[11]=b("i",{class:"bi bi-arrows-angle-contract"},null,-1)),$t(" "+B(o.getLatestHandshake)+" ago ",1)])):H("",!0)])]))]),b("div",hd,[b("h6",null,B(e.Peer.name?e.Peer.name:"Untitled Peer"),1),b("div",dd,[b("small",ud,[T(r,{t:"Public Key"})]),b("small",fd,[b("samp",null,B(e.Peer.id),1)])]),b("div",null,[b("small",gd,[T(r,{t:"Allowed IPs"})]),b("small",pd,[b("samp",null,B(e.Peer.allowed_ip),1)])]),e.Peer.advanced_security?(D(),I("div",md,[b("small",bd,[T(r,{t:"Advanced Security"})]),b("small",_d,[b("samp",null,B(e.Peer.advanced_security),1)])])):H("",!0),b("div",xd,[b("div",{class:St(["ms-auto px-2 rounded-3 subMenuBtn",{active:this.subMenuOpened}])},[b("a",{role:"button",class:"text-body",onClick:t[0]||(t[0]=l=>this.subMenuOpened=!0)},t[13]||(t[13]=[b("h5",{class:"mb-0"},[b("i",{class:"bi bi-three-dots"})],-1)])),T(Ai,{name:"slide-fade"},{default:Et(()=>[this.subMenuOpened?(D(),$(a,{key:0,onQrcode:t[1]||(t[1]=l=>this.$emit("qrcode")),onConfigurationFile:t[2]||(t[2]=l=>this.$emit("configurationFile")),onSetting:t[3]||(t[3]=l=>this.$emit("setting")),onJobs:t[4]||(t[4]=l=>this.$emit("jobs")),onRefresh:t[5]||(t[5]=l=>this.$emit("refresh")),onShare:t[6]||(t[6]=l=>this.$emit("share")),Peer:e.Peer,ref:"target"},null,8,["Peer"])):H("",!0)]),_:1})],2)])])],2)}const vd=Pe(sd,[["render",yd],["__scopeId","data-v-b471ab00"]]),wd={__name:"peerListModals",props:{configurationModals:Object,configurationModalSelectedPeer:Object},emits:["refresh"],setup(i,{emit:t}){const e=t,s=rt(()=>at(()=>import("./peerShareLinkModal-qnsW_7dL.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),n=rt(()=>at(()=>import("./peerJobs-BOyF_5dv.js"),__vite__mapDeps([7,8,1,2,4,3,5,9,10]))),o=rt(()=>at(()=>import("./peerQRCode-DUJVvuUn.js"),__vite__mapDeps([11,12,5,1,2]))),r=rt(()=>at(()=>import("./peerConfigurationFile-04r_7ZIU.js"),__vite__mapDeps([13,1,2,5,12,14]))),a=rt(()=>at(()=>import("./peerSettings-B_tOmYh0.js"),__vite__mapDeps([15,1,2,5,16])));return(l,c)=>(D(),$(yi,{name:"zoom"},{default:Et(()=>[i.configurationModals.peerSetting.modalOpen?(D(),$(G(a),{key:"PeerSettingsModal",selectedPeer:i.configurationModalSelectedPeer,onRefresh:c[0]||(c[0]=h=>e("refresh")),onClose:c[1]||(c[1]=h=>i.configurationModals.peerSetting.modalOpen=!1)},null,8,["selectedPeer"])):H("",!0),i.configurationModals.peerQRCode.modalOpen?(D(),$(G(o),{key:"PeerQRCodeModal",selectedPeer:i.configurationModalSelectedPeer,onClose:c[2]||(c[2]=h=>i.configurationModals.peerQRCode.modalOpen=!1)},null,8,["selectedPeer"])):H("",!0),i.configurationModals.peerScheduleJobs.modalOpen?(D(),$(G(n),{key:"PeerJobsModal",onRefresh:c[3]||(c[3]=h=>e("refresh")),selectedPeer:i.configurationModalSelectedPeer,onClose:c[4]||(c[4]=h=>i.configurationModals.peerScheduleJobs.modalOpen=!1)},null,8,["selectedPeer"])):H("",!0),i.configurationModals.peerShare.modalOpen?(D(),$(G(s),{key:"PeerShareLinkModal",onClose:c[5]||(c[5]=h=>{i.configurationModals.peerShare.modalOpen=!1}),selectedPeer:i.configurationModalSelectedPeer},null,8,["selectedPeer"])):H("",!0),i.configurationModals.peerConfigurationFile.modalOpen?(D(),$(G(r),{key:4,onClose:c[6]||(c[6]=h=>i.configurationModals.peerConfigurationFile.modalOpen=!1),selectedPeer:i.configurationModalSelectedPeer},null,8,["selectedPeer"])):H("",!0)]),_:1}))}},Sd={style:{"margin-bottom":"20px",height:"1px"},id:"loadMore"},kd={__name:"peerIntersectionObserver",props:["peerListLength","showPeersCount"],emits:["loadMore"],setup(i,{emit:t}){const e=K(void 0),s=t;return Di(()=>{e.value=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&s("loadMore")})},{rootMargin:"20px",threshold:1}),e.value.observe(document.querySelector("#loadMore"))}),Ti(()=>{e.value.disconnect()}),(n,o)=>(D(),I("div",Sd))}},Md={class:"container-fluid"},Pd={class:"d-flex align-items-sm-center flex-column flex-sm-row gap-3"},Cd={class:"text-muted d-flex align-items-center gap-2"},Od={class:"mb-0"},Dd={class:"d-flex align-items-center gap-3"},Td={class:"mb-0 display-4"},Ad={class:"ms-sm-auto d-flex gap-2 flex-column"},Ld={class:"card rounded-3 bg-transparent"},Rd={class:"card-body py-2 d-flex align-items-center"},Id={class:"text-muted"},Ed={class:"form-check form-switch mb-0 ms-auto pe-0 me-0"},Fd=["for"],zd={key:2,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},Bd=["disabled","id"],$d={class:"d-flex gap-2"},Hd={class:"row mt-3 gy-2 gx-2 mb-2"},Nd={class:"col-12 col-lg-3"},Wd={class:"card rounded-3 bg-transparent h-100"},Vd={class:"card-body py-2 d-flex flex-column justify-content-center"},jd={class:"mb-0 text-muted"},Ud={class:"col-12 col-lg-3"},Yd={class:"card rounded-3 bg-transparent h-100"},Xd={class:"card-body py-2 d-flex flex-column justify-content-center"},Kd={class:"mb-0 text-muted"},qd={style:{"word-break":"break-all"},class:"col-12 col-lg-6"},Gd={class:"card rounded-3 bg-transparent h-100"},Jd={class:"card-body py-2 d-flex flex-column justify-content-center"},Qd={class:"mb-0 text-muted"},Zd={class:"row gx-2 gy-2 mb-2"},tu={class:"col-12 col-lg-3"},eu={class:"card rounded-3 bg-transparent h-100"},iu={class:"card-body d-flex"},su={class:"mb-0 text-muted"},nu={class:"h4"},ou={class:"col-12 col-lg-3"},ru={class:"card rounded-3 bg-transparent h-100"},au={class:"card-body d-flex"},lu={class:"mb-0 text-muted"},cu={class:"h4"},hu={class:"col-12 col-lg-3"},du={class:"card rounded-3 bg-transparent h-100"},uu={class:"card-body d-flex"},fu={class:"mb-0 text-muted"},gu={class:"h4 text-primary"},pu={class:"col-12 col-lg-3"},mu={class:"card rounded-3 bg-transparent h-100"},bu={class:"card-body d-flex"},_u={class:"mb-0 text-muted"},xu={class:"h4 text-success"},yu={style:{"margin-bottom":"80px"}},vu=20,wu={__name:"peerListNew",async setup(i){let t,e;const s=rt(()=>at(()=>import("./peerSearchBar-DGGMYA9w.js"),__vite__mapDeps([17,1,2,5,18]))),n=rt(()=>at(()=>import("./peerJobsAllModal-CfdUcdt8.js"),__vite__mapDeps([19,8,1,2,4,3,5,9]))),o=rt(()=>at(()=>import("./peerJobsLogsModal-mgEtYGm3.js"),__vite__mapDeps([20,3,1,2,5]))),r=rt(()=>at(()=>import("./editConfiguration-BUCsBeAe.js"),__vite__mapDeps([21,1,2,5,3,22]))),a=rt(()=>at(()=>import("./selectPeers-BJjPrLQo.js"),__vite__mapDeps([23,1,2,5,24]))),l=rt(()=>at(()=>import("./peerAddModal-BZ0JlLvf.js"),__vite__mapDeps([25,1,2,5,26,27]))),c=ei(),h=pn(),u=wo(),d=K({}),f=K([]),g=K(!1),m=K({}),p=K({peerNew:{modalOpen:!1},peerSetting:{modalOpen:!1},peerScheduleJobs:{modalOpen:!1},peerQRCode:{modalOpen:!1},peerConfigurationFile:{modalOpen:!1},peerCreate:{modalOpen:!1},peerScheduleJobsAll:{modalOpen:!1},peerScheduleJobsLogs:{modalOpen:!1},peerShare:{modalOpen:!1},editConfiguration:{modalOpen:!1},selectPeers:{modalOpen:!1},backupRestore:{modalOpen:!1},deleteConfiguration:{modalOpen:!1},editRawConfigurationFile:{modalOpen:!1}}),_=K(!1),y=async()=>{await Gt("/api/getWireguardConfigurationInfo",{configurationName:u.params.id},S=>{S.status&&(d.value=S.data.configurationInfo,f.value=S.data.configurationPeers,f.value.forEach(x=>{x.restricted=!1}),S.data.configurationRestrictedPeers.forEach(x=>{x.restricted=!0,f.value.push(x)}))})};[t,e]=_o(()=>y()),await t,e();const k=K(void 0),M=()=>{clearInterval(k.value),k.value=setInterval(async()=>{await y()},parseInt(c.Configuration.Server.dashboard_refresh_interval))};M(),Ti(()=>{clearInterval(k.value),k.value=void 0}),be(()=>c.Configuration.Server.dashboard_refresh_interval,()=>{M()});const v=async()=>{g.value=!0,await Gt("/api/toggleWireguardConfiguration/",{configurationName:d.value.Name},S=>{S.status?c.newMessage("Server",`${d.value.Name} ${S.data?"is on":"is off"}`,"success"):c.newMessage("Server",S.message,"danger"),h.Configurations.find(x=>x.Name===d.value.Name).Status=S.data,d.value.Status=S.data,g.value=!1})},O=It(()=>({connectedPeers:f.value.filter(S=>S.status==="running").length,totalUsage:f.value.length>0?f.value.filter(S=>!S.restricted).map(S=>S.total_data+S.cumu_data).reduce((S,x)=>S+x,0).toFixed(4):0,totalReceive:f.value.length>0?f.value.filter(S=>!S.restricted).map(S=>S.total_receive+S.cumu_receive).reduce((S,x)=>S+x,0).toFixed(4):0,totalSent:f.value.length>0?f.value.filter(S=>!S.restricted).map(S=>S.total_sent+S.cumu_sent).reduce((S,x)=>S+x,0).toFixed(4):0})),C=K(10),P=It(()=>{const S=h.searchString?f.value.filter(x=>x.name.includes(h.searchString)||x.id.includes(h.searchString)||x.allowed_ip.includes(h.searchString)):f.value;return c.Configuration.Server.dashboard_sort==="restricted"?S.sort((x,w)=>x[c.Configuration.Server.dashboard_sort]<w[c.Configuration.Server.dashboard_sort]?1:x[c.Configuration.Server.dashboard_sort]>w[c.Configuration.Server.dashboard_sort]?-1:0).slice(0,C.value):S.sort((x,w)=>x[c.Configuration.Server.dashboard_sort]<w[c.Configuration.Server.dashboard_sort]?-1:x[c.Configuration.Server.dashboard_sort]>w[c.Configuration.Server.dashboard_sort]?1:0).slice(0,C.value)});return(S,x)=>(D(),I("div",Md,[b("div",Pd,[b("div",null,[b("div",Cd,[b("h5",Od,[T(So,{protocol:d.value.Protocol},null,8,["protocol"])])]),b("div",Dd,[b("h1",Td,[b("samp",null,B(d.value.Name),1)])])]),b("div",Ad,[b("div",Ld,[b("div",Rd,[b("small",Id,[T(j,{t:"Status"})]),b("div",{class:St(["dot ms-2",{active:d.value.Status}])},null,2),b("div",Ed,[b("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+d.value.id},[d.value.Status&&!g.value?(D(),$(j,{key:0,t:"On"})):!d.value.Status&&!g.value?(D(),$(j,{key:1,t:"Off"})):H("",!0),g.value?(D(),I("span",zd)):H("",!0)],8,Fd),xo(b("input",{class:"form-check-input",style:{cursor:"pointer"},disabled:g.value,type:"checkbox",role:"switch",id:"switch"+d.value.id,onChange:x[0]||(x[0]=w=>v()),"onUpdate:modelValue":x[1]||(x[1]=w=>d.value.Status=w)},null,40,Bd),[[yo,d.value.Status]])])])]),b("div",$d,[b("a",{role:"button",onClick:x[2]||(x[2]=w=>p.value.peerNew.modalOpen=!0),class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle"},[x[29]||(x[29]=b("i",{class:"bi bi-plus-circle me-2"},null,-1)),T(j,{t:"Peer"})]),b("button",{class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:x[3]||(x[3]=w=>p.value.editConfiguration.modalOpen=!0),type:"button","aria-expanded":"false"},[x[30]||(x[30]=b("i",{class:"bi bi-gear-fill me-2"},null,-1)),T(j,{t:"Configuration Settings"})])])])]),x[35]||(x[35]=b("hr",null,null,-1)),b("div",Hd,[b("div",Nd,[b("div",Wd,[b("div",Vd,[b("p",jd,[b("small",null,[T(j,{t:"Address"})])]),$t(" "+B(d.value.Address),1)])])]),b("div",Ud,[b("div",Yd,[b("div",Xd,[b("p",Kd,[b("small",null,[T(j,{t:"Listen Port"})])]),$t(" "+B(d.value.ListenPort),1)])])]),b("div",qd,[b("div",Gd,[b("div",Jd,[b("p",Qd,[b("small",null,[T(j,{t:"Public Key"})])]),b("samp",null,B(d.value.PublicKey),1)])])])]),b("div",Zd,[b("div",tu,[b("div",eu,[b("div",iu,[b("div",null,[b("p",su,[b("small",null,[T(j,{t:"Connected Peers"})])]),b("strong",nu,B(O.value.connectedPeers)+" / "+B(f.value.length),1)]),x[31]||(x[31]=b("i",{class:"bi bi-ethernet ms-auto h2 text-muted"},null,-1))])])]),b("div",ou,[b("div",ru,[b("div",au,[b("div",null,[b("p",lu,[b("small",null,[T(j,{t:"Total Usage"})])]),b("strong",cu,B(O.value.totalUsage)+" GB",1)]),x[32]||(x[32]=b("i",{class:"bi bi-arrow-down-up ms-auto h2 text-muted"},null,-1))])])]),b("div",hu,[b("div",du,[b("div",uu,[b("div",null,[b("p",fu,[b("small",null,[T(j,{t:"Total Received"})])]),b("strong",gu,B(O.value.totalReceive)+" GB",1)]),x[33]||(x[33]=b("i",{class:"bi bi-arrow-down ms-auto h2 text-muted"},null,-1))])])]),b("div",pu,[b("div",mu,[b("div",bu,[b("div",null,[b("p",_u,[b("small",null,[T(j,{t:"Total Sent"})])]),b("strong",xu,B(O.value.totalSent)+" GB",1)]),x[34]||(x[34]=b("i",{class:"bi bi-arrow-up ms-auto h2 text-muted"},null,-1))])])])]),T(dh,{configurationPeers:f.value,configurationInfo:d.value},null,8,["configurationPeers","configurationInfo"]),x[36]||(x[36]=b("hr",null,null,-1)),b("div",yu,[f.value.length>0?(D(),$(Th,{key:0,onSearch:x[4]||(x[4]=w=>_.value=!0),onJobsAll:x[5]||(x[5]=w=>p.value.peerScheduleJobsAll.modalOpen=!0),onJobLogs:x[6]||(x[6]=w=>p.value.peerScheduleJobsLogs.modalOpen=!0),onEditConfiguration:x[7]||(x[7]=w=>p.value.editConfiguration.modalOpen=!0),onSelectPeers:x[8]||(x[8]=w=>p.value.selectPeers.modalOpen=!0),onBackupRestore:x[9]||(x[9]=w=>p.value.backupRestore.modalOpen=!0),onDeleteConfiguration:x[10]||(x[10]=w=>p.value.deleteConfiguration.modalOpen=!0),configuration:d.value},null,8,["configuration"])):H("",!0),T(yi,{name:"peerList",tag:"div",class:"row gx-2 gy-2 z-0 position-relative"},{default:Et(()=>[(D(!0),I(Xt,null,xi(P.value,w=>(D(),I("div",{class:"col-12 col-lg-6 col-xl-4",key:w.id},[T(vd,{Peer:w,onShare:A=>{p.value.peerShare.modalOpen=!0,m.value=w},onRefresh:x[11]||(x[11]=A=>y()),onJobs:A=>{p.value.peerScheduleJobs.modalOpen=!0,m.value=w},onSetting:A=>{p.value.peerSetting.modalOpen=!0,m.value=w},onQrcode:A=>{m.value=w,p.value.peerQRCode.modalOpen=!0},onConfigurationFile:A=>{m.value=w,p.value.peerConfigurationFile.modalOpen=!0}},null,8,["Peer","onShare","onJobs","onSetting","onQrcode","onConfigurationFile"])]))),128))]),_:1})]),T(Ai,{name:"slideUp"},{default:Et(()=>[_.value?(D(),$(G(s),{key:0,onClose:x[12]||(x[12]=w=>_.value=!1)})):H("",!0)]),_:1}),T(wd,{configurationModals:p.value,configurationModalSelectedPeer:m.value,onRefresh:x[13]||(x[13]=w=>y())},null,8,["configurationModals","configurationModalSelectedPeer"]),T(yi,{name:"zoom"},{default:Et(()=>[(D(),$(vo,{key:"PeerAddModal"},{default:Et(()=>[p.value.peerNew.modalOpen?(D(),$(G(l),{key:0,onClose:x[14]||(x[14]=w=>p.value.peerNew.modalOpen=!1),onAddedPeers:x[15]||(x[15]=w=>{p.value.peerNew.modalOpen=!1,y()})})):H("",!0)]),_:1})),p.value.peerScheduleJobsAll.modalOpen?(D(),$(G(n),{key:"PeerJobsAllModal",onRefresh:x[16]||(x[16]=w=>y()),onAllLogs:x[17]||(x[17]=w=>p.value.peerScheduleJobsLogs.modalOpen=!0),onClose:x[18]||(x[18]=w=>p.value.peerScheduleJobsAll.modalOpen=!1),configurationPeers:f.value},null,8,["configurationPeers"])):H("",!0),p.value.peerScheduleJobsLogs.modalOpen?(D(),$(G(o),{key:"PeerJobsLogsModal",onClose:x[19]||(x[19]=w=>p.value.peerScheduleJobsLogs.modalOpen=!1),configurationInfo:d.value},null,8,["configurationInfo"])):H("",!0),p.value.editConfiguration.modalOpen?(D(),$(G(r),{key:"EditConfigurationModal",onEditRaw:x[20]||(x[20]=w=>p.value.editRawConfigurationFile.modalOpen=!0),onClose:x[21]||(x[21]=w=>p.value.editConfiguration.modalOpen=!1),onDataChanged:x[22]||(x[22]=w=>d.value=w),onRefresh:x[23]||(x[23]=w=>y()),onBackupRestore:x[24]||(x[24]=w=>p.value.backupRestore.modalOpen=!0),onDeleteConfiguration:x[25]||(x[25]=w=>p.value.deleteConfiguration.modalOpen=!0),configurationInfo:d.value},null,8,["configurationInfo"])):H("",!0),p.value.selectPeers.modalOpen?(D(),$(G(a),{key:3,onRefresh:x[26]||(x[26]=w=>y()),configurationPeers:f.value,onClose:x[27]||(x[27]=w=>p.value.selectPeers.modalOpen=!1)},null,8,["configurationPeers"])):H("",!0)]),_:1}),T(kd,{showPeersCount:C.value,peerListLength:P.value.length,onLoadMore:x[28]||(x[28]=w=>C.value+=vu)},null,8,["showPeersCount","peerListLength"])]))}},Du=Pe(wu,[["__scopeId","data-v-c4a86d7c"]]);export{Du as default};
|