const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/deleteConfiguration-BGwI_EOV.js","assets/index-DxaoJejr.js","assets/index-BdzpqjNP.css","assets/localeText-BJlnw_l3.js","assets/configurationBackupRestore-pXsKPuSV.js","assets/dayjs.min-NjG6GRhz.js","assets/configurationBackupRestore-BeBqyCqt.css","assets/selectPeers-D031tDhJ.js","assets/selectPeers-Wjnh8YUZ.css","assets/editConfiguration-Cx7Z78WG.js","assets/editConfiguration-Oqrarw_V.css","assets/peerShareLinkModal-ClLD06RJ.js","assets/vue-datepicker-0C1_Bl1E.js","assets/peerJobsLogsModal-ChTwBii5.js","assets/peerJobsAllModal-CqOOb5H8.js","assets/schedulePeerJob-DqCUoh1f.js","assets/schedulePeerJob--V7cpve7.css","assets/peerJobs-Btaxqu4M.js","assets/peerJobs-voXURBEt.css","assets/peerCreate-FC1rN8TR.js","assets/peerCreate-BpTNoL68.css","assets/peerQRCode-C78lqRw3.js","assets/browser-CjSdxGTc.js","assets/peerConfigurationFile-yoEwyygD.js","assets/peerConfigurationFile-CNB9RKjb.css","assets/peerSettings-DJI9OWL8.js","assets/peerSettings-DCod994Y.css"])))=>i.map(i=>d[i]); import{_ as Kt,D as Ni,W as Wi,G as ft,y as xe,g as ke,a as D,c as E,b as g,d as C,t as B,F as Zt,h as ki,e as W,j as H,J as Uo,K as Yo,C as Ko,H as On,r as Ut,n as Ct,w as X,T as J,f as Dt,i as V,L as Tn,M as An,N as Pi,O as Xo,o as Ln,P as Go,Q as Mi,R as Jo,U as Rn,p as In,V as En,m as Fn,z as Qo,X as ot,v as qo,k as Zo,Y as rt}from"./index-DxaoJejr.js";import{L as oe}from"./localeText-BJlnw_l3.js";import{d as rs}from"./dayjs.min-NjG6GRhz.js";import{_ as tr}from"./protocolBadge-P6gbBYF5.js";const er={name:"peerSearch",components:{LocaleText:oe},setup(){const i=Ni(),t=Wi();return{store:i,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:ft("Status"),name:ft("Name"),allowed_ip:ft("Allowed IPs"),restricted:ft("Restricted")},interval:{5e3:ft("5 Seconds"),1e4:ft("10 Seconds"),3e4:ft("30 Seconds"),6e4:ft("1 Minutes")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{debounce(){this.searchStringTimeout?(clearTimeout(this.searchStringTimeout),this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)):this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)},updateSort(i){xe("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:i},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(i){xe("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:i},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){ke(`/api/downloadAllPeers/${this.configuration.Name}`,{},i=>{console.log(i),window.wireguard.generateZipFiles(i,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return ft("Search Peers...")}}},ir={class:"d-flex flex-column gap-2 my-4"},sr={class:"d-flex gap-2 peerSearchContainer"},nr={class:"dropdown"},or={"data-bs-toggle":"dropdown",class:"btn w-100 btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},rr={class:"badge text-bg-primary ms-2"},ar={class:"dropdown-menu rounded-3"},lr=["onClick"],cr={class:"ms-auto"},hr={key:0,class:"bi bi-check-circle-fill"},dr={class:"dropdown"},ur={"data-bs-toggle":"dropdown",class:"btn btn-sm w-100 text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},fr={class:"badge text-bg-primary ms-2"},gr={class:"dropdown-menu rounded-3"},pr=["onClick"],mr={class:"ms-auto"},br={key:0,class:"bi bi-check-circle-fill"};function _r(i,t,e,s,n,o){const r=H("LocaleText");return D(),E("div",ir,[g("div",sr,[g("div",nr,[g("button",or,[t[4]||(t[4]=g("i",{class:"bi bi-sort-up me-2"},null,-1)),C(r,{t:"Sort By"}),g("span",rr,B(this.sort[s.store.Configuration.Server.dashboard_sort]),1)]),g("ul",ar,[(D(!0),E(Zt,null,ki(this.sort,(a,l)=>(D(),E("li",null,[g("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateSort(l)},[g("small",null,B(a),1),g("small",cr,[s.store.Configuration.Server.dashboard_sort===l?(D(),E("i",hr)):W("",!0)])],8,lr)]))),256))])]),g("div",dr,[g("button",ur,[t[5]||(t[5]=g("i",{class:"bi bi-arrow-repeat me-2"},null,-1)),C(r,{t:"Refresh Interval"}),g("span",fr,B(this.interval[s.store.Configuration.Server.dashboard_refresh_interval]),1)]),g("ul",gr,[(D(!0),E(Zt,null,ki(this.interval,(a,l)=>(D(),E("li",null,[g("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateRefreshInterval(l)},[g("small",null,B(a),1),g("small",mr,[s.store.Configuration.Server.dashboard_refresh_interval===l?(D(),E("i",br)):W("",!0)])],8,pr)]))),256))])]),g("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle ms-lg-auto",onClick:t[0]||(t[0]=a=>this.$emit("search"))},[t[6]||(t[6]=g("i",{class:"bi bi-search me-2"},null,-1)),C(r,{t:"Search"})]),g("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[1]||(t[1]=a=>this.downloadAllPeer())},[t[7]||(t[7]=g("i",{class:"bi bi-download me-2"},null,-1)),C(r,{t:"Download All"})]),g("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[2]||(t[2]=a=>this.$emit("selectPeers"))},[t[8]||(t[8]=g("i",{class:"bi bi-check2-all me-2"},null,-1)),C(r,{t:"Select Peers"})]),g("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[3]||(t[3]=a=>this.$emit("jobsAll")),type:"button","aria-expanded":"false"},[t[9]||(t[9]=g("i",{class:"bi bi-person-walking me-2"},null,-1)),C(r,{t:"Active Jobs"})])])])}const xr=Kt(er,[["render",_r],["__scopeId","data-v-069dfdd9"]]);function yr(i){return Uo()?(Yo(i),!0):!1}function Bn(i){return typeof i=="function"?i():Ko(i)}const zn=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const vr=Object.prototype.toString,Sr=i=>vr.call(i)==="[object Object]",qe=()=>{},wr=kr();function kr(){var i,t;return zn&&((i=window?.navigator)==null?void 0:i.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function pe(i){var t;const e=Bn(i);return(t=e?.$el)!=null?t:e}const $n=zn?window:void 0;function di(...i){let t,e,s,n;if(typeof i[0]=="string"||Array.isArray(i[0])?([e,s,n]=i,t=$n):[t,e,s,n]=i,!t)return qe;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},a=(h,d,u,f)=>(h.addEventListener(d,u,f),()=>h.removeEventListener(d,u,f)),l=On(()=>[pe(t),Bn(n)],([h,d])=>{if(r(),!h)return;const u=Sr(d)?{...d}:d;o.push(...e.flatMap(f=>s.map(p=>a(h,f,p,u))))},{immediate:!0,flush:"post"}),c=()=>{l(),r()};return yr(c),c}let as=!1;function Hn(i,t,e={}){const{window:s=$n,ignore:n=[],capture:o=!0,detectIframe:r=!1}=e;if(!s)return qe;wr&&!as&&(as=!0,Array.from(s.document.body.children).forEach(u=>u.addEventListener("click",qe)),s.document.documentElement.addEventListener("click",qe));let a=!0;const l=u=>n.some(f=>{if(typeof f=="string")return Array.from(s.document.querySelectorAll(f)).some(p=>p===u.target||u.composedPath().includes(p));{const p=pe(f);return p&&(u.target===p||u.composedPath().includes(p))}}),h=[di(s,"click",u=>{const f=pe(i);if(!(!f||f===u.target||u.composedPath().includes(f))){if(u.detail===0&&(a=!l(u)),!a){a=!0;return}t(u)}},{passive:!0,capture:o}),di(s,"pointerdown",u=>{const f=pe(i);a=!l(u)&&!!(f&&!u.composedPath().includes(f))},{passive:!0}),r&&di(s,"blur",u=>{setTimeout(()=>{var f;const p=pe(i);((f=s.document.activeElement)==null?void 0:f.tagName)==="IFRAME"&&!p?.contains(s.document.activeElement)&&t(u)},0)})].filter(Boolean);return()=>h.forEach(u=>u())}const Pr={key:0,class:"position-absolute d-block p-1 px-2 bg-body text-body rounded-3 border shadow"},Mr={__name:"peerSettingsDropdownTool",props:{icon:String,title:String},emits:["click"],setup(i,{emit:t}){const e=t,s=Ut(!1);return(n,o)=>(D(),E("a",{class:"dropdown-item text-center px-0 rounded-3 position-relative",role:"button",onMouseenter:o[0]||(o[0]=r=>s.value=!0),onMouseleave:o[1]||(o[1]=r=>s.value=!1),onClick:o[2]||(o[2]=r=>e("click"))},[g("i",{class:Ct(["me-auto bi",i.icon])},null,2),C(J,{name:"zoomReversed"},{default:X(()=>[s.value?(D(),E("span",Pr,[g("small",null,B(i.title),1)])):W("",!0)]),_:1})],32))}},Cr=Kt(Mr,[["__scopeId","data-v-2d66aeb6"]]),Dr={name:"peerSettingsDropdown",components:{PeerSettingsDropdownTool:Cr,LocaleText:oe},setup(){return{dashboardStore:Ni()}},props:{Peer:Object},data(){return{deleteBtnDisabled:!1,restrictBtnDisabled:!1,allowAccessBtnDisabled:!1,confirmDelete:!1}},methods:{downloadPeer(){ke("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},i=>{if(i.status){const t=new Blob([i.data.file],{type:"text/plain"}),e=URL.createObjectURL(t),s=`${i.data.fileName}.conf`,n=document.createElement("a");n.href=e,n.download=s,n.click(),this.dashboardStore.newMessage("WGDashboard","Peer download started","success")}else this.dashboardStore.newMessage("Server",i.message,"danger")})},downloadQRCode(i){ke("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},t=>{t.status?this.$emit(i,t.data.file):this.dashboardStore.newMessage("Server",t.message,"danger")})},deletePeer(){this.deleteBtnDisabled=!0,xe(`/api/deletePeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.deleteBtnDisabled=!1})},restrictPeer(){this.restrictBtnDisabled=!0,xe(`/api/restrictPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.restrictBtnDisabled=!1})},allowAccessPeer(){this.allowAccessBtnDisabled=!0,xe(`/api/allowAccessPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.allowAccessBtnDisabled=!1})}}},Or={class:"dropdown-menu mt-2 shadow-lg d-block rounded-3",style:{"max-width":"200px"}},Tr={style:{"font-size":"0.8rem","padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Ar={class:"text-body d-flex"},Lr={class:"ms-auto"},Rr={key:1},Ir={class:"w-100 dropdown-item text-muted",style:{"white-space":"break-spaces","font-size":"0.7rem"}},Er={key:2},Fr={class:"d-flex",style:{"padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Br={key:1,class:"confirmDelete"},zr={style:{"white-space":"break-spaces"},class:"mb-2 d-block fw-bold"},$r={class:"d-flex w-100 gap-2"},Hr=["disabled"],Nr=["disabled"],Wr={key:1};function Vr(i,t,e,s,n,o){const r=H("LocaleText"),a=H("PeerSettingsDropdownTool");return D(),E("ul",Or,[this.Peer.restricted?(D(),E("li",Wr,[g("a",{class:Ct(["dropdown-item d-flex text-warning",{disabled:this.allowAccessBtnDisabled}]),onClick:t[10]||(t[10]=l=>this.allowAccessPeer()),role:"button"},[t[22]||(t[22]=g("i",{class:"me-auto bi bi-unlock"},null,-1)),this.allowAccessBtnDisabled?(D(),V(r,{key:1,t:"Allowing Access..."})):(D(),V(r,{key:0,t:"Allow Access"}))],2)])):(D(),E(Zt,{key:0},[this.confirmDelete?(D(),E("li",Br,[g("p",zr,[C(r,{t:"Are you sure to delete this peer?"})]),g("div",$r,[g("button",{onClick:t[8]||(t[8]=l=>this.deletePeer()),disabled:this.deleteBtnDisabled,class:"flex-grow-1 ms-auto btn btn-sm bg-danger"},[C(r,{t:"Yes"})],8,Hr),g("button",{disabled:this.deleteBtnDisabled,onClick:t[9]||(t[9]=l=>this.confirmDelete=!1),class:"flex-grow-1 btn btn-sm bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle"},[C(r,{t:"No"})],8,Nr)])])):(D(),E(Zt,{key:0},[this.Peer.status==="running"?(D(),E(Zt,{key:0},[g("li",Tr,[g("span",Ar,[t[11]||(t[11]=g("i",{class:"bi bi-box-arrow-in-right"},null,-1)),g("span",Lr,B(this.Peer.endpoint),1)])]),t[12]||(t[12]=g("li",null,[g("hr",{class:"dropdown-divider"})],-1))],64)):W("",!0),this.Peer.private_key?(D(),E("li",Er,[t[13]||(t[13]=g("div",{class:"text-center text-muted"},null,-1)),g("div",Fr,[C(a,{icon:"bi-download",title:"Download",onClick:t[0]||(t[0]=l=>this.downloadPeer())}),C(a,{icon:"bi-qr-code",title:"QR Code",onClick:t[1]||(t[1]=l=>this.downloadQRCode("qrcode"))}),C(a,{icon:"bi-body-text",title:"Configuration File",onClick:t[2]||(t[2]=l=>this.downloadQRCode("configurationFile"))}),C(a,{icon:"bi-share",title:"Share",onClick:t[3]||(t[3]=l=>this.$emit("share"))})])])):(D(),E("li",Rr,[g("small",Ir,[C(r,{t:"Download & QR Code is not available due to no private key set for this peer"})])])),t[20]||(t[20]=g("li",null,[g("hr",{class:"dropdown-divider"})],-1)),g("li",null,[g("a",{class:"dropdown-item d-flex",role:"button",onClick:t[4]||(t[4]=l=>this.$emit("setting"))},[t[14]||(t[14]=g("i",{class:"me-auto bi bi-pen"},null,-1)),t[15]||(t[15]=Dt()),C(r,{t:"Peer Settings"})])]),g("li",null,[g("a",{class:"dropdown-item d-flex",role:"button",onClick:t[5]||(t[5]=l=>this.$emit("jobs"))},[t[16]||(t[16]=g("i",{class:"me-auto bi bi-app-indicator"},null,-1)),t[17]||(t[17]=Dt()),C(r,{t:"Schedule Jobs"})])]),t[21]||(t[21]=g("li",null,[g("hr",{class:"dropdown-divider"})],-1)),g("li",null,[g("a",{class:Ct(["dropdown-item d-flex text-warning",{disabled:this.restrictBtnDisabled}]),onClick:t[6]||(t[6]=l=>this.restrictPeer()),role:"button"},[t[18]||(t[18]=g("i",{class:"me-auto bi bi-lock"},null,-1)),this.restrictBtnDisabled?(D(),V(r,{key:1,t:"Restricting..."})):(D(),V(r,{key:0,t:"Restrict Access"}))],2)]),g("li",null,[g("a",{class:Ct(["dropdown-item d-flex fw-bold text-danger",{disabled:this.deleteBtnDisabled}]),onClick:t[7]||(t[7]=l=>this.confirmDelete=!0),role:"button"},[t[19]||(t[19]=g("i",{class:"me-auto bi bi-trash"},null,-1)),this.deleteBtnDisabled?(D(),V(r,{key:1,t:"Deleting..."})):(D(),V(r,{key:0,t:"Delete"}))],2)])],64))],64))])}const Nn=Kt(Dr,[["render",Vr],["__scopeId","data-v-c4e10919"]]),jr={name:"peer",components:{LocaleText:oe,PeerSettingsDropdown:Nn},props:{Peer:Object},data(){return{}},setup(){const i=Ut(null),t=Ut(!1);return Hn(i,e=>{t.value=!1}),{target:i,subMenuOpened:t}},computed:{getLatestHandshake(){return this.Peer.latest_handshake.includes(",")?this.Peer.latest_handshake.split(",")[0]:this.Peer.latest_handshake}}},Ur={key:0,class:"card-header bg-transparent d-flex align-items-center gap-2 border-0"},Yr={style:{"font-size":"0.8rem"},class:"ms-auto d-flex gap-2"},Kr={class:"text-primary"},Xr={class:"text-success"},Gr={key:0,class:"text-secondary"},Jr={key:1,class:"border-0 card-header bg-transparent text-warning fw-bold",style:{"font-size":"0.8rem"}},Qr={class:"card-body pt-1",style:{"font-size":"0.9rem"}},qr={class:"mb-1"},Zr={class:"text-muted"},ta={class:"d-block"},ea={class:"text-muted"},ia={class:"d-block"},sa={key:0},na={class:"text-muted"},oa={class:"d-block"},ra={class:"d-flex align-items-end"};function aa(i,t,e,s,n,o){const r=H("LocaleText"),a=H("PeerSettingsDropdown");return D(),E("div",{class:Ct(["card shadow-sm rounded-3 peerCard bg-transparent",{"border-warning":e.Peer.restricted}])},[g("div",null,[e.Peer.restricted?(D(),E("div",Jr,[t[12]||(t[12]=g("i",{class:"bi-lock-fill me-2"},null,-1)),C(r,{t:"Access Restricted"})])):(D(),E("div",Ur,[g("div",{class:Ct(["dot ms-0",{active:e.Peer.status==="running"}])},null,2),g("div",Yr,[g("span",Kr,[t[7]||(t[7]=g("i",{class:"bi bi-arrow-down"},null,-1)),g("strong",null,B((e.Peer.cumu_receive+e.Peer.total_receive).toFixed(4)),1),t[8]||(t[8]=Dt(" GB "))]),g("span",Xr,[t[9]||(t[9]=g("i",{class:"bi bi-arrow-up"},null,-1)),g("strong",null,B((e.Peer.cumu_sent+e.Peer.total_sent).toFixed(4)),1),t[10]||(t[10]=Dt(" GB "))]),e.Peer.latest_handshake!=="No Handshake"?(D(),E("span",Gr,[t[11]||(t[11]=g("i",{class:"bi bi-arrows-angle-contract"},null,-1)),Dt(" "+B(o.getLatestHandshake)+" ago ",1)])):W("",!0)])]))]),g("div",Qr,[g("h6",null,B(e.Peer.name?e.Peer.name:"Untitled Peer"),1),g("div",qr,[g("small",Zr,[C(r,{t:"Public Key"})]),g("small",ta,[g("samp",null,B(e.Peer.id),1)])]),g("div",null,[g("small",ea,[C(r,{t:"Allowed IPs"})]),g("small",ia,[g("samp",null,B(e.Peer.allowed_ip),1)])]),e.Peer.advanced_security?(D(),E("div",sa,[g("small",na,[C(r,{t:"Advanced Security"})]),g("small",oa,[g("samp",null,B(e.Peer.advanced_security),1)])])):W("",!0),g("div",ra,[g("div",{class:Ct(["ms-auto px-2 rounded-3 subMenuBtn",{active:this.subMenuOpened}])},[g("a",{role:"button",class:"text-body",onClick:t[0]||(t[0]=l=>this.subMenuOpened=!0)},t[13]||(t[13]=[g("h5",{class:"mb-0"},[g("i",{class:"bi bi-three-dots"})],-1)])),C(J,{name:"slide-fade"},{default:X(()=>[this.subMenuOpened?(D(),V(a,{key:0,onQrcode:t[1]||(t[1]=l=>this.$emit("qrcode",l)),onConfigurationFile:t[2]||(t[2]=l=>this.$emit("configurationFile",l)),onSetting:t[3]||(t[3]=l=>this.$emit("setting")),onJobs:t[4]||(t[4]=l=>this.$emit("jobs")),onRefresh:t[5]||(t[5]=l=>this.$emit("refresh")),onShare:t[6]||(t[6]=l=>this.$emit("share")),Peer:e.Peer,ref:"target"},null,8,["Peer"])):W("",!0)]),_:1})],2)])])],2)}const la=Kt(jr,[["render",aa],["__scopeId","data-v-e00283b9"]]);/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela * Released under the MIT License */function Le(i){return i+.5|0}const Pt=(i,t,e)=>Math.max(Math.min(i,e),t);function me(i){return Pt(Le(i*2.55),0,255)}function Ot(i){return Pt(Le(i*255),0,255)}function St(i){return Pt(Le(i/2.55)/100,0,1)}function ls(i){return Pt(Le(i*100),0,100)}const at={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},Ci=[..."0123456789ABCDEF"],ca=i=>Ci[i&15],ha=i=>Ci[(i&240)>>4]+Ci[i&15],Be=i=>(i&240)>>4===(i&15),da=i=>Be(i.r)&&Be(i.g)&&Be(i.b)&&Be(i.a);function ua(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&at[i[1]]*17,g:255&at[i[2]]*17,b:255&at[i[3]]*17,a:t===5?at[i[4]]*17:255}:(t===7||t===9)&&(e={r:at[i[1]]<<4|at[i[2]],g:at[i[3]]<<4|at[i[4]],b:at[i[5]]<<4|at[i[6]],a:t===9?at[i[7]]<<4|at[i[8]]:255})),e}const fa=(i,t)=>i<255?t(i):"";function ga(i){var t=da(i)?ca:ha;return i?"#"+t(i.r)+t(i.g)+t(i.b)+fa(i.a,t):void 0}const pa=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Wn(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function ma(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 ba(i,t,e){const s=Wn(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 _a(i,t,e,s,n){return i===n?(t-e)/s+(t.5?h/(2-o-r):h/(o+r),l=_a(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function ji(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(Ot)}function Ui(i,t,e){return ji(Wn,i,t,e)}function xa(i,t,e){return ji(ba,i,t,e)}function ya(i,t,e){return ji(ma,i,t,e)}function Vn(i){return(i%360+360)%360}function va(i){const t=pa.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?me(+t[5]):Ot(+t[5]));const n=Vn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=xa(n,o,r):t[1]==="hsv"?s=ya(n,o,r):s=Ui(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function Sa(i,t){var e=Vi(i);e[0]=Vn(e[0]+t),e=Ui(e),i.r=e[0],i.g=e[1],i.b=e[2]}function wa(i){if(!i)return;const t=Vi(i),e=t[0],s=ls(t[1]),n=ls(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${St(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const cs={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"},hs={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 ka(){const i={},t=Object.keys(hs),e=Object.keys(cs);let s,n,o,r,a;for(s=0;s>16&255,o>>8&255,o&255]}return i}let ze;function Pa(i){ze||(ze=ka(),ze.transparent=[0,0,0,0]);const t=ze[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Ma=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Ca(i){const t=Ma.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?me(r):Pt(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?me(s):Pt(s,0,255)),n=255&(t[4]?me(n):Pt(n,0,255)),o=255&(t[6]?me(o):Pt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Da(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${St(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const ui=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Qt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Oa(i,t,e){const s=Qt(St(i.r)),n=Qt(St(i.g)),o=Qt(St(i.b));return{r:Ot(ui(s+e*(Qt(St(t.r))-s))),g:Ot(ui(n+e*(Qt(St(t.g))-n))),b:Ot(ui(o+e*(Qt(St(t.b))-o))),a:i.a+e*(t.a-i.a)}}function $e(i,t,e){if(i){let s=Vi(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ui(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function jn(i,t){return i&&Object.assign(t||{},i)}function ds(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=Ot(i[3]))):(t=jn(i,{r:0,g:0,b:0,a:1}),t.a=Ot(t.a)),t}function Ta(i){return i.charAt(0)==="r"?Ca(i):va(i)}class Pe{constructor(t){if(t instanceof Pe)return t;const e=typeof t;let s;e==="object"?s=ds(t):e==="string"&&(s=ua(t)||Pa(t)||Ta(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=jn(this._rgb);return t&&(t.a=St(t.a)),t}set rgb(t){this._rgb=ds(t)}rgbString(){return this._valid?Da(this._rgb):void 0}hexString(){return this._valid?ga(this._rgb):void 0}hslString(){return this._valid?wa(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Oa(this._rgb,t._rgb,e)),this}clone(){return new Pe(this.rgb)}alpha(t){return this._rgb.a=Ot(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Le(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 $e(this._rgb,2,t),this}darken(t){return $e(this._rgb,2,-t),this}saturate(t){return $e(this._rgb,1,t),this}desaturate(t){return $e(this._rgb,1,-t),this}rotate(t){return Sa(this._rgb,t),this}}/*! * Chart.js v4.4.4 * https://www.chartjs.org * (c) 2024 Chart.js Contributors * Released under the MIT License */function xt(){}const Aa=(()=>{let i=0;return()=>i++})();function $(i){return i===null||typeof i>"u"}function K(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function I(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function ct(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function ut(i,t){return ct(i)?i:t}function R(i,t){return typeof i>"u"?t:i}const La=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function N(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function F(i,t,e,s){let n,o,r;if(K(i))for(o=i.length,n=0;ni,x:i=>i.x,y:i=>i.y};function Ea(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 Fa(i){const t=Ea(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function ie(i,t){return(us[t]||(us[t]=Fa(t)))(i)}function Yi(i){return i.charAt(0).toUpperCase()+i.slice(1)}const Ce=i=>typeof i<"u",Tt=i=>typeof i=="function",fs=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Ba(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const G=Math.PI,bt=2*G,za=bt+G,si=Number.POSITIVE_INFINITY,$a=G/180,dt=G/2,Et=G/4,gs=G*2/3,Di=Math.log10,_t=Math.sign;function ve(i,t,e){return Math.abs(i-t)n-o).pop(),t}function De(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Na(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Wa(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 Ki(i,t,e){e=e||(r=>i[r]1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const Vt=(i,t,e,s)=>Ki(i,e,s?n=>{const o=i[n][t];return oi[n][t]Ki(i,e,s=>i[s][t]>=e);function Xa(i,t,e){let s=0,n=i.length;for(;ss&&i[n-1]>e;)n--;return s>0||n{const s="_onData"+Yi(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function bs(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)&&(Kn.forEach(o=>{delete i[o]}),delete i._chartjs)}function Xn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Gn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Jn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Gn.call(window,()=>{s=!1,i.apply(t,e)}))}}function Ja(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Xi=i=>i==="start"?"left":i==="end"?"right":"center",Q=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Qa=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function qa(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:d,maxDefined:u}=r.getUserBounds();d&&(n=st(Math.min(Vt(a,l,c).lo,e?s:Vt(t,l,r.getPixelForValue(c)).lo),0,s-1)),u?o=st(Math.max(Vt(a,r.axis,h,!0).hi+1,e?0:Vt(t,l,r.getPixelForValue(h),!0).hi+1),n,s)-n:o=s-n}return{start:n,count:o}}function Za(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const He=i=>i===0||i===1,_s=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*bt/e)),xs=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*bt/e)+1,Se={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*dt)+1,easeOutSine:i=>Math.sin(i*dt),easeInOutSine:i=>-.5*(Math.cos(G*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=>He(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=>He(i)?i:_s(i,.075,.3),easeOutElastic:i=>He(i)?i:xs(i,.075,.3),easeInOutElastic(i){return He(i)?i:i<.5?.5*_s(i*2,.1125,.45):.5+.5*xs(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-Se.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?Se.easeInBounce(i*2)*.5:Se.easeOutBounce(i*2-1)*.5+.5};function Gi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ys(i){return Gi(i)?i:new Pe(i)}function fi(i){return Gi(i)?i:new Pe(i).saturate(.5).darken(.1).hexString()}const tl=["x","y","borderWidth","radius","tension"],el=["color","borderColor","backgroundColor"];function il(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:el},numbers:{type:"number",properties:tl}}),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 sl(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const vs=new Map;function nl(i,t){t=t||{};const e=i+JSON.stringify(t);let s=vs.get(e);return s||(s=new Intl.NumberFormat(i,t),vs.set(e,s)),s}function Qn(i,t,e){return nl(t,e).format(i)}const qn={values(i){return K(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=ol(i,e)}const r=Di(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Qn(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(Di(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?qn.numeric.call(this,i,t,e):""}};function ol(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 Zn={formatters:qn};function rl(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Zn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Yt=Object.create(null),Ti=Object.create(null);function we(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)=>fi(n.backgroundColor),this.hoverBorderColor=(s,n)=>fi(n.borderColor),this.hoverColor=(s,n)=>fi(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 gi(this,t,e)}get(t){return we(this,t)}describe(t,e){return gi(Ti,t,e)}override(t,e){return gi(Yt,t,e)}route(t,e,s,n){const o=we(this,t),r=we(this,s),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[n];return I(l)?Object.assign({},c,l):R(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var U=new al({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[il,sl,rl]);function ll(i){return!i||$(i.size)||$(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ss(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 Ft(i,t,e){const s=i.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*s)/s+n}function ws(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Ai(i,t,e,s){to(i,t,e,s,null)}function to(i,t,e,s,n){let o,r,a,l,c,h,d,u;const f=t.pointStyle,p=t.rotation,m=t.radius;let b=(p||0)*$a;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(b),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(m)||m<=0)){switch(i.beginPath(),f){default:n?i.ellipse(e,s,n/2,m,0,0,bt):i.arc(e,s,m,0,bt),i.closePath();break;case"triangle":h=n?n/2:m,i.moveTo(e+Math.sin(b)*h,s-Math.cos(b)*m),b+=gs,i.lineTo(e+Math.sin(b)*h,s-Math.cos(b)*m),b+=gs,i.lineTo(e+Math.sin(b)*h,s-Math.cos(b)*m),i.closePath();break;case"rectRounded":c=m*.516,l=m-c,r=Math.cos(b+Et)*l,d=Math.cos(b+Et)*(n?n/2-c:l),a=Math.sin(b+Et)*l,u=Math.sin(b+Et)*(n?n/2-c:l),i.arc(e-d,s-a,c,b-G,b-dt),i.arc(e+u,s-r,c,b-dt,b),i.arc(e+d,s+a,c,b,b+dt),i.arc(e-u,s+r,c,b+dt,b+G),i.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}b+=Et;case"rectRot":d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,u=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+u,s-r),i.lineTo(e+d,s+a),i.lineTo(e-u,s+r),i.closePath();break;case"crossRot":b+=Et;case"cross":d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,u=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r);break;case"star":d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,u=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r),b+=Et,d=Math.cos(b)*(n?n/2:m),r=Math.cos(b)*m,a=Math.sin(b)*m,u=Math.sin(b)*(n?n/2:m),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r);break;case"line":r=n?n/2:Math.cos(b)*m,a=Math.sin(b)*m,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(b)*(n?n/2:m),s+Math.sin(b)*m);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function Oe(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,dl(i,o),l=0;l+i||0;function eo(i,t){const e={},s=I(t),n=s?Object.keys(t):t,o=I(i)?s?r=>R(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=bl(o(r));return e}function io(i){return eo(i,{top:"y",right:"x",bottom:"y",left:"x"})}function te(i){return eo(i,["topLeft","topRight","bottomLeft","bottomRight"])}function ht(i){const t=io(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function q(i,t){i=i||{},t=t||U.font;let e=R(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=R(i.style,t.style);s&&!(""+s).match(pl)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:R(i.family,t.family),lineHeight:ml(R(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:R(i.weight,t.weight),string:""};return n.string=ll(n),n}function Ne(i,t,e,s){let n,o,r;for(n=0,o=i.length;ne&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function Xt(i,t){return Object.assign(Object.create(i),t)}function qi(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=ro("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>qi([a,...i],t,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return no(a,l,()=>Ml(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return Ps(a).includes(l)},ownKeys(a){return Ps(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function se(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:so(i,s),setContext:o=>se(i,o,e,s),override:o=>se(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return no(o,r,()=>yl(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function so(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:Tt(e)?e:()=>e,isIndexable:Tt(s)?s:()=>s}}const xl=(i,t)=>i?i+Yi(t):t,Zi=(i,t)=>I(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function no(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function yl(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return Tt(a)&&r.isScriptable(t)&&(a=vl(t,a,i,e)),K(a)&&a.length&&(a=Sl(t,a,i,r.isIndexable)),Zi(t,a)&&(a=se(a,n,o&&o[t],r)),a}function vl(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||s);return a.delete(i),Zi(i,l)&&(l=ts(n._scopes,n,i,l)),l}function Sl(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(I(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=ts(c,n,i,h);t.push(se(d,o,r&&r[i],a))}}return t}function oo(i,t,e){return Tt(i)?i(t,e):i}const wl=(i,t)=>i===!0?t:typeof i=="string"?ie(t,i):void 0;function kl(i,t,e,s,n){for(const o of t){const r=wl(e,o);if(r){i.add(r);const a=oo(r._fallback,e,n);if(typeof a<"u"&&a!==e&&a!==s)return a}else if(r===!1&&typeof s<"u"&&e!==s)return null}return!1}function ts(i,t,e,s){const n=t._rootScopes,o=oo(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=ks(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=ks(a,r,o,l,s),l===null)?!1:qi(Array.from(a),[""],n,o,()=>Pl(t,e,s))}function ks(i,t,e,s,n){for(;e;)e=kl(i,t,e,s,n);return e}function Pl(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return K(n)&&I(e)?e:n||{}}function Ml(i,t,e,s){let n;for(const o of t)if(n=ro(xl(o,i),e),typeof n<"u")return Zi(i,n)?ts(e,s,i,n):n}function ro(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function Ps(i){let t=i._keys;return t||(t=i._keys=Cl(i._scopes)),t}function Cl(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const Dl=Number.EPSILON||1e-14,ne=(i,t)=>ti==="x"?"y":"x";function Ol(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=Oi(o,n),l=Oi(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,u=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function Tl(i,t,e){const s=i.length;let n,o,r,a,l,c=ne(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Ll(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,r=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function El(i,t){return li(i).getPropertyValue(t)}const Fl=["top","right","bottom","left"];function jt(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Fl[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Bl=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function zl(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(Bl(n,o,i.target))a=n,l=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function zt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=li(e),o=n.boxSizing==="border-box",r=jt(n,"padding"),a=jt(n,"border","width"),{x:l,y:c,box:h}=zl(i,e),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:f,height:p}=t;return o&&(f-=r.width+a.width,p-=r.height+a.height),{x:Math.round((l-d)/f*e.width/s),y:Math.round((c-u)/p*e.height/s)}}function $l(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&is(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=li(o),l=jt(a,"border","width"),c=jt(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=oi(a.maxWidth,o,"clientWidth"),n=oi(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||si,maxHeight:n||si}}const Ve=i=>Math.round(i*10)/10;function Hl(i,t,e,s){const n=li(i),o=jt(n,"margin"),r=oi(n.maxWidth,i,"clientWidth")||si,a=oi(n.maxHeight,i,"clientHeight")||si,l=$l(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const u=jt(n,"border","width"),f=jt(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Ve(Math.min(c,r,l.maxWidth)),h=Ve(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Ve(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Ve(Math.floor(h*s))),{width:c,height:h}}function Ms(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(i.currentDevicePixelRatio=s,r.height=n,r.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const Nl=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};es()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function Cs(i,t){const e=El(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function $t(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Wl(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Vl(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=$t(i,n,e),a=$t(n,o,e),l=$t(o,t,e),c=$t(r,a,e),h=$t(a,l,e);return $t(c,h,e)}const jl=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}}},Ul=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function ee(i,t,e){return i?jl(t,e):Ul()}function lo(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 co(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function ho(i){return i==="angle"?{between:Yn,compare:Ua,normalize:kt}:{between:Wt,compare:(t,e)=>t-e,normalize:t=>t}}function Ds({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function Yl(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=ho(s),l=t.length;let{start:c,end:h,loop:d}=i,u,f;if(d){for(c+=l,h+=l,u=0,f=l;ul(n,v,_)&&a(n,v)!==0,y=()=>a(o,_)===0||l(o,v,_),M=()=>m||P(),w=()=>!m||y();for(let k=h,O=h;k<=d;++k)x=t[k%r],!x.skip&&(_=c(x[s]),_!==v&&(m=l(_,n,o),b===null&&M()&&(b=a(_,n)===0?k:O),b!==null&&w()&&(p.push(Ds({start:b,end:k,loop:u,count:r,style:f})),b=null),O=k,v=_));return b!==null&&p.push(Ds({start:b,end:d,loop:u,count:r,style:f})),p}function Xl(i,t){const e=[],s=i.segments;for(let n=0;nn&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Jl(i,t,e,s){const n=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%n,end:r%n,loop:s}),o}function Ql(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=Gl(e,n,o,s);if(s===!0)return Os(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Gn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var yt=new tc;const As="transparent",ec={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ys(i||As),n=s.valid&&ys(t||As);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class ic{constructor(t,e,s,n){const o=e[s];n=Ne([t.to,n,o,t.from]);const r=Ne([t.from,o,n]);this._active=!0,this._fn=t.fn||ec[t.type||typeof r],this._easing=Se[t.easing]||Se.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ne([t.to,e,n,t.from]),this._from=Ne([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n{const o=t[n];if(!I(o))return;const r={};for(const a of e)r[a]=o[a];(K(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=nc(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&sc(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new ic(u,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 yt.add(this._chart,s),!0}}function sc(i,t){const e=[],s=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function Fs(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=lc(o,r,s),d=t.length;let u;for(let f=0;fe[s].axis===t).shift()}function dc(i,t){return Xt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function uc(i,t,e){return Xt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function he(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 mi=i=>i==="reset"||i==="none",Bs=(i,t)=>t?i:Object.assign({},i),fc=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:fo(e,!0),values:null};class ss{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Is(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&&he(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,u,f,p)=>d==="x"?u:d==="r"?p:f,o=e.xAxisID=R(s.xAxisID,pi(t,"x")),r=e.yAxisID=R(s.yAxisID,pi(t,"y")),a=e.rAxisID=R(s.rAxisID,pi(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,r,a),h=e.vAxisID=n(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&bs(this._data,this),t._stacked&&he(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(I(e)){const n=this._cachedMeta;this._data=ac(e,n)}else if(s!==e){if(s){bs(s,this);const n=this._cachedMeta;he(n),n._parsed=[]}e&&Object.isExtensible(e)&&Ga(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=Is(e.vScale,e),e.stack!==s.stack&&(n=!0,he(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&Fs(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,u;if(this._parsing===!1)s._parsed=n,s._sorted=!0,u=n;else{K(n[t])?u=this.parseArrayData(s,n,t,e):I(n[t])?u=this.parseObjectData(s,n,t,e):u=this.parsePrimitiveData(s,n,t,e);const f=()=>d[a]===null||c&&d[a]m||d=0;--u)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n=0&&tthis.getContext(s,n,e),m=c.resolveNamedOptions(u,f,p,d);return m.$shared&&(m.$shared=l,o[r]=Object.freeze(Bs(m,l))),m}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,s,e))}const c=new uo(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||mi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){mi(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!mi(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;an-o))}return i._cache.$bar}function pc(i){const t=i.iScale,e=gc(t,i.type);let s=t._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(Ce(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=e.length;n0?n[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function go(i,t,e,s){return K(i)?_c(i,t,e,s):t[e.axis]=e.parse(i,s),t}function zs(i,t,e,s){const n=i.iScale,o=i.vScale,r=n.getLabels(),a=n===o,l=[];let c,h,d,u;for(c=e,h=e+s;c=e?1:-1)}function yc(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.baseh.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[s.axis],c=h=>{const d=h._parsed.find(f=>f[s.axis]===l),u=d&&d[h.vScale.axis];if($(u)||isNaN(u))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,r;for(o=0,r=e.data.length;o0&&this.getParsed(e-1);for(let y=0;y=x){w.skip=!0;continue}const k=this.getParsed(y),O=$(k[f]),S=w[u]=r.getPixelForValue(k[u],y),T=w[f]=o||O?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[f],y);w.skip=isNaN(S)||isNaN(T)||O,w.stop=y>0&&Math.abs(k[u]-P[u])>b,m&&(w.parsed=k,w.raw=c.data[y]),d&&(w.options=h||this.resolveDataElementOptions(y,M.active?"active":n)),_||this.updateElement(M,y,w,n),P=k}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function Bt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ns{static override(t){Object.assign(ns.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Bt()}parse(){return Bt()}format(){return Bt()}add(){return Bt()}diff(){return Bt()}startOf(){return Bt()}endOf(){return Bt()}}var kc={_date:ns};function Pc(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Ka:Vt;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),u=l(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Re(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r]&&l[r](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,n))}),s&&!a?[]:o}var Oc={evaluateInteractionItems:Re,modes:{index(i,t,e,s){const n=zt(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?_i(i,n,o,s,r):xi(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=zt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?_i(i,n,o,s,r):xi(i,n,o,!1,s,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Ws(i,t){return i.filter(e=>bo.indexOf(e.pos)===-1&&e.box.axis===t)}function ue(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 Tc(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;ec.box.fullSize),!0),s=ue(de(t,"left"),!0),n=ue(de(t,"right")),o=ue(de(t,"top"),!0),r=ue(de(t,"bottom")),a=Ws(t,"x"),l=Ws(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:de(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Vs(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function _o(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 Ic(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!I(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&_o(r,o.getPadding());const a=Math.max(0,t.outerWidth-Vs(r,i,"left","right")),l=Math.max(0,t.outerHeight-Vs(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Ec(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 Fc(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function be(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof m.beforeLayout=="function"&&m.beforeLayout()});const h=l.reduce((m,b)=>b.box.options&&b.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},n);_o(u,ht(s));const f=Object.assign({maxPadding:u,w:o,h:r,x:n.left,y:n.top},n),p=Lc(l.concat(c),d);be(a.fullSize,f,d,p),be(l,f,d,p),be(c,f,d,p)&&be(l,f,d,p),Ec(f),js(a.leftAndTop,f,d,p),f.x+=f.w,f.y+=f.h,js(a.rightAndBottom,f,d,p),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},F(a.chartArea,m=>{const b=m.box;Object.assign(b,i.chartArea),b.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class xo{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 Bc extends xo{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ze="$chartjs",zc={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Us=i=>i===null||i==="";function $c(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Ze]={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",Us(n)){const o=Cs(i,"width");o!==void 0&&(i.width=o)}if(Us(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Cs(i,"height");o!==void 0&&(i.height=o)}return i}const yo=Nl?{passive:!0}:!1;function Hc(i,t,e){i&&i.addEventListener(t,e,yo)}function Nc(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,yo)}function Wc(i,t){const e=zc[i.type]||i.type,{x:s,y:n}=zt(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ri(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Vc(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ri(a.addedNodes,s),r=r&&!ri(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function jc(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ri(a.removedNodes,s),r=r&&!ri(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Ae=new Map;let Ys=0;function vo(){const i=window.devicePixelRatio;i!==Ys&&(Ys=i,Ae.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Uc(i,t){Ae.size||window.addEventListener("resize",vo),Ae.set(i,t)}function Yc(i){Ae.delete(i),Ae.size||window.removeEventListener("resize",vo)}function Kc(i,t,e){const s=i.canvas,n=s&&is(s);if(!n)return;const o=Jn((a,l)=>{const c=n.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),Uc(i,o),r}function yi(i,t,e){e&&e.disconnect(),t==="resize"&&Yc(i)}function Xc(i,t,e){const s=i.canvas,n=Jn(o=>{i.ctx!==null&&e(Wc(o,i))},i);return Hc(s,t,n),n}class Gc extends xo{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?($c(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Ze])return!1;const s=e[Ze].initial;["height","width"].forEach(o=>{const r=s[o];$(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ze],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Vc,detach:jc,resize:Kc}[e]||Xc;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:yi,detach:yi,resize:yi}[e]||Nc)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Hl(t,e,s,n)}isAttached(t){const e=t&&is(t);return!!(e&&e.isConnected)}}function Jc(i){return!es()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Bc:Gc}class At{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return De(this.x)&&De(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}function Qc(i,t){const e=i.options.ticks,s=qc(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?th(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return eh(t,c,o,r/n),c;const h=Zc(o,t,n);if(r>0){let d,u;const f=r>1?Math.round((l-a)/(r-1)):null;for(Ue(t,c,h,$(f)?0:a-f,a),d=0,u=r-1;dn)return l}return Math.max(n,1)}function th(i){const t=[];let e,s;for(e=0,s=i.length;ei==="left"?"right":i==="right"?"left":i,Ks=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Xs=(i,t)=>Math.min(t||i,i);function Gs(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;or+a)))return l}function oh(i,t){F(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:ut(e,ut(s,e)),max:ut(s,ut(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){N(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_l(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=st(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),d+6>a&&(a=f/(s-(t.offset?.5:1)),l=this.maxHeight-fe(t.grid)-e.padding-Js(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),r=Va(Math.min(Math.asin(st((h.highest.height+6)/a,-1,1)),Math.asin(st(l/c,-1,1))-Math.asin(st(u/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){N(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){N(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Js(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=fe(o)+l):(t.height=this.maxHeight,t.width=fe(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,p=Nt(this.labelRotation),m=Math.cos(p),b=Math.sin(p);if(a){const _=s.mirror?0:b*d.width+m*u.height;t.height=Math.min(this.maxHeight,t.height+_+f)}else{const _=s.mirror?0:m*d.width+b*u.height;t.width=Math.min(this.maxWidth,t.width+_+f)}this._calculatePadding(c,h,b,m)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*t.width,f=s*e.height):(u=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+r)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){N(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e({width:r[O]||0,height:a[O]||0});return{first:k(0),last:k(e-1),widest:k(M),highest:k(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ya(this._alignToPixels?Ft(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&&ta*n?a/s:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=fe(o),f=[],p=a.setContext(this.getContext()),m=p.display?p.width:0,b=m/2,_=function(Y){return Ft(s,Y,m)};let x,v,P,y,M,w,k,O,S,T,L,Z;if(r==="top")x=_(this.bottom),w=this.bottom-u,O=x-b,T=_(t.top)+b,Z=t.bottom;else if(r==="bottom")x=_(this.top),T=t.top,Z=_(t.bottom)-b,w=x+b,O=this.top+u;else if(r==="left")x=_(this.right),M=this.right-u,k=x-b,S=_(t.left)+b,L=t.right;else if(r==="right")x=_(this.left),S=t.left,L=_(t.right)-b,M=x+b,k=this.left+u;else if(e==="x"){if(r==="center")x=_((t.top+t.bottom)/2+.5);else if(I(r)){const Y=Object.keys(r)[0],nt=r[Y];x=_(this.chart.scales[Y].getPixelForValue(nt))}T=t.top,Z=t.bottom,w=x+b,O=w+u}else if(e==="y"){if(r==="center")x=_((t.left+t.right)/2);else if(I(r)){const Y=Object.keys(r)[0],nt=r[Y];x=_(this.chart.scales[Y].getPixelForValue(nt))}M=x-b,k=M-u,S=t.left,L=t.right}const j=R(n.ticks.maxTicksLimit,d),z=Math.max(1,Math.ceil(d/j));for(v=0;v0&&(It-=Rt/2);break}Fe={left:It,top:ce,width:Rt+Jt.width,height:le+Jt.height,color:z.backdropColor}}b.push({label:P,font:O,textOffset:L,options:{rotation:m,color:nt,strokeColor:Ie,strokeWidth:Ee,textAlign:Gt,textBaseline:Z,translation:[y,M],backdrop:Fe}})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Nt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");U.route(o,n,l,a)})}function uh(i){return"id"in i&&"defaults"in i}class fh{constructor(){this.controllers=new Ye(ss,"datasets",!0),this.elements=new Ye(At,"elements"),this.plugins=new Ye(Object,"plugins"),this.scales=new Ye(re,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):F(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=Yi(t);N(s["before"+n],[],s),e[t](s),N(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function ph(i){const t={},e=[],s=Object.keys(pt.plugins.items);for(let o=0;o1&&Qs(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function qs(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function Sh(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return qs(i,"x",e[0])||qs(i,"y",e[0])}return{}}function wh(i,t){const e=Yt[i.type]||{scales:{}},s=t.scales||{},n=Li(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!I(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Ri(r,a,Sh(r,i),U.scales[a.type]),c=yh(l,n),h=e.scales||{};o[r]=ye(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Li(a,t),h=(Yt[a]||{}).scales||{};Object.keys(h).forEach(d=>{const u=xh(d,l),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),ye(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];ye(a,[U.scales[a.type],U.scale])}),o}function So(i){const t=i.options||(i.options={});t.plugins=R(t.plugins,{}),t.scales=wh(i,t)}function wo(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function kh(i){return i=i||{},i.data=wo(i.data),So(i),i}const Zs=new Map,ko=new Set;function Ke(i,t){let e=Zs.get(i);return e||(e=t(),Zs.set(i,e),ko.add(e)),e}const ge=(i,t,e)=>{const s=ie(t,e);s!==void 0&&i.add(s)};let Ph=class{constructor(t){this._config=kh(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=wo(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(),So(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ke(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ke(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ke(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ke(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>ge(l,t,d))),h.forEach(d=>ge(l,n,d)),h.forEach(d=>ge(l,Yt[o]||{},d)),h.forEach(d=>ge(l,U,d)),h.forEach(d=>ge(l,Ti,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),ko.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Yt[e]||{},U.datasets[e]||{},{type:e},U,Ti]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=tn(this._resolverCache,t,n);let l=r;if(Ch(r,e)){o.$shared=!1,s=Tt(s)?s():s;const c=this.createResolver(t,s,a);l=se(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=tn(this._resolverCache,t,s);return I(e)?se(o,e,void 0,n):o}};function tn(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:qi(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const Mh=i=>I(i)&&Object.getOwnPropertyNames(i).some(t=>Tt(i[t]));function Ch(i,t){const{isScriptable:e,isIndexable:s}=so(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(Tt(a)||Mh(a))||r&&K(a))return!0}return!1}var Dh="4.4.4";const Oh=["top","bottom","left","right","chartArea"];function en(i,t){return i==="top"||i==="bottom"||Oh.indexOf(i)===-1&&t==="x"}function sn(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function nn(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),N(e&&e.onComplete,[i],t)}function Th(i){const t=i.chart,e=t.options.animation;N(e&&e.onProgress,[i],t)}function Po(i){return es()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const ti={},on=i=>{const t=Po(i);return Object.values(ti).filter(e=>e.canvas===t).pop()};function Ah(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function Lh(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Xe(i,t,e){return i.options.clip?i[e]:t[e]}function Rh(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Xe(e,t,"left"),right:Xe(e,t,"right"),top:Xe(s,t,"top"),bottom:Xe(s,t,"bottom")}:t}let ci=class{static defaults=U;static instances=ti;static overrides=Yt;static registry=pt;static version=Dh;static getChart=on;static register(...t){pt.add(...t),rn()}static unregister(...t){pt.remove(...t),rn()}constructor(t,e){const s=this.config=new Ph(e),n=Po(t),o=on(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Jc(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Aa(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new gh,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ja(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],ti[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}yt.listen(this,"complete",nn),yt.listen(this,"progress",Th),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return $(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 pt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ms(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ws(this.canvas,this.ctx),this}stop(){return yt.stop(this),this}resize(t,e){yt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Ms(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),N(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};F(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Ri(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),F(o,r=>{const a=r.options,l=a.id,c=Ri(l,a),h=R(a.type,r.dtype);(a.position===void 0||en(a.position,c)!==en(r.dposition))&&(a.position=r.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const u=pt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(a,t)}),F(n,(r,a)=>{r||delete s[a]}),F(s,r=>{lt.configure(this,r,r.options),lt.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;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 r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(sn("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){F(this.scales,t=>{lt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!fs(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;Ah(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;lt.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],F(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=Rh(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&Ji(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&&Qi(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Oe(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Oc.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=Xt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);Ce(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),yt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};F(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){F(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},F(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!ei(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),l=Ba(t),c=Lh(t,this._lastEvent,s,l);s&&(this._lastEvent=null,N(o.onHover,[t,a,this],this),l&&N(o.onClick,[t,a,this],this));const h=!ei(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};function rn(){return F(ci.instances,i=>i._plugins.invalidate())}function Mo(i,t,e=t){i.lineCap=R(e.borderCapStyle,t.borderCapStyle),i.setLineDash(R(e.borderDash,t.borderDash)),i.lineDashOffset=R(e.borderDashOffset,t.borderDashOffset),i.lineJoin=R(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=R(e.borderWidth,t.borderWidth),i.strokeStyle=R(e.borderColor,t.borderColor)}function Ih(i,t,e){i.lineTo(e.x,e.y)}function Eh(i){return i.stepped?cl:i.tension||i.cubicInterpolationMode==="monotone"?hl:Ih}function Co(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,l=Math.max(n,r),c=Math.min(o,a),h=na&&o>a;return{count:s,start:l,loop:t.loop,ilen:c(r+(c?a-P:P))%o,v=()=>{m!==b&&(i.lineTo(h,b),i.lineTo(h,m),i.lineTo(h,_))};for(l&&(f=n[x(0)],i.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=n[x(u)],f.skip)continue;const P=f.x,y=f.y,M=P|0;M===p?(yb&&(b=y),h=(d*h+P)/++d):(v(),i.lineTo(P,y),p=M,d=0,m=b=y),_=y}v()}function Ii(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Bh:Fh}function zh(i){return i.stepped?Wl:i.tension||i.cubicInterpolationMode==="monotone"?Vl:$t}function $h(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Mo(i,t.options),i.stroke(n)}function Hh(i,t,e,s){const{segments:n,options:o}=t,r=Ii(t);for(const a of n)Mo(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Nh=typeof Path2D=="function";function Wh(i,t,e,s){Nh&&!t.options.segment?$h(i,t,e,s):Hh(i,t,e,s)}class Vh extends At{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;Il(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ql(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=Xl(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=zh(s);let c,h;for(c=0,h=r.length;c{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)}},Qh=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class cn extends At{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=N(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=q(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ln(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((p,m)=>{const b=s+e/2+o.measureText(p.text).width;(m===0||c[c.length-1]+b+2*a>r)&&(d+=h,c[c.length-(m>0?0:1)]=0,f+=h,u++),l[m]={left:0,top:f,row:u,width:b,height:n},c[c.length-1]+=b+a}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let d=a,u=0,f=0,p=0,m=0;return this.legendItems.forEach((b,_)=>{const{itemWidth:x,itemHeight:v}=qh(s,e,o,b,n);_>0&&f+v+2*a>h&&(d+=u+a,c.push({width:u,height:f}),p+=u+a,m++,u=f=0),l[_]={left:p,top:f,col:m,width:x,height:v},u=Math.max(u,x),f+=v+a}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=ee(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Q(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=Q(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+t+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=Q(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=Q(s,this.top+t+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ji(t,this),this._draw(),Qi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=U.color,l=ee(t.rtl,this.left,this.width),c=q(r.font),{padding:h}=r,d=c.size,u=d/2;let f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:p,boxHeight:m,itemHeight:b}=ln(r,d),_=function(M,w,k){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const O=R(k.lineWidth,1);if(n.fillStyle=R(k.fillStyle,a),n.lineCap=R(k.lineCap,"butt"),n.lineDashOffset=R(k.lineDashOffset,0),n.lineJoin=R(k.lineJoin,"miter"),n.lineWidth=O,n.strokeStyle=R(k.strokeStyle,a),n.setLineDash(R(k.lineDash,[])),r.usePointStyle){const S={radius:m*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:O},T=l.xPlus(M,p/2),L=w+u;to(n,S,T,L,r.pointStyleWidth&&p)}else{const S=w+Math.max((d-m)/2,0),T=l.leftForLtr(M,p),L=te(k.borderRadius);n.beginPath(),Object.values(L).some(Z=>Z!==0)?ni(n,{x:T,y:S,w:p,h:m,radius:L}):n.rect(T,S,p,m),n.fill(),O!==0&&n.stroke()}n.restore()},x=function(M,w,k){Te(n,k.text,M,w+b/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},v=this.isHorizontal(),P=this._computeTitleHeight();v?f={x:Q(o,this.left+h,this.right-s[0]),y:this.top+h+P,line:0}:f={x:this.left+h,y:Q(o,this.top+P+h,this.bottom-e[0].height),line:0},lo(this.ctx,t.textDirection);const y=b+h;this.legendItems.forEach((M,w)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const k=n.measureText(M.text).width,O=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),S=p+u+k;let T=f.x,L=f.y;l.setWidth(this.width),v?w>0&&T+S+h>this.right&&(L=f.y+=y,f.line++,T=f.x=Q(o,this.left+h,this.right-s[f.line])):w>0&&L+y>this.bottom&&(T=f.x=T+e[f.line].width+h,f.line++,L=f.y=Q(o,this.top+P+h,this.bottom-e[f.line].height));const Z=l.x(T);if(_(Z,L,M),T=Qa(O,T+p+u,v?T+S:this.right,t.rtl),x(l.x(T),L,M),v)f.x+=S+h;else if(typeof M.text!="string"){const j=c.lineHeight;f.y+=Oo(M,j)+h}else f.y+=y}),co(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=q(e.font),n=ht(e.padding);if(!e.display)return;const o=ee(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=Q(t.align,d,this.right-u);else{const p=this.columnSizes.reduce((m,b)=>Math.max(m,b.height),0);h=c+Q(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const f=Q(a,d,d+u);r.textAlign=o.textAlign(Xi(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,Te(r,e.text,f,h,s)}_computeTitleHeight(){const t=this.options.title,e=q(t.font),s=ht(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(Wt(t,this.left,this.right)&&Wt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>r.length?o:r)),t+e.size/2+s.measureText(n).width}function td(i,t,e){let s=i;return typeof t.text!="string"&&(s=Oo(t,e)),s}function Oo(i,t){const e=i.text?i.text.length:0;return t*e}function ed(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var id={id:"legend",_element:cn,start(i,t,e){const s=i.legend=new cn({ctx:i.ctx,options:e,chart:i});lt.configure(i,s,e),lt.addBox(i,s)},stop(i){lt.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;lt.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=ht(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class To extends At{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=K(s.text)?s.text.length:1;this._padding=ht(s.padding);const o=n*q(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:r}=this,a=r.align;let l=0,c,h,d;return this.isHorizontal()?(h=Q(a,s,o),d=e+t,c=o-s):(r.position==="left"?(h=s+t,d=Q(a,n,e),l=G*-.5):(h=o-t,d=Q(a,e,n),l=G*.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=q(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Te(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Xi(e.align),textBaseline:"middle",translation:[r,a]})}}function sd(i,t){const e=new To({ctx:i.ctx,options:t,chart:i});lt.configure(i,e,t),lt.addBox(i,e),i.titleBlock=e}var nd={id:"title",_element:To,start(i,t,e){sd(i,e)},stop(i){const t=i.titleBlock;lt.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;lt.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const _e={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;ta+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o-1?i.split(` `):i}function od(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function hn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=q(t.bodyFont),c=q(t.titleFont),h=q(t.footerFont),d=o.length,u=n.length,f=s.length,p=ht(t.padding);let m=p.height,b=0,_=s.reduce((P,y)=>P+y.before.length+y.lines.length+y.after.length,0);if(_+=i.beforeBody.length+i.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){const P=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*P+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let x=0;const v=function(P){b=Math.max(b,e.measureText(P).width+x)};return e.save(),e.font=c.string,F(i.title,v),e.font=l.string,F(i.beforeBody.concat(i.afterBody),v),x=t.displayColors?r+2+t.boxPadding:0,F(s,P=>{F(P.before,v),F(P.lines,v),F(P.after,v)}),x=0,e.font=h.string,F(i.footer,v),e.restore(),b+=p.width,{width:b,height:m}}function rd(i,t){const{y:e,height:s}=t;return ei.height-s/2?"bottom":"center"}function ad(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function ld(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),ad(c,i,t,e)&&(c="center"),c}function dn(i,t,e){const s=e.yAlign||t.yAlign||rd(i,e);return{xAlign:e.xAlign||t.xAlign||ld(i,t,e,s),yAlign:s}}function cd(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function hd(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function un(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=te(r);let p=cd(t,a);const m=hd(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(h,u)+n:a==="right"&&(p+=Math.max(d,f)+n),{x:st(p,0,s.width-t.width),y:st(m,0,s.height-t.height)}}function Ge(i,t,e){const s=ht(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function fn(i){return gt([],vt(i))}function dd(i,t,e){return Xt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function gn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Ao={beforeTitle:xt,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"?Ao[t].call(e,s):n}class pn extends At{static positioners=_e;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 uo(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=dd(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),r=tt(s,"afterTitle",this,t);let a=[];return a=gt(a,vt(n)),a=gt(a,vt(o)),a=gt(a,vt(r)),a}getBeforeBody(t,e){return fn(tt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return F(t,o=>{const r={before:[],lines:[],after:[]},a=gn(s,o);gt(r.before,vt(tt(a,"beforeLabel",this,o))),gt(r.lines,tt(a,"label",this,o)),gt(r.after,vt(tt(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return fn(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),r=tt(s,"afterFooter",this,t);let a=[];return a=gt(a,vt(n)),a=gt(a,vt(o)),a=gt(a,vt(r)),a}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,d,u,s))),t.itemSort&&(a=a.sort((h,d)=>t.itemSort(h,d,s))),F(a,h=>{const d=gn(t.callbacks,h);n.push(tt(d,"labelColor",this,h)),o.push(tt(d,"labelPointStyle",this,h)),r.push(tt(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=_e[s.position].call(this,n,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const l=this._size=hn(this,s),c=Object.assign({},a,l),h=dn(this.chart,s,c),d=un(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=te(a),{x:u,y:f}=t,{width:p,height:m}=e;let b,_,x,v,P,y;return o==="center"?(P=f+m/2,n==="left"?(b=u,_=b-r,v=P+r,y=P-r):(b=u+p,_=b+r,v=P-r,y=P+r),x=b):(n==="left"?_=u+Math.max(l,h)+r:n==="right"?_=u+p-Math.max(c,d)-r:_=this.caretX,o==="top"?(v=f,P=v-r,b=_-r,x=_+r):(v=f+m,P=v+r,b=_+r,x=_-r),y=v),{x1:b,x2:_,x3:x,y1:v,y2:P,y3:y}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=ee(s.rtl,this.x,this.width);for(t.x=Ge(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=q(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ni(t,{x:m,y:p,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),ni(t,{x:b,y:p+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=r.backgroundColor,t.fillRect(b,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=q(s.bodyFont);let u=d.lineHeight,f=0;const p=ee(s.rtl,this.x,this.width),m=function(k){e.fillText(k,p.x(t.x+f),t.y+u/2),t.y+=u+o},b=p.textAlign(r);let _,x,v,P,y,M,w;for(e.textAlign=r,e.textBaseline="middle",e.font=d.string,t.x=Ge(this,b,s),e.fillStyle=s.bodyColor,F(this.beforeBody,m),f=a&&b!=="right"?r==="center"?c/2+h:c+2+h:0,P=0,M=n.length;P0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=_e[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=hn(this,t),l=Object.assign({},r,this._size),c=dn(e,t,l),h=un(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=ht(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),lo(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),co(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!ei(s,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,s),a=this._positionChanged(r,t),l=e||!ei(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,r=_e[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}var ud={id:"tooltip",_element:pn,positioners:_e,afterInit(i,t,e){e&&(i.tooltip=new pn({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:Ao},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 fd=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function gd(i,t,e,s){const n=i.indexOf(t);if(n===-1)return fd(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const pd=(i,t)=>i===null?null:st(Math.round(i),0,t);function mn(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}}function bd(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,p=h-1,{min:m,max:b}=t,_=!$(r),x=!$(a),v=!$(c),P=(b-m)/(d+1);let y=ps((b-m)/p/f)*f,M,w,k,O;if(y<1e-14&&!_&&!x)return[{value:m},{value:b}];O=Math.ceil(b/y)-Math.floor(m/y),O>p&&(y=ps(O*y/p/f)*f),$(l)||(M=Math.pow(10,l),y=Math.ceil(y*M)/M),n==="ticks"?(w=Math.floor(m/y)*y,k=Math.ceil(b/y)*y):(w=m,k=b),_&&x&&o&&Na((a-r)/o,y/1e3)?(O=Math.round(Math.min((a-r)/y,h)),y=(a-r)/O,w=r,k=a):v?(w=_?r:w,k=x?a:k,O=c-1,y=(k-w)/O):(O=(k-w)/y,ve(O,Math.round(O),y/1e3)?O=Math.round(O):O=Math.ceil(O));const S=Math.max(ms(y),ms(w));M=Math.pow(10,$(l)?S:l),w=Math.round(w*M)/M,k=Math.round(k*M)/M;let T=0;for(_&&(u&&w!==r?(e.push({value:r}),wa)break;e.push({value:L})}return x&&u&&k!==a?e.length&&ve(e[e.length-1].value,a,bn(a,P,i))?e[e.length-1].value=a:e.push({value:a}):(!x||k===a)&&e.push({value:k}),e}function bn(i,t,{horizontal:e,minRotation:s}){const n=Nt(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class _d extends re{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return $(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=e?n:l,a=l=>o=s?o:l;if(t){const l=_t(n),c=_t(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=bd(n,o);return t.bounds==="ticks"&&Wa(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Qn(t,this.chart.options.locale,this.options.ticks.format)}}class xd extends _d{static id="linear";static defaults={ticks:{callback:Zn.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ct(t)?t:0,this.max=ct(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=Nt(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const hi={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(hi);function _n(i,t){return i-t}function xn(i,t){if($(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),ct(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(De(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function yn(i,t,e,s){const n=et.length;for(let o=et.indexOf(i);o=et.indexOf(e);o--){const r=et[o];if(hi[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return et[e?et.indexOf(e):0]}function vd(i){for(let t=et.indexOf(i)+1,e=et.length;t=t?e[s]:e[n];i[o]=!0}}function Sd(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=e[a],l>=0&&(t[l].major=!0);return t}function Sn(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=st(e,0,r),s=st(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||yn(o.minUnit,e,s,this._getLabelCapacity(e)),a=R(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=De(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const p=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u+m)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return N(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],d=c&&a[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=Vt(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=Vt(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:l}=i[n]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class ag extends wn{static id="timeseries";static defaults=wn.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Je(e,this.min),this._tableRange=Je(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Je(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Je(this._table,s*this._tableRange+this._minPos,!0)}}const Lo={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},wd={ariaLabel:{type:String},ariaDescribedby:{type:String}},kd={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Lo,...wd},Pd=Xo[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function qt(i){return Rn(i)?Mi(i):i}function Md(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return Rn(t)?new Proxy(i,{}):i}function Cd(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function Ro(i,t){i.labels=t}function Io(i,t,e){const s=[];i.datasets=t.map(n=>{const o=i.datasets.find(r=>r[e]===n[e]);return!o||!n.data||s.includes(o)?{...n}:(s.push(o),Object.assign(o,n),o)})}function Dd(i,t){const e={labels:[],datasets:[]};return Ro(e,i.labels),Io(e,i.datasets,t),e}const Od=Tn({props:kd,setup(i,t){let{expose:e,slots:s}=t;const n=Ut(null),o=An(null);e({chart:o});const r=()=>{if(!n.value)return;const{type:c,data:h,options:d,plugins:u,datasetIdKey:f}=i,p=Dd(h,f),m=Md(p,h);o.value=new ci(n.value,{type:c,data:m,options:{...d},plugins:u})},a=()=>{const c=Mi(o.value);c&&(i.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},i.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(i.updateMode)};return Ln(r),Go(a),On([()=>i.options,()=>i.data],(c,h)=>{let[d,u]=c,[f,p]=h;const m=Mi(o.value);if(!m)return;let b=!1;if(d){const _=qt(d),x=qt(f);_&&_!==x&&(Cd(m,_),b=!0)}if(u){const _=qt(u.labels),x=qt(p.labels),v=qt(u.datasets),P=qt(p.datasets);_!==x&&(Ro(m.config.data,_),b=!0),v&&v!==P&&(Io(m.config.data,v,i.datasetIdKey),b=!0)}b&&Jo(()=>{l(m)})},{deep:!0}),()=>Pi("canvas",{role:"img",ariaLabel:i.ariaLabel,ariaDescribedby:i.ariaDescribedby,ref:n},[Pi("p",{},[s.default?s.default():""])])}});function Eo(i,t){return ci.register(t),Tn({props:Lo,setup(e,s){let{expose:n}=s;const o=An(null),r=a=>{o.value=a?.chart};return n({chart:o}),()=>Pi(Od,Pd({ref:r},{type:i,...e}))}})}const Td=Eo("bar",po),Ad=Eo("line",mo);function wt(i){return Array.isArray?Array.isArray(i):zo(i)==="[object Array]"}const Ld=1/0;function Rd(i){if(typeof i=="string")return i;let t=i+"";return t=="0"&&1/i==-Ld?"-0":t}function Id(i){return i==null?"":Rd(i)}function mt(i){return typeof i=="string"}function Fo(i){return typeof i=="number"}function Ed(i){return i===!0||i===!1||Fd(i)&&zo(i)=="[object Boolean]"}function Bo(i){return typeof i=="object"}function Fd(i){return Bo(i)&&i!==null}function it(i){return i!=null}function wi(i){return!i.trim().length}function zo(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Bd="Incorrect 'index' type",zd=i=>`Invalid value for key ${i}`,$d=i=>`Pattern length exceeds max of ${i}.`,Hd=i=>`Missing ${i} property in key`,Nd=i=>`Property 'weight' in key '${i}' must be a positive integer`,kn=Object.prototype.hasOwnProperty;class Wd{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(s=>{let n=$o(s);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight}),this._keys.forEach(s=>{s.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function $o(i){let t=null,e=null,s=null,n=1,o=null;if(mt(i)||wt(i))s=i,t=Pn(i),e=Ei(i);else{if(!kn.call(i,"name"))throw new Error(Hd("name"));const r=i.name;if(s=r,kn.call(i,"weight")&&(n=i.weight,n<=0))throw new Error(Nd(r));t=Pn(r),e=Ei(r),o=i.getFn}return{path:t,id:e,weight:n,src:s,getFn:o}}function Pn(i){return wt(i)?i:i.split(".")}function Ei(i){return wt(i)?i.join("."):i}function Vd(i,t){let e=[],s=!1;const n=(o,r,a)=>{if(it(o))if(!r[a])e.push(o);else{let l=r[a];const c=o[l];if(!it(c))return;if(a===r.length-1&&(mt(c)||Fo(c)||Ed(c)))e.push(Id(c));else if(wt(c)){s=!0;for(let h=0,d=c.length;hi.score===t.score?i.idx{this._keysMap[e.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,mt(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const e=this.size();mt(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e{let r=n.getFn?n.getFn(t):this.getFn(t,n.path);if(it(r)){if(wt(r)){let a=[];const l=[{nestedArrIndex:-1,value:r}];for(;l.length;){const{nestedArrIndex:c,value:h}=l.pop();if(it(h))if(mt(h)&&!wi(h)){let d={v:h,i:c,n:this.norm.get(h)};a.push(d)}else wt(h)&&h.forEach((d,u)=>{l.push({nestedArrIndex:u,value:d})})}s.$[o]=a}else if(mt(r)&&!wi(r)){let a={v:r,n:this.norm.get(r)};s.$[o]=a}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function Ho(i,t,{getFn:e=A.getFn,fieldNormWeight:s=A.fieldNormWeight}={}){const n=new os({getFn:e,fieldNormWeight:s});return n.setKeys(i.map($o)),n.setSources(t),n.create(),n}function Jd(i,{getFn:t=A.getFn,fieldNormWeight:e=A.fieldNormWeight}={}){const{keys:s,records:n}=i,o=new os({getFn:t,fieldNormWeight:e});return o.setKeys(s),o.setIndexRecords(n),o}function Qe(i,{errors:t=0,currentLocation:e=0,expectedLocation:s=0,distance:n=A.distance,ignoreLocation:o=A.ignoreLocation}={}){const r=t/i.length;if(o)return r;const a=Math.abs(s-e);return n?r+a/n:a?1:r}function Qd(i=[],t=A.minMatchCharLength){let e=[],s=-1,n=-1,o=0;for(let r=i.length;o=t&&e.push([s,n]),s=-1)}return i[o-1]&&o-s>=t&&e.push([s,o-1]),e}const Ht=32;function qd(i,t,e,{location:s=A.location,distance:n=A.distance,threshold:o=A.threshold,findAllMatches:r=A.findAllMatches,minMatchCharLength:a=A.minMatchCharLength,includeMatches:l=A.includeMatches,ignoreLocation:c=A.ignoreLocation}={}){if(t.length>Ht)throw new Error($d(Ht));const h=t.length,d=i.length,u=Math.max(0,Math.min(s,d));let f=o,p=u;const m=a>1||l,b=m?Array(d):[];let _;for(;(_=i.indexOf(t,p))>-1;){let w=Qe(t,{currentLocation:_,expectedLocation:u,distance:n,ignoreLocation:c});if(f=Math.min(w,f),p=_+h,m){let k=0;for(;k=S;j-=1){let z=j-1,Y=e[i.charAt(z)];if(m&&(b[z]=+!!Y),L[j]=(L[j+1]<<1|1)&Y,w&&(L[j]|=(x[j+1]|x[j])<<1|1|x[j+1]),L[j]&y&&(v=Qe(t,{errors:w,currentLocation:z,expectedLocation:u,distance:n,ignoreLocation:c}),v<=f)){if(f=v,p=z,p<=u)break;S=Math.max(1,2*u-p)}}if(Qe(t,{errors:w+1,currentLocation:u,expectedLocation:u,distance:n,ignoreLocation:c})>f)break;x=L}const M={isMatch:p>=0,score:Math.max(.001,v)};if(m){const w=Qd(b,a);w.length?l&&(M.indices=w):M.isMatch=!1}return M}function Zd(i){let t={};for(let e=0,s=i.length;e{this.chunks.push({pattern:u,alphabet:Zd(u),startIndex:f})},d=this.pattern.length;if(d>Ht){let u=0;const f=d%Ht,p=d-f;for(;u{const{isMatch:_,score:x,indices:v}=qd(t,p,m,{location:n+b,distance:o,threshold:r,findAllMatches:a,minMatchCharLength:l,includeMatches:s,ignoreLocation:c});_&&(u=!0),d+=x,_&&v&&(h=[...h,...v])});let f={isMatch:u,score:u?d/this.chunks.length:1};return u&&s&&(f.indices=h),f}}class Lt{constructor(t){this.pattern=t}static isMultiMatch(t){return Mn(t,this.multiRegex)}static isSingleMatch(t){return Mn(t,this.singleRegex)}search(){}}function Mn(i,t){const e=i.match(t);return e?e[1]:null}class tu extends Lt{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class eu extends Lt{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class iu extends Lt{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class su extends Lt{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class nu extends Lt{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class ou extends Lt{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class Wo extends Lt{constructor(t,{location:e=A.location,threshold:s=A.threshold,distance:n=A.distance,includeMatches:o=A.includeMatches,findAllMatches:r=A.findAllMatches,minMatchCharLength:a=A.minMatchCharLength,isCaseSensitive:l=A.isCaseSensitive,ignoreLocation:c=A.ignoreLocation}={}){super(t),this._bitapSearch=new No(t,{location:e,threshold:s,distance:n,includeMatches:o,findAllMatches:r,minMatchCharLength:a,isCaseSensitive:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Vo extends Lt{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0,s;const n=[],o=this.pattern.length;for(;(s=t.indexOf(this.pattern,e))>-1;)e=s+o,n.push([s,e-1]);const r=!!n.length;return{isMatch:r,score:r?0:1,indices:n}}}const Fi=[tu,Vo,iu,su,ou,nu,eu,Wo],Cn=Fi.length,ru=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,au="|";function lu(i,t={}){return i.split(au).map(e=>{let s=e.trim().split(ru).filter(o=>o&&!!o.trim()),n=[];for(let o=0,r=s.length;o!!(i[ai.AND]||i[ai.OR]),uu=i=>!!i[$i.PATH],fu=i=>!wt(i)&&Bo(i)&&!Hi(i),Dn=i=>({[ai.AND]:Object.keys(i).map(t=>({[t]:i[t]}))});function jo(i,t,{auto:e=!0}={}){const s=n=>{let o=Object.keys(n);const r=uu(n);if(!r&&o.length>1&&!Hi(n))return s(Dn(n));if(fu(n)){const l=r?n[$i.PATH]:o[0],c=r?n[$i.PATTERN]:n[l];if(!mt(c))throw new Error(zd(l));const h={keyId:Ei(l),pattern:c};return e&&(h.searcher=zi(c,t)),h}let a={children:[],operator:o[0]};return o.forEach(l=>{const c=n[l];wt(c)&&c.forEach(h=>{a.children.push(s(h))})}),a};return Hi(i)||(i=Dn(i)),s(i)}function gu(i,{ignoreFieldNorm:t=A.ignoreFieldNorm}){i.forEach(e=>{let s=1;e.matches.forEach(({key:n,norm:o,score:r})=>{const a=n?n.weight:null;s*=Math.pow(r===0&&a?Number.EPSILON:r,(a||1)*(t?1:o))}),e.score=s})}function pu(i,t){const e=i.matches;t.matches=[],it(e)&&e.forEach(s=>{if(!it(s.indices)||!s.indices.length)return;const{indices:n,value:o}=s;let r={indices:n,value:o};s.key&&(r.key=s.key.src),s.idx>-1&&(r.refIndex=s.idx),t.matches.push(r)})}function mu(i,t){t.score=i.score}function bu(i,t,{includeMatches:e=A.includeMatches,includeScore:s=A.includeScore}={}){const n=[];return e&&n.push(pu),s&&n.push(mu),i.map(o=>{const{idx:r}=o,a={item:t[r],refIndex:r};return n.length&&n.forEach(l=>{l(o,a)}),a})}class ae{constructor(t,e={},s){this.options={...A,...e},this.options.useExtendedSearch,this._keyStore=new Wd(this.options.keys),this.setCollection(t,s)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof os))throw new Error(Bd);this._myIndex=e||Ho(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){it(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let s=0,n=this._docs.length;s-1&&(l=l.slice(0,e)),bu(l,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(t){const e=zi(t,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:o,i:r,n:a})=>{if(!it(o))return;const{isMatch:l,score:c,indices:h}=e.searchIn(o);l&&n.push({item:o,idx:r,matches:[{score:c,value:o,norm:a,indices:h}]})}),n}_searchLogical(t){const e=jo(t,this.options),s=(a,l,c)=>{if(!a.children){const{keyId:d,searcher:u}=a,f=this._findMatches({key:this._keyStore.get(d),value:this._myIndex.getValueForItemAtKeyId(l,d),searcher:u});return f&&f.length?[{idx:c,item:l,matches:f}]:[]}const h=[];for(let d=0,u=a.children.length;d{if(it(a)){let c=s(e,a,l);c.length&&(o[l]||(o[l]={idx:l,item:a,matches:[]},r.push(o[l])),c.forEach(({matches:h})=>{o[l].matches.push(...h)}))}}),r}_searchObjectList(t){const e=zi(t,this.options),{keys:s,records:n}=this._myIndex,o=[];return n.forEach(({$:r,i:a})=>{if(!it(r))return;let l=[];s.forEach((c,h)=>{l.push(...this._findMatches({key:c,value:r[h],searcher:e}))}),l.length&&o.push({idx:a,item:r,matches:l})}),o}_findMatches({key:t,value:e,searcher:s}){if(!it(e))return[];let n=[];if(wt(e))e.forEach(({v:o,i:r,n:a})=>{if(!it(o))return;const{isMatch:l,score:c,indices:h}=s.searchIn(o);l&&n.push({score:c,key:t,value:o,idx:r,norm:a,indices:h})});else{const{v:o,n:r}=e,{isMatch:a,score:l,indices:c}=s.searchIn(o);a&&n.push({score:l,key:t,value:o,norm:r,indices:c})}return n}}ae.version="7.0.0";ae.createIndex=Ho;ae.parseIndex=Jd;ae.config=A;ae.parseQuery=jo;du(hu);const _u={class:"text-primary"},xu={class:"text-success"},yu={key:0,class:"text-secondary"},vu={key:1},Su={__name:"peerRow",props:["Peer"],emits:["qrcode","configurationFile","setting","jobs","refresh","share"],setup(i,{emit:t}){const e=i,s=Ut(!1),n=In(()=>e.Peer.latest_handshake.includes(",")?e.Peer.latest_handshake.split(",")[0]:e.Peer.latest_handshake),o=En("target");Hn(o,a=>{s.value=!1});const r=t;return(a,l)=>(D(),E("tr",null,[g("td",null,[g("small",null,B(i.Peer.name?i.Peer.name:"Untitled Peer"),1)]),g("td",null,[g("small",null,B(i.Peer.id),1)]),g("td",null,[g("small",null,B(i.Peer.allowed_ip),1)]),g("td",null,[g("small",_u,B((i.Peer.cumu_receive+i.Peer.total_receive).toFixed(4))+" GB ",1)]),g("td",null,[g("small",xu,B((i.Peer.cumu_sent+i.Peer.total_sent).toFixed(4))+" GB ",1)]),g("td",null,[i.Peer.latest_handshake!=="No Handshake"?(D(),E("small",yu,[l[7]||(l[7]=g("i",{class:"bi bi-arrows-angle-contract"},null,-1)),Dt(" "+B(n.value)+" ago ",1)])):(D(),E("small",vu,"N/A"))]),g("td",null,[g("a",{role:"button",class:"text-body",onClick:l[0]||(l[0]=c=>s.value=!0)},l[8]||(l[8]=[g("h5",{class:"mb-0"},[g("i",{class:"bi bi-three-dots"})],-1)])),C(J,{name:"slide-fade"},{default:X(()=>[s.value?(D(),V(Nn,{key:0,onQrcode:l[1]||(l[1]=c=>r("qrcode",c)),onConfigurationFile:l[2]||(l[2]=c=>r("configurationFile",c)),onSetting:l[3]||(l[3]=c=>r("setting")),onJobs:l[4]||(l[4]=c=>r("jobs")),onRefresh:l[5]||(l[5]=c=>r("refresh")),onShare:l[6]||(l[6]=c=>r("share")),Peer:i.Peer,ref_key:"target",ref:o},null,8,["Peer"])):W("",!0)]),_:1})])]))}},wu=Kt(Su,[["__scopeId","data-v-1bcea9a9"]]),ku={class:"fixed-bottom w-100 bottom-0 z-2",style:{"z-index":"1"}},Pu={class:"container-fluid"},Mu={class:"row g-0"},Cu={class:"col-md-9 col-lg-10 d-flex justify-content-center py-2"},Du={class:"rounded-3 p-2 border shadow searchPeersContainer bg-body-tertiary"},Ou={class:"d-flex gap-1 align-items-center px-2"},Tu=["placeholder"],Au={__name:"peerSearchBar",emits:["close"],setup(i,{emit:t}){const e=In(()=>ft("Search Peers..."));let s;const n=Ut(""),o=Wi(),r=()=>{s?(clearTimeout(s),s=setTimeout(()=>{o.searchString=n.value},300)):s=setTimeout(()=>{o.searchString=n.value},300)},a=t,l=En("searchBar");return Ln(()=>{l.value.focus()}),(c,h)=>(D(),E("div",ku,[g("div",Pu,[g("div",Mu,[h[5]||(h[5]=g("div",{class:"col-md-3 col-lg-2"},null,-1)),g("div",Cu,[g("div",Du,[g("div",Ou,[h[4]||(h[4]=g("h6",{class:"mb-0 me-2"},[g("label",{for:"searchPeers"},[g("i",{class:"bi bi-search"})])],-1)),Fn(g("input",{ref:"searchBar",class:"form-control rounded-3 bg-secondary-subtle border-1 border-secondary-subtle",placeholder:e.value,id:"searchPeers",onKeyup:h[0]||(h[0]=d=>r()),"onUpdate:modelValue":h[1]||(h[1]=d=>n.value=d)},null,40,Tu),[[Qo,n.value]]),g("button",{onClick:h[2]||(h[2]=d=>a("close")),class:"btn btn-secondary rounded-3 d-flex align-items-center"},[h[3]||(h[3]=g("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),C(oe,{t:"Hide"})])])])])])])]))}},Lu=Kt(Au,[["__scopeId","data-v-8de5d984"]]),Ru={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Iu={class:"container d-flex h-100 w-100"},Eu={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},Fu={class:"card rounded-3 shadow flex-grow-1",id:"deleteConfigurationContainer"},Bu={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},zu={class:"mb-0"},$u={__name:"editRawConfigurationFile",emits:["close"],setup(i,{emit:t}){const e=t;return(s,n)=>(D(),E("div",Ru,[g("div",Iu,[g("div",Eu,[g("div",Fu,[g("div",Bu,[g("h5",zu,[C(oe,{t:"Are you sure to delete this configuration?"})]),g("button",{type:"button",class:"btn-close ms-auto",onClick:n[0]||(n[0]=o=>e("close"))})]),n[1]||(n[1]=g("div",{class:"card-body px-4 text-muted"},null,-1))])])])]))}};ci.register(Vh,Jh,po,mo,xd,id,nd,ud,md,jh);const Hu={name:"peerList",components:{EditRawConfigurationFile:$u,ProtocolBadge:tr,PeerSearchBar:Lu,PeerRow:wu,DeleteConfiguration:ot(()=>rt(()=>import("./deleteConfiguration-BGwI_EOV.js"),__vite__mapDeps([0,1,2,3]))),ConfigurationBackupRestore:ot(()=>rt(()=>import("./configurationBackupRestore-pXsKPuSV.js"),__vite__mapDeps([4,1,2,5,3,6]))),SelectPeers:ot(()=>rt(()=>import("./selectPeers-D031tDhJ.js"),__vite__mapDeps([7,1,2,3,8]))),EditConfiguration:ot(()=>rt(()=>import("./editConfiguration-Cx7Z78WG.js"),__vite__mapDeps([9,1,2,3,10]))),LocaleText:oe,PeerShareLinkModal:ot(()=>rt(()=>import("./peerShareLinkModal-ClLD06RJ.js"),__vite__mapDeps([11,1,2,5,12,3]))),PeerJobsLogsModal:ot(()=>rt(()=>import("./peerJobsLogsModal-ChTwBii5.js"),__vite__mapDeps([13,5,1,2,3]))),PeerJobsAllModal:ot(()=>rt(()=>import("./peerJobsAllModal-CqOOb5H8.js"),__vite__mapDeps([14,15,1,2,12,5,3,16]))),PeerJobs:ot(()=>rt(()=>import("./peerJobs-Btaxqu4M.js"),__vite__mapDeps([17,15,1,2,12,5,3,16,18]))),PeerCreate:ot(()=>rt(()=>import("./peerCreate-FC1rN8TR.js"),__vite__mapDeps([19,1,2,3,20]))),PeerQRCode:ot(()=>rt(()=>import("./peerQRCode-C78lqRw3.js"),__vite__mapDeps([21,22,3,1,2]))),PeerConfigurationFile:ot(()=>rt(()=>import("./peerConfigurationFile-yoEwyygD.js"),__vite__mapDeps([23,1,2,3,24]))),PeerSettings:ot(()=>rt(()=>import("./peerSettings-DJI9OWL8.js"),__vite__mapDeps([25,1,2,3,26]))),PeerSearch:xr,Peer:la,Line:Ad,Bar:Td},setup(){const i=Ni(),t=Wi(),e=Ut(void 0);return{dashboardConfigurationStore:i,wireguardConfigurationStore:t,interval:e}},data(){return{configurationToggling:!1,loading:!1,error:null,configurationInfo:[],configurationPeers:[],historyDataSentDifference:[],historyDataReceivedDifference:[],historySentData:{labels:[],datasets:[{label:"Data Sent",data:[],fill:!1,borderColor:"#198754",tension:0}]},historyReceiveData:{labels:[],datasets:[{label:"Data Received",data:[],fill:!1,borderColor:"#0d6efd",tension:0}]},peerSetting:{modalOpen:!1,selectedPeer:void 0},peerScheduleJobs:{modalOpen:!1,selectedPeer:void 0},peerQRCode:{modalOpen:!1,peerConfigData:void 0},peerConfigurationFile:{modalOpen:!1,peerConfigData:void 0},peerCreate:{modalOpen:!1},peerScheduleJobsAll:{modalOpen:!1},peerScheduleJobsLogs:{modalOpen:!1},peerShare:{modalOpen:!1,selectedPeer:void 0},editConfiguration:{modalOpen:!1},selectPeers:{modalOpen:!1},backupRestore:{modalOpen:!1},deleteConfiguration:{modalOpen:!1},editRawConfigurationFile:{modalOpen:!1},peerSearchBarShow:!1,searchStringTimeout:void 0,searchString:""}},mounted(){},watch:{$route:{immediate:!0,handler(){clearInterval(this.dashboardConfigurationStore.Peers.RefreshInterval),this.loading=!0;let i=this.$route.params.id;this.configurationInfo=[],this.configurationPeers=[],i&&(this.getPeers(i),this.setPeerInterval())}},"dashboardConfigurationStore.Configuration.Server.dashboard_refresh_interval"(){clearInterval(this.dashboardConfigurationStore.Peers.RefreshInterval),this.setPeerInterval()}},beforeRouteLeave(){clearInterval(this.dashboardConfigurationStore.Peers.RefreshInterval)},methods:{toggle(){this.configurationToggling=!0,ke("/api/toggleWireguardConfiguration/",{configurationName:this.configurationInfo.Name},i=>{i.status?this.dashboardConfigurationStore.newMessage("Server",`${this.configurationInfo.Name} ${i.data?"is on":"is off"}`,"success"):this.dashboardConfigurationStore.newMessage("Server",i.message,"danger"),this.configurationInfo.Status=i.data,this.configurationToggling=!1})},getPeers(i=this.$route.params.id){ke("/api/getWireguardConfigurationInfo",{configurationName:i},t=>{if(this.configurationInfo=t.data.configurationInfo,this.configurationPeers=t.data.configurationPeers,this.configurationPeers.forEach(e=>{e.restricted=!1}),t.data.configurationRestrictedPeers.forEach(e=>{e.restricted=!0,this.configurationPeers.push(e)}),this.loading=!1,this.configurationPeers.length>0){const e=this.configurationPeers.map(n=>n.total_sent+n.cumu_sent).reduce((n,o)=>n+o).toFixed(4),s=this.configurationPeers.map(n=>n.total_receive+n.cumu_receive).reduce((n,o)=>n+o).toFixed(4);this.historyDataSentDifference[this.historyDataSentDifference.length-1]!==e&&(this.historyDataSentDifference.length>0&&(this.historySentData={labels:[...this.historySentData.labels,rs().format("HH:mm:ss A")],datasets:[{label:"Data Sent",data:[...this.historySentData.datasets[0].data,((e-this.historyDataSentDifference[this.historyDataSentDifference.length-1])*1e3).toFixed(4)],fill:!1,borderColor:"#198754",tension:0}]}),this.historyDataSentDifference.push(e)),this.historyDataReceivedDifference[this.historyDataReceivedDifference.length-1]!==s&&(this.historyDataReceivedDifference.length>0&&(this.historyReceiveData={labels:[...this.historyReceiveData.labels,rs().format("HH:mm:ss A")],datasets:[{label:"Data Received",data:[...this.historyReceiveData.datasets[0].data,((s-this.historyDataReceivedDifference[this.historyDataReceivedDifference.length-1])*1e3).toFixed(4)],fill:!1,borderColor:"#0d6efd",tension:0}]}),this.historyDataReceivedDifference.push(s))}})},setPeerInterval(){this.dashboardConfigurationStore.Peers.RefreshInterval=setInterval(()=>{this.getPeers()},parseInt(this.dashboardConfigurationStore.Configuration.Server.dashboard_refresh_interval))}},computed:{configurationSummary(){return{connectedPeers:this.configurationPeers.filter(i=>i.status==="running").length,totalUsage:this.configurationPeers.length>0?this.configurationPeers.filter(i=>!i.restricted).map(i=>i.total_data+i.cumu_data).reduce((i,t)=>i+t,0).toFixed(4):0,totalReceive:this.configurationPeers.length>0?this.configurationPeers.filter(i=>!i.restricted).map(i=>i.total_receive+i.cumu_receive).reduce((i,t)=>i+t,0).toFixed(4):0,totalSent:this.configurationPeers.length>0?this.configurationPeers.filter(i=>!i.restricted).map(i=>i.total_sent+i.cumu_sent).reduce((i,t)=>i+t,0).toFixed(4):0}},receiveData(){return this.historyReceiveData},sentData(){return this.historySentData},individualDataUsage(){return{labels:this.configurationPeers.map(i=>i.name?i.name:`Untitled Peer - ${i.id}`),datasets:[{label:"Total Data Usage",data:this.configurationPeers.map(i=>i.cumu_data+i.total_data),backgroundColor:this.configurationPeers.map(i=>"#0dcaf0"),tooltip:{callbacks:{label:i=>`${i.formattedValue} GB`}}}]}},individualDataUsageChartOption(){return{responsive:!0,plugins:{legend:{display:!1}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(i,t)=>`${i} GB`},grid:{display:!1}}}}},chartOptions(){return{responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{label:i=>`${i.formattedValue} MB/s`}}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(i,t)=>`${i} MB/s`},grid:{display:!1}}}}},searchPeers(){new ae(this.configurationPeers,{keys:["name","id","allowed_ip"]});const i=this.wireguardConfigurationStore.searchString?this.configurationPeers.filter(t=>t.name.includes(this.wireguardConfigurationStore.searchString)||t.id.includes(this.wireguardConfigurationStore.searchString)||t.allowed_ip.includes(this.wireguardConfigurationStore.searchString)):this.configurationPeers;return this.dashboardConfigurationStore.Configuration.Server.dashboard_sort==="restricted"?i.slice().sort((t,e)=>t[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]e[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]?-1:0):i.slice().sort((t,e)=>t[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]e[this.dashboardConfigurationStore.Configuration.Server.dashboard_sort]?1:0)}}},Nu={key:0,class:"container-md"},Wu={class:"d-flex align-items-sm-center flex-column flex-sm-row gap-3"},Vu={class:"text-muted d-flex align-items-center gap-2"},ju={class:"mb-0"},Uu={class:"d-flex align-items-center gap-3"},Yu={class:"mb-0 display-4"},Ku={class:"ms-sm-auto d-flex gap-2 flex-column"},Xu={class:"card rounded-3 bg-transparent"},Gu={class:"card-body py-2 d-flex align-items-center"},Ju={class:"text-muted"},Qu={class:"form-check form-switch mb-0 ms-auto pe-0 me-0"},qu=["for"],Zu={key:2,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},tf=["disabled","id"],ef={class:"d-flex gap-2"},sf={class:"row mt-3 gy-2 gx-2 mb-2"},nf={class:"col-12 col-lg-3"},of={class:"card rounded-3 bg-transparent h-100"},rf={class:"card-body py-2 d-flex flex-column justify-content-center"},af={class:"mb-0 text-muted"},lf={class:"col-12 col-lg-3"},cf={class:"card rounded-3 bg-transparent h-100"},hf={class:"card-body py-2 d-flex flex-column justify-content-center"},df={class:"mb-0 text-muted"},uf={style:{"word-break":"break-all"},class:"col-12 col-lg-6"},ff={class:"card rounded-3 bg-transparent h-100"},gf={class:"card-body py-2 d-flex flex-column justify-content-center"},pf={class:"mb-0 text-muted"},mf={class:"row gx-2 gy-2 mb-2"},bf={class:"col-12 col-lg-3"},_f={class:"card rounded-3 bg-transparent h-100"},xf={class:"card-body d-flex"},yf={class:"mb-0 text-muted"},vf={class:"h4"},Sf={class:"col-12 col-lg-3"},wf={class:"card rounded-3 bg-transparent h-100"},kf={class:"card-body d-flex"},Pf={class:"mb-0 text-muted"},Mf={class:"h4"},Cf={class:"col-12 col-lg-3"},Df={class:"card rounded-3 bg-transparent h-100"},Of={class:"card-body d-flex"},Tf={class:"mb-0 text-muted"},Af={class:"h4 text-primary"},Lf={class:"col-12 col-lg-3"},Rf={class:"card rounded-3 bg-transparent h-100"},If={class:"card-body d-flex"},Ef={class:"mb-0 text-muted"},Ff={class:"h4 text-success"},Bf={class:"row gx-2 gy-2 mb-3"},zf={class:"col-12 col-lg-6"},$f={class:"card rounded-3 bg-transparent",style:{height:"270px"}},Hf={class:"card-header bg-transparent border-0"},Nf={class:"text-muted"},Wf={class:"card-body pt-1"},Vf={class:"col-sm col-lg-3"},jf={class:"card rounded-3 bg-transparent",style:{height:"270px"}},Uf={class:"card-header bg-transparent border-0"},Yf={class:"text-muted"},Kf={class:"card-body pt-1"},Xf={class:"col-sm col-lg-3"},Gf={class:"card rounded-3 bg-transparent",style:{height:"270px"}},Jf={class:"card-header bg-transparent border-0"},Qf={class:"text-muted"},qf={class:"card-body pt-1"},Zf={style:{"margin-bottom":"80px"}};function tg(i,t,e,s,n,o){const r=H("ProtocolBadge"),a=H("LocaleText"),l=H("RouterLink"),c=H("Bar"),h=H("Line"),d=H("PeerSearch"),u=H("Peer"),f=H("PeerSearchBar"),p=H("PeerSettings"),m=H("PeerQRCode"),b=H("PeerJobs"),_=H("PeerJobsAllModal"),x=H("PeerJobsLogsModal"),v=H("PeerShareLinkModal"),P=H("EditConfiguration"),y=H("SelectPeers"),M=H("DeleteConfiguration"),w=H("EditRawConfigurationFile"),k=H("ConfigurationBackupRestore"),O=H("PeerConfigurationFile");return this.loading?W("",!0):(D(),E("div",Nu,[g("div",Wu,[g("div",null,[g("div",Vu,[g("h5",ju,[C(r,{protocol:this.configurationInfo.Protocol},null,8,["protocol"])])]),g("div",Uu,[g("h1",Yu,[g("samp",null,B(this.configurationInfo.Name),1)])])]),g("div",Ku,[g("div",Xu,[g("div",Gu,[g("small",Ju,[C(a,{t:"Status"})]),g("div",{class:Ct(["dot ms-2",{active:this.configurationInfo.Status}])},null,2),g("div",Qu,[g("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+this.configurationInfo.id},[this.configurationInfo.Status&&!this.configurationToggling?(D(),V(a,{key:0,t:"On"})):!this.configurationInfo.Status&&!this.configurationToggling?(D(),V(a,{key:1,t:"Off"})):W("",!0),this.configurationToggling?(D(),E("span",Zu)):W("",!0)],8,qu),Fn(g("input",{class:"form-check-input",style:{cursor:"pointer"},disabled:this.configurationToggling,type:"checkbox",role:"switch",id:"switch"+this.configurationInfo.id,onChange:t[0]||(t[0]=S=>this.toggle()),"onUpdate:modelValue":t[1]||(t[1]=S=>this.configurationInfo.Status=S)},null,40,tf),[[qo,this.configurationInfo.Status]])])])]),g("div",ef,[C(l,{to:"create",class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle"},{default:X(()=>[t[37]||(t[37]=g("i",{class:"bi bi-plus-lg me-2"},null,-1)),C(a,{t:"Peer"})]),_:1}),g("button",{class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[2]||(t[2]=S=>n.editConfiguration.modalOpen=!0),type:"button","aria-expanded":"false"},[t[38]||(t[38]=g("i",{class:"bi bi-gear-fill me-2"},null,-1)),C(a,{t:"Configuration Settings"})])])])]),t[43]||(t[43]=g("hr",null,null,-1)),g("div",sf,[g("div",nf,[g("div",of,[g("div",rf,[g("p",af,[g("small",null,[C(a,{t:"Address"})])]),Dt(" "+B(this.configurationInfo.Address),1)])])]),g("div",lf,[g("div",cf,[g("div",hf,[g("p",df,[g("small",null,[C(a,{t:"Listen Port"})])]),Dt(" "+B(this.configurationInfo.ListenPort),1)])])]),g("div",uf,[g("div",ff,[g("div",gf,[g("p",pf,[g("small",null,[C(a,{t:"Public Key"})])]),g("samp",null,B(this.configurationInfo.PublicKey),1)])])])]),g("div",mf,[g("div",bf,[g("div",_f,[g("div",xf,[g("div",null,[g("p",yf,[g("small",null,[C(a,{t:"Connected Peers"})])]),g("strong",vf,B(o.configurationSummary.connectedPeers)+" / "+B(n.configurationPeers.length),1)]),t[39]||(t[39]=g("i",{class:"bi bi-ethernet ms-auto h2 text-muted"},null,-1))])])]),g("div",Sf,[g("div",wf,[g("div",kf,[g("div",null,[g("p",Pf,[g("small",null,[C(a,{t:"Total Usage"})])]),g("strong",Mf,B(o.configurationSummary.totalUsage)+" GB",1)]),t[40]||(t[40]=g("i",{class:"bi bi-arrow-down-up ms-auto h2 text-muted"},null,-1))])])]),g("div",Cf,[g("div",Df,[g("div",Of,[g("div",null,[g("p",Tf,[g("small",null,[C(a,{t:"Total Received"})])]),g("strong",Af,B(o.configurationSummary.totalReceive)+" GB",1)]),t[41]||(t[41]=g("i",{class:"bi bi-arrow-down ms-auto h2 text-muted"},null,-1))])])]),g("div",Lf,[g("div",Rf,[g("div",If,[g("div",null,[g("p",Ef,[g("small",null,[C(a,{t:"Total Sent"})])]),g("strong",Ff,B(o.configurationSummary.totalSent)+" GB",1)]),t[42]||(t[42]=g("i",{class:"bi bi-arrow-up ms-auto h2 text-muted"},null,-1))])])])]),g("div",Bf,[g("div",zf,[g("div",$f,[g("div",Hf,[g("small",Nf,[C(a,{t:"Peers Data Usage"})])]),g("div",Wf,[C(c,{data:o.individualDataUsage,options:o.individualDataUsageChartOption,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["data","options"])])])]),g("div",Vf,[g("div",jf,[g("div",Uf,[g("small",Yf,[C(a,{t:"Real Time Received Data Usage"})])]),g("div",Kf,[C(h,{options:o.chartOptions,data:o.receiveData,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])]),g("div",Xf,[g("div",Gf,[g("div",Jf,[g("small",Qf,[C(a,{t:"Real Time Sent Data Usage"})])]),g("div",qf,[C(h,{options:o.chartOptions,data:o.sentData,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])])]),t[44]||(t[44]=g("hr",null,null,-1)),g("div",Zf,[C(d,{onSearch:t[3]||(t[3]=S=>this.peerSearchBarShow=!0),onJobsAll:t[4]||(t[4]=S=>this.peerScheduleJobsAll.modalOpen=!0),onJobLogs:t[5]||(t[5]=S=>this.peerScheduleJobsLogs.modalOpen=!0),onEditConfiguration:t[6]||(t[6]=S=>this.editConfiguration.modalOpen=!0),onSelectPeers:t[7]||(t[7]=S=>this.selectPeers.modalOpen=!0),onBackupRestore:t[8]||(t[8]=S=>this.backupRestore.modalOpen=!0),onDeleteConfiguration:t[9]||(t[9]=S=>this.deleteConfiguration.modalOpen=!0),configuration:this.configurationInfo},null,8,["configuration"]),C(Zo,{name:"list",tag:"div",class:"row gx-2 gy-2 z-0"},{default:X(()=>[(D(!0),E(Zt,null,ki(this.searchPeers,S=>(D(),E("div",{class:"col-12 col-lg-6 col-xl-4",key:S.id},[C(u,{Peer:S,onShare:T=>{this.peerShare.selectedPeer=S.id,this.peerShare.modalOpen=!0},onRefresh:t[10]||(t[10]=T=>this.getPeers()),onJobs:T=>{n.peerScheduleJobs.modalOpen=!0,n.peerScheduleJobs.selectedPeer=this.configurationPeers.find(L=>L.id===S.id)},onSetting:T=>{n.peerSetting.modalOpen=!0,n.peerSetting.selectedPeer=this.configurationPeers.find(L=>L.id===S.id)},onQrcode:t[11]||(t[11]=T=>{this.peerQRCode.peerConfigData=T,this.peerQRCode.modalOpen=!0}),onConfigurationFile:t[12]||(t[12]=T=>{this.peerConfigurationFile.peerConfigData=T,this.peerConfigurationFile.modalOpen=!0})},null,8,["Peer","onShare","onJobs","onSetting"])]))),128))]),_:1})]),C(J,{name:"slideUp"},{default:X(()=>[this.peerSearchBarShow?(D(),V(f,{key:0,onClose:t[13]||(t[13]=S=>n.peerSearchBarShow=!1)})):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.peerSetting.modalOpen?(D(),V(p,{key:"settings",selectedPeer:this.peerSetting.selectedPeer,onRefresh:t[14]||(t[14]=S=>this.getPeers()),onClose:t[15]||(t[15]=S=>this.peerSetting.modalOpen=!1)},null,8,["selectedPeer"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[n.peerQRCode.modalOpen?(D(),V(m,{peerConfigData:this.peerQRCode.peerConfigData,key:"qrcode",onClose:t[16]||(t[16]=S=>this.peerQRCode.modalOpen=!1)},null,8,["peerConfigData"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.peerScheduleJobs.modalOpen?(D(),V(b,{key:0,onRefresh:t[17]||(t[17]=S=>this.getPeers()),selectedPeer:this.peerScheduleJobs.selectedPeer,onClose:t[18]||(t[18]=S=>this.peerScheduleJobs.modalOpen=!1)},null,8,["selectedPeer"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.peerScheduleJobsAll.modalOpen?(D(),V(_,{key:0,onRefresh:t[19]||(t[19]=S=>this.getPeers()),onAllLogs:t[20]||(t[20]=S=>n.peerScheduleJobsLogs.modalOpen=!0),onClose:t[21]||(t[21]=S=>this.peerScheduleJobsAll.modalOpen=!1),configurationPeers:this.configurationPeers},null,8,["configurationPeers"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.peerScheduleJobsLogs.modalOpen?(D(),V(x,{key:0,onClose:t[22]||(t[22]=S=>this.peerScheduleJobsLogs.modalOpen=!1),configurationInfo:this.configurationInfo},null,8,["configurationInfo"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.peerShare.modalOpen?(D(),V(v,{key:0,onClose:t[23]||(t[23]=S=>{this.peerShare.modalOpen=!1,this.peerShare.selectedPeer=void 0}),peer:this.configurationPeers.find(S=>S.id===this.peerShare.selectedPeer)},null,8,["peer"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.editConfiguration.modalOpen?(D(),V(P,{key:0,onEditRaw:t[24]||(t[24]=S=>this.editRawConfigurationFile.modalOpen=!0),onClose:t[25]||(t[25]=S=>this.editConfiguration.modalOpen=!1),onDataChanged:t[26]||(t[26]=S=>this.configurationInfo=S),onBackupRestore:t[27]||(t[27]=S=>this.backupRestore.modalOpen=!0),onDeleteConfiguration:t[28]||(t[28]=S=>this.deleteConfiguration.modalOpen=!0),configurationInfo:this.configurationInfo},null,8,["configurationInfo"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[this.selectPeers.modalOpen?(D(),V(y,{key:0,onRefresh:t[29]||(t[29]=S=>this.getPeers()),configurationPeers:this.configurationPeers,onClose:t[30]||(t[30]=S=>this.selectPeers.modalOpen=!1)},null,8,["configurationPeers"])):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[n.deleteConfiguration.modalOpen?(D(),V(M,{key:0,onBackup:t[31]||(t[31]=S=>n.backupRestore.modalOpen=!0),onClose:t[32]||(t[32]=S=>n.deleteConfiguration.modalOpen=!1)})):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[n.editRawConfigurationFile.modalOpen?(D(),V(w,{key:0,onClose:t[33]||(t[33]=S=>n.editRawConfigurationFile.modalOpen=!1)})):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[n.backupRestore.modalOpen?(D(),V(k,{key:0,onClose:t[34]||(t[34]=S=>n.backupRestore.modalOpen=!1),onRefreshPeersList:t[35]||(t[35]=S=>this.getPeers())})):W("",!0)]),_:1}),C(J,{name:"zoom"},{default:X(()=>[n.peerConfigurationFile.modalOpen?(D(),V(O,{key:0,onClose:t[36]||(t[36]=S=>n.peerConfigurationFile.modalOpen=!1),configurationFile:n.peerConfigurationFile.peerConfigData},null,8,["configurationFile"])):W("",!0)]),_:1})]))}const lg=Kt(Hu,[["render",tg],["__scopeId","data-v-3b004161"]]);export{lg as default};