diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 2d4cac8..6041d23 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -21,5 +21,9 @@ jobs: - name: Run Vue.js unit tests run: npm run test:unit + - name: Run Firebase integration tests + run: npm run test + working-directory: ./functions + - name: Build environment run: npm run build \ No newline at end of file diff --git a/dist/assets/314858_hidden_eye_icon-5431635a.png b/dist/assets/314858_hidden_eye_icon-5431635a.png new file mode 100644 index 0000000..6f2b613 Binary files /dev/null and b/dist/assets/314858_hidden_eye_icon-5431635a.png differ diff --git a/dist/assets/315220_eye_icon-30328a0f.js b/dist/assets/315220_eye_icon-30328a0f.js new file mode 100644 index 0000000..cd3fe46 --- /dev/null +++ b/dist/assets/315220_eye_icon-30328a0f.js @@ -0,0 +1 @@ +const s="/assets/314858_hidden_eye_icon-5431635a.png",_="/assets/315220_eye_icon-8d95e9db.png";export{s as _,_ as a}; diff --git a/dist/assets/315220_eye_icon-8d95e9db.png b/dist/assets/315220_eye_icon-8d95e9db.png new file mode 100644 index 0000000..c7eec09 Binary files /dev/null and b/dist/assets/315220_eye_icon-8d95e9db.png differ diff --git a/dist/assets/404Page-3090e8b5.js b/dist/assets/404Page-3090e8b5.js new file mode 100644 index 0000000..f935752 --- /dev/null +++ b/dist/assets/404Page-3090e8b5.js @@ -0,0 +1 @@ +import{N as a}from"./Navbar-fcee2b9c.js";import{_ as o,r as n,o as t,c as r,a as s,F as c,b as _}from"./index-9a3ecfe5.js";const p={name:"404Page",components:{Navbar:a}},m=_("h1",null,"404 - You've been derailed :(",-1);function l(d,f,i,u,N,b){const e=n("Navbar");return t(),r(c,null,[s(e),m],64)}const g=o(p,[["render",l]]);export{g as default}; diff --git a/dist/assets/AccountPage-a368ab8c.css b/dist/assets/AccountPage-a368ab8c.css new file mode 100644 index 0000000..c557392 --- /dev/null +++ b/dist/assets/AccountPage-a368ab8c.css @@ -0,0 +1 @@ +h1[data-v-b1085315]{color:#000;text-align:center}h3[data-v-b1085315]{font-size:18px;padding-top:20px}#passReset[data-v-b1085315]{font-size:17px;text-decoration:underline;color:#39d3fa}#passReset[data-v-b1085315]:hover{color:#3993fa;cursor:pointer}#accountDiv[data-v-b1085315]{position:absolute;right:0px;left:0px;bottom:0px;background-color:#fff;height:100%;display:flex;align-items:flex-start;justify-content:center}#accountDiv div[data-v-b1085315]{position:inherit;padding:15px;background-color:#fff;width:45%;height:80%;top:14%;text-align:left;box-shadow:0 0 4px 4px #b6b6b6}#emailUpdate[data-v-b1085315],#passUpdate[data-v-b1085315]{position:relative;left:10px;width:26%}input[data-v-b1085315]{border:none;border-bottom:1px solid #000000;background:transparent;outline:none}#delAcc[data-v-b1085315]{position:absolute;bottom:10px;left:10px}#delPref[data-v-b1085315]{position:absolute;bottom:10px;left:160px} diff --git a/dist/assets/AccountPage-edc2add1.js b/dist/assets/AccountPage-edc2add1.js new file mode 100644 index 0000000..8248d9e --- /dev/null +++ b/dist/assets/AccountPage-edc2add1.js @@ -0,0 +1 @@ +import{g as m,c as f,h as g}from"./index.esm2017-54994bc5.js";import{_ as P,g as b,E as y,k as U,u as v,l as E,m as A,n as T,r as C,o as n,c as o,a as _,b as r,h as k,t as S,i as x,q as u,v as l,F as N,e as D,p as M,j as V}from"./index-9a3ecfe5.js";import{t as B}from"./style-1561178c.js";import{N as F}from"./Navbar-fcee2b9c.js";const w=b(),I={name:"AccountPage",components:{Navbar:F},data(){return{user:null,newEmail:"",newPassword:"",currentPassword:"",toastMessage:"",toastBackground:"",reAuthSuccessful:!1,showCurrentPassword:!1,showNewPassword:!1,toast:()=>{B(this.toastMessage,{hideProgressBar:!0,timeout:4e3,toastBackgroundColor:this.toastBackground})}}},created(){this.user=w.currentUser},methods:{showToast(s,e){this.toastMessage=s,this.toastBackground=e,this.toast()},async authenticateUser(s){var e=await y.credential(this.user.email,s);await U(this.user,e).then(()=>{this.reAuthSuccessful=!0}).catch(h=>{this.reAuthSuccessful=!1,h.message.includes("wrong")?this.showToast("Wrong password inputted","red"):this.showToast(h.message,"red")})},resetCredentials(){this.newEmail="",this.newPassword="",this.currentPassword="",this.reAuthSuccessful=!1},updateUserEmail(){if(!this.newEmail||!this.currentPassword){this.showToast("Missing password input","red");return}this.authenticateUser(this.currentPassword).then(()=>{this.reAuthSuccessful&&v(this.user,this.newEmail).then(()=>{this.resetCredentials(),this.showToast("Email successfully updated","green")}).catch(s=>{this.showToast(s.message,"red")})})},updateUserPassword(){if(!this.newPassword||!this.currentPassword){this.showToast("Missing password input","red");return}this.authenticateUser(this.currentPassword).then(()=>{this.reAuthSuccessful&&E(this.user,this.newPassword).then(()=>{this.resetCredentials(),this.showToast("Password successfully updated","green")}).catch(s=>{this.showToast(s.message,"red")})})},deleteUserAccount(){if(!this.currentPassword){this.showToast("Missing password input","red");return}this.authenticateUser(this.currentPassword).then(()=>{this.reAuthSuccessful&&A(this.user).then(()=>{this.resetCredentials(),this.showToast("Account successfully deleted","green"),this.$router.push({path:"/"})}).catch(s=>{this.showToast(s.message,"red")})})},resetPasswordEmail(){T(w,this.user.email).then(()=>{this.showToast("Reset password email sent","green")}).catch(s=>{this.showToast(s.message,"red")})},deleteUserPreferences(){if(!this.currentPassword){this.showToast("Missing password input","red");return}this.authenticateUser(this.currentPassword).then(()=>{if(!this.reAuthSuccessful)return;const s=m(D);let e=window.location.hostname;(e==="127.0.0.1"||e==="localhost")&&f(s,e,5001),g(s,"deletePreferences")().then(()=>{this.resetCredentials(),this.showToast("Successfully map deleted filter preferences","green")}).catch(c=>{this.showToast(c.message,"red")})}).catch(s=>{this.showToast(s.message,"red")})}}},d=s=>(M("data-v-b1085315"),s=s(),V(),s),R={id:"accountDiv"},W={id:"mainDiv"},j=d(()=>r("h1",null,"Account Settings",-1)),q={key:0,style:{"text-align":"center"}},H=d(()=>r("br",null,null,-1)),Y=d(()=>r("h3",null,"Enter your current password to edit the below settings",-1)),z=d(()=>r("h3",null,"Change email",-1)),G=d(()=>r("h3",null,"Change password",-1));function J(s,e,h,c,a,i){const p=C("Navbar");return n(),o(N,null,[_(p),r("div",R,[r("div",W,[j,this.user?(n(),o("p",q,[k("Your email: "),r("b",null,S(this.user.email),1),H,r("span",{id:"passReset",onClick:e[0]||(e[0]=t=>i.resetPasswordEmail())},"Send password reset email")])):x("",!0),Y,a.showCurrentPassword?u((n(),o("input",{key:1,type:"text","onUpdate:modelValue":e[1]||(e[1]=t=>a.currentPassword=t),placeholder:"Enter existing password"},null,512)),[[l,a.currentPassword]]):u((n(),o("input",{key:2,type:"password","onUpdate:modelValue":e[2]||(e[2]=t=>a.currentPassword=t),placeholder:"Enter existing password"},null,512)),[[l,a.currentPassword]]),z,u(r("input",{type:"email","onUpdate:modelValue":e[3]||(e[3]=t=>a.newEmail=t),"aria-describedby":"emailHelp",placeholder:"Enter new email"},null,512),[[l,a.newEmail]]),r("button",{onClick:e[4]||(e[4]=t=>i.updateUserEmail()),id:"emailUpdate",type:"button",class:"btn btn-primary",value:"Update Email"},"Update email"),G,a.showNewPassword?u((n(),o("input",{key:3,type:"text","onUpdate:modelValue":e[5]||(e[5]=t=>a.newPassword=t),placeholder:"Enter new password"},null,512)),[[l,a.newPassword]]):u((n(),o("input",{key:4,type:"password","onUpdate:modelValue":e[6]||(e[6]=t=>a.newPassword=t),placeholder:"Enter new password"},null,512)),[[l,a.newPassword]]),r("button",{onClick:e[7]||(e[7]=t=>i.updateUserPassword()),id:"passUpdate",type:"button",class:"btn btn-primary"},"Update Password"),r("button",{onClick:e[8]||(e[8]=t=>i.deleteUserPreferences()),id:"delPref",type:"button",class:"btn btn-danger"},"Delete Map Preferences"),r("button",{onClick:e[9]||(e[9]=t=>i.deleteUserAccount()),id:"delAcc",type:"button",class:"btn btn-danger",value:"Delete Account"},"Delete Account")])])],64)}const X=P(I,[["render",J],["__scopeId","data-v-b1085315"]]);export{X as default}; diff --git a/dist/assets/InsightsPage-37912657.js b/dist/assets/InsightsPage-37912657.js deleted file mode 100644 index 3107fda..0000000 --- a/dist/assets/InsightsPage-37912657.js +++ /dev/null @@ -1 +0,0 @@ -import{s as n}from"./store-6f7621d4.js";import{N as u}from"./Navbar-6b07ba01.js";import{_ as p,r as _,o as e,c as a,a as g,b as s,t,d as o,F as l,e as m,p as T,f as b}from"./index-93b9eb88.js";const y={name:"InsightsPage",data(){return{insights:{},latestTrain:{},earliestTrain:{},rawData:{},orderedTrains:[],store:n}},components:{Navbar:u},created(){this.insights=n.insights,this.latestTrain=n.latestTrain,this.earliestTrain=n.earliestTrain,this.rawData=n.rawData,this.orderedTrains=n.orderedTrains}},h=i=>(T("data-v-b6ad733a"),i=i(),b(),i),f=h(()=>s("h1",null,"Insights",-1)),v={key:0},N={key:0},I={key:1},k=h(()=>s("h1",null,"Leaderboard",-1)),C={key:0},D={key:1};function S(i,w,x,L,d,P){const c=_("Navbar");return e(),a(l,null,[g(c),f,this.insights?(e(),a("div",v,[s("p",null,"Total number of trains: "+t(this.insights.totalNumTrains),1),s("p",null,"Number of actively running trains: "+t(this.insights.numRunningTrains),1),s("p",null,"Percentage late: "+t(this.insights.percentageLate)+"%",1),s("p",null,"Percentage early or ontime: "+t(this.insights.percentageNotLate)+"%",1),this.latestTrain.TrainCode?(e(),a("p",N,"Latest train: "+t(this.latestTrain.TrainCode[0])+", "+t(this.insights.latestTime)+" mins late",1)):o("",!0),this.earliestTrain.TrainCode?(e(),a("p",I,"Earliest train: "+t(this.earliestTrain.TrainCode[0])+", "+t(this.insights.earliestTime*-1)+" mins early",1)):o("",!0),s("p",null,"Mainland: "+t(this.insights.numMainland),1),s("p",null,"Suburban: "+t(this.insights.numSuburban),1),s("p",null,"Darts: "+t(this.insights.numDart),1)])):o("",!0),k,(e(!0),a(l,null,m(d.orderedTrains,r=>(e(),a("div",null,[s("h2",null,t(this.rawData[r.jsonIndex].TrainCode[0]),1),r.time>0?(e(),a("p",C,t(r.time)+" mins late",1)):(e(),a("p",D,t(r.time*-1)+" mins early",1))]))),256))],64)}const E=p(y,[["render",S],["__scopeId","data-v-b6ad733a"]]);export{E as default}; diff --git a/dist/assets/InsightsPage-9ac0e67d.css b/dist/assets/InsightsPage-9ac0e67d.css new file mode 100644 index 0000000..1f5fd38 --- /dev/null +++ b/dist/assets/InsightsPage-9ac0e67d.css @@ -0,0 +1 @@ +div[data-v-37c13361],div[data-v-e35fddf5]{width:70%}.card-text[data-v-7860af3e],.card-stats[data-v-7860af3e]{font-size:17px}.piechart[data-v-7860af3e]{display:flex;justify-content:center;padding-bottom:0;margin-bottom:0;height:53%}#barChart[data-v-7860af3e]{position:relative;padding:10px;width:100%;top:20px;height:40%}th[data-v-7860af3e]{padding:15px;text-align:center;font-size:19px}#leaderboardTitleDiv p[data-v-7860af3e]{font-family:Franklin Gothic Medium,Arial Narrow,Arial,sans-serif;text-align:center;font-size:50px;padding-top:10px}table[data-v-7860af3e]{border-spacing:1;border-collapse:collapse;background:white;border-radius:6px;overflow:hidden;max-width:1400px;width:100%;margin:0 auto;position:relative;font-size:19px}*[data-v-7860af3e]{position:relative}td[data-v-7860af3e],th[data-v-7860af3e]{padding-left:8px}thead tr[data-v-7860af3e]{height:60px;background:#ffed86;font-size:16px}tbody tr[data-v-7860af3e]{height:48px;border-bottom:1px solid #e3f1d5}tbody tr[data-v-7860af3e]:last-child{border:0;border-bottom:2px solid #d5e0f1}td[data-v-7860af3e],th[data-v-7860af3e]{text-align:left}td.l[data-v-7860af3e],th.l[data-v-7860af3e]{text-align:right}@media screen and (max-width: 820px){table[data-v-7860af3e],table tr[data-v-7860af3e],td[data-v-7860af3e],th[data-v-7860af3e],*[data-v-7860af3e]{display:block}thead[data-v-7860af3e]{display:none}tbody tr[data-v-7860af3e]{height:auto;padding:8px 0}tbody tr td[data-v-7860af3e]{padding-left:45%;margin-bottom:12px}tbody tr td[data-v-7860af3e]:last-child{margin-bottom:0}tbody tr td[data-v-7860af3e]:before{position:absolute;font-weight:700;width:40%;left:10px;top:0}tbody tr td[data-v-7860af3e]:nth-child(1):before{content:"Code"}tbody tr td[data-v-7860af3e]:nth-child(2):before{content:"Time"}tbody tr td[data-v-7860af3e]:nth-child(3):before{content:"Type"}tbody tr td[data-v-7860af3e]:nth-child(4):before{content:"Origin"}tbody tr td[data-v-7860af3e]:nth-child(5):before{content:"Destination"}} diff --git a/dist/assets/InsightsPage-9f2265bd.css b/dist/assets/InsightsPage-9f2265bd.css deleted file mode 100644 index af1514b..0000000 --- a/dist/assets/InsightsPage-9f2265bd.css +++ /dev/null @@ -1 +0,0 @@ -body[data-v-b6ad733a]{background-color:#2c6666} diff --git a/dist/assets/InsightsPage-ba74d16b.js b/dist/assets/InsightsPage-ba74d16b.js new file mode 100644 index 0000000..55b6023 --- /dev/null +++ b/dist/assets/InsightsPage-ba74d16b.js @@ -0,0 +1,18 @@ +var Jn=Object.defineProperty;var to=(i,t,e)=>t in i?Jn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var P=(i,t,e)=>(to(i,typeof t!="symbol"?t+"":t,e),e);import{s as Z,N as eo}from"./Navbar-fcee2b9c.js";import{g as Vi,c as Ni,h as ve}from"./index.esm2017-54994bc5.js";import{t as io}from"./style-1561178c.js";import{H as sn,J as so,Q as nn,K as no,R as oo,S as ao,U as on,V as pi,W as ro,X as an,_ as Si,r as re,o as q,I as lo,c as J,a as $t,i as le,F as Ee,b as k,t as N,q as co,Y as ho,Z as ji,e as $i,p as fo,j as uo}from"./index-9a3ecfe5.js";/*! + * @kurkle/color v0.3.2 + * https://github.com/kurkle/color#readme + * (c) 2023 Jukka Kurkela + * Released under the MIT License + */function be(i){return i+.5|0}const yt=(i,t,e)=>Math.max(Math.min(i,e),t);function se(i){return yt(be(i*2.55),0,255)}function wt(i){return yt(be(i*255),0,255)}function mt(i){return yt(be(i/2.55)/100,0,1)}function Yi(i){return yt(be(i*100),0,100)}const ot={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},mi=[..."0123456789ABCDEF"],go=i=>mi[i&15],po=i=>mi[(i&240)>>4]+mi[i&15],ke=i=>(i&240)>>4===(i&15),mo=i=>ke(i.r)&&ke(i.g)&&ke(i.b)&&ke(i.a);function bo(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&ot[i[1]]*17,g:255&ot[i[2]]*17,b:255&ot[i[3]]*17,a:t===5?ot[i[4]]*17:255}:(t===7||t===9)&&(e={r:ot[i[1]]<<4|ot[i[2]],g:ot[i[3]]<<4|ot[i[4]],b:ot[i[5]]<<4|ot[i[6]],a:t===9?ot[i[7]]<<4|ot[i[8]]:255})),e}const _o=(i,t)=>i<255?t(i):"";function xo(i){var t=mo(i)?go:po;return i?"#"+t(i.r)+t(i.g)+t(i.b)+_o(i.a,t):void 0}const yo=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function rn(i,t,e){const s=t*Math.min(e,1-e),n=(o,a=(o+i/30)%12)=>e-s*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function vo(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 ko(i,t,e){const s=rn(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 wo(i,t,e,s,n){return i===n?(t-e)/s+(t.5?h/(2-o-a):h/(o+a),l=wo(e,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Ti(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(wt)}function Ci(i,t,e){return Ti(rn,i,t,e)}function Mo(i,t,e){return Ti(ko,i,t,e)}function So(i,t,e){return Ti(vo,i,t,e)}function ln(i){return(i%360+360)%360}function Po(i){const t=yo.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?se(+t[5]):wt(+t[5]));const n=ln(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?s=Mo(n,o,a):t[1]==="hsv"?s=So(n,o,a):s=Ci(n,o,a),{r:s[0],g:s[1],b:s[2],a:e}}function To(i,t){var e=Pi(i);e[0]=ln(e[0]+t),e=Ci(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Co(i){if(!i)return;const t=Pi(i),e=t[0],s=Yi(t[1]),n=Yi(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${mt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const Xi={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"},Ui={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 Do(){const i={},t=Object.keys(Ui),e=Object.keys(Xi);let s,n,o,a,r;for(s=0;s>16&255,o>>8&255,o&255]}return i}let we;function Oo(i){we||(we=Do(),we.transparent=[0,0,0,0]);const t=we[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Ao=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Lo(i){const t=Ao.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const a=+t[7];e=t[8]?se(a):yt(a*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?se(s):yt(s,0,255)),n=255&(t[4]?se(n):yt(n,0,255)),o=255&(t[6]?se(o):yt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Ro(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${mt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const ni=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Vt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Fo(i,t,e){const s=Vt(mt(i.r)),n=Vt(mt(i.g)),o=Vt(mt(i.b));return{r:wt(ni(s+e*(Vt(mt(t.r))-s))),g:wt(ni(n+e*(Vt(mt(t.g))-n))),b:wt(ni(o+e*(Vt(mt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Me(i,t,e){if(i){let s=Pi(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ci(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function cn(i,t){return i&&Object.assign(t||{},i)}function Ki(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=wt(i[3]))):(t=cn(i,{r:0,g:0,b:0,a:1}),t.a=wt(t.a)),t}function Eo(i){return i.charAt(0)==="r"?Lo(i):Po(i)}class fe{constructor(t){if(t instanceof fe)return t;const e=typeof t;let s;e==="object"?s=Ki(t):e==="string"&&(s=bo(t)||Oo(t)||Eo(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=cn(this._rgb);return t&&(t.a=mt(t.a)),t}set rgb(t){this._rgb=Ki(t)}rgbString(){return this._valid?Ro(this._rgb):void 0}hexString(){return this._valid?xo(this._rgb):void 0}hslString(){return this._valid?Co(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Fo(this._rgb,t._rgb,e)),this}clone(){return new fe(this.rgb)}alpha(t){return this._rgb.a=wt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=be(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 Me(this._rgb,2,t),this}darken(t){return Me(this._rgb,2,-t),this}saturate(t){return Me(this._rgb,1,t),this}desaturate(t){return Me(this._rgb,1,-t),this}rotate(t){return To(this._rgb,t),this}}/*! + * Chart.js v4.2.1 + * https://www.chartjs.org + * (c) 2023 Chart.js Contributors + * Released under the MIT License + */function ut(){}const Io=(()=>{let i=0;return()=>i++})();function E(i){return i===null||typeof i>"u"}function B(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function O(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function X(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function nt(i,t){return X(i)?i:t}function A(i,t){return typeof i>"u"?t:i}const zo=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,hn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function I(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function R(i,t,e,s){let n,o,a;if(B(i))if(o=i.length,s)for(n=o-1;n>=0;n--)t.call(e,i[n],n);else for(n=0;ni,x:i=>i.x,y:i=>i.y};function Wo(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 Vo(i){const t=Wo(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Ft(i,t){return(qi[t]||(qi[t]=Vo(t)))(i)}function Di(i){return i.charAt(0).toUpperCase()+i.slice(1)}const rt=i=>typeof i<"u",St=i=>typeof i=="function",Gi=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function No(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const $=Math.PI,H=2*$,$e=Number.POSITIVE_INFINITY,jo=$/180,W=$/2,Pt=$/4,Zi=$*2/3,vt=Math.log10,Mt=Math.sign;function Ie(i,t,e){return Math.abs(i-t)n-o).pop(),t}function Ye(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Yo(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function fn(i,t,e){let s,n,o;for(s=0,n=i.length;sl&&c=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ai(i,t,e){e=e||(a=>i[a]1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const bi=(i,t,e,s)=>Ai(i,e,s?n=>{const o=i[n][t];return oi[n][t]Ai(i,e,s=>i[s][t]>=e);function qo(i,t,e){let s=0,n=i.length;for(;ss&&i[n-1]>e;)n--;return s>0||n{const s="_onData"+Di(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o)}),a}})})}function ts(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)&&(gn.forEach(o=>{delete i[o]}),delete i._chartjs)}function pn(i){const t=new Set;let e,s;for(e=0,s=i.length;e"u"?function(i){return i()}:window.requestAnimationFrame}();function bn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,mn.call(window,()=>{s=!1,i.apply(t,e)}))}}function Zo(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Li=i=>i==="start"?"left":i==="end"?"right":"center",G=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Qo=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t,Se=i=>i===0||i===1,es=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*H/e)),is=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*H/e)+1,he={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*W)+1,easeOutSine:i=>Math.sin(i*W),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=>Se(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=>Se(i)?i:es(i,.075,.3),easeOutElastic:i=>Se(i)?i:is(i,.075,.3),easeInOutElastic(i){return Se(i)?i:i<.5?.5*es(i*2,.1125,.45):.5+.5*is(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-he.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?he.easeInBounce(i*2)*.5:he.easeOutBounce(i*2-1)*.5+.5};function _n(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ss(i){return _n(i)?i:new fe(i)}function oi(i){return _n(i)?i:new fe(i).saturate(.5).darken(.1).hexString()}const Jo=["x","y","borderWidth","radius","tension"],ta=["color","borderColor","backgroundColor"];function ea(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:ta},numbers:{type:"number",properties:Jo}}),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 ia(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const ns=new Map;function sa(i,t){t=t||{};const e=i+JSON.stringify(t);let s=ns.get(e);return s||(s=new Intl.NumberFormat(i,t),ns.set(e,s)),s}function ti(i,t,e){return sa(t,e).format(i)}const xn={values(i){return B(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=na(i,e)}const a=vt(Math.abs(o)),r=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ti(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(vt(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?xn.numeric.call(this,i,t,e):""}};function na(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 ei={formatters:xn};function oa(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",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:ei.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 Et=Object.create(null),_i=Object.create(null);function de(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;ss.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)=>oi(n.backgroundColor),this.hoverBorderColor=(s,n)=>oi(n.borderColor),this.hoverColor=(s,n)=>oi(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ai(this,t,e)}get(t){return de(this,t)}describe(t,e){return ai(_i,t,e)}override(t,e){return ai(Et,t,e)}route(t,e,s,n){const o=de(this,t),a=de(this,s),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[n];return O(l)?Object.assign({},c,l):A(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var j=new aa({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[ea,ia,oa]);function ra(i){return!i||E(i.size)||E(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ue(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 la(i,t,e,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(n=s.data={},o=s.garbageCollect=[],s.font=t),i.save(),i.font=t;let a=0;const r=e.length;let l,c,h,d,f;for(l=0;le.length){for(l=0;l0&&i.stroke()}}function vn(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,ca(i,o),l=0;l+i||0;function Ei(i,t){const e={},s=O(t),n=s?Object.keys(t):t,o=O(i)?s?a=>A(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of n)e[a]=pa(o(a));return e}function kn(i){return Ei(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Lt(i){return Ei(i,["topLeft","topRight","bottomLeft","bottomRight"])}function Q(i){const t=kn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Y(i,t){i=i||{},t=t||j.font;let e=A(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=A(i.style,t.style);s&&!(""+s).match(ua)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:A(i.family,t.family),lineHeight:ga(A(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:A(i.weight,t.weight),string:""};return n.string=ra(n),n}function Pe(i,t,e,s){let n=!0,o,a,r;for(o=0,a=i.length;oe&&r===0?0:r+l;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function zt(i,t){return Object.assign(Object.create(i),t)}function Ii(i,t=[""],e=i,s,n=()=>i[0]){rt(s)||(s=Pn("_fallback",i));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:e,_fallback:s,_getTarget:n,override:a=>Ii([a,...i],t,e,s)};return new Proxy(o,{deleteProperty(a,r){return delete a[r],delete a._keys,delete i[0][r],!0},get(a,r){return Mn(a,r,()=>Ma(r,t,i,a))},getOwnPropertyDescriptor(a,r){return Reflect.getOwnPropertyDescriptor(a._scopes[0],r)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,r){return ls(a).includes(r)},ownKeys(a){return ls(a)},set(a,r,l){const c=a._storage||(a._storage=n());return a[r]=c[r]=l,delete a._keys,!0}})}function Ut(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:wn(i,s),setContext:o=>Ut(i,o,e,s),override:o=>Ut(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return Mn(o,a,()=>_a(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function wn(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:St(e)?e:()=>e,isIndexable:St(s)?s:()=>s}}const ba=(i,t)=>i?i+Di(t):t,zi=(i,t)=>O(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Mn(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t))return i[t];const s=e();return i[t]=s,s}function _a(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=i;let r=s[t];return St(r)&&a.isScriptable(t)&&(r=xa(t,r,i,e)),B(r)&&r.length&&(r=ya(t,r,i,a.isIndexable)),zi(t,r)&&(r=Ut(r,n,o&&o[t],a)),r}function xa(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);return r.add(i),t=t(o,a||s),r.delete(i),zi(i,t)&&(t=Bi(n._scopes,n,i,t)),t}function ya(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(rt(o.index)&&s(i))t=t[o.index%t.length];else if(O(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Bi(c,n,i,h);t.push(Ut(d,o,a&&a[i],r))}}return t}function Sn(i,t,e){return St(i)?i(t,e):i}const va=(i,t)=>i===!0?t:typeof i=="string"?Ft(t,i):void 0;function ka(i,t,e,s,n){for(const o of t){const a=va(e,o);if(a){i.add(a);const r=Sn(a._fallback,e,n);if(rt(r)&&r!==e&&r!==s)return r}else if(a===!1&&rt(s)&&e!==s)return null}return!1}function Bi(i,t,e,s){const n=t._rootScopes,o=Sn(t._fallback,e,s),a=[...i,...n],r=new Set;r.add(s);let l=rs(r,a,e,o||e,s);return l===null||rt(o)&&o!==e&&(l=rs(r,a,o,l,s),l===null)?!1:Ii(Array.from(r),[""],n,o,()=>wa(t,e,s))}function rs(i,t,e,s,n){for(;e;)e=ka(i,t,e,s,n);return e}function wa(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return B(n)&&O(e)?e:n||{}}function Ma(i,t,e,s){let n;for(const o of t)if(n=Pn(ba(o,i),e),rt(n))return zi(i,n)?Bi(e,s,i,n):n}function Pn(i,t){for(const e of t){if(!e)continue;const s=e[i];if(rt(s))return s}}function ls(i){let t=i._keys;return t||(t=i._keys=Sa(i._scopes)),t}function Sa(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}function Tn(){return typeof window<"u"&&typeof document<"u"}function Hi(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ke(i,t,e){let s;return typeof i=="string"?(s=parseInt(i,10),i.indexOf("%")!==-1&&(s=s/100*t.parentNode[e])):s=i,s}const ii=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function Pa(i,t){return ii(i).getPropertyValue(t)}const Ta=["top","right","bottom","left"];function Rt(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 Ca=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Da(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(Ca(n,o,i.target))r=n,l=o;else{const c=t.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Ot(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=ii(e),o=n.boxSizing==="border-box",a=Rt(n,"padding"),r=Rt(n,"border","width"),{x:l,y:c,box:h}=Da(i,e),d=a.left+(h&&r.left),f=a.top+(h&&r.top);let{width:u,height:m}=t;return o&&(u-=a.width+r.width,m-=a.height+r.height),{x:Math.round((l-d)/u*e.width/s),y:Math.round((c-f)/m*e.height/s)}}function Oa(i,t,e){let s,n;if(t===void 0||e===void 0){const o=Hi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=ii(o),l=Rt(r,"border","width"),c=Rt(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,s=Ke(r.maxWidth,o,"clientWidth"),n=Ke(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||$e,maxHeight:n||$e}}const Te=i=>Math.round(i*10)/10;function Aa(i,t,e,s){const n=ii(i),o=Rt(n,"margin"),a=Ke(n.maxWidth,i,"clientWidth")||$e,r=Ke(n.maxHeight,i,"clientHeight")||$e,l=Oa(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const f=Rt(n,"border","width"),u=Rt(n,"padding");c-=u.width+f.width,h-=u.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Te(Math.min(c,a,l.maxWidth)),h=Te(Math.min(h,r,l.maxHeight)),c&&!h&&(h=Te(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Te(Math.floor(h*s))),{width:c,height:h}}function cs(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 a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(i.currentDevicePixelRatio=s,a.height=n,a.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const La=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return i}();function hs(i,t){const e=Pa(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}const Ra=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},Fa=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Yt(i,t,e){return i?Ra(t,e):Fa()}function Cn(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 Dn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}/*! + * Chart.js v4.2.1 + * https://www.chartjs.org + * (c) 2023 Chart.js Contributors + * Released under the MIT License + */class Ea{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(s-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=mn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var gt=new Ea;const ds="transparent",Ia={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ss(i||ds),n=s.valid&&ss(t||ds);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class za{constructor(t,e,s,n){const o=e[s];n=Pe([t.to,n,o,t.from]);const a=Pe([t.from,o,n]);this._active=!0,this._fn=t.fn||Ia[t.type||typeof a],this._easing=he[t.easing]||he.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=a,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,a=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Pe([t.to,e,n,t.from]),this._from=Pe([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n{const o=t[n];if(!O(o))return;const a={};for(const r of e)a[r]=o[r];(B(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a)})})}_animateOptions(t,e){const s=e.options,n=Ha(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Ba(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,r);continue}else d.cancel();if(!f||!f.duration){t[c]=h;continue}o[c]=d=new za(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 gt.add(this._chart,s),!0}}function Ba(i,t){const e=[],s=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function ms(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=ja(o,a,s),d=t.length;let f;for(let u=0;ue[s].axis===t).shift()}function Xa(i,t){return zt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ua(i,t,e){return zt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Qt(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 li=i=>i==="reset"||i==="none",bs=(i,t)=>t?i:Object.assign({},i),Ka=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:An(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=gs(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&&Qt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,f,u,m)=>d==="x"?f:d==="r"?m:u,o=e.xAxisID=A(s.xAxisID,ri(t,"x")),a=e.yAxisID=A(s.yAxisID,ri(t,"y")),r=e.rAxisID=A(s.rAxisID,ri(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ts(this._data,this),t._stacked&&Qt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(O(e))this._data=Na(e);else if(s!==e){if(s){ts(s,this);const n=this._cachedMeta;Qt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Go(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=gs(e.vScale,e),e.stack!==s.stack&&(n=!0,Qt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&ms(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:a}=s,r=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,f;if(this._parsing===!1)s._parsed=n,s._sorted=!0,f=n;else{B(n[t])?f=this.parseArrayData(s,n,t,e):O(n[t])?f=this.parseObjectData(s,n,t,e):f=this.parsePrimitiveData(s,n,t,e);const u=()=>d[r]===null||c&&d[r]g||d=0;--f)if(!m()){this.updateRangeFromParsed(c,t,u,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(s,n,e),g=c.resolveNamedOptions(f,u,m,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(bs(g,l))),g}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),f=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(f,this.getContext(t,s,e))}const c=new On(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||li(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:a}}updateElement(t,e,s,n){li(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!li(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const n=s.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;rn-o))}return i._cache.$bar}function Ga(i){const t=i.iScale,e=qa(t,i.type);let s=t._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(rt(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a)};for(n=0,o=e.length;n0?n[i-1]:null,r=iMath.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function Ln(i,t,e,s){return B(i)?Ja(i,t,e,s):t[e.axis]=e.parse(i,s),t}function _s(i,t,e,s){const n=i.iScale,o=i.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,f;for(c=e,h=e+s;c=e?1:-1)}function er(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.basel.controller.options.grouped),o=s.options.stacked,a=[],r=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(E(h)||isNaN(h))return!0};for(const l of n)if(!(e!==void 0&&r(l))&&((o===!1||a.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,a;for(o=0,a=e.data.length;oXe(x,r,l,!0)?1:Math.max(v,v*e,y,y*e),m=(x,v,y)=>Xe(x,r,l,!0)?-1:Math.min(v,v*e,y,y*e),g=u(0,c,d),p=u(W,h,f),b=m($,c,d),_=m($+W,h,f);s=(g-b)/2,n=(p-_)/2,o=-(g+b)/2,a=-(p+_)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}class ne 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(O(s[t])){const{key:l="value"}=this._parsing;o=c=>+Ft(s[c],l)}let a,r;for(a=t,r=t+e;a0&&!isNaN(t)?H*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ti(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,a,r,l;if(!t){for(n=0,o=s.data.datasets.length;nt!=="spacing",_indexable:t=>t!=="spacing"}),P(ne,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}});class xi extends ne{}P(xi,"id","pie"),P(xi,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function Ct(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Wi{static override(t){Object.assign(Wi.prototype,t)}constructor(t){this.options=t||{}}init(){}formats(){return Ct()}parse(){return Ct()}format(){return Ct()}add(){return Ct()}diff(){return Ct()}startOf(){return Ct()}endOf(){return Ct()}}var ar={_date:Wi};function rr(i,t,e,s){const{controller:n,data:o,_sorted:a}=i,r=n._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?Ko:bi;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),f=l(o,t,e+h);return{lo:d.lo,hi:f.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function _e(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r{l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),s&&!r?[]:o}var dr={evaluateInteractionItems:_e,modes:{index(i,t,e,s){const n=Ot(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?hi(i,n,o,s,a):di(i,n,o,!1,s,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Ot(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?hi(i,n,o,s,a):di(i,n,o,!1,s,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;he.pos===t)}function ks(i,t){return i.filter(e=>Rn.indexOf(e.pos)===-1&&e.box.axis===t)}function te(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 fr(i){const t=[];let e,s,n,o,a,r;for(e=0,s=(i||[]).length;ec.box.fullSize),!0),s=te(Jt(t,"left"),!0),n=te(Jt(t,"right")),o=te(Jt(t,"top"),!0),a=te(Jt(t,"bottom")),r=ks(t,"x"),l=ks(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Jt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function ws(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Fn(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 mr(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!O(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Fn(a,o.getPadding());const r=Math.max(0,t.outerWidth-ws(a,i,"left","right")),l=Math.max(0,t.outerHeight-ws(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function br(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 _r(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function oe(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,p)=>p.box.options&&p.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),f=Object.assign({},n);Fn(f,Q(s));const u=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),m=gr(l.concat(c),d);oe(r.fullSize,u,d,m),oe(l,u,d,m),oe(c,u,d,m)&&oe(l,u,d,m),br(u),Ms(r.leftAndTop,u,d,m),u.x+=u.w,u.y+=u.h,Ms(r.rightAndBottom,u,d,m),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},R(r.chartArea,g=>{const p=g.box;Object.assign(p,i.chartArea),p.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class En{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 xr extends En{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Be="$chartjs",yr={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ss=i=>i===null||i==="";function vr(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Be]={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",Ss(n)){const o=hs(i,"width");o!==void 0&&(i.width=o)}if(Ss(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=hs(i,"height");o!==void 0&&(i.height=o)}return i}const In=La?{passive:!0}:!1;function kr(i,t,e){i.addEventListener(t,e,In)}function wr(i,t,e){i.canvas.removeEventListener(t,e,In)}function Mr(i,t){const e=yr[i.type]||i.type,{x:s,y:n}=Ot(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function qe(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Sr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||qe(r.addedNodes,s),a=a&&!qe(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Pr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||qe(r.removedNodes,s),a=a&&!qe(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const pe=new Map;let Ps=0;function zn(){const i=window.devicePixelRatio;i!==Ps&&(Ps=i,pe.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Tr(i,t){pe.size||window.addEventListener("resize",zn),pe.set(i,t)}function Cr(i){pe.delete(i),pe.size||window.removeEventListener("resize",zn)}function Dr(i,t,e){const s=i.canvas,n=s&&Hi(s);if(!n)return;const o=bn((r,l)=>{const c=n.clientWidth;e(r,l),c{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),Tr(i,o),a}function fi(i,t,e){e&&e.disconnect(),t==="resize"&&Cr(i)}function Or(i,t,e){const s=i.canvas,n=bn(o=>{i.ctx!==null&&e(Mr(o,i))},i);return kr(s,t,n),n}class Ar extends En{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(vr(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Be])return!1;const s=e[Be].initial;["height","width"].forEach(o=>{const a=s[o];E(a)?e.removeAttribute(o):e.setAttribute(o,a)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Be],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:Sr,detach:Pr,resize:Dr}[e]||Or;n[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:fi,detach:fi,resize:fi}[e]||wr)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Aa(t,e,s,n)}isAttached(t){const e=Hi(t);return!!(e&&e.isConnected)}}function Lr(i){return!Tn()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?xr:Ar}class bt{constructor(){P(this,"active",!1)}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return Ye(this.x)&&Ye(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}}P(bt,"defaults",{}),P(bt,"defaultRoutes");function Rr(i,t){const e=i.options.ticks,s=Fr(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Ir(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return zr(t,c,o,a/n),c;const h=Er(o,t,n);if(a>0){let d,f;const u=a>1?Math.round((l-r)/(a-1)):null;for(De(t,c,h,E(u)?0:r-u,r),d=0,f=a-1;dn)return l}return Math.max(n,1)}function Ir(i){const t=[];let e,s;for(e=0,s=i.length;ei==="left"?"right":i==="right"?"left":i,Ts=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Cs=(i,t)=>Math.min(t||i,i);function Ds(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;oa+r)))return l}function Vr(i,t){R(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;os?s:e,s=n&&e>s?e:s,{min:nt(e,nt(s,e)),max:nt(s,nt(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(){I(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ma(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,f=h.highest.height,u=it(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/s:u/(s-1),d+6>r&&(r=u/(s-(t.offset?.5:1)),l=this.maxHeight-ee(t.grid)-e.padding-Os(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),a=Oi(Math.min(Math.asin(it((h.highest.height+6)/r,-1,1)),Math.asin(it(l/c,-1,1))-Math.asin(it(f/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=Os(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=ee(o)+l):(t.height=this.maxHeight,t.width=ee(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:f}=this._getLabelSizes(),u=s.padding*2,m=ft(this.labelRotation),g=Math.cos(m),p=Math.sin(m);if(r){const b=s.mirror?0:p*d.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:g*d.width+p*f.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,p,g)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,u=0;l?c?(f=n*t.width,u=s*e.height):(f=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,u=e.width/2),this.paddingLeft=Math.max((f-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(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({width:a[T]||0,height:r[T]||0});return{first:S(0),last:S(e-1),widest:S(w),highest:S(M),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Uo(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&&tr*n?r/s:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=ee(o),u=[],m=r.setContext(this.getContext()),g=m.display?m.width:0,p=g/2,b=function(z){return Tt(s,z,g)};let _,x,v,y,w,M,S,T,D,C,L,U;if(a==="top")_=b(this.bottom),M=this.bottom-f,T=_-p,C=b(t.top)+p,U=t.bottom;else if(a==="bottom")_=b(this.top),C=t.top,U=b(t.bottom)-p,M=_+p,T=this.top+f;else if(a==="left")_=b(this.right),w=this.right-f,S=_-p,D=b(t.left)+p,L=t.right;else if(a==="right")_=b(this.left),D=t.left,L=b(t.right)-p,w=_+p,S=this.left+f;else if(e==="x"){if(a==="center")_=b((t.top+t.bottom)/2+.5);else if(O(a)){const z=Object.keys(a)[0],V=a[z];_=b(this.chart.scales[z].getPixelForValue(V))}C=t.top,U=t.bottom,M=_+p,T=M+f}else if(e==="y"){if(a==="center")_=b((t.left+t.right)/2);else if(O(a)){const z=Object.keys(a)[0],V=a[z];_=b(this.chart.scales[z].getPixelForValue(V))}w=_-p,S=w-f,D=t.left,L=t.right}const st=A(n.ticks.maxTicksLimit,d),F=Math.max(1,Math.ceil(d/st));for(x=0;xo.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,a=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,a;for(o=0,a=e.length;o{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");j.route(o,n,l,r)})}function Kr(i){return"id"in i&&"defaults"in i}class qr{constructor(){this.controllers=new Oe(Xt,"datasets",!0),this.elements=new Oe(bt,"elements"),this.plugins=new Oe(Object,"plugins"),this.scales=new Oe(Bt,"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):R(n,a=>{const r=s||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,s){const n=Di(t);I(s["before"+n],[],s),e[t](s),I(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function Zr(i){const t={},e=[],s=Object.keys(ht.plugins.items);for(let o=0;o1&&Ge(i[0].toLowerCase(),t),i))return i;throw new Error(`Cannot determine type of '${name}' axis. Please provide 'axis' or 'position' option.`)}function nl(i,t){const e=Et[i.type]||{scales:{}},s=t.scales||{},n=yi(i.type,t),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!O(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=Ge(a,r),c=il(l,n),h=e.scales||{};o[a]=ce(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||yi(r,t),h=(Et[r]||{}).scales||{};Object.keys(h).forEach(d=>{const f=el(d,l),u=a[f+"AxisID"]||f;o[u]=o[u]||Object.create(null),ce(o[u],[{axis:f},s[u],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];ce(r,[j.scales[r.type],j.scale])}),o}function Bn(i){const t=i.options||(i.options={});t.plugins=A(t.plugins,{}),t.scales=nl(i,t)}function Hn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function ol(i){return i=i||{},i.data=Hn(i.data),Bn(i),i}const As=new Map,Wn=new Set;function Ae(i,t){let e=As.get(i);return e||(e=t(),As.set(i,e),Wn.add(e)),e}const ie=(i,t,e)=>{const s=Ft(t,e);s!==void 0&&i.add(s)};class al{constructor(t){this._config=ol(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=Hn(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(),Bn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ae(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ae(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ae(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ae(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,a=this._cachedScopes(t,s),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>ie(l,t,d))),h.forEach(d=>ie(l,n,d)),h.forEach(d=>ie(l,Et[o]||{},d)),h.forEach(d=>ie(l,j,d)),h.forEach(d=>ie(l,_i,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Wn.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Et[e]||{},j.datasets[e]||{},{type:e},j,_i]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Ls(this._resolverCache,t,n);let l=a;if(ll(a,e)){o.$shared=!1,s=St(s)?s():s;const c=this.createResolver(t,s,r);l=Ut(a,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Ls(this._resolverCache,t,s);return O(e)?Ut(o,e,void 0,n):o}}function Ls(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:Ii(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}const rl=i=>O(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||St(i[e]),!1);function ll(i,t){const{isScriptable:e,isIndexable:s}=wn(i);for(const n of t){const o=e(n),a=s(n),r=(a||o)&&i[n];if(o&&(St(r)||rl(r))||a&&B(r))return!0}return!1}var cl="4.2.1";const hl=["top","bottom","left","right","chartArea"];function Rs(i,t){return i==="top"||i==="bottom"||hl.indexOf(i)===-1&&t==="x"}function Fs(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Es(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),I(e&&e.onComplete,[i],t)}function dl(i){const t=i.chart,e=t.options.animation;I(e&&e.onProgress,[i],t)}function Vn(i){return Tn()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const He={},Is=i=>{const t=Vn(i);return Object.values(He).filter(e=>e.canvas===t).pop()};function fl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const a=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=a)}}}function ul(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function gl(i){const{xScale:t,yScale:e}=i;if(t&&e)return{left:t.left,right:t.right,top:e.top,bottom:e.bottom}}var xt;let xe=(xt=class{static register(...t){ht.add(...t),zs()}static unregister(...t){ht.remove(...t),zs()}constructor(t,e){const s=this.config=new al(e),n=Vn(t),o=Is(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Lr(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Io(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Gr,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Zo(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],He[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}gt.listen(this,"complete",Es),gt.listen(this,"progress",dl),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return E(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 ht}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():cs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return os(this.canvas,this.ctx),this}stop(){return gt.stop(this),this}resize(t,e){gt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,cs(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),I(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};R(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=Ge(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),R(o,a=>{const r=a.options,l=r.id,c=Ge(l,r),h=A(r.type,a.dtype);(r.position===void 0||Rs(r.position,c)!==Rs(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const f=ht.getScale(h);d=new f({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(r,t)}),R(n,(a,r)=>{a||delete s[r]}),R(s,a=>{at.configure(this,a,a.options),at.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;ne.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{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Fs("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){R(this.scales,t=>{at.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Gi(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const a=s==="_removeElements"?-o:o;fl(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=s(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;at.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],R(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=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=gl(t)||this.chartArea,a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(n&&Ri(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&Fi(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return vn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=dr.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=zt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);rt(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),gt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};R(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{n("attach",r),this.attached=!0,this.resize(),s("resize",o),s("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){R(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},R(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!Ne(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=s?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,s,a),l=No(t),c=ul(t,this._lastEvent,s,l);s&&(this._lastEvent=null,I(o.onHover,[t,r,this],this),l&&I(o.onClick,[t,r,this],this));const h=!Ne(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}},P(xt,"defaults",j),P(xt,"instances",He),P(xt,"overrides",Et),P(xt,"registry",ht),P(xt,"version",cl),P(xt,"getChart",Is),xt);function zs(){return R(xe.instances,i=>i._plugins.invalidate())}function pl(i,t,e){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=n/r;i.beginPath(),i.arc(o,a,r,s-c,e+c),l>n?(c=n/l,i.arc(o,a,l,e+c,s-c,!0)):i.arc(o,a,n,e+W,s-W),i.closePath(),i.clip()}function ml(i){return Ei(i,["outerStart","outerEnd","innerStart","innerEnd"])}function bl(i,t,e,s){const n=ml(i.options.borderRadius),o=(e-t)/2,a=Math.min(o,s*t/2),r=l=>{const c=(e-Math.min(o,l))*s/2;return it(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:it(n.innerStart,0,a),innerEnd:it(n.innerEnd,0,a)}}function Nt(i,t,e,s){return{x:e+i*Math.cos(t),y:s+i*Math.sin(t)}}function Ze(i,t,e,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+s+e-c,0),f=h>0?h+s+e+c:0;let u=0;const m=n-l;if(s){const F=h>0?h-s:0,z=d>0?d-s:0,V=(F+z)/2,lt=V!==0?m*V/(V+s):m;u=(m-lt)/2}const g=Math.max(.001,m*d-e/$)/d,p=(m-g)/2,b=l+p+u,_=n-p-u,{outerStart:x,outerEnd:v,innerStart:y,innerEnd:w}=bl(t,f,d,_-b),M=d-x,S=d-v,T=b+x/M,D=_-v/S,C=f+y,L=f+w,U=b+y/C,st=_-w/L;if(i.beginPath(),o){const F=(T+D)/2;if(i.arc(a,r,d,T,F),i.arc(a,r,d,F,D),v>0){const K=Nt(S,D,a,r);i.arc(K.x,K.y,v,D,_+W)}const z=Nt(L,_,a,r);if(i.lineTo(z.x,z.y),w>0){const K=Nt(L,st,a,r);i.arc(K.x,K.y,w,_+W,st+Math.PI)}const V=(_-w/f+(b+y/f))/2;if(i.arc(a,r,f,_-w/f,V,!0),i.arc(a,r,f,V,b+y/f,!0),y>0){const K=Nt(C,U,a,r);i.arc(K.x,K.y,y,U+Math.PI,b-W)}const lt=Nt(M,b,a,r);if(i.lineTo(lt.x,lt.y),x>0){const K=Nt(M,T,a,r);i.arc(K.x,K.y,x,b-W,T)}}else{i.moveTo(a,r);const F=Math.cos(T)*d+a,z=Math.sin(T)*d+r;i.lineTo(F,z);const V=Math.cos(D)*d+a,lt=Math.sin(D)*d+r;i.lineTo(V,lt)}i.closePath()}function _l(i,t,e,s,n){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){Ze(i,t,e,s,l,n);for(let c=0;c=H||Xe(o,r,l),g=At(a,c+f,h+f);return m&&g}getCenterPoint(t){const{x:e,y:s,startAngle:n,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(a+r+c+l)/2;return{x:e+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:s}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=s>H?Math.floor(s/H):0,s===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const l=1-Math.sin(Math.min($,s||0)),c=n*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,_l(t,this,c,o,a),xl(t,this,c,o,a),t.restore()}}P(We,"id","arc"),P(We,"defaults",{borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),P(We,"defaultRoutes",{backgroundColor:"backgroundColor"});function Nn(i,t){const{x:e,y:s,base:n,width:o,height:a}=i.getProps(["x","y","base","width","height"],t);let r,l,c,h,d;return i.horizontal?(d=a/2,r=Math.min(e,n),l=Math.max(e,n),c=s-d,h=s+d):(d=o/2,r=e-d,l=e+d,c=Math.min(s,n),h=Math.max(s,n)),{left:r,top:c,right:l,bottom:h}}function kt(i,t,e,s){return i?0:it(t,e,s)}function yl(i,t,e){const s=i.options.borderWidth,n=i.borderSkipped,o=kn(s);return{t:kt(n.top,o.top,0,e),r:kt(n.right,o.right,0,t),b:kt(n.bottom,o.bottom,0,e),l:kt(n.left,o.left,0,t)}}function vl(i,t,e){const{enableBorderRadius:s}=i.getProps(["enableBorderRadius"]),n=i.options.borderRadius,o=Lt(n),a=Math.min(t,e),r=i.borderSkipped,l=s||O(n);return{topLeft:kt(!l||r.top||r.left,o.topLeft,0,a),topRight:kt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:kt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:kt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function kl(i){const t=Nn(i),e=t.right-t.left,s=t.bottom-t.top,n=yl(i,e/2,s/2),o=vl(i,e/2,s/2);return{outer:{x:t.left,y:t.top,w:e,h:s,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function ui(i,t,e,s){const n=t===null,o=e===null,r=i&&!(n&&o)&&Nn(i,s);return r&&(n||At(t,r.left,r.right))&&(o||At(e,r.top,r.bottom))}function wl(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Ml(i,t){i.rect(t.x,t.y,t.w,t.h)}function gi(i,t,e={}){const s=i.x!==e.x?-t:0,n=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-s,a=(i.y+i.h!==e.y+e.h?t:0)-n;return{x:i.x+s,y:i.y+n,w:i.w+o,h:i.h+a,radius:i.radius}}class Ve extends bt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:a}=kl(this),r=wl(a.radius)?ge:Ml;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,gi(a,e,o)),t.clip(),r(t,gi(o,-e,a)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),r(t,gi(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,s){return ui(this,t,e,s)}inXRange(t,e){return ui(this,t,null,e)}inYRange(t,e){return ui(this,null,t,e)}getCenterPoint(t){const{x:e,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?s:(s+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}P(Ve,"id","bar"),P(Ve,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),P(Ve,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Bs=(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)}},Sl=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Hs extends bt{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=I(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=Y(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=Bs(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,u=-h;return this.legendItems.forEach((m,g)=>{const p=s+e/2+o.measureText(m.text).width;(g===0||c[c.length-1]+p+2*r>a)&&(d+=h,c[c.length-(g>0?0:1)]=0,u+=h,f++),l[g]={left:0,top:u,row:f,width:p,height:n},c[c.length-1]+=p+r}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,f=0,u=0,m=0,g=0;return this.legendItems.forEach((p,b)=>{const{itemWidth:_,itemHeight:x}=Pl(s,e,o,p,n);b>0&&u+x+2*r>h&&(d+=f+r,c.push({width:f,height:u}),m+=f+r,g++,f=u=0),l[b]={left:m,top:u,col:g,width:_,height:x},f=Math.max(f,_),u+=x+r}),d+=f,c.push({width:f,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,a=Yt(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=G(s,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=G(s,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=G(s,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=G(s,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ri(t,this),this._draw(),Fi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:a}=t,r=j.color,l=Yt(t.rtl,this.left,this.width),c=Y(a.font),{padding:h}=a,d=c.size,f=d/2;let u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:m,boxHeight:g,itemHeight:p}=Bs(a,d),b=function(w,M,S){if(isNaN(m)||m<=0||isNaN(g)||g<0)return;n.save();const T=A(S.lineWidth,1);if(n.fillStyle=A(S.fillStyle,r),n.lineCap=A(S.lineCap,"butt"),n.lineDashOffset=A(S.lineDashOffset,0),n.lineJoin=A(S.lineJoin,"miter"),n.lineWidth=T,n.strokeStyle=A(S.strokeStyle,r),n.setLineDash(A(S.lineDash,[])),a.usePointStyle){const D={radius:g*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:T},C=l.xPlus(w,m/2),L=M+f;yn(n,D,C,L,a.pointStyleWidth&&m)}else{const D=M+Math.max((d-g)/2,0),C=l.leftForLtr(w,m),L=Lt(S.borderRadius);n.beginPath(),Object.values(L).some(U=>U!==0)?ge(n,{x:C,y:D,w:m,h:g,radius:L}):n.rect(C,D,m,g),n.fill(),T!==0&&n.stroke()}n.restore()},_=function(w,M,S){It(n,S.text,w,M+p/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},x=this.isHorizontal(),v=this._computeTitleHeight();x?u={x:G(o,this.left+h,this.right-s[0]),y:this.top+h+v,line:0}:u={x:this.left+h,y:G(o,this.top+v+h,this.bottom-e[0].height),line:0},Cn(this.ctx,t.textDirection);const y=p+h;this.legendItems.forEach((w,M)=>{n.strokeStyle=w.fontColor,n.fillStyle=w.fontColor;const S=n.measureText(w.text).width,T=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),D=m+f+S;let C=u.x,L=u.y;l.setWidth(this.width),x?M>0&&C+D+h>this.right&&(L=u.y+=y,u.line++,C=u.x=G(o,this.left+h,this.right-s[u.line])):M>0&&L+y>this.bottom&&(C=u.x=C+e[u.line].width+h,u.line++,L=u.y=G(o,this.top+v+h,this.bottom-e[u.line].height));const U=l.x(C);if(b(U,L,w),C=Qo(T,C+m+f,x?C+D:this.right,t.rtl),_(l.x(C),L,w),x)u.x+=D+h;else if(typeof w.text!="string"){const st=c.lineHeight;u.y+=jn(w,st)}else u.y+=y}),Dn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=Y(e.font),n=Q(e.padding);if(!e.display)return;const o=Yt(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=G(t.align,d,this.right-f);else{const m=this.columnSizes.reduce((g,p)=>Math.max(g,p.height),0);h=c+G(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const u=G(r,d,d+f);a.textAlign=o.textAlign(Li(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,It(a,e.text,u,h,s)}_computeTitleHeight(){const t=this.options.title,e=Y(t.font),s=Q(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(At(t,this.left,this.right)&&At(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>a.length?o:a)),t+e.size/2+s.measureText(n).width}function Cl(i,t,e){let s=i;return typeof t.text!="string"&&(s=jn(t,e)),s}function jn(i,t){const e=i.text?i.text.length+.5:0;return t*e}function Dl(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var $n={id:"legend",_element:Hs,start(i,t,e){const s=i.legend=new Hs({ctx:i.ctx,options:e,chart:i});at.configure(i,s,e),at.addBox(i,s)},stop(i){at.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;at.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=Q(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class Yn extends bt{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=B(s.text)?s.text.length:1;this._padding=Q(s.padding);const o=n*Y(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=G(r,s,o),d=e+t,c=o-s):(a.position==="left"?(h=s+t,d=G(r,n,e),l=$*-.5):(h=o-t,d=G(r,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=Y(e.font),o=s.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);It(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Li(e.align),textBaseline:"middle",translation:[a,r]})}}function Ol(i,t){const e=new Yn({ctx:i.ctx,options:t,chart:i});at.configure(i,e,t),at.addBox(i,e),i.titleBlock=e}var Al={id:"title",_element:Yn,start(i,t,e){Ol(i,e)},stop(i){const t=i.titleBlock;at.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;at.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 ae={average(i){if(!i.length)return!1;let t,e,s=0,n=0,o=0;for(t=0,e=i.length;t-1?i.split(` +`):i}function Ll(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:i,label:a,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Ws(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=Y(t.bodyFont),c=Y(t.titleFont),h=Y(t.footerFont),d=o.length,f=n.length,u=s.length,m=Q(t.padding);let g=m.height,p=0,b=s.reduce((v,y)=>v+y.before.length+y.lines.length+y.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=u*v+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*h.lineHeight+(f-1)*t.footerSpacing);let _=0;const x=function(v){p=Math.max(p,e.measureText(v).width+_)};return e.save(),e.font=c.string,R(i.title,x),e.font=l.string,R(i.beforeBody.concat(i.afterBody),x),_=t.displayColors?a+2+t.boxPadding:0,R(s,v=>{R(v.before,x),R(v.lines,x),R(v.after,x)}),_=0,e.font=h.string,R(i.footer,x),e.restore(),p+=m.width,{width:p,height:g}}function Rl(i,t){const{y:e,height:s}=t;return ei.height-s/2?"bottom":"center"}function Fl(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function El(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Fl(c,i,t,e)&&(c="center"),c}function Vs(i,t,e){const s=e.yAlign||t.yAlign||Rl(i,e);return{xAlign:e.xAlign||t.xAlign||El(i,t,e,s),yAlign:s}}function Il(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function zl(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Ns(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:u}=Lt(a);let m=Il(t,r);const g=zl(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(h,f)+n:r==="right"&&(m+=Math.max(d,u)+n),{x:it(m,0,s.width-t.width),y:it(g,0,s.height-t.height)}}function Le(i,t,e){const s=Q(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function js(i){return ct([],pt(i))}function Bl(i,t,e){return zt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function $s(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Xn={beforeTitle:ut,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"u"?Xn[t].call(e,s):n}class vi extends bt{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 On(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Bl(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=tt(s,"beforeTitle",this,t),o=tt(s,"title",this,t),a=tt(s,"afterTitle",this,t);let r=[];return r=ct(r,pt(n)),r=ct(r,pt(o)),r=ct(r,pt(a)),r}getBeforeBody(t,e){return js(tt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return R(t,o=>{const a={before:[],lines:[],after:[]},r=$s(s,o);ct(a.before,pt(tt(r,"beforeLabel",this,o))),ct(a.lines,tt(r,"label",this,o)),ct(a.after,pt(tt(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return js(tt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=tt(s,"beforeFooter",this,t),o=tt(s,"footer",this,t),a=tt(s,"afterFooter",this,t);let r=[];return r=ct(r,pt(n)),r=ct(r,pt(o)),r=ct(r,pt(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;lt.filter(h,d,f,s))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,s))),R(r,h=>{const d=$s(t.callbacks,h);n.push(tt(d,"labelColor",this,h)),o.push(tt(d,"labelPointStyle",this,h)),a.push(tt(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const r=ae[s.position].call(this,n,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);const l=this._size=Ws(this,s),c=Object.assign({},r,l),h=Vs(this.chart,s,c),d=Ns(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Lt(r),{x:f,y:u}=t,{width:m,height:g}=e;let p,b,_,x,v,y;return o==="center"?(v=u+g/2,n==="left"?(p=f,b=p-a,x=v+a,y=v-a):(p=f+m,b=p+a,x=v-a,y=v+a),_=p):(n==="left"?b=f+Math.max(l,h)+a:n==="right"?b=f+m-Math.max(c,d)-a:b=this.caretX,o==="top"?(x=u,v=x-a,p=b-a,_=b+a):(x=u+g,v=x+a,p=b+a,_=b-a),y=x),{x1:p,x2:b,x3:_,y1:x,y2:v,y3:y}}drawTitle(t,e,s){const n=this.title,o=n.length;let a,r,l;if(o){const c=Yt(s.rtl,this.x,this.width);for(t.x=Le(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",a=Y(s.titleFont),r=s.titleSpacing,e.fillStyle=s.titleColor,e.font=a.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ge(t,{x:p,y:g,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ge(t,{x:b,y:g+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=a.backgroundColor,t.fillRect(b,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=Y(s.bodyFont);let f=d.lineHeight,u=0;const m=Yt(s.rtl,this.x,this.width),g=function(S){e.fillText(S,m.x(t.x+u),t.y+f/2),t.y+=f+o},p=m.textAlign(a);let b,_,x,v,y,w,M;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Le(this,p,s),e.fillStyle=s.bodyColor,R(this.beforeBody,g),u=r&&p!=="right"?a==="center"?c/2+h:c+2+h:0,v=0,w=n.length;v0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const a=ae[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=Ws(this,t),l=Object.assign({},a,this._size),c=Vs(e,t,l),h=Ns(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const a=Q(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),Cn(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Dn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!Ne(s,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,s),r=this._positionChanged(a,t),l=e||!Ne(a,o)||r;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e;const a=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,a=ae[o.position].call(this,t,e);return a!==!1&&(s!==a.x||n!==a.y)}}P(vi,"positioners",ae);var Un={id:"tooltip",_element:vi,positioners:ae,afterInit(i,t,e){e&&(i.tooltip=new vi({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:Xn},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 Hl=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Wl(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Hl(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Vl=(i,t)=>i===null?null:it(Math.round(i),0,t);function Ys(i){const t=this.getLabels();return i>=0&&ie.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}P(ki,"id","category"),P(ki,"defaults",{ticks:{callback:Ys}});function Nl(i,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=i,u=o||1,m=h-1,{min:g,max:p}=t,b=!E(a),_=!E(r),x=!E(c),v=(p-g)/(d+1);let y=Qi((p-g)/m/u)*u,w,M,S,T;if(y<1e-14&&!b&&!_)return[{value:g},{value:p}];T=Math.ceil(p/y)-Math.floor(g/y),T>m&&(y=Qi(T*y/m/u)*u),E(l)||(w=Math.pow(10,l),y=Math.ceil(y*w)/w),n==="ticks"?(M=Math.floor(g/y)*y,S=Math.ceil(p/y)*y):(M=g,S=p),b&&_&&o&&Yo((r-a)/o,y/1e3)?(T=Math.round(Math.min((r-a)/y,h)),y=(r-a)/T,M=a,S=r):x?(M=b?a:M,S=_?r:S,T=c-1,y=(S-M)/T):(T=(S-M)/y,Ie(T,Math.round(T),y/1e3)?T=Math.round(T):T=Math.ceil(T));const D=Math.max(Ji(y),Ji(M));w=Math.pow(10,E(l)?D:l),M=Math.round(M*w)/w,S=Math.round(S*w)/w;let C=0;for(b&&(f&&M!==a?(e.push({value:a}),Mn=e?n:l,r=l=>o=s?o:l;if(t){const l=Mt(n),c=Mt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Nl(n,o);return t.bounds==="ticks"&&fn(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return ti(t,this.chart.options.locale,this.options.ticks.format)}}class wi extends Qe{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?t:0,this.max=X(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=ft(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}P(wi,"id","linear"),P(wi,"defaults",{ticks:{callback:ei.formatters.numeric}});const me=i=>Math.floor(vt(i)),Dt=(i,t)=>Math.pow(10,me(i)+t);function Us(i){return i/Math.pow(10,me(i))===1}function Ks(i,t,e){const s=Math.pow(10,e),n=Math.floor(i/s);return Math.ceil(t/s)-n}function jl(i,t){const e=t-i;let s=me(e);for(;Ks(i,t,s)>10;)s++;for(;Ks(i,t,s)<10;)s--;return Math.min(s,me(i))}function $l(i,{min:t,max:e}){t=nt(i.min,t);const s=[],n=me(t);let o=jl(t,e),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((t-l)*a)/a,h=Math.floor((t-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),f=nt(i.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;f=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),f=Math.round((l+h+d*Math.pow(10,o))*a)/a;const u=nt(i.max,f);return s.push({value:u,major:Us(u),significand:d}),s}class qs extends Bt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=Qe.prototype.parse.apply(this,[t,e]);if(s===0){this._zero=!0;return}return X(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?Math.max(0,t):null,this.max=X(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!X(this._userMin)&&(this.min=t===Dt(this.min,0)?Dt(this.min,-1):Dt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,n=this.max;const o=r=>s=t?s:r,a=r=>n=e?n:r;s===n&&(s<=0?(o(1),a(10)):(o(Dt(s,-1)),a(Dt(n,1)))),s<=0&&o(Dt(n,-1)),n<=0&&a(Dt(s,1)),this.min=s,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=$l(e,this);return t.bounds==="ticks"&&fn(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":ti(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=vt(t),this._valueRange=vt(this.max)-vt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(vt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}P(qs,"id","logarithmic"),P(qs,"defaults",{ticks:{callback:ei.formatters.logarithmic,major:{enabled:!0}}});function Mi(i){const t=i.ticks;if(t.display&&i.display){const e=Q(t.backdropPadding);return A(t.font&&t.font.size,j.font.size)+e.height}return 0}function Yl(i,t,e){return e=B(e)?e:[e],{w:la(i,t.string,e),h:e.length*t.lineHeight}}function Gs(i,t,e,s,n){return i===s||i===n?{start:t-e/2,end:t+e/2}:in?{start:t-e,end:t}:{start:t,end:t+e}}function Xl(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?$/o:0;for(let l=0;lt.r&&(r=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),n.startt.b&&(l=(n.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function Kl(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,a=Mi(o)/2,r=i.drawingArea,l=o.pointLabels.centerPointLabels?$/n:0;for(let c=0;c270||e<90)&&(i-=t),i}function Ql(i,t){const{ctx:e,options:{pointLabels:s}}=i;for(let n=t-1;n>=0;n--){const o=s.setContext(i.getPointLabelContext(n)),a=Y(o.font),{x:r,y:l,textAlign:c,left:h,top:d,right:f,bottom:u}=i._pointLabelItems[n],{backdropColor:m}=o;if(!E(m)){const g=Lt(o.borderRadius),p=Q(o.backdropPadding);e.fillStyle=m;const b=h-p.left,_=d-p.top,x=f-h+p.width,v=u-d+p.height;Object.values(g).some(y=>y!==0)?(e.beginPath(),ge(e,{x:b,y:_,w:x,h:v,radius:g}),e.fill()):e.fillRect(b,_,x,v)}It(e,i._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:c,textBaseline:"middle"})}}function Kn(i,t,e,s){const{ctx:n}=i;if(e)n.arc(i.xCenter,i.yCenter,t,0,H);else{let o=i.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let a=1;a{const n=I(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?Xl(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=H/(this._pointLabels.length||1),s=this.options.startAngle||0;return dt(t*e+ft(s))}getDistanceFromCenterForValue(t){if(E(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(E(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(d!==0){l=this.getDistanceFromCenterForValue(h.value);const f=this.getContext(d),u=n.setContext(f),m=o.setContext(f);Jl(this,u,l,a,m)}}),s.display){for(t.save(),r=a-1;r>=0;r--){const h=s.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:f}=h;!f||!d||(t.lineWidth=f,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const n=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&!e.reverse)return;const c=s.setContext(this.getContext(l)),h=Y(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const d=Q(c.backdropPadding);t.fillRect(-a/2-d.left,-o-h.size/2-d.top,a+d.width,h.size+d.height)}It(t,r.label,0,-o,h,{color:c.color})}),t.restore()}drawTitle(){}}P(Re,"id","radialLinear"),P(Re,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ei.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),P(Re,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),P(Re,"descriptors",{angleLines:{_fallback:"grid"}});const si={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}},et=Object.keys(si);function ec(i,t){return i-t}function Zs(i,t){if(E(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let a=t;return typeof s=="function"&&(a=s(a)),X(a)||(a=typeof s=="string"?e.parse(a,s):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(Ye(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function Qs(i,t,e,s){const n=et.length;for(let o=et.indexOf(i);o=et.indexOf(e);o--){const a=et[o];if(si[a].common&&i._adapter.diff(n,s,a)>=t-1)return a}return et[e?et.indexOf(e):0]}function sc(i){for(let t=et.indexOf(i)+1,e=et.length;t=t?e[s]:e[n];i[o]=!0}}function nc(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=e[r],l>=0&&(t[l].major=!0);return t}function tn(i,t,e){const s=[],n={},o=t.length;let a,r;for(a=0;a+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=it(e,0,a),s=it(s,0,a),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,a=o.unit||Qs(o.minUnit,e,s,this._getLabelCapacity(e)),r=A(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Ye(l)||l===!0,h={};let d=e,f,u;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(s,e,a)>1e5*r)throw new Error(e+" and "+s+" are too far apart with stepSize of "+r+" "+a);const m=n.ticks.source==="data"&&this.getDataTimestamps();for(f=d,u=0;fg-p).map(g=>+g)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return I(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],f=s[e],u=c&&d&&f&&f.major;return this._adapter.format(t,n||(u?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=bi(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=bi(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class en extends Je{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=Fe(e,this.min),this._tableRange=Fe(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(a=0,r=n.length;a({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},oc={type:{type:String,required:!0},...qn},ac=ro[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function jt(i){return an(i)?pi(i):i}function rc(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return an(t)?new Proxy(i,{}):i}function lc(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function Gn(i,t){i.labels=t}function Zn(i,t,e){const s=[];i.datasets=t.map(n=>{const o=i.datasets.find(a=>a[e]===n[e]);return!o||!n.data||s.includes(o)?{...n}:(s.push(o),Object.assign(o,n),o)})}function cc(i,t){const e={labels:[],datasets:[]};return Gn(e,i.labels),Zn(e,i.datasets,t),e}const hc=sn({props:oc,setup(i,t){let{expose:e}=t;const s=so(null),n=nn(null);e({chart:n});const o=()=>{if(!s.value)return;const{type:l,data:c,options:h,plugins:d,datasetIdKey:f}=i,u=cc(c,f),m=rc(u,c);n.value=new xe(s.value,{type:l,data:m,options:{...h},plugins:d})},a=()=>{const l=pi(n.value);l&&(l.destroy(),n.value=null)},r=l=>{l.update(i.updateMode)};return no(o),oo(a),ao([()=>i.options,()=>i.data],(l,c)=>{let[h,d]=l,[f,u]=c;const m=pi(n.value);if(!m)return;let g=!1;if(h){const p=jt(h),b=jt(f);p&&p!==b&&(lc(m,p),g=!0)}if(d){const p=jt(d.labels),b=jt(u.labels),_=jt(d.datasets),x=jt(u.datasets);p!==b&&(Gn(m.config.data,p),g=!0),_&&_!==x&&(Zn(m.config.data,_,i.datasetIdKey),g=!0)}g&&r(m)},{deep:!0}),()=>on("canvas",{ref:s})}});function Qn(i,t){return xe.register(t),sn({props:qn,setup(e,s){let{expose:n}=s;const o=nn(null),a=r=>{o.value=r==null?void 0:r.chart};return n({chart:o}),()=>on(hc,ac({ref:a},{type:i,...e}))}})}const dc=Qn("bar",ze),fc=Qn("pie",xi);xe.register(Al,Un,$n,Ve,ki,wi);const uc={name:"BarChart",components:{Bar:dc},data(){return{chartData:{labels:["Punctuality Percentage"],datasets:[{label:"Late",backgroundColor:"rgba(255, 0, 0, 0.3)",hoverBackgroundColor:"rgba(255, 0, 0, 0.8)",borderColor:"rgb(255, 0, 0)",borderWidth:1,data:[Z.insights.percentageLate]},{label:"Early/ontime",backgroundColor:"rgba(74, 220, 87, 0.3)",hoverBackgroundColor:"rgba(74, 220, 87), 0.8)",borderColor:"rgb(74, 220, 87)",borderWidth:1,data:[Z.insights.percentageNotLate]}]},chartOptions:{responsive:!0,maintainAspectRatio:!1}}}};function gc(i,t,e,s,n,o){const a=re("Bar");return q(),lo(a,{data:n.chartData,id:i.barChart,options:n.chartOptions},null,8,["data","id","options"])}const pc=Si(uc,[["render",gc],["__scopeId","data-v-37c13361"]]);xe.register(We,Un,$n);const mc={name:"pieChart",components:{Pie:fc},props:{trainChart:{type:Boolean,default:!1}},data(){return{trainData:{labels:["Trains","Darts"],datasets:[{backgroundColor:["#41B883","#E46651","#00D8FF"],data:[Z.insights.numTrains,Z.insights.numDarts]}]},stationData:{labels:["Train Stations","Dart Stations"],datasets:[{backgroundColor:["#41B883","#E46651","#00D8FF"],data:[Z.insights.numTrainStations,Z.insights.numDartStations]}]},chartOptions:{responsive:!0,maintainAspectRatio:!1,radius:80,hoverOffset:0}}}};const bc={key:0,class:"piechart"},_c={key:1,class:"barchart"};function xc(i,t,e,s,n,o){const a=re("Pie");return q(),J(Ee,null,[e.trainChart?(q(),J("div",bc,[$t(a,{data:n.trainData,options:n.chartOptions},null,8,["data","options"])])):le("",!0),e.trainChart?le("",!0):(q(),J("div",_c,[$t(a,{data:n.stationData,options:n.chartOptions},null,8,["data","options"])]))],64)}const yc=Si(mc,[["render",xc],["__scopeId","data-v-e35fddf5"]]);const vc={name:"InsightsPage",data(){const i=()=>{io(this.toastMessage,{hideProgressBar:!0,timeout:4e3,toastBackgroundColor:this.toastBackground})};let t=this.$loading.show({loader:"dots",container:this.$refs.container,canCancel:!1});return{insights:{},rawData:{},orderedTrains:[],topEarliestLatest:[],showTopEarliestLatest:!1,readyToRender:!1,store:Z,toastMessage:"",toastBackground:"",toast:i,loader:t}},components:{Navbar:eo,pieChart:yc,BarChart:pc},created(){if(!Z.orderedTrains.length>0){let i=window.location.hostname;i==="127.0.0.1"||i==="localhost"?this.postTrainAndStationData():this.getTrainAndStationData()}else this.insights=Z.insights,this.rawData=Z.rawData,this.orderedTrains=Z.orderedTrains,this.topEarliestLatest=this.orderedTrains.slice(0,3).concat(this.orderedTrains.slice(-3)),this.loader.hide(),this.readyToRender=!0},methods:{showToast(i,t){this.toastMessage=i,this.toastBackground=t,this.toast()},getOrigin(i){let t=i.indexOf("-")+1,e=i.indexOf("to ")-1;return i.substring(t,e)},getDestination(i){let e=i.indexOf("to ")+3,s=i.indexOf("(")-1;return i.substring(e,s)},postTrainAndStationData(){const i=Vi($i);let t=window.location.hostname;(t==="127.0.0.1"||t==="localhost")&&Ni(i,t,5001),ve(i,"postLiveTrainData")().then(()=>{ve(i,"postStationData")().then(()=>{this.getTrainAndStationData()})}).catch(s=>{this.showToast(s.message,"red")})},getTrainAndStationData(){const i=Vi($i);let t=window.location.hostname;(t==="127.0.0.1"||t=="localhost")&&Ni(i,t,5001),ve(i,"getLiveTrainData")().then(s=>{try{if(!s.data)throw new Error("Error fetching live train data from the database");for(var n=[],o={totalNumTrains:0,numRunningTrains:0,numLateRunningTrains:0,numTrains:0,numDarts:0,totalNumStations:0,numTrainStations:0,numDartStations:0},a=0;a{if(!l.data)throw new Error("Error fetching station from the database");for(var c=0;c{this.loader.hide(),this.showToast("Error fetching live data","red")})}}},_t=i=>(fo("data-v-7860af3e"),i=i(),uo(),i),kc={class:"card-group"},wc={class:"card"},Mc=_t(()=>k("h4",{style:{"text-align":"center"}},"Train Insights",-1)),Sc={key:0,class:"piechart"},Pc={class:"card-body"},Tc=_t(()=>k("h5",{class:"card-title"},"Train Data",-1)),Cc={class:"card-text"},Dc={class:"card-stats"},Oc={class:"card-stats"},Ac={class:"card"},Lc=_t(()=>k("h4",{style:{"text-align":"center"}},"Station Insights",-1)),Rc={key:0,class:"piechart"},Fc={class:"card-body"},Ec=_t(()=>k("h5",{class:"card-title"},"Station Data",-1)),Ic={class:"card-text"},zc={class:"card-stats"},Bc={class:"card-stats"},Hc={class:"card"},Wc=_t(()=>k("h4",{style:{"text-align":"center"}},"Punctuality Insights",-1)),Vc={key:0},Nc={class:"card-body"},jc=_t(()=>k("h5",{class:"card-title"},"Punctuality Data",-1)),$c={class:"card-text"},Yc={class:"card-stats"},Xc={class:"card-stats"},Uc=_t(()=>k("div",{id:"leaderboardTitleDiv"},[k("p",null,"Leaderboard")],-1)),Kc={style:{left:"3px",top:"3px"},class:"form-check form-switch"},qc=_t(()=>k("label",{class:"form-check-label",for:"showTopEarliestLatest"},"Show All Train Entries",-1)),Gc=_t(()=>k("thead",null,[k("tr",null,[k("th",null,"Code"),k("th",null,"Time"),k("th",null,"Type"),k("th",null,"Origin"),k("th",null,"Destination")])],-1)),Zc={key:0},Qc={style:{color:"#fc1919"}},Jc={key:1},th={style:{color:"rgb(129, 213, 3)"}},eh={key:0},ih={style:{color:"#fc1919"}},sh={key:1},nh={style:{color:"rgb(129, 213, 3)"}};function oh(i,t,e,s,n,o){const a=re("Navbar"),r=re("pieChart"),l=re("BarChart");return q(),J(Ee,null,[$t(a),k("div",kc,[k("div",wc,[Mc,n.readyToRender?(q(),J("div",Sc,[$t(r,{id:i.stationPie,trainChart:!0},null,8,["id"])])):le("",!0),k("div",Pc,[Tc,k("p",Cc,"Total number of trains: "+N(this.insights.totalNumTrains),1),k("ul",null,[k("li",null,[k("p",Dc,"Trains: "+N(this.insights.numTrains),1)]),k("li",null,[k("p",Oc,"Darts: "+N(this.insights.numDarts),1)])])])]),k("div",Ac,[Lc,n.readyToRender?(q(),J("div",Rc,[$t(r,{id:i.stationPie,trainChart:!1},null,8,["id"])])):le("",!0),k("div",Fc,[Ec,k("p",Ic,"Total number of stations: "+N(this.insights.totalNumStations),1),k("ul",null,[k("li",null,[k("p",zc,"Trains: "+N(this.insights.numTrainStations),1)]),k("li",null,[k("p",Bc,"Darts: "+N(this.insights.numDartStations),1)])])])]),k("div",Hc,[Wc,n.readyToRender?(q(),J("div",Vc,[$t(l,{id:"barChart"})])):le("",!0),k("div",Nc,[jc,k("p",$c,"Number of actively running trains: "+N(this.insights.numRunningTrains),1),k("ul",null,[k("li",null,[k("p",Yc,"Percentage late: "+N(this.insights.percentageLate)+"%",1)]),k("li",null,[k("p",Xc,"Percentage early or ontime: "+N(this.insights.percentageNotLate)+"%",1)])])])])]),Uc,k("table",null,[k("div",Kc,[co(k("input",{class:"form-check-input",type:"checkbox",role:"switch","onUpdate:modelValue":t[0]||(t[0]=c=>n.showTopEarliestLatest=c)},null,512),[[ho,n.showTopEarliestLatest]]),qc]),Gc,n.showTopEarliestLatest?(q(!0),J(Ee,{key:1},ji(n.orderedTrains,c=>(q(),J("tbody",null,[k("tr",null,[k("td",null,N(this.rawData[c.jsonIndex].TrainCode[0]),1),c.time>0?(q(),J("td",eh,[k("span",ih,N(c.time)+" mins late",1)])):(q(),J("td",sh,[k("span",nh,N(c.time*-1)+" mins early",1)])),k("td",null,N(this.rawData[c.jsonIndex].TrainType[0]),1),k("td",null,N(o.getOrigin(this.rawData[c.jsonIndex].PublicMessage[0])),1),k("td",null,N(o.getDestination(this.rawData[c.jsonIndex].PublicMessage[0])),1)])]))),256)):(q(!0),J(Ee,{key:0},ji(n.topEarliestLatest,c=>(q(),J("tbody",null,[k("tr",null,[k("td",null,N(this.rawData[c.jsonIndex].TrainCode[0]),1),c.time>0?(q(),J("td",Zc,[k("span",Qc,N(c.time)+" mins late",1)])):(q(),J("td",Jc,[k("span",th,N(c.time*-1)+" mins early",1)])),k("td",null,N(this.rawData[c.jsonIndex].TrainType[0]),1),k("td",null,N(o.getOrigin(this.rawData[c.jsonIndex].PublicMessage[0])),1),k("td",null,N(o.getDestination(this.rawData[c.jsonIndex].PublicMessage[0])),1)])]))),256))])],64)}const fh=Si(vc,[["render",oh],["__scopeId","data-v-7860af3e"]]);export{fh as default}; diff --git a/dist/assets/LoginPage-1a8e9e77.css b/dist/assets/LoginPage-1a8e9e77.css new file mode 100644 index 0000000..36ccc25 --- /dev/null +++ b/dist/assets/LoginPage-1a8e9e77.css @@ -0,0 +1 @@ +#background[data-v-b3c98f88]{margin:0;padding:0;width:100%;height:100%;position:absolute;background-color:#e0e0e0;font-family:sans-serif}.loginbox[data-v-b3c98f88]{height:420px;width:320px;background:#000;color:#fff;top:50%;left:50%;position:absolute;transform:translate(-50%,-50%);box-sizing:border-box;padding:70px 30px}#imgDiv[data-v-b3c98f88]{height:10%;width:10%;right:40px;bottom:150px;position:absolute}#eyeImg[data-v-b3c98f88]{height:80%;width:100%}#eyeImg[data-v-b3c98f88]:hover{transform:scale(1.1)}h1[data-v-b3c98f88]{margin:0;padding:0 0 20px;font-size:22px;text-align:center}.loginbox p[data-v-b3c98f88]{margin:0;padding:0;font-weight:700}.loginbox input[data-v-b3c98f88]{width:100%;margin-bottom:20px}.loginbox input[type=email][data-v-b3c98f88],input[type=password][data-v-b3c98f88],input[type=text][data-v-b3c98f88]{border:none;border-bottom:1px solid #fff;background:transparent;outline:none;height:40px;color:#fff;font-size:16px}.loginbox input[type=submit][data-v-b3c98f88]:hover{cursor:pointer;background:#66a3ff;color:#000}.loginbox a[data-v-b3c98f88]{text-decoration:none;font-size:12px;line-height:20px;color:#a9a9a9;display:flex}.loginbox a[data-v-b3c98f88]:hover{color:#ffc107}.loginbox input[type=submit][data-v-b3c98f88]{border:none;outline:none;height:40px;background:#0052cc;font-size:18px;border-radius:20px}.avatar[data-v-b3c98f88]{width:100px;height:100px;border-radius:50%;position:absolute;top:-50px;left:calc(50% - 50px)} diff --git a/dist/assets/LoginPage-8a330df8.js b/dist/assets/LoginPage-8a330df8.js new file mode 100644 index 0000000..450a696 --- /dev/null +++ b/dist/assets/LoginPage-8a330df8.js @@ -0,0 +1 @@ +import{_ as c,g as u,$ as _,n as f,r as p,o as a,c as n,a as h,b as e,q as d,v as m,w as v,F as P,e as k,h as y,p as b,j as E}from"./index-9a3ecfe5.js";import{t as T}from"./style-1561178c.js";import{N as C}from"./Navbar-fcee2b9c.js";import{_ as x,a as I}from"./315220_eye_icon-30328a0f.js";const B=u(),N={name:"LoginPage",data(){return{email:"",password:"",toastMessage:"",toastBackground:"",forgotPassword:!1,showPassword:!1,toast:()=>{T(this.toastMessage,{hideProgressBar:!0,timeout:4e3,toastBackgroundColor:this.toastBackground})}}},components:{Navbar:C},methods:{showToast(i,s){this.toastMessage=i,this.toastBackground=s,this.toast()},login(){const i=u(k);if(!this.email||!this.password){this.showToast("Missing credentials","red");return}_(i,this.email,this.password).then(()=>{this.showToast("Logged in successfully","green"),this.$router.push({path:"/"})}).catch(s=>{s.message.includes("email")?this.showToast("Invalid email","red"):s.message.includes("user")?this.showToast("Could not find this user","red"):this.showToast(s.message,"red")})},resetPasswordEmail(){if(!this.email){this.showToast("Missing credentials","red");return}f(B,this.email).then(()=>{this.showToast("Reset password email sent","green"),this.email=""}).catch(i=>{i.message.includes("email")?this.showToast("Invalid email","red"):i.message.includes("user")?this.showToast("Could not find this user","red"):this.showToast(i.message,"red")})}}},l=i=>(b("data-v-b3c98f88"),i=i(),E(),i),V={id:"background"},L={class:"loginbox"},M=l(()=>e("img",{src:"https://cdn.discordapp.com/attachments/1017419092447207436/1063092138029625394/pixil-frame-0.png",class:"avatar"},null,-1)),A={key:0},F=l(()=>e("h1",null,"Login",-1)),S=l(()=>e("p",null,"Email Address",-1)),U=l(()=>e("p",null,"Password",-1)),D={id:"imgDiv"},R={key:1},H=l(()=>e("h1",null,"Forgot Password",-1)),j=l(()=>e("p",null,"Email Address",-1));function q(i,s,G,W,o,r){const w=p("Navbar"),g=p("router-link");return a(),n(P,null,[h(w),e("div",V,[e("div",L,[M,o.forgotPassword?(a(),n("div",R,[H,j,d(e("input",{type:"email","onUpdate:modelValue":s[7]||(s[7]=t=>o.email=t),"aria-describedby":"emailHelp",placeholder:"Enter email"},null,512),[[m,o.email]]),e("input",{onClick:s[8]||(s[8]=(...t)=>r.resetPasswordEmail&&r.resetPasswordEmail(...t)),type:"submit",name:"",value:"Send Reset Email"}),e("a",{onClick:s[9]||(s[9]=t=>{o.forgotPassword=!o.forgotPassword,this.email=""})},"Go back")])):(a(),n("div",A,[F,S,d(e("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=t=>o.email=t),"aria-describedby":"emailHelp",placeholder:"Enter email"},null,512),[[m,o.email]]),U,e("div",D,[o.showPassword?(a(),n("img",{key:0,id:"eyeImg",src:x,onClick:s[1]||(s[1]=t=>this.showPassword=!this.showPassword),alt:"show"})):(a(),n("img",{key:1,id:"eyeImg",src:I,onClick:s[2]||(s[2]=t=>this.showPassword=!this.showPassword)}))]),o.showPassword?d((a(),n("input",{key:0,type:"text","onUpdate:modelValue":s[3]||(s[3]=t=>o.password=t),placeholder:"Enter password"},null,512)),[[m,o.password]]):d((a(),n("input",{key:1,type:"password","onUpdate:modelValue":s[4]||(s[4]=t=>o.password=t),placeholder:"Enter password"},null,512)),[[m,o.password]]),e("input",{onClick:s[5]||(s[5]=(...t)=>r.login&&r.login(...t)),type:"submit",name:"",value:"Login"}),e("a",{onClick:s[6]||(s[6]=t=>{o.forgotPassword=!o.forgotPassword,this.email=""})},"Forgot password?"),e("a",null,[h(g,{to:"/signup"},{default:v(()=>[y("Don't have an account?")]),_:1})])]))])])],64)}const Q=c(N,[["render",q],["__scopeId","data-v-b3c98f88"]]);export{Q as default}; diff --git a/dist/assets/LoginPage-a53ab66f.js b/dist/assets/LoginPage-a53ab66f.js deleted file mode 100644 index 3dab30e..0000000 --- a/dist/assets/LoginPage-a53ab66f.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as g,h,l as v,r as d,o as w,c as f,a as p,b as o,m as c,v as u,w as b,F as x,i as k,k as N,p as y,f as E}from"./index-93b9eb88.js";import{N as I}from"./Navbar-6b07ba01.js";const L={name:"LoginPage",data(){return{email:"",password:""}},components:{Navbar:I},methods:{login(){const s=h(k);v(s,this.email,this.password).then(e=>{e.user,this.$router.push({path:"/secure"})}).catch(e=>{const l=e.code,r=e.message;console.log(l),console.log(r)})}}},n=s=>(y("data-v-67d86943"),s=s(),E(),s),P={id:"background"},V={class:"loginbox"},C=n(()=>o("img",{src:"https://cdn.discordapp.com/attachments/1017419092447207436/1063092138029625394/pixil-frame-0.png",class:"avatar"},null,-1)),A=n(()=>o("h1",null,"Login",-1)),B=n(()=>o("p",null,"Email Address",-1)),S=n(()=>o("p",null,"Password",-1));function D(s,e,l,r,a,i){const _=d("Navbar"),m=d("router-link");return w(),f(x,null,[p(_),o("div",P,[o("div",V,[C,A,B,c(o("input",{type:"email","onUpdate:modelValue":e[0]||(e[0]=t=>a.email=t),"aria-describedby":"emailHelp",placeholder:"Enter email"},null,512),[[u,a.email]]),S,c(o("input",{type:"password","onUpdate:modelValue":e[1]||(e[1]=t=>a.password=t),placeholder:"Enter password"},null,512),[[u,a.password]]),o("input",{onClick:e[2]||(e[2]=(...t)=>i.login&&i.login(...t)),type:"submit",name:"",value:"Login"}),o("a",null,[p(m,{to:"/signup"},{default:b(()=>[N("Don't have an account?")]),_:1})])])])],64)}const T=g(L,[["render",D],["__scopeId","data-v-67d86943"]]);export{T as default}; diff --git a/dist/assets/LoginPage-d42bd1fa.css b/dist/assets/LoginPage-d42bd1fa.css deleted file mode 100644 index 6e18e51..0000000 --- a/dist/assets/LoginPage-d42bd1fa.css +++ /dev/null @@ -1 +0,0 @@ -#background[data-v-67d86943]{margin:0;padding:0;width:100%;height:100%;position:absolute;background-color:#e0e0e0;font-family:sans-serif}.loginbox[data-v-67d86943]{height:420px;width:320px;background:#000;color:#fff;top:50%;left:50%;position:absolute;transform:translate(-50%,-50%);box-sizing:border-box;padding:70px 30px}h1[data-v-67d86943]{margin:0;padding:0 0 20px;font-size:22px;text-align:center}.loginbox p[data-v-67d86943]{margin:0;padding:0;font-weight:700}.loginbox input[data-v-67d86943]{width:100%;margin-bottom:20px}.loginbox input[type=email][data-v-67d86943],input[type=password][data-v-67d86943]{border:none;border-bottom:1px solid #fff;background:transparent;outline:none;height:40px;color:#fff;font-size:16px}.loginbox input[type=submit][data-v-67d86943]:hover{cursor:pointer;background:#66a3ff;color:#000}.loginbox a[data-v-67d86943]{text-decoration:none;font-size:12px;line-height:20px;color:#a9a9a9}.loginbox a[data-v-67d86943]:hover{color:#ffc107}.loginbox input[type=submit][data-v-67d86943]{border:none;outline:none;height:40px;background:#0052cc;font-size:18px;border-radius:20px}.avatar[data-v-67d86943]{width:100px;height:100px;border-radius:50%;position:absolute;top:-50px;left:calc(50% - 50px)} diff --git a/dist/assets/MapPage-26750926.css b/dist/assets/MapPage-26750926.css deleted file mode 100644 index 2ac17dd..0000000 --- a/dist/assets/MapPage-26750926.css +++ /dev/null @@ -1 +0,0 @@ -#sidebarHeader[data-v-34a2bae4]{position:relative;top:0%;height:15%;width:100%;overflow:hidden}#sidebarDiv[data-v-34a2bae4]{position:absolute;height:80%;width:100%;color:#fff}#headerImage[data-v-34a2bae4]{height:80%;width:auto;overflow:hidden;position:relative;top:10px}#xButton[data-v-34a2bae4]{font-size:80%;font-family:Georgia;color:#fff;position:absolute;top:10px;right:10px}#xButton[data-v-34a2bae4]:hover{color:red}.overlay-content[data-v-8f7d73f5]{width:1%}.trainMapIcon[data-v-8f7d73f5]{width:28px;height:32px}#sidebar[data-v-8f7d73f5]{position:absolute;height:85%;width:20%;left:2%;top:12%;z-index:2;text-align:center;animation:gradient-8f7d73f5 15s ease infinite;background:linear-gradient(45deg,#000000,#111111,#222222,#333333,#444444,#555555);background-size:400%,400%;box-shadow:0 0 4px 2px #333;overflow:hidden;font-family:Franklin Gothic Medium,Arial Narrow,Arial,sans-serif}.slideLeft-enter-active[data-v-8f7d73f5],.slideLeft-leave-active[data-v-8f7d73f5]{transition:opacity .5s;transition:all .8s}.slideLeft-enter-from[data-v-8f7d73f5],.slideLeft-leave-to[data-v-8f7d73f5]{opacity:0;transform:translate(-100px)}@keyframes gradient-8f7d73f5{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}#publicMessageTicker[data-v-8f7d73f5]{z-index:3;position:absolute;bottom:0px;width:100%;background-color:#ffff7d;color:#000;font-family:Franklin Gothic Medium,Arial Narrow,Arial,sans-serif;text-align:bottom;font-size:17px} diff --git a/dist/assets/MapPage-66b44c57.js b/dist/assets/MapPage-66b44c57.js deleted file mode 100644 index 43399c2..0000000 --- a/dist/assets/MapPage-66b44c57.js +++ /dev/null @@ -1,7 +0,0 @@ -import{s as K}from"./store-6f7621d4.js";import{n as QA,q as hA,_ as BA,o as O,c as T,b as S,t as H,p as DA,f as pA,u as R,r as N,a as j,w as W,T as xA,x as nA,d as rA,F as _,i as oA,e as aA}from"./index-93b9eb88.js";import{g as iA,c as sA,h as gA}from"./index.esm2017-da4ff3a2.js";import{N as wA}from"./Navbar-6b07ba01.js";const mA={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class PA{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||mA[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const EA=PA,Z=6378137,z=Math.PI*Z,MA=[-z,-z,z,z],bA=[-180,-85,180,85],k=Z*Math.log(Math.tan(Math.PI/2));class Y extends EA{constructor(e){super({code:e,units:"m",extent:MA,global:!0,worldExtent:bA,getPointResolution:function(o,A){return o/Math.cosh(A[1]/Z)}})}}const cA=[new Y("EPSG:3857"),new Y("EPSG:102100"),new Y("EPSG:102113"),new Y("EPSG:900913"),new Y("http://www.opengis.net/def/crs/EPSG/0/3857"),new Y("http://www.opengis.net/gml/srs/epsg.xml#3857")];function yA(l,e,o){const A=l.length;o=o>1?o:2,e===void 0&&(o>2?e=l.slice():e=new Array(A));for(let t=0;tk?n=k:n<-k&&(n=-k),e[t+1]=n}return e}function OA(l,e,o){const A=l.length;o=o>1?o:2,e===void 0&&(o>2?e=l.slice():e=new Array(A));for(let t=0;t0;(c>>>=1)&&(g+=g))c&1&&(s+=g);return s}},1626:function(e,o){e.exports=function(A){return typeof A=="function"}},1950:function(e,o,A){var t=A("24fb");o=t(!1),o.push([e.i,".marquee-text-wrap{overflow:hidden}.marquee-text-content{width:100000px}.marquee-text-text{-webkit-animation-name:marquee-text-animation;animation-name:marquee-text-animation;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;float:left}.marquee-text-paused .marquee-text-text{-webkit-animation-play-state:paused;animation-play-state:paused}@-webkit-keyframes marquee-text-animation{0%{-webkit-transform:translateX(0);transform:translateX(0)}to{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}@keyframes marquee-text-animation{0%{-webkit-transform:translateX(0);transform:translateX(0)}to{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}",""]),o.locals={wrap:"marquee-text-wrap",content:"marquee-text-content",text:"marquee-text-text",animation:"marquee-text-animation",paused:"marquee-text-paused"},e.exports=o},"1be4":function(e,o,A){var t=A("d066");e.exports=t("document","documentElement")},"1d80":function(e,o){e.exports=function(A){if(A==null)throw TypeError("Can't call method on "+A);return A}},"23cb":function(e,o,A){var t=A("a691"),n=Math.max,r=Math.min;e.exports=function(a,i){var g=t(a);return g<0?n(g+i,0):r(g,i)}},"23e7":function(e,o,A){var t=A("da84"),n=A("06cf").f,r=A("9112"),a=A("6eeb"),i=A("ce4e"),g=A("e893"),s=A("94ca");e.exports=function(c,u){var f=c.target,d=c.global,E=c.stat,x,p,h,Q,w,m;if(d?p=t:E?p=t[f]||i(f,{}):p=(t[f]||{}).prototype,p)for(h in u){if(w=u[h],c.noTargetGet?(m=n(p,h),Q=m&&m.value):Q=p[h],x=s(d?h:f+(E?".":"#")+h,c.forced),!x&&Q!==void 0){if(typeof w==typeof Q)continue;g(w,Q)}(c.sham||Q&&Q.sham)&&r(w,"sham",!0),a(p,h,w,c)}}},"241c":function(e,o,A){var t=A("ca84"),n=A("7839"),r=n.concat("length","prototype");o.f=Object.getOwnPropertyNames||function(i){return t(i,r)}},"24fb":function(e,o,A){e.exports=function(r){var a=[];return a.toString=function(){return this.map(function(g){var s=t(g,r);return g[2]?"@media ".concat(g[2]," {").concat(s,"}"):s}).join("")},a.i=function(i,g,s){typeof i=="string"&&(i=[[null,i,""]]);var c={};if(s)for(var u=0;u=74)&&(s=n.match(/Chrome\/(\d+)/),s&&(c=s[1]))),e.exports=c&&+c},"342f":function(e,o,A){var t=A("d066");e.exports=t("navigator","userAgent")||""},"37e8":function(e,o,A){var t=A("83ab"),n=A("9bf2"),r=A("825a"),a=A("df75");e.exports=t?Object.defineProperties:function(g,s){r(g);for(var c=a(s),u=c.length,f=0,d;u>f;)n.f(g,d=c[f++],s[d]);return g}},"38cf":function(e,o,A){var t=A("23e7"),n=A("1148");t({target:"String",proto:!0},{repeat:n})},"3bbe":function(e,o,A){var t=A("1626");e.exports=function(n){if(typeof n=="object"||t(n))return n;throw TypeError("Can't set "+String(n)+" as a prototype")}},"44ad":function(e,o,A){var t=A("d039"),n=A("c6b6"),r="".split;e.exports=t(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return n(a)=="String"?r.call(a,""):Object(a)}:Object},"44d2":function(e,o,A){var t=A("b622"),n=A("7c73"),r=A("9bf2"),a=t("unscopables"),i=Array.prototype;i[a]==null&&r.f(i,a,{configurable:!0,value:n(null)}),e.exports=function(g){i[a][g]=!0}},"485a":function(e,o,A){var t=A("1626"),n=A("861d");e.exports=function(r,a){var i,g;if(a==="string"&&t(i=r.toString)&&!n(g=i.call(r))||t(i=r.valueOf)&&!n(g=i.call(r))||a!=="string"&&t(i=r.toString)&&!n(g=i.call(r)))return g;throw TypeError("Can't convert object to primitive value")}},4930:function(e,o,A){var t=A("2d00"),n=A("d039");e.exports=!!Object.getOwnPropertySymbols&&!n(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&t&&t<41})},"499e":function(e,o,A){A.r(o),A.d(o,"default",function(){return E});function t(B,C){for(var I=[],v={},D=0;DI.parts.length&&(v.parts.length=I.parts.length)}else{for(var b=[],D=0;Dd;)if(E=u[d++],E!=E)return!0}else for(;f>d;d++)if((i||d in u)&&u[d]===s)return i||d||0;return!i&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},"50c4":function(e,o,A){var t=A("a691"),n=Math.min;e.exports=function(r){return r>0?n(t(r),9007199254740991):0}},5135:function(e,o,A){var t=A("7b0b"),n={}.hasOwnProperty;e.exports=Object.hasOwn||function(a,i){return n.call(t(a),i)}},5692:function(e,o,A){var t=A("c430"),n=A("c6cd");(e.exports=function(r,a){return n[r]||(n[r]=a!==void 0?a:{})})("versions",[]).push({version:"3.18.0",mode:t?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},"56ef":function(e,o,A){var t=A("d066"),n=A("241c"),r=A("7418"),a=A("825a");e.exports=t("Reflect","ownKeys")||function(g){var s=n.f(a(g)),c=r.f;return c?s.concat(c(g)):s}},"577e":function(e,o,A){var t=A("f5df");e.exports=function(n){if(t(n)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return String(n)}},5899:function(e,o){e.exports=` -\v\f\r                 \u2028\u2029\uFEFF`},"58a8":function(e,o,A){var t=A("1d80"),n=A("577e"),r=A("5899"),a="["+r+"]",i=RegExp("^"+a+a+"*"),g=RegExp(a+a+"*$"),s=function(c){return function(u){var f=n(t(u));return c&1&&(f=f.replace(i,"")),c&2&&(f=f.replace(g,"")),f}};e.exports={start:s(1),end:s(2),trim:s(3)}},"59ed":function(e,o,A){var t=A("1626"),n=A("0d51");e.exports=function(r){if(t(r))return r;throw TypeError(n(r)+" is not a function")}},"5c6c":function(e,o){e.exports=function(A,t){return{enumerable:!(A&1),configurable:!(A&2),writable:!(A&4),value:t}}},"5e77":function(e,o,A){var t=A("83ab"),n=A("5135"),r=Function.prototype,a=t&&Object.getOwnPropertyDescriptor,i=n(r,"name"),g=i&&function(){}.name==="something",s=i&&(!t||t&&a(r,"name").configurable);e.exports={EXISTS:i,PROPER:g,CONFIGURABLE:s}},"69f3":function(e,o,A){var t=A("7f9a"),n=A("da84"),r=A("861d"),a=A("9112"),i=A("5135"),g=A("c6cd"),s=A("f772"),c=A("d012"),u="Object already initialized",f=n.WeakMap,d,E,x,p=function(I){return x(I)?E(I):d(I,{})},h=function(I){return function(v){var D;if(!r(v)||(D=E(v)).type!==I)throw TypeError("Incompatible receiver, "+I+" required");return D}};if(t||g.state){var Q=g.state||(g.state=new f),w=Q.get,m=Q.has,B=Q.set;d=function(I,v){if(m.call(Q,I))throw new TypeError(u);return v.facade=I,B.call(Q,I,v),v},E=function(I){return w.call(Q,I)||{}},x=function(I){return m.call(Q,I)}}else{var C=s("state");c[C]=!0,d=function(I,v){if(i(I,C))throw new TypeError(u);return v.facade=I,a(I,C,v),v},E=function(I){return i(I,C)?I[C]:{}},x=function(I){return i(I,C)}}e.exports={set:d,get:E,has:x,enforce:p,getterFor:h}},"6b0d":function(e,o,A){Object.defineProperty(o,"__esModule",{value:!0}),o.default=(t,n)=>{for(const[r,a]of n)t[r]=a;return t}},"6eeb":function(e,o,A){var t=A("da84"),n=A("1626"),r=A("5135"),a=A("9112"),i=A("ce4e"),g=A("8925"),s=A("69f3"),c=A("5e77").CONFIGURABLE,u=s.get,f=s.enforce,d=String(String).split("String");(e.exports=function(E,x,p,h){var Q=h?!!h.unsafe:!1,w=h?!!h.enumerable:!1,m=h?!!h.noTargetGet:!1,B=h&&h.name!==void 0?h.name:x,C;if(n(p)&&(String(B).slice(0,7)==="Symbol("&&(B="["+String(B).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!r(p,"name")||c&&p.name!==B)&&a(p,"name",B),C=f(p),C.source||(C.source=d.join(typeof B=="string"?B:""))),E===t){w?E[x]=p:i(x,p);return}else Q?!m&&E[x]&&(w=!0):delete E[x];w?E[x]=p:a(E,x,p)})(Function.prototype,"toString",function(){return n(this)&&u(this).source||g(this)})},7156:function(e,o,A){var t=A("1626"),n=A("861d"),r=A("d2bb");e.exports=function(a,i,g){var s,c;return r&&t(s=i.constructor)&&s!==g&&n(c=s.prototype)&&c!==g.prototype&&r(a,c),a}},7418:function(e,o){o.f=Object.getOwnPropertySymbols},7839:function(e,o){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"7b0b":function(e,o,A){var t=A("1d80");e.exports=function(n){return Object(t(n))}},"7c73":function(e,o,A){var t=A("825a"),n=A("37e8"),r=A("7839"),a=A("d012"),i=A("1be4"),g=A("cc12"),s=A("f772"),c=">",u="<",f="prototype",d="script",E=s("IE_PROTO"),x=function(){},p=function(B){return u+d+c+B+u+"/"+d+c},h=function(B){B.write(p("")),B.close();var C=B.parentWindow.Object;return B=null,C},Q=function(){var B=g("iframe"),C="java"+d+":",I;return B.style.display="none",i.appendChild(B),B.src=String(C),I=B.contentWindow.document,I.open(),I.write(p("document.F=Object")),I.close(),I.F},w,m=function(){try{w=new ActiveXObject("htmlfile")}catch{}m=typeof document<"u"?document.domain&&w?h(w):Q():h(w);for(var B=r.length;B--;)delete m[f][r[B]];return m()};a[E]=!0,e.exports=Object.create||function(C,I){var v;return C!==null?(x[f]=t(C),v=new x,x[f]=null,v[E]=C):v=m(),I===void 0?v:n(v,I)}},"7f9a":function(e,o,A){var t=A("da84"),n=A("1626"),r=A("8925"),a=t.WeakMap;e.exports=n(a)&&/native code/.test(r(a))},"81d5":function(e,o,A){var t=A("7b0b"),n=A("23cb"),r=A("50c4");e.exports=function(i){for(var g=t(this),s=r(g.length),c=arguments.length,u=n(c>1?arguments[1]:void 0,s),f=c>2?arguments[2]:void 0,d=f===void 0?s:n(f,s);d>u;)g[u++]=i;return g}},"825a":function(e,o,A){var t=A("861d");e.exports=function(n){if(t(n))return n;throw TypeError(String(n)+" is not an object")}},"83ab":function(e,o,A){var t=A("d039");e.exports=!t(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},"861d":function(e,o,A){var t=A("1626");e.exports=function(n){return typeof n=="object"?n!==null:t(n)}},8875:function(e,o,A){var t,n,r;(function(a,i){n=[],t=i,r=typeof t=="function"?t.apply(o,n):t,r!==void 0&&(e.exports=r)})(typeof self<"u"?self:this,function(){function a(){var i=Object.getOwnPropertyDescriptor(document,"currentScript");if(!i&&"currentScript"in document&&document.currentScript||i&&i.get!==a&&document.currentScript)return document.currentScript;try{throw new Error}catch(w){var g=/.*at [^(]*\((.*):(.+):(.+)\)$/ig,s=/@([^@]*):(\d+):(\d+)\s*$/ig,c=g.exec(w.stack)||s.exec(w.stack),u=c&&c[1]||!1,f=c&&c[2]||!1,d=document.location.href.replace(document.location.hash,""),E,x,p,h=document.getElementsByTagName("script");u===d&&(E=document.documentElement.outerHTML,x=new RegExp("(?:[^\\n]+?\\n){0,"+(f-2)+"}[^<]* +
- + - \ No newline at end of file + diff --git a/functions/index.js b/functions/index.js index 8bbd137..4973f3f 100644 --- a/functions/index.js +++ b/functions/index.js @@ -1,7 +1,3 @@ -// exports.scheduledFunction = functions.pubsub.schedule('every 10 minutes').onRun((context) => { - // functions.logger.info("Test log") -// }) - // Firebase imports const functions = require("firebase-functions"); const admin = require('firebase-admin'); @@ -12,6 +8,8 @@ admin.initializeApp(); const axios = require('axios'); const parseString = require('xml2js').parseString; +/* --------------------- station functions --------------------- */ + // function to fetch station data from the Firestore database exports.getStationData = functions.https.onRequest((request, response) => { response.set('Access-Control-Allow-Origin', '*'); @@ -69,7 +67,7 @@ exports.postStationData = functions.https.onRequest((request, response) => { response.set('Access-Control-Allow-Origin', '*'); response.set('Access-Control-Allow-Credentials', 'true'); cors(request, response, () => { - // fetch dart stations and classify as dart stations + // fetch dart stations axios.get('http://api.irishrail.ie/realtime/realtime.asmx/getAllStationsXML_WithStationType?StationType=D').then(res => { // XML to JSON parseString(res.data, function(err, result) { @@ -94,7 +92,7 @@ exports.postStationData = functions.https.onRequest((request, response) => { dartCodes.add(doc["StationCode"][0]) }) - // fetch all train stations + // fetch all stations axios.get('http://api.irishrail.ie/realtime/realtime.asmx/getAllStationsXML_WithStationType?StationType=A').then(res => { parseString(res.data, function(err, result) { let jsonData = parseJSON(result) @@ -110,6 +108,73 @@ exports.postStationData = functions.https.onRequest((request, response) => { }) }) +// scheduled version +exports.scheduledPostStationData = functions.pubsub.schedule("every day 00:00").onRun(async (context) => { + // helper functon to parse station JSON objects + function parseJSON(result) { + let jsonStr = JSON.stringify(result); + let jsonObj = JSON.parse(jsonStr); + let jsonData = jsonObj.ArrayOfObjStation.objStation; + return jsonData; + } + + // helper function to write to the database + function batchWriteDB(db, jsonData, dartCodes, stationTypeCode) { + if (!jsonData) return + var batchWrite = db.batch(); + jsonData.forEach((doc) => { + // append if the dartCodes hashset is empty or the current station is not present, and ignoring positions of zero + if ((dartCodes.size == 0 || !dartCodes.has(doc["StationCode"][0])) && !(doc["StationLongitude"] == 0 || doc["StationLatitude"] == 0)) { + doc["StationType"] = [stationTypeCode] + var docID = db.collection('stations').doc(doc["StationCode"][0]) + batchWrite.set(docID, doc); + } + }); + batchWrite.commit() + } + + // fetch dart stations + return axios.get('http://api.irishrail.ie/realtime/realtime.asmx/getAllStationsXML_WithStationType?StationType=D').then(res => { + // XML to JSON + parseString(res.data, function(err, result) { + let jsonData = parseJSON(result) + + // batch delete all of the station collection's documents + var db = admin.firestore(); + admin.firestore().collection('stations').get().then((snapshot) => { + var batchDelete = db.batch(); + snapshot.forEach(doc => { + batchDelete.delete(doc.ref); + }); + + batchDelete.commit().then(function() { + // store all dart codes into a hashset + // compare these with the station call with code "all" to avoid duplicates + let dartCodes = new Set() + batchWriteDB(db, jsonData, dartCodes, "DART"); + + // populate the dartCodes hashset + jsonData.forEach((doc) => { + dartCodes.add(doc["StationCode"][0]) + }) + + // fetch all train stations + axios.get('http://api.irishrail.ie/realtime/realtime.asmx/getAllStationsXML_WithStationType?StationType=A').then(res => { + parseString(res.data, function(err, result) { + let jsonData = parseJSON(result) + batchWriteDB(db, jsonData, dartCodes, "Train") + functions.logger.log("Successfully fetched and upload station data from Irish Rail on a schedule") + return "Successfully fetched and upload station data from Irish Rail on a schedule" + }) + }) + }) + }) + }) + }) +}) + +/* --------------------- train functions --------------------- */ + // function to fetch live train data from the Firestore database exports.getLiveTrainData = functions.https.onRequest((request, response) => { response.set('Access-Control-Allow-Origin', '*'); @@ -167,7 +232,7 @@ exports.postLiveTrainData = functions.https.onRequest((request, response) => { response.set('Access-Control-Allow-Origin', '*'); response.set('Access-Control-Allow-Credentials', 'true'); cors(request, response, () => { - // fetch mainland trains and classify as trains + // fetch mainland trains axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=M').then(res => { // XML to JSON parseString(res.data, function(err, result) { @@ -185,13 +250,13 @@ exports.postLiveTrainData = functions.https.onRequest((request, response) => { // batch write all train JSON objects to the liveTrainData collection batchWriteDB(request, response, db, jsonData, "Train"); - // fetch suburban trains and classify as trains + // fetch suburban trains axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=S').then(res => { parseString(res.data, function(err, result) { let jsonData = parseJSON(result) batchWriteDB(request, response, db, jsonData, "Train"); - // fetch dart trains and classify as darts + // fetch dart trains axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=D').then(res => { parseString(res.data, function(err, result) { let jsonData = parseJSON(result) @@ -209,6 +274,74 @@ exports.postLiveTrainData = functions.https.onRequest((request, response) => { }) }) +// scheduled version +exports.scheduledPostLiveTrainData = functions.pubsub.schedule('every 10 minutes').onRun(async (context) => { + // helper function to parse train JSON objects + function parseJSON(result) { + let jsonStr = JSON.stringify(result); + let jsonObj = JSON.parse(jsonStr); + let jsonData = jsonObj.ArrayOfObjTrainPositions.objTrainPositions; + return jsonData; + } + + // helper function to write to the database + function batchWriteDB(db, jsonData, trainTypeCode) { + if (!jsonData) return + var batchWrite = db.batch(); + jsonData.forEach((doc) => { + // ignore trains with longitudes or latitudes equal zero + if (!(doc["TrainLongitude"] == 0 || doc["TrainLatitude"] == 0)) { + doc["TrainType"] = [trainTypeCode] + var docID = db.collection('liveTrainData').doc(doc["TrainCode"][0]); + batchWrite.set(docID, doc); + } + }); + batchWrite.commit() + } + + // fetch mainland stations + return axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=M').then(res => { + // XML to JSON + parseString(res.data, function(err, result) { + let jsonData = parseJSON(result) + + // batch delete all of the liveTrainData collections's documents + var db = admin.firestore(); + admin.firestore().collection('liveTrainData').get().then((snapshot) => { + var batchDelete = db.batch(); + snapshot.forEach(doc => { + batchDelete.delete(doc.ref); + }); + + batchDelete.commit().then(function() { + // batch write all train JSON objects to the liveTrainData collection + batchWriteDB(db, jsonData, "Train"); + + // fetch suburban trains + axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=S').then(res => { + parseString(res.data, function(err, result) { + let jsonData = parseJSON(result) + batchWriteDB(db, jsonData, "Train"); + + // fetch DARTs + axios.get('https://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML_WithTrainType?TrainType=D').then(res => { + parseString(res.data, function(err, result) { + let jsonData = parseJSON(result) + batchWriteDB(db, jsonData, "DART"); + functions.logger.log("Successfully fetched and uploaded live train data from Irish Rail on a schedule") + return "Successfully fetched and uploaded live train data from Irish Rail on a schedule" + }) + }) + }) + }) + }) + }) + }) + }) +}) + +/* --------------------- preferences functions --------------------- */ + // secure function to fetch a user's filter preferences from the database exports.getPreferences = functions.https.onCall((data, context) => { if (!context.auth) return "Error request is not verified"