Your IP : 216.73.216.93


Current Path : /home/users/unlimited/www/admin.medimeet.codeskitter.site/assets/
Upload File :
Current File : /home/users/unlimited/www/admin.medimeet.codeskitter.site/assets/Dashboard-DagddnR0.js

var Mo=Object.defineProperty;var ko=(i,t,e)=>t in i?Mo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var D=(i,t,e)=>ko(i,typeof t!="symbol"?t+"":t,e);import{f as Do,i as Co,j as u,a as Ao,y as K,J as Ce,B as C,E as L,H as Zi,T as B,M as jo,r as q,K as Dn,ah as ni,x as at,C as E,Q as Cn,F as Ji}from"./index-f5FVPPWf.js";import{d as Oo,l as To,u as An,c as ts}from"./HasPermission-D75jcuOi.js";import{u as Oi}from"./SettingData-HUsgVeqA.js";import{u as Po}from"./Users-DPTYncBa.js";import{F as z}from"./input-aKY8cD2r.js";import{u as Ro}from"./UsePatientsData-2jGB5q0K.js";import{g as jn,I as es,k as On,u as Pe}from"./index-B8iLT9XL.js";import{M as Tn,a as Pn,b as Rn,c as In}from"./menu-list-UQBnhbZh.js";import{e as Io,f as Lo,g as zo,h as vt}from"./index-CinUYxjD.js";import{A as Eo}from"./AddMedicine-0q74ZIMD.js";import{A as Fo}from"./AddNewAppointment-BJ7pZqHM.js";import{n as Zt,i as Ti,S as O,D as Pi,g as Wo}from"./Dashboard-QYea_GjR.js";import{a as Bo}from"./index-DU_wrUvN.js";import{e as Ho}from"./index-D-rZ_zLU.js";import{B as ie}from"./visually-hidden.style-BrEqndXz.js";import{A as No}from"./AddPatients-BLpTyXQl.js";import{l as Vo,m as Yo,c as $o}from"./index-NjlW3JBs.js";import{G as Ri}from"./grid-CY4MOgwY.js";import{m as Uo}from"./index.esm-CxKpqEdJ.js";import{a as is}from"./index-LnFfRe5O.js";import{A as Xo}from"./Calender-Be02IQk0.js";import{A as qo}from"./Add-4SYS4JDm.js";import"./use-clickable-DJbYv-Vn.js";import"./useMutation-DWP0Ot2c.js";import"./UsersComboBox-BR1MkjhI.js";import"./popover-BeKqgCqh.js";import"./swiper-react-CbcsGzjN.js";import"./card-body-U833268K.js";import"./select-Dt5dI57S.js";import"./split-CzYrjwZo.js";import"./image-DDwLQVjO.js";import"./tr-SHTCPR9-.js";import"./IsdModal-7Szgl44l.js";import"./input-group-BHnguFbm.js";import"./today-D_vLUvRX.js";import"./findIndex-BpxUuUn_.js";import"./isEqual-963yh_6q.js";function ss(i){return Uo(i,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}const oi=Do(function(t,e){const{area:s,colSpan:n,colStart:o,colEnd:r,rowEnd:a,rowSpan:l,rowStart:c,...h}=t,d=Co({gridArea:s,gridColumn:ss(n),gridRow:ss(l),gridColumnStart:o,gridColumnEnd:r,gridRowStart:c,gridRowEnd:a});return u.jsx(Ao.div,{ref:e,__css:d,...h})});oi.displayName="GridItem";const Ko=async()=>(await Ce(K.token,"get_appointments")).data,Go=async()=>(await Ce(K.token,`get_appointments/doctor/${K.id}`)).data,Qo=()=>{const{isLoading:i,data:t,error:e}=Oi({queryKey:["dashboard-appointments"],queryFn:K.role.name==="Doctor"?Go:Ko});return{appointmentsData:t,appointmentsLoading:i,appointmentsError:e}},Zo=async()=>(await Ce(K.token,"get_all_transaction")).data,Jo=()=>{const{isLoading:i,data:t,error:e}=Oi({queryKey:["main-transactions"],queryFn:Zo});return{transactionsData:t,transactionsLoading:i,transactionsError:e}};function tr({data:i}){return u.jsxs(C,{w:"100%",borderRadius:8,overflow:"hidden",boxShadow:"lg",minH:"100%",bg:L("#fff","gray.900"),children:[u.jsxs(C,{padding:3,bg:"main.900",pb:10,color:"#fff",children:[u.jsx(Zi,{fontSize:"md",children:"Welcome Back!"}),u.jsxs(B,{fontSize:"sm",children:[K.role.name," - ",K.f_name," ",K.l_name]})]}),u.jsxs(C,{p:3,pos:"relative",bg:L("#fff","gray.900"),children:[u.jsx(jo,{src:"/admin/profile.png",w:16,top:"-8",pos:"absolute"}),u.jsx(Zi,{fontSize:"sm",mt:6,ml:1,children:K.role.name}),u.jsx(B,{fontSize:"sm",ml:1,children:K.email}),u.jsxs(C,{mt:2,ml:1,children:[u.jsxs(z,{justify:"space-between",gap:6,children:[u.jsxs(C,{flex:1,children:[u.jsx(B,{fontSize:"sm",fontWeight:500,children:"Total Active Doctors"}),u.jsx(B,{fontSize:"xl",color:"blue.600",fontWeight:700,children:i==null?void 0:i.total_active_doctors})]}),u.jsxs(C,{flex:1,children:[u.jsx(B,{fontSize:"sm",fontWeight:500,children:"Total Appointments"}),u.jsx(B,{fontSize:"xl",color:"blue.600",fontWeight:700,children:i==null?void 0:i.total_appointments})]})]}),u.jsxs(z,{justify:"space-between",gap:6,mt:2,children:[u.jsxs(C,{flex:1,children:[u.jsx(B,{fontSize:"sm",fontWeight:500,children:"Total Patients"}),u.jsx(B,{fontSize:"xl",color:"blue.600",fontWeight:700,children:i==null?void 0:i.total_patients})]}),u.jsxs(C,{flex:1,children:[u.jsx(B,{fontSize:"sm",fontWeight:500,children:"Total Users"}),u.jsx(B,{fontSize:"xl",color:"blue.600",fontWeight:700,children:i==null?void 0:i.total_users})]})]})]})]})]})}/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */function Ae(i){return i+.5|0}const Mt=(i,t,e)=>Math.max(Math.min(i,e),t);function le(i){return Mt(Ae(i*2.55),0,255)}function kt(i){return Mt(Ae(i*255),0,255)}function _t(i){return Mt(Ae(i/2.55)/100,0,1)}function ns(i){return Mt(Ae(i*100),0,100)}const rt={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"],er=i=>vi[i&15],ir=i=>vi[(i&240)>>4]+vi[i&15],Re=i=>(i&240)>>4===(i&15),sr=i=>Re(i.r)&&Re(i.g)&&Re(i.b)&&Re(i.a);function nr(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&rt[i[1]]*17,g:255&rt[i[2]]*17,b:255&rt[i[3]]*17,a:t===5?rt[i[4]]*17:255}:(t===7||t===9)&&(e={r:rt[i[1]]<<4|rt[i[2]],g:rt[i[3]]<<4|rt[i[4]],b:rt[i[5]]<<4|rt[i[6]],a:t===9?rt[i[7]]<<4|rt[i[8]]:255})),e}const or=(i,t)=>i<255?t(i):"";function rr(i){var t=sr(i)?er:ir;return i?"#"+t(i.r)+t(i.g)+t(i.b)+or(i.a,t):void 0}const ar=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ln(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 lr(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 cr(i,t,e){const s=Ln(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 hr(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function Ii(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=hr(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Li(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(kt)}function zi(i,t,e){return Li(Ln,i,t,e)}function dr(i,t,e){return Li(cr,i,t,e)}function fr(i,t,e){return Li(lr,i,t,e)}function zn(i){return(i%360+360)%360}function ur(i){const t=ar.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?le(+t[5]):kt(+t[5]));const n=zn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=dr(n,o,r):t[1]==="hsv"?s=fr(n,o,r):s=zi(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function gr(i,t){var e=Ii(i);e[0]=zn(e[0]+t),e=zi(e),i.r=e[0],i.g=e[1],i.b=e[2]}function pr(i){if(!i)return;const t=Ii(i),e=t[0],s=ns(t[1]),n=ns(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${_t(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const os={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"},rs={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 mr(){const i={},t=Object.keys(rs),e=Object.keys(os);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,os[o]);o=parseInt(rs[r],16),i[a]=[o>>16&255,o>>8&255,o&255]}return i}let Ie;function br(i){Ie||(Ie=mr(),Ie.transparent=[0,0,0,0]);const t=Ie[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const xr=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function _r(i){const t=xr.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?le(r):Mt(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?le(s):Mt(s,0,255)),n=255&(t[4]?le(n):Mt(n,0,255)),o=255&(t[6]?le(o):Mt(o,0,255)),{r:s,g:n,b:o,a:e}}}function yr(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${_t(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const hi=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Nt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function vr(i,t,e){const s=Nt(_t(i.r)),n=Nt(_t(i.g)),o=Nt(_t(i.b));return{r:kt(hi(s+e*(Nt(_t(t.r))-s))),g:kt(hi(n+e*(Nt(_t(t.g))-n))),b:kt(hi(o+e*(Nt(_t(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Le(i,t,e){if(i){let s=Ii(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=zi(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function En(i,t){return i&&Object.assign(t||{},i)}function as(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=En(i,{r:0,g:0,b:0,a:1}),t.a=kt(t.a)),t}function wr(i){return i.charAt(0)==="r"?_r(i):ur(i)}class xe{constructor(t){if(t instanceof xe)return t;const e=typeof t;let s;e==="object"?s=as(t):e==="string"&&(s=nr(t)||br(t)||wr(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=En(this._rgb);return t&&(t.a=_t(t.a)),t}set rgb(t){this._rgb=as(t)}rgbString(){return this._valid?yr(this._rgb):void 0}hexString(){return this._valid?rr(this._rgb):void 0}hslString(){return this._valid?pr(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=vr(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=Ae(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 Le(this._rgb,2,t),this}darken(t){return Le(this._rgb,2,-t),this}saturate(t){return Le(this._rgb,1,t),this}desaturate(t){return Le(this._rgb,1,-t),this}rotate(t){return gr(this._rgb,t),this}}/*!
 * Chart.js v4.4.9
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */function mt(){}const Sr=(()=>{let i=0;return()=>i++})();function H(i){return i==null}function Q(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 I(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function ct(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function ft(i,t){return ct(i)?i:t}function P(i,t){return typeof i>"u"?t:i}const Mr=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,Fn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function N(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function F(i,t,e,s){let n,o,r;if(Q(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(I(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function Ge(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function Qe(i){if(Q(i))return i.map(Qe);if(I(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=Qe(i[e[n]]);return t}return i}function Wn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function kr(i,t,e,s){if(!Wn(i))return;const n=t[i],o=e[i];I(n)&&I(o)?_e(n,o,s):t[i]=Qe(o)}function _e(i,t,e){const s=Q(t)?t:[t],n=s.length;if(!I(i))return i;e=e||{};const o=e.merger||kr;let r;for(let a=0;a<n;++a){if(r=s[a],!I(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 _e(i,t,{merger:Dr})}function Dr(i,t,e){if(!Wn(i))return;const s=t[i],n=e[i];I(s)&&I(n)?fe(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=Qe(n))}const ls={"":i=>i,x:i=>i.x,y:i=>i.y};function Cr(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 Ar(i){const t=Cr(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function ye(i,t){return(ls[t]||(ls[t]=Ar(t)))(i)}function Ei(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Ze=i=>typeof i<"u",Dt=i=>typeof i=="function",cs=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function jr(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const $=Math.PI,Y=2*$,Or=Y+$,Je=Number.POSITIVE_INFINITY,Tr=$/180,G=$/2,Ot=$/4,hs=$*2/3,Bn=Math.log10,qt=Math.sign;function ue(i,t,e){return Math.abs(i-t)<e}function ds(i){const t=Math.round(i);i=ue(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Bn(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Pr(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s===0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function Rr(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function ve(i){return!Rr(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function Ir(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Lr(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 yt(i){return i*($/180)}function zr(i){return i*(180/$)}function fs(i){if(!ct(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function Hn(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*$&&(o+=Y),{angle:o,distance:n}}function wi(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Er(i,t){return(i-t+Or)%Y-$}function St(i){return(i%Y+Y)%Y}function we(i,t,e,s){const n=St(i),o=St(t),r=St(e),a=St(o-n),l=St(r-n),c=St(n-o),h=St(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function it(i,t,e){return Math.max(t,Math.min(e,i))}function Fr(i){return it(i,-32768,32767)}function Yt(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 Lt=(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),Wr=(i,t,e)=>Fi(i,e,s=>i[s][t]>=e);function Br(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 Nn=["push","pop","shift","splice","unshift"];function Hr(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Nn.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 us(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)&&(Nn.forEach(o=>{delete i[o]}),delete i._chartjs)}function Nr(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Vn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Yn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Vn.call(window,()=>{s=!1,i.apply(t,e)}))}}function Vr(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Wi=i=>i==="start"?"left":i==="end"?"right":"center",tt=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Yr=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function $r(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,h=r.axis,{min:d,max:f,minDefined:g,maxDefined:p}=r.getUserBounds();if(g){if(n=Math.min(Lt(l,h,d).lo,e?s:Lt(t,h,r.getPixelForValue(d)).lo),c){const m=l.slice(0,n+1).reverse().findIndex(b=>!H(b[a.axis]));n-=Math.max(0,m)}n=it(n,0,s-1)}if(p){let m=Math.max(Lt(l,r.axis,f,!0).hi+1,e?0:Lt(t,h,r.getPixelForValue(f),!0).hi+1);if(c){const b=l.slice(m-1).findIndex(x=>!H(x[a.axis]));m+=Math.max(0,b)}o=it(m,n,s)-n}else o=s-n}return{start:n,count:o}}function Ur(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const ze=i=>i===0||i===1,gs=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*Y/e)),ps=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*Y/e)+1,ge={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*G)+1,easeOutSine:i=>Math.sin(i*G),easeInOutSine:i=>-.5*(Math.cos($*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>ze(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>ze(i)?i:gs(i,.075,.3),easeOutElastic:i=>ze(i)?i:ps(i,.075,.3),easeInOutElastic(i){return ze(i)?i:i<.5?.5*gs(i*2,.1125,.45):.5+.5*ps(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-ge.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?ge.easeInBounce(i*2)*.5:ge.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 ms(i){return Bi(i)?i:new xe(i)}function di(i){return Bi(i)?i:new xe(i).saturate(.5).darken(.1).hexString()}const Xr=["x","y","borderWidth","radius","tension"],qr=["color","borderColor","backgroundColor"];function Kr(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:qr},numbers:{type:"number",properties:Xr}}),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 Gr(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const bs=new Map;function Qr(i,t){t=t||{};const e=i+JSON.stringify(t);let s=bs.get(e);return s||(s=new Intl.NumberFormat(i,t),bs.set(e,s)),s}function Hi(i,t,e){return Qr(t,e).format(i)}const Zr={values(i){return Q(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=Jr(i,e)}const r=Bn(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),Hi(i,s,l)}};function Jr(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 $n={formatters:Zr};function ta(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:$n.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 Ft=Object.create(null),Si=Object.create(null);function pe(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 fi(i,t,e){return typeof t=="string"?_e(pe(i,t),e):_e(pe(i,""),t)}class ea{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)=>di(n.backgroundColor),this.hoverBorderColor=(s,n)=>di(n.borderColor),this.hoverColor=(s,n)=>di(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 fi(this,t,e)}get(t){return pe(this,t)}describe(t,e){return fi(Si,t,e)}override(t,e){return fi(Ft,t,e)}route(t,e,s,n){const o=pe(this,t),r=pe(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 I(l)?Object.assign({},c,l):P(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var X=new ea({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Kr,Gr,ta]);function ia(i){return!i||H(i.size)||H(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function xs(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 _s(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){Un(i,t,e,s,null)}function Un(i,t,e,s,n){let o,r,a,l,c,h,d,f;const g=t.pointStyle,p=t.rotation,m=t.radius;let b=(p||0)*Tr;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(b),i.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),i.restore();return}if(!(isNaN(m)||m<=0)){switch(i.beginPath(),g){default:n?i.ellipse(e,s,n/2,m,0,0,Y):i.arc(e,s,m,0,Y),i.closePath();break;case"triangle":h=n?n/2:m,i.moveTo(e+Math.sin(b)*h,s-Math.cos(b)*m),b+=hs,i.lineTo(e+Math.sin(b)*h,s-Math.cos(b)*m),b+=hs,i.lineTo(e+Math.sin(b)*h,s-Math.cos(b)*m),i.closePath();break;case"rectRounded":c=m*.516,l=m-c,r=Math.cos(b+Ot)*l,d=Math.cos(b+Ot)*(n?n/2-c:l),a=Math.sin(b+Ot)*l,f=Math.sin(b+Ot)*(n?n/2-c:l),i.arc(e-d,s-a,c,b-$,b-G),i.arc(e+f,s-r,c,b-G,b),i.arc(e+d,s+a,c,b,b+G),i.arc(e-f,s+r,c,b+G,b+$),i.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}b+=Ot;case"rectRot":d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,f=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+f,s-r),i.lineTo(e+d,s+a),i.lineTo(e-f,s+r),i.closePath();break;case"crossRot":b+=Ot;case"cross":d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,f=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+f,s-r),i.lineTo(e-f,s+r);break;case"star":d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,f=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+f,s-r),i.lineTo(e-f,s+r),b+=Ot,d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,f=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+f,s-r),i.lineTo(e-f,s+r);break;case"line":r=n?n/2:Math.cos(b)*m,a=Math.sin(b)*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(b)*(n?n/2:m),s+Math.sin(b)*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 Ni(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Vi(i){i.restore()}function sa(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 na(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 oa(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),H(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 ra(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 aa(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Me(i,t,e,s,n,o={}){const r=Q(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,oa(i,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&aa(i,o.backdrop),a&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),H(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,s,o.maxWidth)),i.fillText(c,e,s,o.maxWidth),ra(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function ki(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*$,$,!0),i.lineTo(e,s+o-r.bottomLeft),i.arc(e+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,$,G,!0),i.lineTo(e+n-r.bottomRight,s+o),i.arc(e+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,G,0,!0),i.lineTo(e+n,s+r.topRight),i.arc(e+n-r.topRight,s+r.topRight,r.topRight,0,-G,!0),i.lineTo(e+r.topLeft,s)}const la=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,ca=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function ha(i,t){const e=(""+i).match(la);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 da=i=>+i||0;function Yi(i,t){const e={},s=I(t),n=s?Object.keys(t):t,o=I(i)?s?r=>P(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=da(o(r));return e}function fa(i){return Yi(i,{top:"y",right:"x",bottom:"y",left:"x"})}function me(i){return Yi(i,["topLeft","topRight","bottomLeft","bottomRight"])}function ht(i){const t=fa(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function et(i,t){i=i||{},t=t||X.font;let e=P(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=P(i.style,t.style);s&&!(""+s).match(ca)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:P(i.family,t.family),lineHeight:ha(P(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:P(i.weight,t.weight),string:""};return n.string=ia(n),n}function Ee(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 ua(i,t,e){const{min:s,max:n}=i,o=Fn(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 $i(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=Gn("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>$i([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 qn(a,l,()=>va(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return vs(a).includes(l)},ownKeys(a){return vs(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function Kt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Xn(i,s),setContext:o=>Kt(i,o,e,s),override:o=>Kt(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 qn(o,r,()=>pa(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function Xn(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:Dt(e)?e:()=>e,isIndexable:Dt(s)?s:()=>s}}const ga=(i,t)=>i?i+Ei(t):t,Ui=(i,t)=>I(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function qn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function pa(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return Dt(a)&&r.isScriptable(t)&&(a=ma(t,a,i,e)),Q(a)&&a.length&&(a=ba(t,a,i,r.isIndexable)),Ui(t,a)&&(a=Kt(a,n,o&&o[t],r)),a}function ma(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),Ui(i,l)&&(l=Xi(n._scopes,n,i,l)),l}function ba(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(I(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Xi(c,n,i,h);t.push(Kt(d,o,r&&r[i],a))}}return t}function Kn(i,t,e){return Dt(i)?i(t,e):i}const xa=(i,t)=>i===!0?t:typeof i=="string"?ye(t,i):void 0;function _a(i,t,e,s,n){for(const o of t){const r=xa(e,o);if(r){i.add(r);const a=Kn(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 Xi(i,t,e,s){const n=t._rootScopes,o=Kn(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=ys(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=ys(a,r,o,l,s),l===null)?!1:$i(Array.from(a),[""],n,o,()=>ya(t,e,s))}function ys(i,t,e,s,n){for(;e;)e=_a(i,t,e,s,n);return e}function ya(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return Q(n)&&I(e)?e:n||{}}function va(i,t,e,s){let n;for(const o of t)if(n=Gn(ga(o,i),e),typeof n<"u")return Ui(i,n)?Xi(e,s,i,n):n}function Gn(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function vs(i){let t=i._keys;return t||(t=i._keys=wa(i._scopes)),t}function wa(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 Sa=Number.EPSILON||1e-14,Gt=(i,t)=>t<i.length&&!i[t].skip&&i[t],Qn=i=>i==="x"?"y":"x";function Ma(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=wi(o,n),l=wi(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,f=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+f*(r.x-n.x),y:o.y+f*(r.y-n.y)}}}function ka(i,t,e){const s=i.length;let n,o,r,a,l,c=Gt(i,0);for(let h=0;h<s-1;++h)if(l=c,c=Gt(i,h+1),!(!l||!c)){if(ue(t[h],0,Sa)){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 Da(i,t,e="x"){const s=Qn(e),n=i.length;let o,r,a,l=Gt(i,0);for(let c=0;c<n;++c){if(r=a,a=l,l=Gt(i,c+1),!a)continue;const h=a[e],d=a[s];r&&(o=(h-r[e])/3,a[`cp1${e}`]=h-o,a[`cp1${s}`]=d-o*t[c]),l&&(o=(l[e]-h)/3,a[`cp2${e}`]=h+o,a[`cp2${s}`]=d+o*t[c])}}function Ca(i,t="x"){const e=Qn(t),s=i.length,n=Array(s).fill(0),o=Array(s);let r,a,l,c=Gt(i,0);for(r=0;r<s;++r)if(a=l,l=c,c=Gt(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?qt(n[r-1])!==qt(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}ka(i,n,o),Da(i,o,t)}function Fe(i,t,e){return Math.max(Math.min(i,e),t)}function Aa(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=Fe(n.cp1x,t.left,t.right),n.cp1y=Fe(n.cp1y,t.top,t.bottom)),a&&(n.cp2x=Fe(n.cp2x,t.left,t.right),n.cp2y=Fe(n.cp2y,t.top,t.bottom)))}function ja(i,t,e,s,n){let o,r,a,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Ca(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=Ma(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&&Aa(i,e)}function qi(){return typeof window<"u"&&typeof document<"u"}function Ki(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ti(i,t,e){let s;return typeof i=="string"?(s=parseInt(i,10),i.indexOf("%")!==-1&&(s=s/100*t.parentNode[e])):s=i,s}const ri=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function Oa(i,t){return ri(i).getPropertyValue(t)}const Ta=["top","right","bottom","left"];function Et(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Ta[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Pa=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Ra(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(Pa(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 Rt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=ri(e),o=n.boxSizing==="border-box",r=Et(n,"padding"),a=Et(n,"border","width"),{x:l,y:c,box:h}=Ra(i,e),d=r.left+(h&&a.left),f=r.top+(h&&a.top);let{width:g,height:p}=t;return o&&(g-=r.width+a.width,p-=r.height+a.height),{x:Math.round((l-d)/g*e.width/s),y:Math.round((c-f)/p*e.height/s)}}function Ia(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&Ki(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=ri(o),l=Et(a,"border","width"),c=Et(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=ti(a.maxWidth,o,"clientWidth"),n=ti(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||Je,maxHeight:n||Je}}const We=i=>Math.round(i*10)/10;function La(i,t,e,s){const n=ri(i),o=Et(n,"margin"),r=ti(n.maxWidth,i,"clientWidth")||Je,a=ti(n.maxHeight,i,"clientHeight")||Je,l=Ia(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const f=Et(n,"border","width"),g=Et(n,"padding");c-=g.width+f.width,h-=g.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=We(Math.min(c,r,l.maxWidth)),h=We(Math.min(h,a,l.maxHeight)),c&&!h&&(h=We(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=We(Math.floor(h*s))),{width:c,height:h}}function ws(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 za=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};qi()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function Ss(i,t){const e=Oa(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function It(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Ea(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 Fa(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=It(i,n,e),a=It(n,o,e),l=It(o,t,e),c=It(r,a,e),h=It(a,l,e);return It(c,h,e)}const Wa=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}}},Ba=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Ut(i,t,e){return i?Wa(t,e):Ba()}function Zn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function Jn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function to(i){return i==="angle"?{between:we,compare:Er,normalize:St}:{between:Yt,compare:(t,e)=>t-e,normalize:t=>t}}function Ms({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 Ha(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=to(s),l=t.length;let{start:c,end:h,loop:d}=i,f,g;if(d){for(c+=l,h+=l,f=0,g=l;f<g&&r(a(t[c%l][s]),n,o);++f)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:i.style}}function Na(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,r=t.length,{compare:a,between:l,normalize:c}=to(s),{start:h,end:d,loop:f,style:g}=Ha(i,t,e),p=[];let m=!1,b=null,x,y,v;const w=()=>l(n,v,x)&&a(n,v)!==0,_=()=>a(o,x)===0||l(o,v,x),M=()=>m||w(),k=()=>!m||_();for(let S=h,A=h;S<=d;++S)y=t[S%r],!y.skip&&(x=c(y[s]),x!==v&&(m=l(x,n,o),b===null&&M()&&(b=a(x,n)===0?S:A),b!==null&&k()&&(p.push(Ms({start:b,end:S,loop:f,count:r,style:g})),b=null),A=S,v=x));return b!==null&&p.push(Ms({start:b,end:d,loop:f,count:r,style:g})),p}function Va(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=Na(s[n],i.points,t);o.length&&e.push(...o)}return e}function Ya(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 $a(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 Ua(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=Ya(e,n,o,s);if(s===!0)return ks(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 ks(i,$a(e,r,l,c),e,t)}function ks(i,t,e,s){return!s||!s.setContext||!e?t:Xa(i,t,e,s)}function Xa(i,t,e,s){const n=i._chart.getContext(),o=Ds(i.options),{_datasetIndex:r,options:{spanGaps:a}}=i,l=e.length,c=[];let h=o,d=t[0].start,f=d;function g(p,m,b,x){const y=a?-1:1;if(p!==m){for(p+=l;e[p%l].skip;)p-=y;for(;e[m%l].skip;)m+=y;p%l!==m%l&&(c.push({start:p%l,end:m%l,loop:b,style:x}),h=x,d=m%l)}}for(const p of t){d=a?d:p.start;let m=e[d%l],b;for(f=d+1;f<=p.end;f++){const x=e[f%l];b=Ds(s.setContext(Wt(n,{type:"segment",p0:m,p1:x,p0DataIndex:(f-1)%l,p1DataIndex:f%l,datasetIndex:r}))),qa(b,h)&&g(d,f-1,p.loop,h),m=x,h=b}d<f-1&&g(d,f-1,p.loop,h)}return c}function Ds(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function qa(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)}function Be(i,t,e){return i.options.clip?i[e]:t[e]}function Ka(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Be(e,t,"left"),right:Be(e,t,"right"),top:Be(s,t,"top"),bottom:Be(s,t,"bottom")}:t}function Ga(i,t){const e=t._clip;if(e.disabled)return!1;const s=Ka(t,i.chartArea);return{left:e.left===!1?0:s.left-(e.left===!0?0:e.left),right:e.right===!1?i.width:s.right+(e.right===!0?0:e.right),top:e.top===!1?0:s.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?i.height:s.bottom+(e.bottom===!0?0:e.bottom)}}/*!
 * Chart.js v4.4.9
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */class Qa{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=Vn.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 Qa;const Cs="transparent",Za={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ms(i||Cs),n=s.valid&&ms(t||Cs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Ja{constructor(t,e,s,n){const o=e[s];n=Ee([t.to,n,o,t.from]);const r=Ee([t.from,o,n]);this._active=!0,this._fn=t.fn||Za[t.type||typeof r],this._easing=ge[t.easing]||ge.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=Ee([t.to,e,n,t.from]),this._from=Ee([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 eo{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!I(t))return;const e=Object.keys(X.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!I(o))return;const r={};for(const a of e)r[a]=o[a];(Q(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=el(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&tl(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 d=o[c];const f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,a);continue}else d.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=d=new Ja(f,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return bt.add(this._chart,s),!0}}function tl(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 el(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 As(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 il(i,t,e){if(e===!1)return!1;const s=As(i,e),n=As(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function sl(i){let t,e,s,n;return I(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 io(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 js(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let r,a,l,c;if(t===null)return;let h=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===e){if(h=!0,s.all)continue;break}c=i.values[l],ct(c)&&(o||t===0||qt(t)===qt(c))&&(t+=c)}return!h&&!s.all?0:t}function nl(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 ui(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function ol(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function rl(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 al(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function Os(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 Ts(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=ol(o,r,s),d=t.length;let f;for(let g=0;g<d;++g){const p=t[g],{[l]:m,[c]:b}=p,x=p._stacks||(p._stacks={});f=x[c]=al(n,h,m),f[a]=b,f._top=Os(f,r,!0,s.type),f._bottom=Os(f,r,!1,s.type);const y=f._visualValues||(f._visualValues={});y[a]=b}}function gi(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function ll(i,t){return Wt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function cl(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 pi=i=>i==="reset"||i==="none",Ps=(i,t)=>t?i:Object.assign({},i),hl=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:io(e,!0),values:null};class Xt{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=ui(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=(d,f,g,p)=>d==="x"?f:d==="r"?p:g,o=e.xAxisID=P(s.xAxisID,gi(t,"x")),r=e.yAxisID=P(s.yAxisID,gi(t,"y")),a=e.rAxisID=P(s.rAxisID,gi(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&&us(this._data,this),t._stacked&&se(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(I(e)){const n=this._cachedMeta;this._data=nl(e,n)}else if(s!==e){if(s){us(s,this);const n=this._cachedMeta;se(n),n._parsed=[]}e&&Object.isExtensible(e)&&Hr(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=ui(e.vScale,e),e.stack!==s.stack&&(n=!0,se(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ts(this,e._parsed),e._stacked=ui(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,f;if(this._parsing===!1)s._parsed=n,s._sorted=!0,f=n;else{Q(n[t])?f=this.parseArrayData(s,n,t,e):I(n[t])?f=this.parseObjectData(s,n,t,e):f=this.parsePrimitiveData(s,n,t,e);const g=()=>d[a]===null||c&&d[a]<c[a];for(h=0;h<e;++h)s._parsed[h+t]=d=f[h],l&&(g()&&(l=!1),c=d);s._sorted=l}r&&Ts(this,f)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,d=new Array(n);let f,g,p;for(f=0,g=n;f<g;++f)p=f+s,d[f]={[a]:h||o.parse(c[p],p),[l]:r.parse(e[p],p)};return d}parseArrayData(t,e,s,n){const{xScale:o,yScale:r}=t,a=new Array(n);let l,c,h,d;for(l=0,c=n;l<c;++l)h=l+s,d=e[h],a[l]={x:o.parse(d[0],h),y:r.parse(d[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,d,f,g;for(h=0,d=n;h<d;++h)f=h+s,g=e[f],c[h]={x:o.parse(ye(g,a),f),y:r.parse(ye(g,l),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const n=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:io(n,!0),values:e._stacks[t.axis]._visualValues};return js(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=js(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=hl(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=rl(a);let f,g;function p(){g=n[f];const m=g[a.axis];return!ct(g[t.axis])||h>m||d<m}for(f=0;f<r&&!(!p()&&(this.updateRangeFromParsed(c,t,g,l),o));++f);if(o){for(f=r-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(c,t,g,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],ct(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=sl(P(this.options.clip,il(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 d=n[h];d.hidden||(d.active&&c?r.push(d):d.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=cl(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=ll(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&&Ze(s);if(a)return Ps(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),h),g=Object.keys(X.elements[t]),p=()=>this.getContext(s,n,e),m=c.resolveNamedOptions(f,g,p,d);return m.$shared&&(m.$shared=l,o[r]=Object.freeze(Ps(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,d=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(f,this.getContext(t,s,e))}const c=new eo(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||pi(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){pi(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!pi(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])}}D(Xt,"defaults",{}),D(Xt,"datasetElementType",null),D(Xt,"dataElementType",null);function dl(i,t,e){let s=1,n=1,o=0,r=0;if(t<Y){const a=i,l=a+t,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),f=Math.sin(l),g=(v,w,_)=>we(v,a,l,!0)?1:Math.max(w,w*e,_,_*e),p=(v,w,_)=>we(v,a,l,!0)?-1:Math.min(w,w*e,_,_*e),m=g(0,c,d),b=g(G,h,f),x=p($,c,d),y=p($+G,h,f);s=(m-x)/2,n=(b-y)/2,o=-(m+x)/2,r=-(b+y)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}class ce extends Xt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=l=>+s[l];if(I(s[t])){const{key:l="value"}=this._parsing;o=c=>+ye(s[c],l)}let r,a;for(r=t,a=t+e;r<a;++r)n._parsed[r]=o(r)}}_getRotation(){return yt(this.options.rotation-90)}_getCircumference(){return yt(this.options.circumference)}_getRotationExtents(){let t=Y,e=-Y;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const n=this.chart.getDatasetMeta(s).controller,o=n._getRotation(),r=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+r)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:s}=e,n=this._cachedMeta,o=n.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-r)/2,0),l=Math.min(Mr(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=dl(d,h,l),b=(s.width-r)/f,x=(s.height-r)/g,y=Math.max(Math.min(b,x)/2,0),v=Fn(this.options.radius,y),w=Math.max(v*l,0),_=(v-w)/this._getVisibleDatasetWeightTotal();this.offsetX=p*v,this.offsetY=m*v,n.total=this.calculateTotal(),this.outerRadius=v-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const s=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/Y)}updateElements(t,e,s,n){const o=n==="reset",r=this.chart,a=r.chartArea,c=r.options.animation,h=(a.left+a.right)/2,d=(a.top+a.bottom)/2,f=o&&c.animateScale,g=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:m,includeOptions:b}=this._getSharedOptions(e,n);let x=this._getRotation(),y;for(y=0;y<e;++y)x+=this._circumference(y,o);for(y=e;y<e+s;++y){const v=this._circumference(y,o),w=t[y],_={x:h+this.offsetX,y:d+this.offsetY,startAngle:x,endAngle:x+v,circumference:v,outerRadius:p,innerRadius:g};b&&(_.options=m||this.resolveDataElementOptions(y,w.active?"active":n)),x+=v,this.updateElement(w,y,_,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let s=0,n;for(n=0;n<e.length;n++){const o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?Y*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=Hi(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,r,a,l;if(!t){for(n=0,o=s.data.datasets.length;n<o;++n)if(s.isDatasetVisible(n)){r=s.getDatasetMeta(n),t=r.data,a=r.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)l=a.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let s=0,n=t.length;s<n;++s){const o=this.resolveDataElementOptions(s);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(e+=this._getRingWeight(s));return e}_getRingWeight(t){return Math.max(P(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}D(ce,"id","doughnut"),D(ce,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),D(ce,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),D(ce,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}});class Xe extends Xt{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}=$r(e,n,r);this._drawStart=a,this._drawCount=l,Ur(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:d}=this._getSharedOptions(e,n),f=r.axis,g=a.axis,{spanGaps:p,segment:m}=this.options,b=ve(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||n==="none",y=e+s,v=t.length;let w=e>0&&this.getParsed(e-1);for(let _=0;_<v;++_){const M=t[_],k=x?M:{};if(_<e||_>=y){k.skip=!0;continue}const S=this.getParsed(_),A=H(S[g]),T=k[f]=r.getPixelForValue(S[f],_),j=k[g]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[g],_);k.skip=isNaN(T)||isNaN(j)||A,k.stop=_>0&&Math.abs(S[f]-w[f])>b,m&&(k.parsed=S,k.raw=c.data[_]),d&&(k.options=h||this.resolveDataElementOptions(_,M.active?"active":n)),x||this.updateElement(M,_,k,n),w=S}}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()}}D(Xe,"id","line"),D(Xe,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),D(Xe,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Pt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Gi{constructor(t){D(this,"options");this.options=t||{}}static override(t){Object.assign(Gi.prototype,t)}init(){}formats(){return Pt()}parse(){return Pt()}format(){return Pt()}add(){return Pt()}diff(){return Pt()}startOf(){return Pt()}endOf(){return Pt()}}var so={_date:Gi};function fl(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?Wr:Lt;if(s){if(n._sharedOptions){const h=o[0],d=typeof h.getRange=="function"&&h.getRange(t);if(d){const f=c(o,t,e-d),g=c(o,t,e+d);return{lo:f.lo,hi:g.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:d}=n._cachedMeta,{_parsed:f}=i,g=f.slice(0,h.lo+1).reverse().findIndex(m=>!H(m[d.axis]));h.lo-=Math.max(0,g);const p=f.slice(h.hi).findIndex(m=>!H(m[d.axis]));h.hi+=Math.max(0,p)}return h}}return{lo:0,hi:o.length-1}}function ai(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:d,hi:f}=fl(o[a],t,r,n);for(let g=d;g<=f;++g){const p=h[g];p.skip||s(p,c,g)}}}function ul(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 mi(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||ai(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 gl(i,t,e,s){let n=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:d}=Hn(r,{x:t.x,y:t.y});we(d,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return ai(i,e,t,o),n}function pl(i,t,e,s,n,o){let r=[];const a=ul(e);let l=Number.POSITIVE_INFINITY;function c(h,d,f){const g=h.inRange(t.x,t.y,n);if(s&&!g)return;const p=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(p))&&!g)return;const b=a(t,p);b<l?(r=[{element:h,datasetIndex:d,index:f}],l=b):b===l&&r.push({element:h,datasetIndex:d,index:f})}return ai(i,e,t,c),r}function bi(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?gl(i,t,e,n):pl(i,t,e,s,n,o)}function Rs(i,t,e,s,n){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return ai(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 ml={modes:{index(i,t,e,s){const n=Rt(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?mi(i,n,o,s,r):bi(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Rt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?mi(i,n,o,s,r):bi(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=Rt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return mi(i,n,o,s,r)},nearest(i,t,e,s){const n=Rt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return bi(i,n,o,e.intersect,s,r)},x(i,t,e,s){const n=Rt(t,i);return Rs(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=Rt(t,i);return Rs(i,n,"y",e.intersect,s)}}};const no=["left","top","right","bottom"];function ne(i,t){return i.filter(e=>e.pos===t)}function Is(i,t){return i.filter(e=>no.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 bl(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 xl(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!no.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 _l(i,t){const e=xl(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 yl(i){const t=bl(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=Is(t,"x"),l=Is(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 Ls(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function oo(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 vl(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!I(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&oo(r,o.getPadding());const a=Math.max(0,t.outerWidth-Ls(r,i,"left","right")),l=Math.max(0,t.outerHeight-Ls(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function wl(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 Sl(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 he(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,Sl(a.horizontal,t));const{same:d,other:f}=vl(t,e,a,s);c|=d&&n.length,h=h||f,l.fullSize||n.push(a)}return c&&he(n,t,e,s)||h}function He(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 zs(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]||{placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const d=t.w*h,f=c.size||l.height;Ze(c.start)&&(r=c.start),l.fullSize?He(l,n.left,r,e.outerWidth-n.right-n.left,f):He(l,t.left+c.placed,r,d,f),c.start=r,c.placed+=d,r=l.bottom}else{const d=t.h*h,f=c.size||l.width;Ze(c.start)&&(o=c.start),l.fullSize?He(l,o,n.top,f,e.outerHeight-n.bottom-n.top):He(l,o,t.top+c.placed,f,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=r}var lt={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=ht(i.options.layout.padding),o=Math.max(t-n.width,0),r=Math.max(e-n.height,0),a=yl(i.boxes),l=a.vertical,c=a.horizontal;F(i.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const h=l.reduce((m,b)=>b.box.options&&b.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),f=Object.assign({},n);oo(f,ht(s));const g=Object.assign({maxPadding:f,w:o,h:r,x:n.left,y:n.top},n),p=_l(l.concat(c),d);he(a.fullSize,g,d,p),he(l,g,d,p),he(c,g,d,p)&&he(l,g,d,p),wl(g),zs(a.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,zs(a.rightAndBottom,g,d,p),i.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},F(a.chartArea,m=>{const b=m.box;Object.assign(b,i.chartArea),b.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class ro{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 Ml extends ro{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const qe="$chartjs",kl={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Es=i=>i===null||i==="";function Dl(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[qe]={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",Es(n)){const o=Ss(i,"width");o!==void 0&&(i.width=o)}if(Es(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Ss(i,"height");o!==void 0&&(i.height=o)}return i}const ao=za?{passive:!0}:!1;function Cl(i,t,e){i&&i.addEventListener(t,e,ao)}function Al(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,ao)}function jl(i,t){const e=kl[i.type]||i.type,{x:s,y:n}=Rt(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ei(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||ei(a.addedNodes,s),r=r&&!ei(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Tl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ei(a.removedNodes,s),r=r&&!ei(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const ke=new Map;let Fs=0;function lo(){const i=window.devicePixelRatio;i!==Fs&&(Fs=i,ke.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Pl(i,t){ke.size||window.addEventListener("resize",lo),ke.set(i,t)}function Rl(i){ke.delete(i),ke.size||window.removeEventListener("resize",lo)}function Il(i,t,e){const s=i.canvas,n=s&&Ki(s);if(!n)return;const o=Yn((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),Pl(i,o),r}function xi(i,t,e){e&&e.disconnect(),t==="resize"&&Rl(i)}function Ll(i,t,e){const s=i.canvas,n=Yn(o=>{i.ctx!==null&&e(jl(o,i))},i);return Cl(s,t,n),n}class zl extends ro{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Dl(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[qe])return!1;const s=e[qe].initial;["height","width"].forEach(o=>{const r=s[o];H(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[qe],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Ol,detach:Tl,resize:Il}[e]||Ll;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:xi,detach:xi,resize:xi}[e]||Al)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return La(t,e,s,n)}isAttached(t){const e=t&&Ki(t);return!!(e&&e.isConnected)}}function El(i){return!qi()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Ml:zl}class pt{constructor(){D(this,"x");D(this,"y");D(this,"active",!1);D(this,"options");D(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return ve(this.x)&&ve(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}D(pt,"defaults",{}),D(pt,"defaultRoutes");function Fl(i,t){const e=i.options.ticks,s=Wl(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Hl(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return Nl(t,c,o,r/n),c;const h=Bl(o,t,n);if(r>0){let d,f;const g=r>1?Math.round((l-a)/(r-1)):null;for(Ne(t,c,h,H(g)?0:a-g,a),d=0,f=r-1;d<f;d++)Ne(t,c,h,o[d],o[d+1]);return Ne(t,c,h,l,H(g)?t.length:l+g),c}return Ne(t,c,h),c}function Wl(i){const t=i.options.offset,e=i._tickSize(),s=i._length/e+(t?0:1),n=i._maxLength/e;return Math.floor(Math.min(s,n))}function Bl(i,t,e){const s=Vl(i),n=t.length/e;if(!s)return Math.max(n,1);const o=Pr(s);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>n)return l}return Math.max(n,1)}function Hl(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function Nl(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 Ne(i,t,e,s,n){const o=P(s,0),r=Math.min(P(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 Vl(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 Yl=i=>i==="left"?"right":i==="right"?"left":i,Ws=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Bs=(i,t)=>Math.min(t||i,i);function Hs(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 $l(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 Ul(i,t){F(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 Ns(i,t){if(!i.display)return 0;const e=et(i.font,t),s=ht(i.padding);return(Q(i.text)?i.text.length:1)*e.lineHeight+s.height}function Xl(i,t){return Wt(i,{scale:t,type:"scale"})}function ql(i,t,e){return Wt(i,{tick:e,index:t,type:"tick"})}function Kl(i,t,e){let s=Wi(i);return(e&&t!=="right"||!e&&t==="right")&&(s=Yl(s)),s}function Gl(i,t,e,s){const{top:n,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,f,g,p;const m=r-n,b=a-o;if(i.isHorizontal()){if(g=tt(s,o,a),I(e)){const x=Object.keys(e)[0],y=e[x];p=h[x].getPixelForValue(y)+m-t}else e==="center"?p=(c.bottom+c.top)/2+m-t:p=Ws(i,e,t);f=a-o}else{if(I(e)){const x=Object.keys(e)[0],y=e[x];g=h[x].getPixelForValue(y)-b+t}else e==="center"?g=(c.left+c.right)/2-b+t:g=Ws(i,e,t);p=tt(s,r,n),d=e==="left"?-G:G}return{titleX:g,titleY:p,maxWidth:f,rotation:d}}class Jt 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=ft(t,Number.POSITIVE_INFINITY),e=ft(e,Number.NEGATIVE_INFINITY),s=ft(s,Number.POSITIVE_INFINITY),n=ft(n,Number.NEGATIVE_INFINITY),{min:ft(t,s),max:ft(e,n),minDefined:ct(t),maxDefined:ct(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:ft(e,ft(s,e)),max:ft(s,ft(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(){N(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=ua(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Hs(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(){N(this.options.afterUpdate,[this])}beforeSetDimensions(){N(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(){N(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),N(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){N(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=N(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){N(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){N(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=Bs(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(),d=h.widest.width,f=h.highest.height,g=it(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/s:g/(s-1),d+6>a&&(a=g/(s-(t.offset?.5:1)),l=this.maxHeight-re(t.grid)-e.padding-Ns(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),r=zr(Math.min(Math.asin(it((h.highest.height+6)/a,-1,1)),Math.asin(it(l/c,-1,1))-Math.asin(it(f/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){N(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){N(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=Ns(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:d,highest:f}=this._getLabelSizes(),g=s.padding*2,p=yt(this.labelRotation),m=Math.cos(p),b=Math.sin(p);if(a){const x=s.mirror?0:b*d.width+m*f.height;t.height=Math.min(this.maxHeight,t.height+x+g)}else{const x=s.mirror?0:m*d.width+b*f.height;t.width=Math.min(this.maxWidth,t.width+x+g)}this._calculatePadding(c,h,b,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,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=n*t.width,g=s*e.height):(f=s*t.height,g=n*e.width):o==="start"?g=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,g=e.width/2),this.paddingLeft=Math.max((f-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((g-d+r)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+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(){N(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++)H(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=Hs(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/Bs(e,s));let c=0,h=0,d,f,g,p,m,b,x,y,v,w,_;for(d=0;d<e;d+=l){if(p=t[d].label,m=this._resolveTickFontOptions(d),n.font=b=m.string,x=o[b]=o[b]||{data:{},gc:[]},y=m.lineHeight,v=w=0,!H(p)&&!Q(p))v=xs(n,x.data,x.gc,v,p),w=y;else if(Q(p))for(f=0,g=p.length;f<g;++f)_=p[f],!H(_)&&!Q(_)&&(v=xs(n,x.data,x.gc,v,_),w+=y);r.push(v),a.push(w),c=Math.max(v,c),h=Math.max(w,h)}Ul(o,e);const M=r.indexOf(c),k=a.indexOf(h),S=A=>({width:r[A]||0,height:a[A]||0});return{first:S(0),last:S(e-1),widest:S(M),highest:S(k),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 Fr(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=ql(this.getContext(),t,s))}return this.$context||(this.$context=Xl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=yt(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(),d=this.ticks.length+(l?1:0),f=re(o),g=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,b=m/2,x=function(V){return Tt(s,V,m)};let y,v,w,_,M,k,S,A,T,j,R,Z;if(r==="top")y=x(this.bottom),k=this.bottom-f,A=y-b,j=x(t.top)+b,Z=t.bottom;else if(r==="bottom")y=x(this.top),j=t.top,Z=x(t.bottom)-b,k=y+b,A=this.top+f;else if(r==="left")y=x(this.right),M=this.right-f,S=y-b,T=x(t.left)+b,R=t.right;else if(r==="right")y=x(this.left),T=t.left,R=x(t.right)-b,M=y+b,S=this.left+f;else if(e==="x"){if(r==="center")y=x((t.top+t.bottom)/2+.5);else if(I(r)){const V=Object.keys(r)[0],U=r[V];y=x(this.chart.scales[V].getPixelForValue(U))}j=t.top,Z=t.bottom,k=y+b,A=k+f}else if(e==="y"){if(r==="center")y=x((t.left+t.right)/2);else if(I(r)){const V=Object.keys(r)[0],U=r[V];y=x(this.chart.scales[V].getPixelForValue(U))}M=y-b,S=M-f,T=t.left,R=t.right}const ot=P(n.ticks.maxTicksLimit,d),W=Math.max(1,Math.ceil(d/ot));for(v=0;v<d;v+=W){const V=this.getContext(v),U=o.setContext(V),dt=a.setContext(V),J=U.lineWidth,Bt=U.color,Te=dt.dash||[],Ht=dt.dashOffset,te=U.tickWidth,At=U.tickColor,ee=U.tickBorderDash||[],jt=U.tickBorderDashOffset;w=$l(this,v,l),w!==void 0&&(_=Tt(s,w,J),c?M=S=T=R=_:k=A=j=Z=_,g.push({tx1:M,ty1:k,tx2:S,ty2:A,x1:T,y1:j,x2:R,y2:Z,width:J,color:Bt,borderDash:Te,borderDashOffset:Ht,tickWidth:te,tickColor:At,tickBorderDash:ee,tickBorderDashOffset:jt}))}return this._ticksLength=d,this._borderValue=y,g}_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:d}=o,f=re(s.grid),g=f+h,p=d?-h:g,m=-yt(this.labelRotation),b=[];let x,y,v,w,_,M,k,S,A,T,j,R,Z="middle";if(n==="top")M=this.bottom-p,k=this._getXAxisLabelAlignment();else if(n==="bottom")M=this.top+p,k=this._getXAxisLabelAlignment();else if(n==="left"){const W=this._getYAxisLabelAlignment(f);k=W.textAlign,_=W.x}else if(n==="right"){const W=this._getYAxisLabelAlignment(f);k=W.textAlign,_=W.x}else if(e==="x"){if(n==="center")M=(t.top+t.bottom)/2+g;else if(I(n)){const W=Object.keys(n)[0],V=n[W];M=this.chart.scales[W].getPixelForValue(V)+g}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-g;else if(I(n)){const W=Object.keys(n)[0],V=n[W];_=this.chart.scales[W].getPixelForValue(V)}k=this._getYAxisLabelAlignment(f).textAlign}e==="y"&&(l==="start"?Z="top":l==="end"&&(Z="bottom"));const ot=this._getLabelSizes();for(x=0,y=a.length;x<y;++x){v=a[x],w=v.label;const W=o.setContext(this.getContext(x));S=this.getPixelForTick(x)+o.labelOffset,A=this._resolveTickFontOptions(x),T=A.lineHeight,j=Q(w)?w.length:1;const V=j/2,U=W.color,dt=W.textStrokeColor,J=W.textStrokeWidth;let Bt=k;r?(_=S,k==="inner"&&(x===y-1?Bt=this.options.reverse?"left":"right":x===0?Bt=this.options.reverse?"right":"left":Bt="center"),n==="top"?c==="near"||m!==0?R=-j*T+T/2:c==="center"?R=-ot.highest.height/2-V*T+T:R=-ot.highest.height+T/2:c==="near"||m!==0?R=T/2:c==="center"?R=ot.highest.height/2-V*T:R=ot.highest.height-j*T,d&&(R*=-1),m!==0&&!W.showLabelBackdrop&&(_+=T/2*Math.sin(m))):(M=S,R=(1-j)*T/2);let Te;if(W.showLabelBackdrop){const Ht=ht(W.backdropPadding),te=ot.heights[x],At=ot.widths[x];let ee=R-Ht.top,jt=0-Ht.left;switch(Z){case"middle":ee-=te/2;break;case"bottom":ee-=te;break}switch(k){case"center":jt-=At/2;break;case"right":jt-=At;break;case"inner":x===y-1?jt-=At:x>0&&(jt-=At/2);break}Te={left:jt,top:ee,width:At+Ht.width,height:te+Ht.height,color:W.backdropColor}}b.push({label:w,font:A,textOffset:R,options:{rotation:m,color:U,strokeColor:dt,strokeWidth:J,textAlign:Bt,textBaseline:Z,translation:[_,M],backdrop:Te}})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-yt(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,d,f;this.isHorizontal()?(c=Tt(t,this.left,r)-r/2,h=Tt(t,this.right,a)+a/2,d=f=l):(d=Tt(t,this.top,r)-r/2,f=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,d),e.lineTo(h,f),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&Ni(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;Me(s,c,0,h,l,a)}n&&Vi(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=et(s.font),r=ht(s.padding),a=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||I(e)?(l+=r.bottom,Q(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:d,rotation:f}=Gl(this,l,e,a);Me(t,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:f,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=P(t.grid&&t.grid.z,-1),n=P(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Jt.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 et(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ve{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;Jl(e)&&(s=this.register(e));const n=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,Ql(t,r,s),this.override&&X.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 X[n]&&(delete X[n][s],this.override&&delete Ft[s])}}function Ql(i,t,e){const s=_e(Object.create(null),[e?X.get(e):{},X.get(t),i.defaults]);X.set(t,s),i.defaultRoutes&&Zl(t,i.defaultRoutes),i.descriptors&&X.describe(t,i.descriptors)}function Zl(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(".");X.route(o,n,l,a)})}function Jl(i){return"id"in i&&"defaults"in i}class tc{constructor(){this.controllers=new Ve(Xt,"datasets",!0),this.elements=new Ve(pt,"elements"),this.plugins=new Ve(Object,"plugins"),this.scales=new Ve(Jt,"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):F(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=Ei(t);N(s["before"+n],[],s),e[t](s),N(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 gt=new tc;class ec{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(N(a,l,r)===!1&&n.cancelable)return!1}return!0}invalidate(){H(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=P(s.options&&s.options.plugins,{}),o=ic(s);return n===!1&&!e?[]:nc(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 ic(i){const t={},e=[],s=Object.keys(gt.plugins.items);for(let o=0;o<s.length;o++)e.push(gt.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 sc(i,t){return!t&&i===!1?null:i===!0?{}:i}function nc(i,{plugins:t,localIds:e},s,n){const o=[],r=i.getContext();for(const a of t){const l=a.id,c=sc(s[l],n);c!==null&&o.push({plugin:a,options:oc(i.config,{plugin:a,local:e[l]},c,r)})}return o}function oc(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 Di(i,t){const e=X.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function rc(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function ac(i,t){return i===t?"_index_":"_value_"}function Vs(i){if(i==="x"||i==="y"||i==="r")return i}function lc(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function Ci(i,...t){if(Vs(i))return i;for(const e of t){const s=e.axis||lc(e.position)||i.length>1&&Vs(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Ys(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function cc(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 Ys(i,"x",e[0])||Ys(i,"y",e[0])}return{}}function hc(i,t){const e=Ft[i.type]||{scales:{}},s=t.scales||{},n=Di(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!I(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,cc(r,i),X.scales[a.type]),c=ac(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||Di(a,t),h=(Ft[a]||{}).scales||{};Object.keys(h).forEach(d=>{const f=rc(d,l),g=r[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),fe(o[g],[{axis:f},s[g],h[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];fe(a,[X.scales[a.type],X.scale])}),o}function co(i){const t=i.options||(i.options={});t.plugins=P(t.plugins,{}),t.scales=hc(i,t)}function ho(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function dc(i){return i=i||{},i.data=ho(i.data),co(i),i}const $s=new Map,fo=new Set;function Ye(i,t){let e=$s.get(i);return e||(e=t(),$s.set(i,e),fo.add(e)),e}const ae=(i,t,e)=>{const s=ye(t,e);s!==void 0&&i.add(s)};class fc{constructor(t){this._config=dc(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=ho(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(),co(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ye(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ye(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ye(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ye(`${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(d=>ae(l,t,d))),h.forEach(d=>ae(l,n,d)),h.forEach(d=>ae(l,Ft[o]||{},d)),h.forEach(d=>ae(l,X,d)),h.forEach(d=>ae(l,Si,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),fo.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Ft[e]||{},X.datasets[e]||{},{type:e},X,Si]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Us(this._resolverCache,t,n);let l=r;if(gc(r,e)){o.$shared=!1,s=Dt(s)?s():s;const c=this.createResolver(t,s,a);l=Kt(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Us(this._resolverCache,t,s);return I(e)?Kt(o,e,void 0,n):o}}function Us(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:$i(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const uc=i=>I(i)&&Object.getOwnPropertyNames(i).some(t=>Dt(i[t]));function gc(i,t){const{isScriptable:e,isIndexable:s}=Xn(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(Dt(a)||uc(a))||r&&Q(a))return!0}return!1}var pc="4.4.9";const mc=["top","bottom","left","right","chartArea"];function Xs(i,t){return i==="top"||i==="bottom"||mc.indexOf(i)===-1&&t==="x"}function qs(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Ks(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),N(e&&e.onComplete,[i],t)}function bc(i){const t=i.chart,e=t.options.animation;N(e&&e.onProgress,[i],t)}function uo(i){return qi()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Ke={},Gs=i=>{const t=uo(i);return Object.values(Ke).filter(e=>e.canvas===t).pop()};function xc(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 _c(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}var wt;let Ct=(wt=class{static register(...t){gt.add(...t),Qs()}static unregister(...t){gt.remove(...t),Qs()}constructor(t,e){const s=this.config=new fc(e),n=uo(t),o=Gs(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||El(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=Sr(),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 ec,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Vr(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],Ke[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}bt.listen(this,"complete",Ks),bt.listen(this,"progress",bc),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return H(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 gt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ws(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return _s(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,ws(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),N(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};F(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"}}))),F(o,r=>{const a=r.options,l=a.id,c=Ci(l,a),h=P(a.type,r.dtype);(a.position===void 0||Xs(a.position,c)!==Xs(r.dposition))&&(a.position=r.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const f=gt.getScale(h);d=new f({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(a,t)}),F(n,(r,a)=>{r||delete s[a]}),F(s,r=>{lt.configure(this,r,r.options),lt.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(qs("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||Di(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=gt.getController(a),{datasetElementType:c,dataElementType:h}=X.datasets[a];Object.assign(l,{dataElementType:gt.getElement(h),datasetElementType:c&&gt.getElement(c)}),r.controller=new l(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){F(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:d}=this.getDatasetMeta(c),f=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(f),r=Math.max(+d.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),n||F(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(qs("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){F(this.scales,t=>{lt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!cs(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;xc(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(!cs(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;lt.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],F(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,Dt(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(),Ks({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const r=e[n];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},n=Ga(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&Ni(e,n),t.controller.draw(),n&&Vi(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return Se(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=ml.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);Ze(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(),_s(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ke[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,s=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};F(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(){F(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},F(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}});!Ge(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),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=jr(t),c=_c(t,this._lastEvent,s,l);s&&(this._lastEvent=null,N(o.onHover,[t,a,this],this),l&&N(o.onClick,[t,a,this],this));const h=!Ge(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)}},D(wt,"defaults",X),D(wt,"instances",Ke),D(wt,"overrides",Ft),D(wt,"registry",gt),D(wt,"version",pc),D(wt,"getChart",Gs),wt);function Qs(){return F(Ct.instances,i=>i._plugins.invalidate())}function yc(i,t,e){const{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=n/a;i.beginPath(),i.arc(o,r,a,s-c,e+c),l>n?(c=n/l,i.arc(o,r,l,e+c,s-c,!0)):i.arc(o,r,n,e+G,s-G),i.closePath(),i.clip()}function vc(i){return Yi(i,["outerStart","outerEnd","innerStart","innerEnd"])}function wc(i,t,e,s){const n=vc(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,s*t/2),a=l=>{const c=(e-Math.min(o,l))*s/2;return it(l,0,Math.min(o,c))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:it(n.innerStart,0,r),innerEnd:it(n.innerEnd,0,r)}}function Vt(i,t,e,s){return{x:e+i*Math.cos(t),y:s+i*Math.sin(t)}}function ii(i,t,e,s,n,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+s+e-c,0),f=h>0?h+s+e+c:0;let g=0;const p=n-l;if(s){const W=h>0?h-s:0,V=d>0?d-s:0,U=(W+V)/2,dt=U!==0?p*U/(U+s):p;g=(p-dt)/2}const m=Math.max(.001,p*d-e/$)/d,b=(p-m)/2,x=l+b+g,y=n-b-g,{outerStart:v,outerEnd:w,innerStart:_,innerEnd:M}=wc(t,f,d,y-x),k=d-v,S=d-w,A=x+v/k,T=y-w/S,j=f+_,R=f+M,Z=x+_/j,ot=y-M/R;if(i.beginPath(),o){const W=(A+T)/2;if(i.arc(r,a,d,A,W),i.arc(r,a,d,W,T),w>0){const J=Vt(S,T,r,a);i.arc(J.x,J.y,w,T,y+G)}const V=Vt(R,y,r,a);if(i.lineTo(V.x,V.y),M>0){const J=Vt(R,ot,r,a);i.arc(J.x,J.y,M,y+G,ot+Math.PI)}const U=(y-M/f+(x+_/f))/2;if(i.arc(r,a,f,y-M/f,U,!0),i.arc(r,a,f,U,x+_/f,!0),_>0){const J=Vt(j,Z,r,a);i.arc(J.x,J.y,_,Z+Math.PI,x-G)}const dt=Vt(k,x,r,a);if(i.lineTo(dt.x,dt.y),v>0){const J=Vt(k,A,r,a);i.arc(J.x,J.y,v,x-G,A)}}else{i.moveTo(r,a);const W=Math.cos(A)*d+r,V=Math.sin(A)*d+a;i.lineTo(W,V);const U=Math.cos(T)*d+r,dt=Math.sin(T)*d+a;i.lineTo(U,dt)}i.closePath()}function Sc(i,t,e,s,n){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){ii(i,t,e,s,l,n);for(let c=0;c<o;++c)i.fill();isNaN(a)||(l=r+(a%Y||Y))}return ii(i,t,e,s,l,n),i.fill(),l}function Mc(i,t,e,s,n){const{fullCircles:o,startAngle:r,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:f}=l,g=l.borderAlign==="inner";if(!c)return;i.setLineDash(d||[]),i.lineDashOffset=f,g?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let p=t.endAngle;if(o){ii(i,t,e,s,p,n);for(let m=0;m<o;++m)i.stroke();isNaN(a)||(p=r+(a%Y||Y))}g&&yc(i,t,p),o||(ii(i,t,e,s,p,n),i.stroke())}class zt extends pt{constructor(e){super();D(this,"circumference");D(this,"endAngle");D(this,"fullCircles");D(this,"innerRadius");D(this,"outerRadius");D(this,"pixelMargin");D(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.getProps(["x","y"],n),{angle:r,distance:a}=Hn(o,{x:e,y:s}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),g=(this.options.spacing+this.options.borderWidth)/2,p=P(f,c-l),m=we(r,l,c)&&l!==c,b=p>=Y||m,x=Yt(a,h+g,d+g);return b&&x}getCenterPoint(e){const{x:s,y:n,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+r)/2,f=(a+l+h+c)/2;return{x:s+Math.cos(d)*f,y:n+Math.sin(d)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:s,circumference:n}=this,o=(s.offset||0)/4,r=(s.spacing||0)/2,a=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=n>Y?Math.floor(n/Y):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min($,n||0)),h=o*c;e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,Sc(e,this,h,r,a),Mc(e,this,h,r,a),e.restore()}}D(zt,"id","arc"),D(zt,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),D(zt,"defaultRoutes",{backgroundColor:"backgroundColor"}),D(zt,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function go(i,t,e=t){i.lineCap=P(e.borderCapStyle,t.borderCapStyle),i.setLineDash(P(e.borderDash,t.borderDash)),i.lineDashOffset=P(e.borderDashOffset,t.borderDashOffset),i.lineJoin=P(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=P(e.borderWidth,t.borderWidth),i.strokeStyle=P(e.borderColor,t.borderColor)}function kc(i,t,e){i.lineTo(e.x,e.y)}function Dc(i){return i.stepped?sa:i.tension||i.cubicInterpolationMode==="monotone"?na:kc}function po(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 Cc(i,t,e,s){const{points:n,options:o}=t,{count:r,start:a,loop:l,ilen:c}=po(n,e,s),h=Dc(o);let{move:d=!0,reverse:f}=s||{},g,p,m;for(g=0;g<=c;++g)p=n[(a+(f?c-g:g))%r],!p.skip&&(d?(i.moveTo(p.x,p.y),d=!1):h(i,m,p,f,o.stepped),m=p);return l&&(p=n[(a+(f?c:0))%r],h(i,m,p,f,o.stepped)),!!l}function Ac(i,t,e,s){const n=t.points,{count:o,start:r,ilen:a}=po(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,d=0,f,g,p,m,b,x;const y=w=>(r+(c?a-w:w))%o,v=()=>{m!==b&&(i.lineTo(h,b),i.lineTo(h,m),i.lineTo(h,x))};for(l&&(g=n[y(0)],i.moveTo(g.x,g.y)),f=0;f<=a;++f){if(g=n[y(f)],g.skip)continue;const w=g.x,_=g.y,M=w|0;M===p?(_<m?m=_:_>b&&(b=_),h=(d*h+w)/++d):(v(),i.lineTo(w,_),p=M,d=0,m=b=_),x=_}v()}function Ai(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Ac:Cc}function jc(i){return i.stepped?Ea:i.tension||i.cubicInterpolationMode==="monotone"?Fa:It}function Oc(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),go(i,t.options),i.stroke(n)}function Tc(i,t,e,s){const{segments:n,options:o}=t,r=Ai(t);for(const a of n)go(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Pc=typeof Path2D=="function";function Rc(i,t,e,s){Pc&&!t.options.segment?Oc(i,t,e,s):Tc(i,t,e,s)}class $t extends pt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;ja(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=Ua(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=Va(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=jc(s);let c,h;for(c=0,h=r.length;c<h;++c){const{start:d,end:f}=r[c],g=o[d],p=o[f];if(g===p){a.push(g);continue}const m=Math.abs((n-g[e])/(p[e]-g[e])),b=l(g,p,m,s.stepped);b[e]=t[e],a.push(b)}return a.length===1?a[0]:a}pathSegment(t,e,s){return Ai(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=Ai(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(),Rc(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}D($t,"id","line"),D($t,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),D($t,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),D($t,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Zs(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class be extends pt{constructor(e){super();D(this,"parsed");D(this,"skip");D(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,s){return Zs(this,e,"x",s)}inYRange(e,s){return Zs(this,e,"y",s)}getCenterPoint(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}size(e){e=e||this.options||{};let s=e.radius||0;s=Math.max(s,s&&e.hoverRadius||0);const n=s&&e.borderWidth||0;return(s+n)*2}draw(e,s){const n=this.options;this.skip||n.radius<.1||!Se(this,s,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,Mi(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}D(be,"id","point"),D(be,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),D(be,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Js=(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)}},Ic=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class tn 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=N(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=et(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Js(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 d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-h;return this.legendItems.forEach((p,m)=>{const b=s+e/2+o.measureText(p.text).width;(m===0||c[c.length-1]+b+2*a>r)&&(d+=h,c[c.length-(m>0?0:1)]=0,g+=h,f++),l[m]={left:0,top:g,row:f,width:b,height:n},c[c.length-1]+=b+a}),d}_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 d=a,f=0,g=0,p=0,m=0;return this.legendItems.forEach((b,x)=>{const{itemWidth:y,itemHeight:v}=Lc(s,e,o,b,n);x>0&&g+v+2*a>h&&(d+=f+a,c.push({width:f,height:g}),p+=f+a,m++,f=g=0),l[x]={left:p,top:g,col:m,width:y,height:v},f=Math.max(f,y),g+=v+a}),d+=f,c.push({width:f,height:g}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=Ut(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=tt(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=tt(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=tt(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=tt(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;Ni(t,this),this._draw(),Vi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=X.color,l=Ut(t.rtl,this.left,this.width),c=et(r.font),{padding:h}=r,d=c.size,f=d/2;let g;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:b}=Js(r,d),x=function(M,k,S){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const A=P(S.lineWidth,1);if(n.fillStyle=P(S.fillStyle,a),n.lineCap=P(S.lineCap,"butt"),n.lineDashOffset=P(S.lineDashOffset,0),n.lineJoin=P(S.lineJoin,"miter"),n.lineWidth=A,n.strokeStyle=P(S.strokeStyle,a),n.setLineDash(P(S.lineDash,[])),r.usePointStyle){const T={radius:m*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:A},j=l.xPlus(M,p/2),R=k+f;Un(n,T,j,R,r.pointStyleWidth&&p)}else{const T=k+Math.max((d-m)/2,0),j=l.leftForLtr(M,p),R=me(S.borderRadius);n.beginPath(),Object.values(R).some(Z=>Z!==0)?ki(n,{x:j,y:T,w:p,h:m,radius:R}):n.rect(j,T,p,m),n.fill(),A!==0&&n.stroke()}n.restore()},y=function(M,k,S){Me(n,S.text,M,k+b/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),w=this._computeTitleHeight();v?g={x:tt(o,this.left+h,this.right-s[0]),y:this.top+h+w,line:0}:g={x:this.left+h,y:tt(o,this.top+w+h,this.bottom-e[0].height),line:0},Zn(this.ctx,t.textDirection);const _=b+h;this.legendItems.forEach((M,k)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const S=n.measureText(M.text).width,A=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),T=p+f+S;let j=g.x,R=g.y;l.setWidth(this.width),v?k>0&&j+T+h>this.right&&(R=g.y+=_,g.line++,j=g.x=tt(o,this.left+h,this.right-s[g.line])):k>0&&R+_>this.bottom&&(j=g.x=j+e[g.line].width+h,g.line++,R=g.y=tt(o,this.top+w+h,this.bottom-e[g.line].height));const Z=l.x(j);if(x(Z,R,M),j=Yr(A,j+p+f,v?j+T:this.right,t.rtl),y(l.x(j),R,M),v)g.x+=T+h;else if(typeof M.text!="string"){const ot=c.lineHeight;g.y+=mo(M,ot)+h}else g.y+=_}),Jn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=et(e.font),n=ht(e.padding);if(!e.display)return;const o=Ut(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=tt(t.align,d,this.right-f);else{const p=this.columnSizes.reduce((m,b)=>Math.max(m,b.height),0);h=c+tt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const g=tt(a,d,d+f);r.textAlign=o.textAlign(Wi(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,Me(r,e.text,g,h,s)}_computeTitleHeight(){const t=this.options.title,e=et(t.font),s=ht(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(Yt(t,this.left,this.right)&&Yt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],Yt(t,n.left,n.left+n.width)&&Yt(e,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(t){const e=this.options;if(!Fc(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=Ic(n,s);n&&!o&&N(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&N(e.onHover,[t,s,this],this)}else s&&N(e.onClick,[t,s,this],this)}}function Lc(i,t,e,s,n){const o=zc(s,i,t,e),r=Ec(n,s,t.lineHeight);return{itemWidth:o,itemHeight:r}}function zc(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 Ec(i,t,e){let s=i;return typeof t.text!="string"&&(s=mo(t,e)),s}function mo(i,t){const e=i.text?i.text.length:0;return t*e}function Fc(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var je={id:"legend",_element:tn,start(i,t,e){const s=i.legend=new tn({ctx:i.ctx,options:e,chart:i});lt.configure(i,s,e),lt.addBox(i,s)},stop(i){lt.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;lt.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=ht(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 bo 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=Q(s.text)?s.text.length:1;this._padding=ht(s.padding);const o=n*et(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,d;return this.isHorizontal()?(h=tt(a,s,o),d=e+t,c=o-s):(r.position==="left"?(h=s+t,d=tt(a,n,e),l=$*-.5):(h=o-t,d=tt(a,e,n),l=$*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=et(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Me(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Wi(e.align),textBaseline:"middle",translation:[r,a]})}}function Wc(i,t){const e=new bo({ctx:i.ctx,options:t,chart:i});lt.configure(i,e,t),lt.addBox(i,e),i.titleBlock=e}var li={id:"title",_element:bo,start(i,t,e){Wc(i,e)},stop(i){const t=i.titleBlock;lt.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;lt.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 de={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=wi(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 ut(i,t){return t&&(Q(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function xt(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
`)>-1?i.split(`
`):i}function Bc(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 en(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=et(t.bodyFont),c=et(t.titleFont),h=et(t.footerFont),d=o.length,f=n.length,g=s.length,p=ht(t.padding);let m=p.height,b=0,x=s.reduce((w,_)=>w+_.before.length+_.lines.length+_.after.length,0);if(x+=i.beforeBody.length+i.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),x){const w=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=g*w+(x-g)*l.lineHeight+(x-1)*t.bodySpacing}f&&(m+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let y=0;const v=function(w){b=Math.max(b,e.measureText(w).width+y)};return e.save(),e.font=c.string,F(i.title,v),e.font=l.string,F(i.beforeBody.concat(i.afterBody),v),y=t.displayColors?r+2+t.boxPadding:0,F(s,w=>{F(w.before,v),F(w.lines,v),F(w.after,v)}),y=0,e.font=h.string,F(i.footer,v),e.restore(),b+=p.width,{width:b,height:m}}function Hc(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function Nc(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 Vc(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"),Nc(c,i,t,e)&&(c="center"),c}function sn(i,t,e){const s=e.yAlign||t.yAlign||Hc(i,e);return{xAlign:e.xAlign||t.xAlign||Vc(i,t,e,s),yAlign:s}}function Yc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function $c(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function nn(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:g}=me(r);let p=Yc(t,a);const m=$c(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(h,f)+n:a==="right"&&(p+=Math.max(d,g)+n),{x:it(p,0,s.width-t.width),y:it(m,0,s.height-t.height)}}function $e(i,t,e){const s=ht(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function on(i){return ut([],xt(i))}function Uc(i,t,e){return Wt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function rn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const xo={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 H(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 st(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?xo[t].call(e,s):n}class ji extends pt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new eo(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Uc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=st(s,"beforeTitle",this,t),o=st(s,"title",this,t),r=st(s,"afterTitle",this,t);let a=[];return a=ut(a,xt(n)),a=ut(a,xt(o)),a=ut(a,xt(r)),a}getBeforeBody(t,e){return on(st(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return F(t,o=>{const r={before:[],lines:[],after:[]},a=rn(s,o);ut(r.before,xt(st(a,"beforeLabel",this,o))),ut(r.lines,st(a,"label",this,o)),ut(r.after,xt(st(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return on(st(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=st(s,"beforeFooter",this,t),o=st(s,"footer",this,t),r=st(s,"afterFooter",this,t);let a=[];return a=ut(a,xt(n)),a=ut(a,xt(o)),a=ut(a,xt(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(Bc(this.chart,e[l]));return t.filter&&(a=a.filter((h,d,f)=>t.filter(h,d,f,s))),t.itemSort&&(a=a.sort((h,d)=>t.itemSort(h,d,s))),F(a,h=>{const d=rn(t.callbacks,h);n.push(st(d,"labelColor",this,h)),o.push(st(d,"labelPointStyle",this,h)),r.push(st(d,"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=de[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=en(this,s),c=Object.assign({},a,l),h=sn(this.chart,s,c),d=nn(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX: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:d}=me(a),{x:f,y:g}=t,{width:p,height:m}=e;let b,x,y,v,w,_;return o==="center"?(w=g+m/2,n==="left"?(b=f,x=b-r,v=w+r,_=w-r):(b=f+p,x=b+r,v=w-r,_=w+r),y=b):(n==="left"?x=f+Math.max(l,h)+r:n==="right"?x=f+p-Math.max(c,d)-r:x=this.caretX,o==="top"?(v=g,w=v-r,b=x-r,y=x+r):(v=g+m,w=v+r,b=x+r,y=x-r),_=v),{x1:b,x2:x,x3:y,y1:v,y2:w,y3:_}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=Ut(s.rtl,this.x,this.width);for(t.x=$e(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=et(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=et(o.bodyFont),d=$e(this,"left",o),f=n.x(d),g=l<h.lineHeight?(h.lineHeight-l)/2:0,p=e.y+g;if(o.usePointStyle){const m={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},b=n.leftForLtr(f,c)+c/2,x=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Mi(t,m,b,x),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Mi(t,m,b,x)}else{t.lineWidth=I(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(f,c),b=n.leftForLtr(n.xPlus(f,1),c-2),x=me(r.borderRadius);Object.values(x).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ki(t,{x:m,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),ki(t,{x:b,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(b,p+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,d=et(s.bodyFont);let f=d.lineHeight,g=0;const p=Ut(s.rtl,this.x,this.width),m=function(S){e.fillText(S,p.x(t.x+g),t.y+f/2),t.y+=f+o},b=p.textAlign(r);let x,y,v,w,_,M,k;for(e.textAlign=r,e.textBaseline="middle",e.font=d.string,t.x=$e(this,b,s),e.fillStyle=s.bodyColor,F(this.beforeBody,m),g=a&&b!=="right"?r==="center"?c/2+h:c+2+h:0,w=0,M=n.length;w<M;++w){for(x=n[w],y=this.labelTextColors[w],e.fillStyle=y,F(x.before,m),v=x.lines,a&&v.length&&(this._drawColorBox(e,t,w,p,s),f=Math.max(d.lineHeight,l)),_=0,k=v.length;_<k;++_)m(v[_]),f=d.lineHeight;F(x.after,m)}g=0,f=d.lineHeight,F(this.afterBody,m),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let r,a;if(o){const l=Ut(s.rtl,this.x,this.width);for(t.x=$e(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",r=et(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:d,topRight:f,bottomLeft:g,bottomRight:p}=me(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+d,l),r==="top"&&this.drawCaret(t,e,s,n),e.lineTo(a+c-f,l),e.quadraticCurveTo(a+c,l,a+c,l+f),r==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(a+c,l+h-p),e.quadraticCurveTo(a+c,l+h,a+c-p,l+h),r==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(a+g,l+h),e.quadraticCurveTo(a,l+h,a,l+h-g),r==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(a,l+d),e.quadraticCurveTo(a,l,a+d,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=de[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=en(this,t),l=Object.assign({},r,this._size),c=sn(e,t,l),h=nn(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=ht(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),Zn(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Jn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ge(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||!Ge(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=de[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}D(ji,"positioners",de);var Oe={id:"tooltip",_element:ji,positioners:de,afterInit(i,t,e){e&&(i.tooltip=new ji({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:xo},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 Xc=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function qc(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Xc(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Kc=(i,t)=>i===null?null:it(Math.round(i),0,t);function an(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class Qt extends Jt{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(H(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:qc(s,t,P(e,t),this._addedLabels),Kc(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 an.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}D(Qt,"id","category"),D(Qt,"defaults",{ticks:{callback:an}});function Gc(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=i,g=o||1,p=h-1,{min:m,max:b}=t,x=!H(r),y=!H(a),v=!H(c),w=(b-m)/(d+1);let _=ds((b-m)/p/g)*g,M,k,S,A;if(_<1e-14&&!x&&!y)return[{value:m},{value:b}];A=Math.ceil(b/_)-Math.floor(m/_),A>p&&(_=ds(A*_/p/g)*g),H(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),n==="ticks"?(k=Math.floor(m/_)*_,S=Math.ceil(b/_)*_):(k=m,S=b),x&&y&&o&&Ir((a-r)/o,_/1e3)?(A=Math.round(Math.min((a-r)/_,h)),_=(a-r)/A,k=r,S=a):v?(k=x?r:k,S=y?a:S,A=c-1,_=(S-k)/A):(A=(S-k)/_,ue(A,Math.round(A),_/1e3)?A=Math.round(A):A=Math.ceil(A));const T=Math.max(fs(_),fs(k));M=Math.pow(10,H(l)?T:l),k=Math.round(k*M)/M,S=Math.round(S*M)/M;let j=0;for(x&&(f&&k!==r?(e.push({value:r}),k<r&&j++,ue(Math.round((k+j*_)*M)/M,r,ln(r,w,i))&&j++):k<r&&j++);j<A;++j){const R=Math.round((k+j*_)*M)/M;if(y&&R>a)break;e.push({value:R})}return y&&f&&S!==a?e.length&&ue(e[e.length-1].value,a,ln(a,w,i))?e[e.length-1].value=a:e.push({value:a}):(!y||S===a)&&e.push({value:S}),e}function ln(i,t,{horizontal:e,minRotation:s}){const n=yt(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class Qc extends Jt{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 H(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=qt(n),c=qt(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=Gc(n,o);return t.bounds==="ticks"&&Lr(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 Hi(t,this.chart.options.locale,this.options.ticks.format)}}class si extends Qc{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ct(t)?t:0,this.max=ct(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=yt(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}D(si,"id","linear"),D(si,"defaults",{ticks:{callback:$n.formatters.numeric}});const ci={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}},nt=Object.keys(ci);function cn(i,t){return i-t}function hn(i,t){if(H(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)),ct(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(ve(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function dn(i,t,e,s){const n=nt.length;for(let o=nt.indexOf(i);o<n-1;++o){const r=ci[nt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=s)return nt[o]}return nt[n-1]}function Zc(i,t,e,s,n){for(let o=nt.length-1;o>=nt.indexOf(e);o--){const r=nt[o];if(ci[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return nt[e?nt.indexOf(e):0]}function Jc(i){for(let t=nt.indexOf(i)+1,e=nt.length;t<e;++t)if(ci[nt[t]].common)return nt[t]}function fn(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 th(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 un(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:th(i,s,n,e)}class De extends Jt{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 so._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:hn(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=ct(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=ct(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=Br(n,o,r);return this._unit=e.unit||(s.autoSkip?dn(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Zc(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Jc(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),un(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=it(e,0,r),s=it(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||dn(o.minUnit,e,s,this._getLabelCapacity(e)),a=P(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=ve(l)||l===!0,h={};let d=e,f,g;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,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 p=n.ticks.source==="data"&&this.getDataTimestamps();for(f=d,g=0;f<s;f=+t.add(f,a,r),g++)fn(h,f,p);return(f===s||n.bounds==="ticks"||g===1)&&fn(h,f,p),Object.keys(h).sort(cn).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 N(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],d=c&&a[c],f=s[e],g=c&&d&&f&&f.major;return this._adapter.format(t,n||(g?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e<s;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,n=yt(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,un(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(hn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Nr(t.sort(cn))}}D(De,"id","time"),D(De,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function 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}=Lt(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}=Lt(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 gn extends De{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)}}D(gn,"id","timeseries"),D(gn,"defaults",De.defaults);const _o="label";function pn(i,t){typeof i=="function"?i(t):i&&(i.current=t)}function eh(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function yo(i,t){i.labels=t}function vo(i,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_o;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 ih(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_o;const e={labels:[],datasets:[]};return yo(e,i.labels),vo(e,i.datasets,t),e}function sh(i,t){const{height:e=150,width:s=300,redraw:n=!1,datasetIdKey:o,type:r,data:a,options:l,plugins:c=[],fallbackContent:h,updateMode:d,...f}=i,g=q.useRef(null),p=q.useRef(null),m=()=>{g.current&&(p.current=new Ct(g.current,{type:r,data:ih(a,o),options:l&&{...l},plugins:c}),pn(t,p.current))},b=()=>{pn(t,null),p.current&&(p.current.destroy(),p.current=null)};return q.useEffect(()=>{!n&&p.current&&l&&eh(p.current,l)},[n,l]),q.useEffect(()=>{!n&&p.current&&yo(p.current.config.data,a.labels)},[n,a.labels]),q.useEffect(()=>{!n&&p.current&&a.datasets&&vo(p.current.config.data,a.datasets,o)},[n,a.datasets]),q.useEffect(()=>{p.current&&(n?(b(),setTimeout(m)):p.current.update(d))},[n,l,a.labels,a.datasets,d]),q.useEffect(()=>{p.current&&(b(),setTimeout(m))},[r]),q.useEffect(()=>(m(),()=>b()),[]),Dn.createElement("canvas",{ref:g,role:"img",height:e,width:s,...f},h)}const nh=q.forwardRef(sh);function wo(i,t){return Ct.register(t),q.forwardRef((e,s)=>Dn.createElement(nh,{...e,ref:s,type:i}))}const So=wo("line",Xe),Qi=wo("doughnut",ce);Ct.register($t,Qt,si,be,li,Oe,je);const _i=(i,t)=>`rgba(${i.replace(/^#/,"").match(/.{2}/g).map(s=>parseInt(s,16)).join(", ")}, ${t})`,yi=(i,t)=>{const e=E(),s=E().subtract(t,"days"),n={};i.forEach(l=>{const c=E(l.date);if(c.isBetween(s,e,null,"[]")){const h=c.format("YYYY-MM-DD");n[h]||(n[h]=0),n[h]++}});const o=[];let r=s.clone();for(;r.isBefore(e,"day");)o.push(r.format("YYYY-MM-DD")),r.add(1,"day");return o.map(l=>({date:l,count:n[l]||0}))};function mn({appointments:i,cancelledAppointments:t,compleatedAppointments:e}){const[s,n]=q.useState(15),o=ni(),r=yi(i||[],s),a=yi(t||[],s),l=yi(e||[],s),c=new Set([...r.map(g=>g.date),...a.map(g=>g.date)]),h=Array.from(c).sort(),d={labels:h,datasets:[{label:"All",data:h.map(g=>{var p;return((p=r.find(m=>m.date===g))==null?void 0:p.count)||0}),borderColor:o.colors.blue[500],backgroundColor:_i(o.colors.blue[500],5),borderWidth:2,fill:"origin",tension:.2},{label:"Cancelled",data:h.map(g=>{var p;return((p=a.find(m=>m.date===g))==null?void 0:p.count)||0}),borderColor:o.colors.red[500],backgroundColor:_i(o.colors.red[500],5),borderWidth:2,fill:!0,tension:.2},{label:"Compleated",data:h.map(g=>{var p;return((p=l.find(m=>m.date===g))==null?void 0:p.count)||0}),borderColor:o.colors.green[500],backgroundColor:_i(o.colors.green[500],5),borderWidth:2,fill:!0,tension:.2}]},f={responsive:!0,interaction:{mode:"nearest",axis:"xy",intersect:!1},scales:{x:{type:"time",time:{unit:s>179?"month":s>89?"week":"day"},border:{color:L(o.colors.gray[600],o.colors.gray[300])},grid:{display:!1},ticks:{color:L(o.colors.gray[600],o.colors.gray[400])}},y:{border:{color:L(o.colors.gray[600],o.colors.gray[300])},grid:{display:!1},ticks:{color:L(o.colors.gray[600],o.colors.gray[400])}}},onHover:(g,p)=>{p.length?g.native.target.style.cursor="pointer":g.native.target.style.cursor="default"}};return u.jsxs(C,{p:4,borderRadius:"md",boxShadow:"md",maxW:"100%",bg:L("#fff","gray.900"),children:[u.jsxs(z,{mb:5,justify:"space-between",align:"center",children:[" ",u.jsxs(B,{fontSize:"lg",fontWeight:"bold",children:["Appointments in the Last ",s," Days"]}),u.jsxs(Tn,{children:[u.jsxs(Pn,{as:at,rightIcon:u.jsx(jn,{}),size:"sm",children:["Last ",s," Days"]}),u.jsx(Rn,{children:[15,30,90,180,365].map(g=>u.jsxs(In,{bg:g===s?"gray.200":"transparent",onClick:()=>{n(g)},fontSize:"sm",children:["Last ",g," Days"]},g))})]})]}),u.jsx(So,{data:d,options:f})]})}Ct.register(li,Oe,je,zt,Qt);const oh={Pending:"#f6e05e",Confirmed:"#48bb78",Rejected:"#f56565",Cancelled:"red",Completed:"#3182ce",Rescheduled:"#ed8936",Visited:"#805ad5",Unknown:"gray"},rh=i=>{const t={Pending:0,Confirmed:0,Rejected:0,Cancelled:0,Completed:0,Rescheduled:0,Visited:0,Unknown:0};return i.forEach(e=>{const s=e.status||"Unknown";t[s]=(t[s]||0)+1}),t};function bn({appointments:i}){const t=ni(),e=rh(i||[]),s={labels:Object.keys(e),datasets:[{data:Object.values(e),backgroundColor:Object.keys(e).map(n=>oh[n]||t.colors.gray[500]),borderWidth:1}]};return u.jsxs(C,{p:4,borderRadius:"md",maxW:"100%",children:[u.jsx(B,{mb:4,children:"Appointment Status Distribution"}),u.jsx(Qi,{data:s})]})}/*!
  * chartjs-adapter-moment v1.0.1
  * https://www.chartjs.org
  * (c) 2022 chartjs-adapter-moment Contributors
  * Released under the MIT license
  */const ah={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};so._date.override(typeof E=="function"?{_id:"moment",formats:function(){return ah},parse:function(i,t){return typeof i=="string"&&typeof t=="string"?i=E(i,t):i instanceof E||(i=E(i)),i.isValid()?i.valueOf():null},format:function(i,t){return E(i).format(t)},add:function(i,t,e){return E(i).add(t,e).valueOf()},diff:function(i,t,e){return E(i).diff(E(t),e)},startOf:function(i,t,e){return i=E(i),t==="isoWeek"?(e=Math.trunc(Math.min(Math.max(0,e),6)),i.isoWeekday(e).startOf("day").valueOf()):i.startOf(t).valueOf()},endOf:function(i,t){return E(i).endOf(t).valueOf()}}:{});Ct.register(Qt,si,$t,be,li,Oe,je,De);const xn=(i,t)=>`rgba(${i.replace(/^#/,"").match(/.{2}/g).map(s=>parseInt(s,16)).join(", ")}, ${t})`,_n=(i,t)=>{const e=E(),s=E().subtract(t,"days"),n={};i.forEach(l=>{const c=E(l.created_at);if(c.isBetween(s,e,null,"[]")){const h=c.format("YYYY-MM-DD");n[h]||(n[h]=0),n[h]+=parseFloat(l.amount)}});const o=[];let r=s.clone();for(;r.isBefore(e,"day");)o.push(r.format("YYYY-MM-DD")),r.add(1,"day");return o.map(l=>({date:l,amount:n[l]||0}))};function yn({creditTransactions:i,debitTransactions:t}){const[e,s]=q.useState(15),n=ni(),o=_n(i||[],e),r=_n(t||[],e),a=new Set([...o.map(d=>d.date),...r.map(d=>d.date)]),l=Array.from(a).sort(),c={labels:l,datasets:[{label:"Credit",data:l.map(d=>{var f;return((f=o.find(g=>g.date===d))==null?void 0:f.amount)||0}),borderColor:n.colors.green[500],backgroundColor:xn(n.colors.green[500],3),borderWidth:2,fill:!0,tension:.2},{label:"Debit",data:l.map(d=>{var f;return((f=r.find(g=>g.date===d))==null?void 0:f.amount)||0}),borderColor:n.colors.red[500],backgroundColor:xn(n.colors.red[500],3),borderWidth:2,fill:!0,tension:.2}]},h={responsive:!0,interaction:{mode:"nearest",axis:"xy",intersect:!1},scales:{x:{type:"time",time:{unit:e>179?"month":e>89?"week":"day"},border:{color:L(n.colors.gray[600],n.colors.gray[300])},grid:{display:!1},ticks:{color:L(n.colors.gray[600],n.colors.gray[400])}},y:{border:{color:L(n.colors.gray[600],n.colors.gray[300])},grid:{display:!1},ticks:{color:L(n.colors.gray[600],n.colors.gray[400])}}},onHover:(d,f)=>{f.length?d.native.target.style.cursor="pointer":d.native.target.style.cursor="default"}};return u.jsxs(C,{p:4,borderRadius:"md",maxW:"100%",bg:L("#fff","gray.900"),children:[u.jsxs(z,{mb:5,justify:"space-between",align:"center",children:[u.jsxs(B,{fontSize:"lg",fontWeight:"bold",children:["Transactions in the Last ",e," Days"]}),u.jsxs(Tn,{children:[u.jsxs(Pn,{as:at,rightIcon:u.jsx(jn,{}),size:"sm",children:["Last ",e," Days"]}),u.jsx(Rn,{children:[15,30,90,180,365].map(d=>u.jsxs(In,{bg:d===e?"gray.200":"transparent",onClick:()=>{s(d)},fontSize:"sm",children:["Last ",d," Days"]},d))})]})]}),u.jsx(So,{data:c,options:h})]})}const lh="₹";Ct.register(li,Oe,je,zt,Qt);const ch={Credited:"#48bb78",Debited:"#f56565"},hh=i=>{const t={Credited:0,Debited:0};return i.forEach(e=>{const s=e.transaction_type||"Unknown";if(s==="Credited"||s==="Debited"){const n=s==="Debited"?"Debited":s;t[n]+=e.amount}}),t};function vn({transactions:i}){const t=ni(),e=hh(i||[]),s={labels:Object.keys(e),datasets:[{data:Object.values(e),backgroundColor:Object.keys(e).map(o=>ch[o]||t.colors.gray[500]),borderWidth:1}]},n={responsive:!0,cutout:"50%",rotation:-90,circumference:180,plugins:{legend:{position:"bottom"},tooltip:{callbacks:{label:function(o){const r=o.raw;return`${lh} ${r.toLocaleString()}`}}}}};return u.jsxs(C,{p:4,borderRadius:"md",maxW:"100%",children:[u.jsx(B,{mb:4,children:"Transaction Total Amount Distribution"}),u.jsx(Qi,{data:s,options:n,width:50})]})}const dh=(i,t)=>{const e=E().subtract(t,"days").startOf("day");return(i==null?void 0:i.filter(n=>E(n.created_at).isAfter(e))).map(n=>({id:n.id,image:n.image,name:`${n.f_name} ${n.l_name}`,phone:n.phone,gender:n.gender}))},fh=E().subtract(Zt,"days").format("YYYY-MM-DD"),uh=E().format("YYYY-MM-DD");function wn({Users:i}){const[t,e]=q.useState(Zt),[s,n]=q.useState({startDate:fh,endDate:uh});return u.jsxs(C,{p:4,borderRadius:"md",maxW:"100%",bg:L("#fff","gray.900"),children:[u.jsxs(z,{mb:5,justify:"space-between",align:"center",gap:5,children:[u.jsxs(B,{fontSize:"md",fontWeight:"bold",children:["Users Registration in the Last ",t," Days"]}),u.jsx(Ti,{dateRange:s,setDateRange:n,setLastDays:e})]}),u.jsx(C,{children:i?u.jsx(C,{maxH:96,overflow:"scroll",children:u.jsx(Pi,{minPad:"10px 5px",data:dh(i,t)})}):u.jsxs(C,{children:[u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2})]})})]})}const gh=(i,t)=>{const e=E().subtract(t,"days").startOf("day");return i.filter(n=>E(n.created_at).isAfter(e)).map(n=>({id:n.id,image:n.image,name:`${n.f_name} ${n.l_name}`,phone:n.phone,gender:n.gender}))},ph=E().subtract(Zt,"days").format("YYYY-MM-DD"),mh=E().format("YYYY-MM-DD");function Sn({Patients:i}){const[t,e]=q.useState(Zt),[s,n]=q.useState({startDate:ph,endDate:mh});return u.jsxs(C,{p:4,borderRadius:"md",maxW:"100%",bg:L("#fff","gray.900"),children:[u.jsxs(z,{mb:5,justify:"space-between",align:"center",gap:5,children:[u.jsxs(B,{fontSize:"md",fontWeight:"bold",children:["Patients Registration in the Last ",t," Days"]}),u.jsx(Ti,{dateRange:s,setDateRange:n,setLastDays:e})]}),u.jsx(C,{children:i?u.jsx(C,{maxH:96,overflow:"scroll",children:u.jsx(Pi,{minPad:"10px 5px",data:gh(i,t)})}):u.jsxs(C,{children:[u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2})]})})]})}const bh=(i,t)=>{const e=E().subtract(t,"days").startOf("day"),s=i.filter(o=>E(o.created_at).isAfter(e));return(s==null?void 0:s.map(o=>{const{id:r,status:a,date:l,time_slots:c,type:h,payment_status:d,patient_f_name:f,patient_l_name:g,doct_f_name:p,doct_l_name:m,doct_image:b}=o;return{id:r,image:b,Doctor:`${p} ${m}`,Patient:`${f} ${g}`,Status:Wo(a),Date:l,"Time Slots":c,Type:h==="Emergency"?u.jsx(ie,{colorScheme:"red",children:h}):u.jsx(ie,{colorScheme:"green",children:h}),"Payment Status":d==="Paid"?u.jsx(ie,{colorScheme:"green",children:d}):d==="Refunded"?u.jsx(ie,{colorScheme:"blue",children:d}):u.jsx(ie,{colorScheme:"red",children:"Not Paid"})}})).sort((o,r)=>r.id-o.id)},xh=E().subtract(Zt,"days").format("YYYY-MM-DD"),_h=E().format("YYYY-MM-DD");function Mn({Appointments:i}){const[t,e]=q.useState(Zt),[s,n]=q.useState({startDate:xh,endDate:_h}),o=Cn();return u.jsxs(C,{p:4,borderRadius:"md",maxW:"100%",bg:L("#fff","gray.900"),children:[u.jsxs(z,{mb:5,justify:"space-between",align:"center",children:[u.jsxs(B,{fontSize:"Lg",fontWeight:"bold",children:["Appointments Made in the Last ",t," Days"]}),u.jsx(Ti,{dateRange:s,setDateRange:n,setLastDays:e})]}),u.jsx(C,{children:i?u.jsx(C,{maxH:80,overflow:"scroll",children:u.jsx(Pi,{minPad:"10px 5px",data:bh(i,t),onActionClick:u.jsx(yh,{navigate:o})})}):u.jsxs(C,{children:[u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2}),u.jsx(O,{h:10,w:"100%",mt:2})]})})]})}const yh=({rowData:i,navigate:t})=>u.jsxs(z,{justify:"center",children:[u.jsx(es,{size:"sm",variant:"ghost",_hover:{background:"none"},onClick:()=>{t(`/appointment/${i.id}`)},icon:u.jsx(Bo,{fontSize:18,color:Ji.colors.green[500]})}),u.jsx(es,{size:"sm",variant:"ghost",_hover:{background:"none"},onClick:()=>{t(`/appointment/${i.id}`)},icon:u.jsx(Ho,{fontSize:18,color:Ji.colors.blue[500]})})]}),kn=()=>{const[i,t]=q.useState(E());q.useEffect(()=>{const n=setInterval(()=>{const o=E();t(o)},1e3);return()=>clearInterval(n)},[]);const e=i.format("DD MMM YYYY"),s=i.format("hh:mm:ss A");return u.jsxs(z,{gap:2,children:[u.jsx(B,{fontSize:"md",fontWeight:600,children:e}),u.jsx(B,{fontSize:"md",fontWeight:600,children:s})]})};function vh({data:i}){const t=[{title:"Cancellation Req Initiated",value:(i==null?void 0:i.total_cancel_req_initiated_appointment)||0,icon:u.jsx(Vo,{fontSize:"32px"}),color:"blue.600"},{title:"Cancellation Request Processing",value:(i==null?void 0:i.total_cancel_req_processing_appointment)||0,icon:u.jsx(Io,{fontSize:"32px"}),color:"blue.600"},{title:"Cancellation Request Approved",value:(i==null?void 0:i.total_cancel_req_approved_appointment)||0,icon:u.jsx(On,{fontSize:"32px"}),color:"blue.600"},{title:"Cancellation Request Rejected",value:(i==null?void 0:i.total_cancel_req_rejected_appointment)||0,icon:u.jsx(Yo,{fontSize:"32px"}),color:"blue.600"}];return u.jsx(Ri,{templateColumns:"repeat(auto-fit, minmax(400px, 1fr))",gap:5,children:t.map((e,s)=>u.jsx(oi,{children:u.jsx(C,{boxShadow:"md",p:8,borderRadius:8,bg:L("#fff","gray.900"),children:u.jsxs(z,{justify:"space-between",children:[u.jsxs(C,{children:[u.jsx(B,{fontSize:"sm",fontWeight:600,children:e.title}),u.jsx(B,{fontSize:"3xl",fontWeight:700,color:e.color,children:e.value})]}),u.jsx(z,{p:2,borderRadius:"50%",bg:"blue.700",w:16,h:16,align:"center",justify:"center",color:"#fff",children:e.icon})]})})},s))})}Ct.register(zt,Oe,je);const wh=({cancelData:i})=>{const t={labels:["Cancel Request Initiated","Cancel Request Rejected","Cancel Request Approved","Cancel Request Processing"],datasets:[{label:"Appointment Cancellations",data:[(i==null?void 0:i.total_cancel_req_initiated_appointment)||0,(i==null?void 0:i.total_cancel_req_rejected_appointment)||0,(i==null?void 0:i.total_cancel_req_approved_appointment)||0,(i==null?void 0:i.total_cancel_req_processing_appointment)||0],backgroundColor:["#f39c12","#e74c3c","#2ecc71","#3498db"],hoverBackgroundColor:["#f39c12aa","#e74c3caa","#2ecc71aa","#3498dbaa"],borderWidth:1}]},e={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top"},tooltip:{enabled:!0}}};return u.jsxs(C,{p:4,borderRadius:"md",boxShadow:"md",children:[u.jsx(B,{fontSize:"lg",fontWeight:"bold",mb:4,children:"Appointment Cancellation Status"}),u.jsx(C,{h:"300px",children:u.jsx(Qi,{data:t,options:e})})]})};function Sh({data:i}){const t=[{title:"Today's Appointment",value:(i==null?void 0:i.total_today_appointment)||0,icon:u.jsx($o,{fontSize:"32px"}),color:"blue.600"},{title:"Upcoming Appointment",value:(i==null?void 0:i.total_upcoming_appointments)||0,icon:u.jsx(Lo,{fontSize:"32px"}),color:"blue.600"},{title:"Pending Appointments",value:(i==null?void 0:i.total_pending_appointment)||0,icon:u.jsx(zo,{fontSize:"32px"}),color:"blue.600"},{title:"Confirm Appointments",value:(i==null?void 0:i.total_confirmed_appointment)||0,icon:u.jsx(Oo,{fontSize:"32px"}),color:"blue.600"}];return u.jsx(Ri,{templateColumns:"repeat(2, 1fr)",gap:8,children:t.map((e,s)=>u.jsx(oi,{children:u.jsx(C,{boxShadow:"md",p:8,borderRadius:8,bg:L("#fff","gray.900"),children:u.jsxs(z,{justify:"space-between",children:[u.jsxs(C,{children:[u.jsx(B,{fontSize:"sm",fontWeight:600,children:e.title}),u.jsx(B,{fontSize:"3xl",fontWeight:700,color:e.color,children:e.value})]}),u.jsx(z,{p:2,borderRadius:"50%",bg:"blue.700",w:16,h:16,align:"center",justify:"center",color:"#fff",children:e.icon})]})})},s))})}function Mh({data:i}){const t=[{title:"Cancelled Appointments",value:(i==null?void 0:i.total_cancelled_appointment)||0,icon:u.jsx(is,{fontSize:"32px"}),color:"red.500"},{title:"Rejected Appointments",value:(i==null?void 0:i.total_rejected_appointment)||0,icon:u.jsx(is,{fontSize:"32px"}),color:"red.400"},{title:"Completed Appointments",value:(i==null?void 0:i.total_completed_appointment)||0,icon:u.jsx(On,{fontSize:"32px"}),color:"blue.600"},{title:"Visited Appointments",value:(i==null?void 0:i.total_visited_appointment)||0,icon:u.jsx(To,{fontSize:"32px"}),color:"blue.600"}];return u.jsx(Ri,{templateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:4,children:t.map((e,s)=>u.jsx(oi,{children:u.jsx(C,{boxShadow:"md",p:8,borderRadius:8,bg:L("#fff","gray.900"),children:u.jsxs(z,{justify:"space-between",children:[u.jsxs(C,{children:[u.jsx(B,{fontSize:"sm",fontWeight:600,children:e.title}),u.jsx(B,{fontSize:"3xl",fontWeight:700,color:e.color,children:e.value})]}),u.jsx(z,{p:2,borderRadius:"50%",bg:"blue.700",w:16,h:16,align:"center",justify:"center",color:"#fff",children:e.icon})]})})},s))})}const kh=async()=>{const i=await Ce(K.token,"get_dashboard_count");if(i.response!==200)throw new Error(i.message);return i.data},Dh=async()=>{const i=await Ce(K.token,`get_dashboard_count/doctor/${K.id}`);if(i.response!==200)throw new Error(i.message);return i.data};function ud(){const{appointmentsData:i}=Qo(),{usersData:t}=Po(),{transactionsData:e}=Jo(),{patientsData:s}=Ro(),{hasPermission:n}=An(),{data:o,isLoading:r}=Oi({queryKey:["dashboard"],queryFn:K.role.name==="Doctor"?Dh:kh}),a=i==null?void 0:i.filter(f=>f.status==="Completed"||f.status==="Visited"),l=i==null?void 0:i.filter(f=>f.status==="Cancelled"),c=i==null?void 0:i.filter(f=>f.status!="Cancelled"||f.status!="Rejected"||f.status!="Pending"),h=e==null?void 0:e.filter(f=>f.transaction_type==="Debited"),d=e==null?void 0:e.filter(f=>f.transaction_type==="Credited");return u.jsxs(C,{children:[u.jsx(Ch,{}),u.jsxs(z,{gap:5,mt:5,children:[u.jsx(C,{width:"35%",minH:"100%",flex:1,children:r?u.jsx(O,{w:"100%",h:240}):u.jsx(tr,{data:o})}),u.jsx(C,{width:"70%",flex:2,children:r?u.jsxs(u.Fragment,{children:[u.jsxs(z,{gap:5,children:[" ",u.jsxs(u.Fragment,{children:[u.jsx(O,{flex:1,w:"100%",h:24}),u.jsx(O,{flex:1,w:"100%",h:24})]})]}),u.jsxs(z,{gap:5,mt:8,children:[" ",u.jsxs(u.Fragment,{children:[u.jsx(O,{flex:1,w:"100%",h:24}),u.jsx(O,{flex:1,w:"100%",h:24})]})]})]}):u.jsx(u.Fragment,{children:u.jsx(Sh,{data:o})})})]}),u.jsx(C,{mt:5,children:r?u.jsxs(u.Fragment,{children:[u.jsxs(z,{gap:5,children:[" ",u.jsxs(u.Fragment,{children:[u.jsx(O,{flex:1,w:"100%",h:24}),u.jsx(O,{flex:1,w:"100%",h:24})]})]}),u.jsxs(z,{gap:5,mt:8,children:[" ",u.jsxs(u.Fragment,{children:[u.jsx(O,{flex:1,w:"100%",h:24}),u.jsx(O,{flex:1,w:"100%",h:24})]})]})]}):u.jsx(u.Fragment,{children:u.jsx(Mh,{data:o})})}),u.jsxs(z,{gap:2,mt:5,children:[K.role.name==="Admin"?u.jsx(C,{flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(wn,{Users:t})}):n("USER_VIEW")?u.jsx(C,{flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(wn,{Users:t})}):null," ",K.role.name==="Admin"?u.jsx(C,{flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(Sn,{Patients:s})}):n("PATIENT_VIEW")?u.jsx(C,{flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(Sn,{Patients:s})}):null," "]}),n("APPOINTMENT_VIEW")&&u.jsx(C,{mt:5,children:u.jsx(Xo,{appointmentData:i})}),K.role.name==="Admin"?u.jsx(C,{mt:5,children:u.jsx(Mn,{Appointments:i})}):n("APPOINTMENT_VIEW")?u.jsx(C,{mt:5,children:u.jsx(Mn,{Appointments:i})}):null," ",K.role.name==="Admin"?u.jsxs(z,{gap:5,mt:5,children:[u.jsx(C,{maxW:"68%",flex:2,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(mn,{appointments:i,cancelledAppointments:l,compleatedAppointments:a,confirmedAppointments:c})}),u.jsx(C,{maxW:"30%",flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(bn,{appointments:i})})]}):n("APPOINTMENT_VIEW")?u.jsxs(z,{gap:5,mt:5,children:[u.jsx(C,{maxW:"68%",flex:2,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(mn,{appointments:i,cancelledAppointments:l,compleatedAppointments:a,confirmedAppointments:c})}),u.jsx(C,{maxW:"30%",flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(bn,{appointments:i})})]}):null," ",K.role.name==="Admin"?u.jsxs(z,{gap:5,mt:5,children:[u.jsx(C,{maxW:"68%",flex:2,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(yn,{creditTransactions:d,debitTransactions:h})}),u.jsx(C,{maxW:"30%",flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(vn,{transactions:e})})]}):n("ALL_TRANSACTION_VIEW")?u.jsxs(z,{gap:5,mt:5,children:[u.jsx(C,{maxW:"68%",flex:2,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(yn,{creditTransactions:d,debitTransactions:h})}),u.jsx(C,{maxW:"30%",flex:1,bg:L("#fff","gray.900"),borderRadius:8,children:u.jsx(vn,{transactions:e})})]}):null," ",u.jsxs(z,{gap:5,mt:5,children:[u.jsx(C,{maxW:"68%",flex:2,children:u.jsx(vh,{data:o})}),u.jsx(C,{maxW:"30%",flex:1,bg:L("#fff","gray.900"),borderRadius:8,maxH:"fit-content",children:u.jsx(wh,{cancelData:o})})]})]})}const Ch=()=>{const{hasPermission:i}=An(),t=Cn(),{isOpen:e,onOpen:s,onClose:n}=Pe(),{isOpen:o,onOpen:r,onClose:a}=Pe(),{isOpen:l,onOpen:c,onClose:h}=Pe(),{isOpen:d,onOpen:f,onClose:g}=Pe();return u.jsxs(u.Fragment,{children:[K.role.name==="Admin"?u.jsxs(z,{gap:5,justify:"space-between",children:[u.jsxs(z,{gap:5,justify:"start",children:[" ",u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{r()},borderRadius:0,children:"Add New Appointment"}),u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{t("/doctors/add")},borderRadius:0,children:"Add Doctor"}),u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{c()},borderRadius:0,children:"Add Patient"}),u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{s()},borderRadius:0,children:"Add Medicine"}),u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(ts,{fontSize:18}),onClick:()=>{f()},borderRadius:0,children:"New checkin"})]}),u.jsx(kn,{})]}):u.jsxs(z,{gap:5,justify:"space-between",children:[u.jsxs(z,{gap:5,justify:"start",children:[i("APPOINTMENT_ADD")&&u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{r()},borderRadius:0,children:"Add New Appointment"}),i("DOCTOR_ADD")&&u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{t("/doctors/add")},borderRadius:0,children:"Add Doctor"}),i("PATIENT_ADD")&&u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{c()},borderRadius:0,children:"Add Patient"}),i("MEDICINE_ADD")&&u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(vt,{fontSize:18}),onClick:()=>{s()},borderRadius:0,children:"Add Medicine"}),i("CHECKIN_ADD")&&u.jsx(at,{size:"xs",colorScheme:"blue",bg:"blue.700",_hover:{bg:"blue.700"},color:"#fff",leftIcon:u.jsx(ts,{fontSize:18}),onClick:()=>{s()},borderRadius:0,children:"Add Medicine"})]}),u.jsx(kn,{})]})," ",u.jsx(Eo,{isOpen:e,onClose:n}),u.jsx(Fo,{isOpen:o,onClose:a}),u.jsx(No,{nextFn:()=>{},onClose:h,isOpen:l}),u.jsx(qo,{isOpen:d,onClose:g})]})};export{ud as default};