goose 0.19.1

A load testing framework inspired by Locust.
Documentation
"use strict";(()=>{var fh=Object.defineProperty;var ph=(e,t,n)=>t in e?fh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t,n)=>ph(e,typeof t!="symbol"?t+"":t,n);function Tn(e){return e+.5|0}var Jt=(e,t,n)=>Math.max(Math.min(e,n),t);function Sn(e){return Jt(Tn(e*2.55),0,255)}function Zt(e){return Jt(Tn(e*255),0,255)}function Ht(e){return Jt(Tn(e/2.55)/100,0,1)}function Wr(e){return Jt(Tn(e*100),0,100)}var mt={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},Di=[..."0123456789ABCDEF"],mh=e=>Di[e&15],gh=e=>Di[(e&240)>>4]+Di[e&15],bs=e=>(e&240)>>4===(e&15),bh=e=>bs(e.r)&&bs(e.g)&&bs(e.b)&&bs(e.a);function _h(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&mt[e[1]]*17,g:255&mt[e[2]]*17,b:255&mt[e[3]]*17,a:t===5?mt[e[4]]*17:255}:(t===7||t===9)&&(n={r:mt[e[1]]<<4|mt[e[2]],g:mt[e[3]]<<4|mt[e[4]],b:mt[e[5]]<<4|mt[e[6]],a:t===9?mt[e[7]]<<4|mt[e[8]]:255})),n}var xh=(e,t)=>e<255?t(e):"";function yh(e){var t=bh(e)?mh:gh;return e?"#"+t(e.r)+t(e.g)+t(e.b)+xh(e.a,t):void 0}var vh=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Yr(e,t,n){let s=t*Math.min(n,1-n),i=(o,r=(o+e/30)%12)=>n-s*Math.max(Math.min(r-3,9-r,1),-1);return[i(0),i(8),i(4)]}function wh(e,t,n){let s=(i,o=(i+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function kh(e,t,n){let s=Yr(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)s[i]*=1-t-n,s[i]+=t;return s}function Sh(e,t,n,s,i){return e===i?(t-n)/s+(t<n?6:0):t===i?(n-e)/s+2:(e-t)/s+4}function Oi(e){let n=e.r/255,s=e.g/255,i=e.b/255,o=Math.max(n,s,i),r=Math.min(n,s,i),a=(o+r)/2,l,c,u;return o!==r&&(u=o-r,c=a>.5?u/(2-o-r):u/(o+r),l=Sh(n,s,i,u,o),l=l*60+.5),[l|0,c||0,a]}function Hi(e,t,n,s){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,s)).map(Zt)}function Ii(e,t,n){return Hi(Yr,e,t,n)}function Mh(e,t,n){return Hi(kh,e,t,n)}function Th(e,t,n){return Hi(wh,e,t,n)}function $r(e){return(e%360+360)%360}function Ch(e){let t=vh.exec(e),n=255,s;if(!t)return;t[5]!==s&&(n=t[6]?Sn(+t[5]):Zt(+t[5]));let i=$r(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Mh(i,o,r):t[1]==="hsv"?s=Th(i,o,r):s=Ii(i,o,r),{r:s[0],g:s[1],b:s[2],a:n}}function Eh(e,t){var n=Oi(e);n[0]=$r(n[0]+t),n=Ii(n),e.r=n[0],e.g=n[1],e.b=n[2]}function Lh(e){if(!e)return;let t=Oi(e),n=t[0],s=Wr(t[1]),i=Wr(t[2]);return e.a<255?`hsla(${n}, ${s}%, ${i}%, ${Ht(e.a)})`:`hsl(${n}, ${s}%, ${i}%)`}var jr={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"},Ur={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 Ph(){let e={},t=Object.keys(Ur),n=Object.keys(jr),s,i,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],i=0;i<n.length;i++)o=n[i],a=a.replace(o,jr[o]);o=parseInt(Ur[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}var _s;function Rh(e){_s||(_s=Ph(),_s.transparent=[0,0,0,0]);let t=_s[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var Ah=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Dh(e){let t=Ah.exec(e),n=255,s,i,o;if(t){if(t[7]!==s){let r=+t[7];n=t[8]?Sn(r):Jt(r*255,0,255)}return s=+t[1],i=+t[3],o=+t[5],s=255&(t[2]?Sn(s):Jt(s,0,255)),i=255&(t[4]?Sn(i):Jt(i,0,255)),o=255&(t[6]?Sn(o):Jt(o,0,255)),{r:s,g:i,b:o,a:n}}}function Oh(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Ht(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var Ai=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Ke=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Hh(e,t,n){let s=Ke(Ht(e.r)),i=Ke(Ht(e.g)),o=Ke(Ht(e.b));return{r:Zt(Ai(s+n*(Ke(Ht(t.r))-s))),g:Zt(Ai(i+n*(Ke(Ht(t.g))-i))),b:Zt(Ai(o+n*(Ke(Ht(t.b))-o))),a:e.a+n*(t.a-e.a)}}function xs(e,t,n){if(e){let s=Oi(e);s[t]=Math.max(0,Math.min(s[t]+s[t]*n,t===0?360:1)),s=Ii(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function Kr(e,t){return e&&Object.assign(t||{},e)}function qr(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Zt(e[3]))):(t=Kr(e,{r:0,g:0,b:0,a:1}),t.a=Zt(t.a)),t}function Ih(e){return e.charAt(0)==="r"?Dh(e):Ch(e)}var Mn=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,s;n==="object"?s=qr(t):n==="string"&&(s=_h(t)||Rh(t)||Ih(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Kr(this._rgb);return t&&(t.a=Ht(t.a)),t}set rgb(t){this._rgb=qr(t)}rgbString(){return this._valid?Oh(this._rgb):void 0}hexString(){return this._valid?yh(this._rgb):void 0}hslString(){return this._valid?Lh(this._rgb):void 0}mix(t,n){if(t){let s=this.rgb,i=t.rgb,o,r=n===o?.5:n,a=2*r-1,l=s.a-i.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*i.r+.5,s.g=255&c*s.g+o*i.g+.5,s.b=255&c*s.b+o*i.b+.5,s.a=r*s.a+(1-r)*i.a,this.rgb=s}return this}interpolate(t,n){return t&&(this._rgb=Hh(this._rgb,t._rgb,n)),this}clone(){return new e(this.rgb)}alpha(t){return this._rgb.a=Zt(t),this}clearer(t){let n=this._rgb;return n.a*=1-t,this}greyscale(){let t=this._rgb,n=Tn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){let n=this._rgb;return n.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return xs(this._rgb,2,t),this}darken(t){return xs(this._rgb,2,-t),this}saturate(t){return xs(this._rgb,1,t),this}desaturate(t){return xs(this._rgb,1,-t),this}rotate(t){return Eh(this._rgb,t),this}};function St(){}var oa=(()=>{let e=0;return()=>e++})();function W(e){return e==null}function U(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function H(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function $(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function ct(e,t){return $(e)?e:t}function D(e,t){return typeof e=="undefined"?t:e}var ra=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function z(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function B(e,t,n,s){let i,o,r;if(U(e))if(o=e.length,s)for(i=o-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;i<o;i++)t.call(n,e[i],i);else if(H(e))for(r=Object.keys(e),o=r.length,i=0;i<o;i++)t.call(n,e[r[i]],r[i])}function Ln(e,t){let n,s,i,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,s=e.length;n<s;++n)if(i=e[n],o=t[n],i.datasetIndex!==o.datasetIndex||i.index!==o.index)return!1;return!0}function ks(e){if(U(e))return e.map(ks);if(H(e)){let t=Object.create(null),n=Object.keys(e),s=n.length,i=0;for(;i<s;++i)t[n[i]]=ks(e[n[i]]);return t}return e}function aa(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Fh(e,t,n,s){if(!aa(e))return;let i=t[e],o=n[e];H(i)&&H(o)?Ge(i,o,s):t[e]=ks(o)}function Ge(e,t,n){let s=U(t)?t:[t],i=s.length;if(!H(e))return e;n=n||{};let o=n.merger||Fh,r;for(let a=0;a<i;++a){if(r=s[a],!H(r))continue;let l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function Ze(e,t){return Ge(e,t,{merger:Bh})}function Bh(e,t,n){if(!aa(e))return;let s=t[e],i=n[e];H(s)&&H(i)?Ze(s,i):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=ks(i))}var Xr={"":e=>e,x:e=>e.x,y:e=>e.y};function Nh(e){let t=e.split("."),n=[],s="";for(let i of t)s+=i,s.endsWith("\\")?s=s.slice(0,-1)+".":(n.push(s),s="");return n}function zh(e){let t=Nh(e);return n=>{for(let s of t){if(s==="")break;n=n&&n[s]}return n}}function Pn(e,t){return(Xr[t]||(Xr[t]=zh(t)))(e)}function Cs(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Rn=e=>typeof e!="undefined",It=e=>typeof e=="function",zi=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function la(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}var G=Math.PI,lt=2*G,Vh=lt+G,Ss=Number.POSITIVE_INFINITY,Wh=G/180,at=G/2,ke=G/4,Gr=G*2/3,Ft=Math.log10,Me=Math.sign;function Qe(e,t,n){return Math.abs(e-t)<n}function Vi(e){let t=Math.round(e);e=Qe(e,t,e/1e3)?t:e;let n=Math.pow(10,Math.floor(Ft(e))),s=e/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function ca(e){let t=[],n=Math.sqrt(e),s;for(s=1;s<n;s++)e%s===0&&(t.push(s),t.push(e/s));return n===(n|0)&&t.push(n),t.sort((i,o)=>i-o).pop(),t}function tn(e){return!isNaN(parseFloat(e))&&isFinite(e)}function ua(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function Wi(e,t,n){let s,i,o;for(s=0,i=e.length;s<i;s++)o=e[s][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Bt(e){return e*(G/180)}function Es(e){return e*(180/G)}function ji(e){if(!$(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function ha(e,t){let n=t.x-e.x,s=t.y-e.y,i=Math.sqrt(n*n+s*s),o=Math.atan2(s,n);return o<-.5*G&&(o+=lt),{angle:o,distance:i}}function Ms(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function jh(e,t){return(e-t+Vh)%lt-G}function rt(e){return(e%lt+lt)%lt}function Ui(e,t,n,s){let i=rt(e),o=rt(t),r=rt(n),a=rt(o-i),l=rt(r-i),c=rt(i-o),u=rt(i-r);return i===o||i===r||s&&o===r||a>l&&c<u}function pt(e,t,n){return Math.max(t,Math.min(n,e))}function da(e){return pt(e,-32768,32767)}function Ce(e,t,n,s=1e-6){return e>=Math.min(t,n)-s&&e<=Math.max(t,n)+s}function Ls(e,t,n){n=n||(r=>e[r]<t);let s=e.length-1,i=0,o;for(;s-i>1;)o=i+s>>1,n(o)?i=o:s=o;return{lo:i,hi:s}}var te=(e,t,n,s)=>Ls(e,n,s?i=>{let o=e[i][t];return o<n||o===n&&e[i+1][t]===n}:i=>e[i][t]<n),fa=(e,t,n)=>Ls(e,n,s=>e[s][t]>=n);function pa(e,t,n){let s=0,i=e.length;for(;s<i&&e[s]<t;)s++;for(;i>s&&e[i-1]>n;)i--;return s>0||i<e.length?e.slice(s,i):e}var ma=["push","pop","shift","splice","unshift"];function ga(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),ma.forEach(n=>{let s="_onData"+Cs(n),i=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){let r=i.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function qi(e,t){let n=e._chartjs;if(!n)return;let s=n.listeners,i=s.indexOf(t);i!==-1&&s.splice(i,1),!(s.length>0)&&(ma.forEach(o=>{delete e[o]}),delete e._chartjs)}function ba(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var Yi=(function(){return typeof window=="undefined"?function(e){return e()}:window.requestAnimationFrame})();function $i(e,t){let n=[],s=!1;return function(...i){n=i,s||(s=!0,Yi.call(window,()=>{s=!1,e.apply(t,n)}))}}function _a(e,t){let n;return function(...s){return t?(clearTimeout(n),n=setTimeout(e,t,s)):e.apply(this,s),t}}var Ki=e=>e==="start"?"left":e==="end"?"right":"center",ut=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,xa=(e,t,n,s)=>e===(s?"left":"right")?n:e==="center"?(t+n)/2:t;function ya(e,t,n){let s=t.length,i=0,o=s;if(e._sorted){let{iScale:r,_parsed:a}=e,l=r.axis,{min:c,max:u,minDefined:h,maxDefined:d}=r.getUserBounds();h&&(i=pt(Math.min(te(a,l,c).lo,n?s:te(t,l,r.getPixelForValue(c)).lo),0,s-1)),d?o=pt(Math.max(te(a,r.axis,u,!0).hi+1,n?0:te(t,l,r.getPixelForValue(u),!0).hi+1),i,s)-i:o=s-i}return{start:i,count:o}}function va(e){let{xScale:t,yScale:n,_scaleRanges:s}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!s)return e._scaleRanges=i,!0;let o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==n.min||s.ymax!==n.max;return Object.assign(s,i),o}var ys=e=>e===0||e===1,Jr=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*lt/n)),Zr=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*lt/n)+1,Xe={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*at)+1,easeOutSine:e=>Math.sin(e*at),easeInOutSine:e=>-.5*(Math.cos(G*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>ys(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>ys(e)?e:Jr(e,.075,.3),easeOutElastic:e=>ys(e)?e:Zr(e,.075,.3),easeInOutElastic(e){return ys(e)?e:e<.5?.5*Jr(e*2,.1125,.45):.5+.5*Zr(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Xe.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Xe.easeInBounce(e*2)*.5:Xe.easeOutBounce(e*2-1)*.5+.5};function Xi(e){if(e&&typeof e=="object"){let t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Gi(e){return Xi(e)?e:new Mn(e)}function Fi(e){return Xi(e)?e:new Mn(e).saturate(.5).darken(.1).hexString()}var Uh=["x","y","borderWidth","radius","tension"],qh=["color","borderColor","backgroundColor"];function Yh(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:qh},numbers:{type:"number",properties:Uh}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function $h(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Qr=new Map;function Kh(e,t){t=t||{};let n=e+JSON.stringify(t),s=Qr.get(n);return s||(s=new Intl.NumberFormat(e,t),Qr.set(n,s)),s}function Ps(e,t,n){return Kh(t,n).format(e)}var wa={values(e){return U(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";let s=this.chart.options.locale,i,o=e;if(n.length>1){let c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),o=Xh(e,n)}let r=Ft(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:i,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Ps(e,s,l)},logarithmic(e,t,n){if(e===0)return"0";let s=n[t].significand||e/Math.pow(10,Math.floor(Ft(e)));return[1,2,3,5,10,15].includes(s)||t>.8*n.length?wa.numeric.call(this,e,t,n):""}};function Xh(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var An={formatters:wa};function Gh(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.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:An.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}var ee=Object.create(null),Rs=Object.create(null);function Cn(e,t){if(!t)return e;let n=t.split(".");for(let s=0,i=n.length;s<i;++s){let o=n[s];e=e[o]||(e[o]=Object.create(null))}return e}function Bi(e,t,n){return typeof t=="string"?Ge(Cn(e,t),n):Ge(Cn(e,""),t)}var Ni=class{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,i)=>Fi(i.backgroundColor),this.hoverBorderColor=(s,i)=>Fi(i.borderColor),this.hoverColor=(s,i)=>Fi(i.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(n)}set(t,n){return Bi(this,t,n)}get(t){return Cn(this,t)}describe(t,n){return Bi(Rs,t,n)}override(t,n){return Bi(ee,t,n)}route(t,n,s,i){let o=Cn(this,t),r=Cn(this,s),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){let l=this[a],c=r[i];return H(l)?Object.assign({},c,l):D(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}},K=new Ni({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Yh,$h,Gh]);function Jh(e){return!e||W(e.size)||W(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function En(e,t,n,s,i){let o=t[i];return o||(o=t[i]=e.measureText(i).width,n.push(i)),o>s&&(s=o),s}function ka(e,t,n,s){s=s||{};let i=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(i=s.data={},o=s.garbageCollect=[],s.font=t),e.save(),e.font=t;let r=0,a=n.length,l,c,u,h,d;for(l=0;l<a;l++)if(h=n[l],h!=null&&!U(h))r=En(e,i,o,r,h);else if(U(h))for(c=0,u=h.length;c<u;c++)d=h[c],d!=null&&!U(d)&&(r=En(e,i,o,r,d));e.restore();let f=o.length/2;if(f>n.length){for(l=0;l<f;l++)delete i[o[l]];o.splice(0,f)}return r}function ne(e,t,n){let s=e.currentDevicePixelRatio,i=n!==0?Math.max(n/2,.5):0;return Math.round((t-i)*s)/s+i}function Ji(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function As(e,t,n,s){Zi(e,t,n,s,null)}function Zi(e,t,n,s,i){let o,r,a,l,c,u,h,d,f=t.pointStyle,g=t.rotation,p=t.radius,m=(g||0)*Wh;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,s),e.rotate(m),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),f){default:i?e.ellipse(n,s,i/2,p,0,0,lt):e.arc(n,s,p,0,lt),e.closePath();break;case"triangle":u=i?i/2:p,e.moveTo(n+Math.sin(m)*u,s-Math.cos(m)*p),m+=Gr,e.lineTo(n+Math.sin(m)*u,s-Math.cos(m)*p),m+=Gr,e.lineTo(n+Math.sin(m)*u,s-Math.cos(m)*p),e.closePath();break;case"rectRounded":c=p*.516,l=p-c,r=Math.cos(m+ke)*l,h=Math.cos(m+ke)*(i?i/2-c:l),a=Math.sin(m+ke)*l,d=Math.sin(m+ke)*(i?i/2-c:l),e.arc(n-h,s-a,c,m-G,m-at),e.arc(n+d,s-r,c,m-at,m),e.arc(n+h,s+a,c,m,m+at),e.arc(n-d,s+r,c,m+at,m+G),e.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,u=i?i/2:l,e.rect(n-u,s-l,2*u,2*l);break}m+=ke;case"rectRot":h=Math.cos(m)*(i?i/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(i?i/2:p),e.moveTo(n-h,s-a),e.lineTo(n+d,s-r),e.lineTo(n+h,s+a),e.lineTo(n-d,s+r),e.closePath();break;case"crossRot":m+=ke;case"cross":h=Math.cos(m)*(i?i/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(i?i/2:p),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+d,s-r),e.lineTo(n-d,s+r);break;case"star":h=Math.cos(m)*(i?i/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(i?i/2:p),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+d,s-r),e.lineTo(n-d,s+r),m+=ke,h=Math.cos(m)*(i?i/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(i?i/2:p),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+d,s-r),e.lineTo(n-d,s+r);break;case"line":r=i?i/2:Math.cos(m)*p,a=Math.sin(m)*p,e.moveTo(n-r,s-a),e.lineTo(n+r,s+a);break;case"dash":e.moveTo(n,s),e.lineTo(n+Math.cos(m)*(i?i/2:p),s+Math.sin(m)*p);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function kt(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Dn(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function On(e){e.restore()}function Sa(e,t,n,s,i){if(!t)return e.lineTo(n.x,n.y);if(i==="middle"){let o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else i==="after"!=!!s?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function Ma(e,t,n,s){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?n.cp2x:n.cp1x,s?n.cp2y:n.cp1y,n.x,n.y)}function Zh(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),W(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Qh(e,t,n,s,i){if(i.strikethrough||i.underline){let o=e.measureText(s),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=i.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=i.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function td(e,t){let n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Ee(e,t,n,s,i,o={}){let r=U(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(e.save(),e.font=i.string,Zh(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&td(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),W(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,s,o.maxWidth)),e.fillText(c,n,s,o.maxWidth),Qh(e,n,s,c,o),s+=Number(i.lineHeight);e.restore()}function Hn(e,t){let{x:n,y:s,w:i,h:o,radius:r}=t;e.arc(n+r.topLeft,s+r.topLeft,r.topLeft,1.5*G,G,!0),e.lineTo(n,s+o-r.bottomLeft),e.arc(n+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,G,at,!0),e.lineTo(n+i-r.bottomRight,s+o),e.arc(n+i-r.bottomRight,s+o-r.bottomRight,r.bottomRight,at,0,!0),e.lineTo(n+i,s+r.topRight),e.arc(n+i-r.topRight,s+r.topRight,r.topRight,0,-at,!0),e.lineTo(n+r.topLeft,s)}var ed=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,nd=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function sd(e,t){let n=(""+e).match(ed);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}var id=e=>+e||0;function Qi(e,t){let n={},s=H(t),i=s?Object.keys(t):t,o=H(e)?s?r=>D(e[r],e[t[r]]):r=>e[r]:()=>e;for(let r of i)n[r]=id(o(r));return n}function Ta(e){return Qi(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Le(e){return Qi(e,["topLeft","topRight","bottomLeft","bottomRight"])}function nt(e){let t=Ta(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Z(e,t){e=e||{},t=t||K.font;let n=D(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let s=D(e.style,t.style);s&&!(""+s).match(nd)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);let i={family:D(e.family,t.family),lineHeight:sd(D(e.lineHeight,t.lineHeight),n),size:n,style:s,weight:D(e.weight,t.weight),string:""};return i.string=Jh(i),i}function In(e,t,n,s){let i=!0,o,r,a;for(o=0,r=e.length;o<r;++o)if(a=e[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),i=!1),n!==void 0&&U(a)&&(a=a[n%a.length],i=!1),a!==void 0))return s&&!i&&(s.cacheable=!1),a}function Ca(e,t,n){let{min:s,max:i}=e,o=ra(t,(i-s)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(i,o)}}function Nt(e,t){return Object.assign(Object.create(e),t)}function Ds(e,t=[""],n,s,i=()=>e[0]){let o=n||e;typeof s=="undefined"&&(s=Pa("_fallback",e));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:s,_getTarget:i,override:a=>Ds([a,...e],t,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return Ea(a,l,()=>dd(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return ea(a).includes(l)},ownKeys(a){return ea(a)},set(a,l,c){let u=a._storage||(a._storage=i());return a[l]=u[l]=c,delete a._keys,!0}})}function Te(e,t,n,s){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:to(e,s),setContext:o=>Te(e,o,n,s),override:o=>Te(e.override(o),t,n,s)};return new Proxy(i,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return Ea(o,r,()=>rd(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function to(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:s=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:s,isScriptable:It(n)?n:()=>n,isIndexable:It(s)?s:()=>s}}var od=(e,t)=>e?e+Cs(t):t,eo=(e,t)=>H(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ea(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];let s=n();return e[t]=s,s}function rd(e,t,n){let{_proxy:s,_context:i,_subProxy:o,_descriptors:r}=e,a=s[t];return It(a)&&r.isScriptable(t)&&(a=ad(t,a,e,n)),U(a)&&a.length&&(a=ld(t,a,e,r.isIndexable)),eo(t,a)&&(a=Te(a,i,o&&o[t],r)),a}function ad(e,t,n,s){let{_proxy:i,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||s);return a.delete(e),eo(e,l)&&(l=no(i._scopes,i,e,l)),l}function ld(e,t,n,s){let{_proxy:i,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index!="undefined"&&s(e))return t[o.index%t.length];if(H(t[0])){let l=t,c=i._scopes.filter(u=>u!==l);t=[];for(let u of l){let h=no(c,i,e,u);t.push(Te(h,o,r&&r[e],a))}}return t}function La(e,t,n){return It(e)?e(t,n):e}var cd=(e,t)=>e===!0?t:typeof e=="string"?Pn(t,e):void 0;function ud(e,t,n,s,i){for(let o of t){let r=cd(n,o);if(r){e.add(r);let a=La(r._fallback,n,i);if(typeof a!="undefined"&&a!==n&&a!==s)return a}else if(r===!1&&typeof s!="undefined"&&n!==s)return null}return!1}function no(e,t,n,s){let i=t._rootScopes,o=La(t._fallback,n,s),r=[...e,...i],a=new Set;a.add(s);let l=ta(a,r,n,o||n,s);return l===null||typeof o!="undefined"&&o!==n&&(l=ta(a,r,o,l,s),l===null)?!1:Ds(Array.from(a),[""],i,o,()=>hd(t,n,s))}function ta(e,t,n,s,i){for(;n;)n=ud(e,t,n,s,i);return n}function hd(e,t,n){let s=e._getTarget();t in s||(s[t]={});let i=s[t];return U(i)&&H(n)?n:i||{}}function dd(e,t,n,s){let i;for(let o of t)if(i=Pa(od(o,e),n),typeof i!="undefined")return eo(e,i)?no(n,s,e,i):i}function Pa(e,t){for(let n of t){if(!n)continue;let s=n[e];if(typeof s!="undefined")return s}}function ea(e){let t=e._keys;return t||(t=e._keys=fd(e._scopes)),t}function fd(e){let t=new Set;for(let n of e)for(let s of Object.keys(n).filter(i=>!i.startsWith("_")))t.add(s);return Array.from(t)}var pd=Number.EPSILON||1e-14,Je=(e,t)=>t<e.length&&!e[t].skip&&e[t],Ra=e=>e==="x"?"y":"x";function md(e,t,n,s){let i=e.skip?t:e,o=t,r=n.skip?t:n,a=Ms(o,i),l=Ms(r,o),c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;let h=s*c,d=s*u;return{previous:{x:o.x-h*(r.x-i.x),y:o.y-h*(r.y-i.y)},next:{x:o.x+d*(r.x-i.x),y:o.y+d*(r.y-i.y)}}}function gd(e,t,n){let s=e.length,i,o,r,a,l,c=Je(e,0);for(let u=0;u<s-1;++u)if(l=c,c=Je(e,u+1),!(!l||!c)){if(Qe(t[u],0,pd)){n[u]=n[u+1]=0;continue}i=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(i,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=i*r*t[u],n[u+1]=o*r*t[u])}}function bd(e,t,n="x"){let s=Ra(n),i=e.length,o,r,a,l=Je(e,0);for(let c=0;c<i;++c){if(r=a,a=l,l=Je(e,c+1),!a)continue;let u=a[n],h=a[s];r&&(o=(u-r[n])/3,a[`cp1${n}`]=u-o,a[`cp1${s}`]=h-o*t[c]),l&&(o=(l[n]-u)/3,a[`cp2${n}`]=u+o,a[`cp2${s}`]=h+o*t[c])}}function _d(e,t="x"){let n=Ra(t),s=e.length,i=Array(s).fill(0),o=Array(s),r,a,l,c=Je(e,0);for(r=0;r<s;++r)if(a=l,l=c,c=Je(e,r+1),!!l){if(c){let u=c[t]-l[t];i[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?Me(i[r-1])!==Me(i[r])?0:(i[r-1]+i[r])/2:i[r-1]:i[r]}gd(e,i,o),bd(e,o,t)}function vs(e,t,n){return Math.max(Math.min(e,n),t)}function xd(e,t){let n,s,i,o,r,a=kt(e[0],t);for(n=0,s=e.length;n<s;++n)r=o,o=a,a=n<s-1&&kt(e[n+1],t),o&&(i=e[n],r&&(i.cp1x=vs(i.cp1x,t.left,t.right),i.cp1y=vs(i.cp1y,t.top,t.bottom)),a&&(i.cp2x=vs(i.cp2x,t.left,t.right),i.cp2y=vs(i.cp2y,t.top,t.bottom)))}function Aa(e,t,n,s,i){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")_d(e,i);else{let c=s?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=md(c,a,e[Math.min(o+1,r-(s?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&xd(e,n)}function Os(){return typeof window!="undefined"&&typeof document!="undefined"}function Hs(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ts(e,t,n){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*t.parentNode[n])):s=e,s}var Is=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function yd(e,t){return Is(e).getPropertyValue(t)}var vd=["top","right","bottom","left"];function Se(e,t,n){let s={};n=n?"-"+n:"";for(let i=0;i<4;i++){let o=vd[i];s[o]=parseFloat(e[t+"-"+o+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}var wd=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function kd(e,t){let n=e.touches,s=n&&n.length?n[0]:e,{offsetX:i,offsetY:o}=s,r=!1,a,l;if(wd(i,o,e.target))a=i,l=o;else{let c=t.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function se(e,t){if("native"in e)return e;let{canvas:n,currentDevicePixelRatio:s}=t,i=Is(n),o=i.boxSizing==="border-box",r=Se(i,"padding"),a=Se(i,"border","width"),{x:l,y:c,box:u}=kd(e,n),h=r.left+(u&&a.left),d=r.top+(u&&a.top),{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-h)/f*n.width/s),y:Math.round((c-d)/g*n.height/s)}}function Sd(e,t,n){let s,i;if(t===void 0||n===void 0){let o=e&&Hs(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{let r=o.getBoundingClientRect(),a=Is(o),l=Se(a,"border","width"),c=Se(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,s=Ts(a.maxWidth,o,"clientWidth"),i=Ts(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:s||Ss,maxHeight:i||Ss}}var ws=e=>Math.round(e*10)/10;function Da(e,t,n,s){let i=Is(e),o=Se(i,"margin"),r=Ts(i.maxWidth,e,"clientWidth")||Ss,a=Ts(i.maxHeight,e,"clientHeight")||Ss,l=Sd(e,t,n),{width:c,height:u}=l;if(i.boxSizing==="content-box"){let d=Se(i,"border","width"),f=Se(i,"padding");c-=f.width+d.width,u-=f.height+d.height}return c=Math.max(0,c-o.width),u=Math.max(0,s?c/s:u-o.height),c=ws(Math.min(c,r,l.maxWidth)),u=ws(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ws(c/2)),(t!==void 0||n!==void 0)&&s&&l.height&&u>l.height&&(u=l.height,c=ws(Math.floor(u*s))),{width:c,height:u}}function so(e,t,n){let s=t||1,i=Math.floor(e.height*s),o=Math.floor(e.width*s);e.height=Math.floor(e.height),e.width=Math.floor(e.width);let r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||r.height!==i||r.width!==o?(e.currentDevicePixelRatio=s,r.height=i,r.width=o,e.ctx.setTransform(s,0,0,s,0,0),!0):!1}var Oa=(function(){let e=!1;try{let t={get passive(){return e=!0,!1}};Os()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(t){}return e})();function io(e,t){let n=yd(e,t),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Qt(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function Ha(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:s==="middle"?n<.5?e.y:t.y:s==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function Ia(e,t,n,s){let i={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Qt(e,i,n),a=Qt(i,o,n),l=Qt(o,t,n),c=Qt(r,a,n),u=Qt(a,l,n);return Qt(c,u,n)}var Md=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,s){return n-s},leftForLtr(n,s){return n-s}}},Td=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Pe(e,t,n){return e?Md(t,n):Td()}function oo(e,t){let n,s;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,s=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=s)}function ro(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Fa(e){return e==="angle"?{between:Ui,compare:jh,normalize:rt}:{between:Ce,compare:(t,n)=>t-n,normalize:t=>t}}function na({start:e,end:t,count:n,loop:s,style:i}){return{start:e%n,end:t%n,loop:s&&(t-e+1)%n===0,style:i}}function Cd(e,t,n){let{property:s,start:i,end:o}=n,{between:r,normalize:a}=Fa(s),l=t.length,{start:c,end:u,loop:h}=e,d,f;if(h){for(c+=l,u+=l,d=0,f=l;d<f&&r(a(t[c%l][s]),i,o);++d)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:h,style:e.style}}function ao(e,t,n){if(!n)return[e];let{property:s,start:i,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Fa(s),{start:u,end:h,loop:d,style:f}=Cd(e,t,n),g=[],p=!1,m=null,b,x,v,y=()=>l(i,v,b)&&a(i,v)!==0,_=()=>a(o,b)===0||l(o,v,b),w=()=>p||y(),M=()=>!p||_();for(let S=u,L=u;S<=h;++S)x=t[S%r],!x.skip&&(b=c(x[s]),b!==v&&(p=l(b,i,o),m===null&&w()&&(m=a(b,i)===0?S:L),m!==null&&M()&&(g.push(na({start:m,end:S,loop:d,count:r,style:f})),m=null),L=S,v=b));return m!==null&&g.push(na({start:m,end:h,loop:d,count:r,style:f})),g}function lo(e,t){let n=[],s=e.segments;for(let i=0;i<s.length;i++){let o=ao(s[i],e.points,t);o.length&&n.push(...o)}return n}function Ed(e,t,n,s){let i=0,o=t-1;if(n&&!s)for(;i<t&&!e[i].skip;)i++;for(;i<t&&e[i].skip;)i++;for(i%=t,n&&(o+=i);o>i&&e[o%t].skip;)o--;return o%=t,{start:i,end:o}}function Ld(e,t,n,s){let i=e.length,o=[],r=t,a=e[t],l;for(l=t+1;l<=n;++l){let c=e[l%i];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%i,end:(l-1)%i,loop:s}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%i,end:r%i,loop:s}),o}function Ba(e,t){let n=e.points,s=e.options.spanGaps,i=n.length;if(!i)return[];let o=!!e._loop,{start:r,end:a}=Ed(n,i,o,s);if(s===!0)return sa(e,[{start:r,end:a,loop:o}],n,t);let l=a<r?a+i:a,c=!!e._fullLoop&&r===0&&a===i-1;return sa(e,Ld(n,r,l,c),n,t)}function sa(e,t,n,s){return!s||!s.setContext||!n?t:Pd(e,t,n,s)}function Pd(e,t,n,s){let i=e._chart.getContext(),o=ia(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[],u=o,h=t[0].start,d=h;function f(g,p,m,b){let x=a?-1:1;if(g!==p){for(g+=l;n[g%l].skip;)g-=x;for(;n[p%l].skip;)p+=x;g%l!==p%l&&(c.push({start:g%l,end:p%l,loop:m,style:b}),u=b,h=p%l)}}for(let g of t){h=a?h:g.start;let p=n[h%l],m;for(d=h+1;d<=g.end;d++){let b=n[d%l];m=ia(s.setContext(Nt(i,{type:"segment",p0:p,p1:b,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),Rd(m,u)&&f(h,d-1,g.loop,u),p=b,u=m}h<d-1&&f(h,d-1,g.loop,u)}return c}function ia(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Rd(e,t){if(!t)return!1;let n=[],s=function(i,o){return Xi(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,s)!==JSON.stringify(t,s)}var bo=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,s,i){let o=n.listeners[i],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(s-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Yi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((s,i)=>{if(!s.running||!s.items.length)return;let o=s.items,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&&(i.draw(),this._notify(i,s,t,"progress")),o.length||(s.running=!1,this._notify(i,s,t,"complete"),s.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){let n=this._charts,s=n.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,s)),s}listen(t,n,s){this._getAnims(t).listeners[n].push(s)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){let n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((s,i)=>Math.max(s,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;let n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){let n=this._charts.get(t);if(!n||!n.items.length)return;let s=n.items,i=s.length-1;for(;i>=0;--i)s[i].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},zt=new bo,Na="transparent",Ad={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let s=Gi(e||Na),i=s.valid&&Gi(t||Na);return i&&i.valid?i.mix(s,n).hexString():t},number(e,t,n){return e+(t-e)*n}},_o=class{constructor(t,n,s,i){let o=n[s];i=In([t.to,i,o,t.from]);let r=In([t.from,o,i]);this._active=!0,this._fn=t.fn||Ad[t.type||typeof r],this._easing=Xe[t.easing]||Xe.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=s,this._from=r,this._to=i,this._promises=void 0}active(){return this._active}update(t,n,s){if(this._active){this._notify(!1);let i=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=In([t.to,n,i,t.from]),this._from=In([t.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let n=t-this._start,s=this._duration,i=this._prop,o=this._from,r=this._loop,a=this._to,l;if(this._active=o!==a&&(r||n<s),!this._active){this._target[i]=a,this._notify(!0);return}if(n<0){this._target[i]=o;return}l=n/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,a,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((n,s)=>{t.push({res:n,rej:s})})}_notify(t){let n=t?"res":"rej",s=this._promises||[];for(let i=0;i<s.length;i++)s[i][n]()}},$s=class{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!H(t))return;let n=Object.keys(K.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{let o=t[i];if(!H(o))return;let r={};for(let a of n)r[a]=o[a];(U(o.properties)&&o.properties||[i]).forEach(a=>{(a===i||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,n){let s=n.options,i=Od(t,s);if(!i)return[];let o=this._createAnimations(i,s);return s.$shared&&Dd(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,n){let s=this._properties,i=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now(),l;for(l=r.length-1;l>=0;--l){let c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(t,n));continue}let u=n[c],h=o[c],d=s.get(c);if(h)if(d&&h.active()){h.update(d,u,a);continue}else h.cancel();if(!d||!d.duration){t[c]=u;continue}o[c]=h=new _o(d,t,c,u),i.push(h)}return i}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}let s=this._createAnimations(t,n);if(s.length)return zt.add(this._chart,s),!0}};function Dd(e,t){let n=[],s=Object.keys(t);for(let i=0;i<s.length;i++){let o=e[s[i]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Od(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function za(e,t){let n=e&&e.options||{},s=n.reverse,i=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:s?o:i,end:s?i:o}}function Hd(e,t,n){if(n===!1)return!1;let s=za(e,n),i=za(t,n);return{top:i.end,right:s.end,bottom:i.start,left:s.start}}function Id(e){let t,n,s,i;return H(e)?(t=e.top,n=e.right,s=e.bottom,i=e.left):t=n=s=i=e,{top:t,right:n,bottom:s,left:i,disabled:e===!1}}function Al(e,t){let n=[],s=e._getSortedDatasetMetas(t),i,o;for(i=0,o=s.length;i<o;++i)n.push(s[i].index);return n}function Va(e,t,n,s={}){let i=e.keys,o=s.mode==="single",r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=i.length;r<a;++r){if(l=+i[r],l===n){if(u=!0,s.all)continue;break}c=e.values[l],$(c)&&(o||t===0||Me(t)===Me(c))&&(t+=c)}return!u&&!s.all?0:t}function Fd(e,t){let{iScale:n,vScale:s}=t,i=n.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length),l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[i]:u,[o]:e[u]};return a}function co(e,t){let n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Bd(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Nd(e){let{min:t,max:n,minDefined:s,maxDefined:i}=e.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function zd(e,t,n){let s=e[t]||(e[t]={});return s[n]||(s[n]={})}function Wa(e,t,n,s){for(let i of t.getMatchingVisibleMetas(s).reverse()){let o=e[i.index];if(n&&o>0||!n&&o<0)return i.index}return null}function ja(e,t){let{chart:n,_cachedMeta:s}=e,i=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,u=Bd(o,r,s),h=t.length,d;for(let f=0;f<h;++f){let g=t[f],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});d=b[c]=zd(i,u,p),d[a]=m,d._top=Wa(d,r,!0,s.type),d._bottom=Wa(d,r,!1,s.type);let x=d._visualValues||(d._visualValues={});x[a]=m}}function uo(e,t){let n=e.scales;return Object.keys(n).filter(s=>n[s].axis===t).shift()}function Vd(e,t){return Nt(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wd(e,t,n){return Nt(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Fn(e,t){let n=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){t=t||e._parsed;for(let i of t){let o=i._stacks;if(!o||o[s]===void 0||o[s][n]===void 0)return;delete o[s][n],o[s]._visualValues!==void 0&&o[s]._visualValues[n]!==void 0&&delete o[s]._visualValues[n]}}}var ho=e=>e==="reset"||e==="none",Ua=(e,t)=>t?e:Object.assign({},e),jd=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Al(n,!0),values:null},De=class{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=co(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&&Fn(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,n=this._cachedMeta,s=this.getDataset(),i=(h,d,f,g)=>h==="x"?d:h==="r"?g:f,o=n.xAxisID=D(s.xAxisID,uo(t,"x")),r=n.yAxisID=D(s.yAxisID,uo(t,"y")),a=n.rAxisID=D(s.rAxisID,uo(t,"r")),l=n.indexAxis,c=n.iAxisID=i(l,o,r,a),u=n.vAxisID=i(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&qi(this._data,this),t._stacked&&Fn(t)}_dataCheck(){let t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if(H(n)){let i=this._cachedMeta;this._data=Fd(n,i)}else if(s!==n){if(s){qi(s,this);let i=this._cachedMeta;Fn(i),i._parsed=[]}n&&Object.isExtensible(n)&&ga(n,this),this._syncList=[],this._data=n}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let n=this._cachedMeta,s=this.getDataset(),i=!1;this._dataCheck();let o=n._stacked;n._stacked=co(n.vScale,n),n.stack!==s.stack&&(i=!0,Fn(n),n.stack=s.stack),this._resyncElements(t),(i||o!==n._stacked)&&(ja(this,n._parsed),n._stacked=co(n.vScale,n))}configure(){let t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){let{_cachedMeta:s,_data:i}=this,{iScale:o,_stacked:r}=s,a=o.axis,l=t===0&&n===i.length?!0:s._sorted,c=t>0&&s._parsed[t-1],u,h,d;if(this._parsing===!1)s._parsed=i,s._sorted=!0,d=i;else{U(i[t])?d=this.parseArrayData(s,i,t,n):H(i[t])?d=this.parseObjectData(s,i,t,n):d=this.parsePrimitiveData(s,i,t,n);let f=()=>h[a]===null||c&&h[a]<c[a];for(u=0;u<n;++u)s._parsed[u+t]=h=d[u],l&&(f()&&(l=!1),c=h);s._sorted=l}r&&ja(this,d)}parsePrimitiveData(t,n,s,i){let{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,h=new Array(i),d,f,g;for(d=0,f=i;d<f;++d)g=d+s,h[d]={[a]:u||o.parse(c[g],g),[l]:r.parse(n[g],g)};return h}parseArrayData(t,n,s,i){let{xScale:o,yScale:r}=t,a=new Array(i),l,c,u,h;for(l=0,c=i;l<c;++l)u=l+s,h=n[u],a[l]={x:o.parse(h[0],u),y:r.parse(h[1],u)};return a}parseObjectData(t,n,s,i){let{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(i),u,h,d,f;for(u=0,h=i;u<h;++u)d=u+s,f=n[d],c[u]={x:o.parse(Pn(f,a),d),y:r.parse(Pn(f,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,s){let i=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Al(i,!0),values:n._stacks[t.axis]._visualValues};return Va(a,r,o.index,{mode:s})}updateRangeFromParsed(t,n,s,i){let o=s[n.axis],r=o===null?NaN:o,a=i&&s._stacks[n.axis];i&&a&&(i.values=a,r=Va(i,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){let s=this._cachedMeta,i=s._parsed,o=s._sorted&&t===s.iScale,r=i.length,a=this._getOtherScale(t),l=jd(n,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=Nd(a),d,f;function g(){f=i[d];let p=f[a.axis];return!$(f[t.axis])||u>p||h<p}for(d=0;d<r&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let n=this._cachedMeta._parsed,s=[],i,o,r;for(i=0,o=n.length;i<o;++i)r=n[i][t.axis],$(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){let n=this._cachedMeta,s=n.iScale,i=n.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(t){let n=this._cachedMeta;this.update(t||"default"),n._clip=Id(D(this.options.clip,Hd(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,n=this.chart,s=this._cachedMeta,i=s.data||[],o=n.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||i.length-a,c=this.options.drawActiveElementsOnTop,u;for(s.dataset&&s.dataset.draw(t,o,a,l),u=a;u<a+l;++u){let h=i[u];h.hidden||(h.active&&c?r.push(h):h.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){let s=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,n,s){let i=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let r=this._cachedMeta.data[t];o=r.$context||(r.$context=Wd(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=i.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Vd(this.chart.getContext(),this.index)),o.dataset=i,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",s){let i=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],l=this.enableOptionSharing&&Rn(s);if(a)return Ua(a,l);let c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),h=i?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),u),f=Object.keys(K.elements[t]),g=()=>this.getContext(s,i,n),p=c.resolveNamedOptions(d,f,g,h);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(Ua(p,l))),p}_resolveAnimations(t,n,s){let i=this.chart,o=this._cachedDataOpts,r=`animation-${n}`,a=o[r];if(a)return a;let l;if(i.options.animation!==!1){let u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),d=u.getOptionScopes(this.getDataset(),h);l=u.createResolver(d,this.getContext(t,s,n))}let c=new $s(i,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,n){return!n||ho(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){let s=this.resolveDataElementOptions(t,n),i=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(n,o)||o!==i;return this.updateSharedOptions(o,n,s),{sharedOptions:o,includeOptions:r}}updateElement(t,n,s,i){ho(i)?Object.assign(t,s):this._resolveAnimations(n,i).update(t,s)}updateSharedOptions(t,n,s){t&&!ho(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,i){t.active=i;let o=this.getStyle(n,i);this._resolveAnimations(n,s,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let n=this._data,s=this._cachedMeta.data;for(let[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];let i=s.length,o=n.length,r=Math.min(o,i);r&&this.parse(0,r),o>i?this._insertElements(i,o-i,t):o<i&&this._removeElements(o,i-o)}_insertElements(t,n,s=!0){let i=this._cachedMeta,o=i.data,r=t+n,a,l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(t,n),s&&this.updateElements(o,t,n,"reset")}updateElements(t,n,s,i){}_removeElements(t,n){let s=this._cachedMeta;if(this._parsing){let i=s._parsed.splice(t,n);s._stacked&&Fn(s,i)}s.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[n,s,i]=t;this[n](s,i)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);let s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};E(De,"defaults",{}),E(De,"datasetElementType",null),E(De,"dataElementType",null);var Oe=class extends De{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let n=this._cachedMeta,{dataset:s,data:i=[],_dataset:o}=n,r=this.chart._animationsDisabled,{start:a,count:l}=ya(n,i,r);this._drawStart=a,this._drawCount=l,va(n)&&(a=0,l=i.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=i;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:c},t),this.updateElements(i,a,l,t)}updateElements(t,n,s,i){let o=i==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,i),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=tn(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||i==="none",x=n+s,v=t.length,y=n>0&&this.getParsed(n-1);for(let _=0;_<v;++_){let w=t[_],M=b?w:{};if(_<n||_>=x){M.skip=!0;continue}let S=this.getParsed(_),L=W(S[f]),I=M[d]=r.getPixelForValue(S[d],_),R=M[f]=o||L?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[f],_);M.skip=isNaN(I)||isNaN(R)||L,M.stop=_>0&&Math.abs(S[d]-y[d])>m,p&&(M.parsed=S,M.raw=c.data[_]),h&&(M.options=u||this.resolveDataElementOptions(_,w.active?"active":i)),b||this.updateElement(w,_,M,i),y=S}}getMaxOverflow(){let t=this._cachedMeta,n=t.dataset,s=n.options&&n.options.borderWidth||0,i=t.data||[];if(!i.length)return s;let o=i[0].size(this.resolveDataElementOptions(0)),r=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(s,o,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};E(Oe,"id","line"),E(Oe,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),E(Oe,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Re(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var xo=class e{constructor(t){E(this,"options");this.options=t||{}}static override(t){Object.assign(e.prototype,t)}init(){}formats(){return Re()}parse(){return Re()}format(){return Re()}add(){return Re()}diff(){return Re()}startOf(){return Re()}endOf(){return Re()}},Ud={_date:xo};function qd(e,t,n,s){let{controller:i,data:o,_sorted:r}=e,a=i._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){let l=a._reversePixels?fa:te;if(s){if(i._sharedOptions){let c=o[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){let h=l(o,t,n-u),d=l(o,t,n+u);return{lo:h.lo,hi:d.hi}}}}else return l(o,t,n)}return{lo:0,hi:o.length-1}}function $n(e,t,n,s,i){let o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){let{index:c,data:u}=o[a],{lo:h,hi:d}=qd(o[a],t,r,i);for(let f=h;f<=d;++f){let g=u[f];g.skip||s(g,c,f)}}}function Yd(e){let t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(s,i){let o=t?Math.abs(s.x-i.x):0,r=n?Math.abs(s.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function fo(e,t,n,s,i){let o=[];return!i&&!e.isPointInArea(t)||$n(e,n,t,function(a,l,c){!i&&!kt(a,e.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function $d(e,t,n,s){let i=[];function o(r,a,l){let{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],s),{angle:h}=ha(r,{x:t.x,y:t.y});Ui(h,c,u)&&i.push({element:r,datasetIndex:a,index:l})}return $n(e,n,t,o),i}function Kd(e,t,n,s,i,o){let r=[],a=Yd(n),l=Number.POSITIVE_INFINITY;function c(u,h,d){let f=u.inRange(t.x,t.y,i);if(s&&!f)return;let g=u.getCenterPoint(i);if(!(!!o||e.isPointInArea(g))&&!f)return;let m=a(t,g);m<l?(r=[{element:u,datasetIndex:h,index:d}],l=m):m===l&&r.push({element:u,datasetIndex:h,index:d})}return $n(e,n,t,c),r}function po(e,t,n,s,i,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!s?$d(e,t,n,i):Kd(e,t,n,s,i,o)}function qa(e,t,n,s,i){let o=[],r=n==="x"?"inXRange":"inYRange",a=!1;return $n(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],i)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,i))}),s&&!a?[]:o}var Xd={evaluateInteractionItems:$n,modes:{index(e,t,n,s){let i=se(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?fo(e,i,o,s,r):po(e,i,o,!1,s,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{let u=a[0].index,h=c.data[u];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,s){let i=se(t,e),o=n.axis||"xy",r=n.includeInvisible||!1,a=n.intersect?fo(e,i,o,s,r):po(e,i,o,!1,s,r);if(a.length>0){let l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,s){let i=se(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return fo(e,i,o,s,r)},nearest(e,t,n,s){let i=se(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return po(e,i,o,n.intersect,s,r)},x(e,t,n,s){let i=se(t,e);return qa(e,i,"x",n.intersect,s)},y(e,t,n,s){let i=se(t,e);return qa(e,i,"y",n.intersect,s)}}},Dl=["left","top","right","bottom"];function Bn(e,t){return e.filter(n=>n.pos===t)}function Ya(e,t){return e.filter(n=>Dl.indexOf(n.pos)===-1&&n.box.axis===t)}function Nn(e,t){return e.sort((n,s)=>{let i=t?s:n,o=t?n:s;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function Gd(e){let t=[],n,s,i,o,r,a;for(n=0,s=(e||[]).length;n<s;++n)i=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=i,t.push({index:n,box:i,pos:o,horizontal:i.isHorizontal(),weight:i.weight,stack:r&&o+r,stackWeight:a});return t}function Jd(e){let t={};for(let n of e){let{stack:s,pos:i,stackWeight:o}=n;if(!s||!Dl.includes(i))continue;let r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Zd(e,t){let n=Jd(e),{vBoxMaxWidth:s,hBoxMaxHeight:i}=t,o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];let{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*s:l&&t.availableWidth,a.height=i):(a.width=s,a.height=u?u*i:l&&t.availableHeight)}return n}function Qd(e){let t=Gd(e),n=Nn(t.filter(c=>c.box.fullSize),!0),s=Nn(Bn(t,"left"),!0),i=Nn(Bn(t,"right")),o=Nn(Bn(t,"top"),!0),r=Nn(Bn(t,"bottom")),a=Ya(t,"x"),l=Ya(t,"y");return{fullSize:n,leftAndTop:s.concat(o),rightAndBottom:i.concat(l).concat(r).concat(a),chartArea:Bn(t,"chartArea"),vertical:s.concat(i).concat(l),horizontal:o.concat(r).concat(a)}}function $a(e,t,n,s){return Math.max(e[n],t[n])+Math.max(e[s],t[s])}function Ol(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function tf(e,t,n,s){let{pos:i,box:o}=n,r=e.maxPadding;if(!H(i)){n.size&&(e[i]-=n.size);let h=s[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[i]+=n.size}o.getPadding&&Ol(r,o.getPadding());let a=Math.max(0,t.outerWidth-$a(r,e,"left","right")),l=Math.max(0,t.outerHeight-$a(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function ef(e){let t=e.maxPadding;function n(s){let i=Math.max(t[s]-e[s],0);return e[s]+=i,i}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function nf(e,t){let n=t.maxPadding;function s(i){let o={left:0,top:0,right:0,bottom:0};return i.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return s(e?["left","right"]:["top","bottom"])}function Wn(e,t,n,s){let i=[],o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,nf(a.horizontal,t));let{same:h,other:d}=tf(t,n,a,s);c|=h&&i.length,u=u||d,l.fullSize||i.push(a)}return c&&Wn(i,t,n,s)||u}function Fs(e,t,n,s,i){e.top=n,e.left=t,e.right=t+s,e.bottom=n+i,e.width=s,e.height=i}function Ka(e,t,n,s){let i=n.padding,{x:o,y:r}=t;for(let a of e){let l=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){let h=t.w*u,d=c.size||l.height;Rn(c.start)&&(r=c.start),l.fullSize?Fs(l,i.left,r,n.outerWidth-i.right-i.left,d):Fs(l,t.left+c.placed,r,h,d),c.start=r,c.placed+=h,r=l.bottom}else{let h=t.h*u,d=c.size||l.width;Rn(c.start)&&(o=c.start),l.fullSize?Fs(l,o,i.top,d,n.outerHeight-i.bottom-i.top):Fs(l,o,t.top+c.placed,d,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=r}var ie={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){let n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,s){if(!e)return;let i=nt(e.options.layout.padding),o=Math.max(t-i.width,0),r=Math.max(n-i.height,0),a=Qd(e.boxes),l=a.vertical,c=a.horizontal;B(e.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let u=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),d=Object.assign({},i);Ol(d,nt(s));let f=Object.assign({maxPadding:d,w:o,h:r,x:i.left,y:i.top},i),g=Zd(l.concat(c),h);Wn(a.fullSize,f,h,g),Wn(l,f,h,g),Wn(c,f,h,g)&&Wn(l,f,h,g),ef(f),Ka(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,Ka(a.rightAndBottom,f,h,g),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},B(a.chartArea,p=>{let m=p.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Ks=class{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,s){}removeEventListener(t,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,s,i){return n=Math.max(0,n||t.width),s=s||t.height,{width:n,height:Math.max(0,i?Math.floor(n/i):s)}}isAttached(t){return!0}updateConfig(t){}},yo=class extends Ks{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},qs="$chartjs",sf={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Xa=e=>e===null||e==="";function of(e,t){let n=e.style,s=e.getAttribute("height"),i=e.getAttribute("width");if(e[qs]={initial:{height:s,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Xa(i)){let o=io(e,"width");o!==void 0&&(e.width=o)}if(Xa(s))if(e.style.height==="")e.height=e.width/(t||2);else{let o=io(e,"height");o!==void 0&&(e.height=o)}return e}var Hl=Oa?{passive:!0}:!1;function rf(e,t,n){e&&e.addEventListener(t,n,Hl)}function af(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Hl)}function lf(e,t){let n=sf[e.type]||e.type,{x:s,y:i}=se(e,t);return{type:n,chart:t,native:e,x:s!==void 0?s:null,y:i!==void 0?i:null}}function Xs(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function cf(e,t,n){let s=e.canvas,i=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Xs(a.addedNodes,s),r=r&&!Xs(a.removedNodes,s);r&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function uf(e,t,n){let s=e.canvas,i=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Xs(a.removedNodes,s),r=r&&!Xs(a.addedNodes,s);r&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var qn=new Map,Ga=0;function Il(){let e=window.devicePixelRatio;e!==Ga&&(Ga=e,qn.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function hf(e,t){qn.size||window.addEventListener("resize",Il),qn.set(e,t)}function df(e){qn.delete(e),qn.size||window.removeEventListener("resize",Il)}function ff(e,t,n){let s=e.canvas,i=s&&Hs(s);if(!i)return;let o=$i((a,l)=>{let c=i.clientWidth;n(a,l),c<i.clientWidth&&n()},window),r=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(i),hf(e,o),r}function mo(e,t,n){n&&n.disconnect(),t==="resize"&&df(e)}function pf(e,t,n){let s=e.canvas,i=$i(o=>{e.ctx!==null&&n(lf(o,e))},e);return rf(s,t,i),i}var vo=class extends Ks{acquireContext(t,n){let s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(of(t,n),s):null}releaseContext(t){let n=t.canvas;if(!n[qs])return!1;let s=n[qs].initial;["height","width"].forEach(o=>{let r=s[o];W(r)?n.removeAttribute(o):n.setAttribute(o,r)});let i=s.style||{};return Object.keys(i).forEach(o=>{n.style[o]=i[o]}),n.width=n.width,delete n[qs],!0}addEventListener(t,n,s){this.removeEventListener(t,n);let i=t.$proxies||(t.$proxies={}),r={attach:cf,detach:uf,resize:ff}[n]||pf;i[n]=r(t,n,s)}removeEventListener(t,n){let s=t.$proxies||(t.$proxies={}),i=s[n];if(!i)return;({attach:mo,detach:mo,resize:mo}[n]||af)(t,n,i),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,s,i){return Da(t,n,s,i)}isAttached(t){let n=t&&Hs(t);return!!(n&&n.isConnected)}};function mf(e){return!Os()||typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas?yo:vo}var Ct=class{constructor(){E(this,"x");E(this,"y");E(this,"active",!1);E(this,"options");E(this,"$animations")}tooltipPosition(t){let{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}hasValue(){return tn(this.x)&&tn(this.y)}getProps(t,n){let s=this.$animations;if(!n||!s)return this;let i={};return t.forEach(o=>{i[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),i}};E(Ct,"defaults",{}),E(Ct,"defaultRoutes");function gf(e,t){let n=e.options.ticks,s=bf(e),i=Math.min(n.maxTicksLimit||s,s),o=n.major.enabled?xf(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>i)return yf(t,c,o,r/i),c;let u=_f(o,t,i);if(r>0){let h,d,f=r>1?Math.round((l-a)/(r-1)):null;for(Bs(t,c,u,W(f)?0:a-f,a),h=0,d=r-1;h<d;h++)Bs(t,c,u,o[h],o[h+1]);return Bs(t,c,u,l,W(f)?t.length:l+f),c}return Bs(t,c,u),c}function bf(e){let t=e.options.offset,n=e._tickSize(),s=e._length/n+(t?0:1),i=e._maxLength/n;return Math.floor(Math.min(s,i))}function _f(e,t,n){let s=vf(e),i=t.length/n;if(!s)return Math.max(i,1);let o=ca(s);for(let r=0,a=o.length-1;r<a;r++){let l=o[r];if(l>i)return l}return Math.max(i,1)}function xf(e){let t=[],n,s;for(n=0,s=e.length;n<s;n++)e[n].major&&t.push(n);return t}function yf(e,t,n,s){let i=0,o=n[0],r;for(s=Math.ceil(s),r=0;r<e.length;r++)r===o&&(t.push(e[r]),i++,o=n[i*s])}function Bs(e,t,n,s,i){let o=D(s,0),r=Math.min(D(i,e.length),e.length),a=0,l,c,u;for(n=Math.ceil(n),i&&(l=i-s,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function vf(e){let t=e.length,n,s;if(t<2)return!1;for(s=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==s)return!1;return s}var wf=e=>e==="left"?"right":e==="right"?"left":e,Ja=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Za=(e,t)=>Math.min(t||e,e);function Qa(e,t){let n=[],s=e.length/t,i=e.length,o=0;for(;o<i;o+=s)n.push(e[Math.floor(o)]);return n}function kf(e,t,n){let s=e.ticks.length,i=Math.min(t,s-1),o=e._startPixel,r=e._endPixel,a=1e-6,l=e.getPixelForTick(i),c;if(!(n&&(s===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(i-1))/2,l+=i<t?c:-c,l<o-a||l>r+a)))return l}function Sf(e,t){B(e,n=>{let s=n.gc,i=s.length/2,o;if(i>t){for(o=0;o<i;++o)delete n.data[s[o]];s.splice(0,i)}})}function zn(e){return e.drawTicks?e.tickLength:0}function tl(e,t){if(!e.display)return 0;let n=Z(e.font,t),s=nt(e.padding);return(U(e.text)?e.text.length:1)*n.lineHeight+s.height}function Mf(e,t){return Nt(e,{scale:t,type:"scale"})}function Tf(e,t,n){return Nt(e,{tick:n,index:t,type:"tick"})}function Cf(e,t,n){let s=Ki(e);return(n&&t!=="right"||!n&&t==="right")&&(s=wf(s)),s}function Ef(e,t,n,s){let{top:i,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l,h=0,d,f,g,p=r-i,m=a-o;if(e.isHorizontal()){if(f=ut(s,o,a),H(n)){let b=Object.keys(n)[0],x=n[b];g=u[b].getPixelForValue(x)+p-t}else n==="center"?g=(c.bottom+c.top)/2+p-t:g=Ja(e,n,t);d=a-o}else{if(H(n)){let b=Object.keys(n)[0],x=n[b];f=u[b].getPixelForValue(x)-m+t}else n==="center"?f=(c.left+c.right)/2-m+t:f=Ja(e,n,t);g=ut(s,r,i),h=n==="left"?-at:at}return{titleX:f,titleY:g,maxWidth:d,rotation:h}}var Ie=class e extends Ct{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:s,_suggestedMax:i}=this;return t=ct(t,Number.POSITIVE_INFINITY),n=ct(n,Number.NEGATIVE_INFINITY),s=ct(s,Number.POSITIVE_INFINITY),i=ct(i,Number.NEGATIVE_INFINITY),{min:ct(t,s),max:ct(n,i),minDefined:$(t),maxDefined:$(n)}}getMinMax(t){let{min:n,max:s,minDefined:i,maxDefined:o}=this.getUserBounds(),r;if(i&&o)return{min:n,max:s};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),i||(n=Math.min(n,r.min)),o||(s=Math.max(s,r.max));return n=o&&n>s?s:n,s=i&&n>s?n:s,{min:ct(n,ct(s,n)),max:ct(s,ct(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){z(this.options.beforeUpdate,[this])}update(t,n,s){let{beginAtZero:i,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,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=Ca(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?Qa(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=gf(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,s;this.isHorizontal()?(n=this.left,s=this.right):(n=this.top,s=this.bottom,t=!t),this._startPixel=n,this._endPixel=s,this._reversePixels=t,this._length=s-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){z(this.options.afterUpdate,[this])}beforeSetDimensions(){z(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){z(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),z(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){z(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let n=this.options.ticks,s,i,o;for(s=0,i=t.length;s<i;s++)o=t[s],o.label=z(n.callback,[o.value,s,t],this)}afterTickToLabelConversion(){z(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){z(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,n=t.ticks,s=Za(this.ticks.length,t.ticks.maxTicksLimit),i=n.minRotation||0,o=n.maxRotation,r=i,a,l,c;if(!this._isVisible()||!n.display||i>=o||s<=1||!this.isHorizontal()){this.labelRotation=i;return}let u=this._getLabelSizes(),h=u.widest.width,d=u.highest.height,f=pt(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),h+6>a&&(a=f/(s-(t.offset?.5:1)),l=this.maxHeight-zn(t.grid)-n.padding-tl(t.title,this.chart.options.font),c=Math.sqrt(h*h+d*d),r=Es(Math.min(Math.asin(pt((u.highest.height+6)/a,-1,1)),Math.asin(pt(l/c,-1,1))-Math.asin(pt(d/c,-1,1)))),r=Math.max(i,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){z(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){z(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:n,options:{ticks:s,title:i,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=tl(i,n.options.font);if(a?(t.width=this.maxWidth,t.height=zn(o)+l):(t.height=this.maxHeight,t.width=zn(o)+l),s.display&&this.ticks.length){let{first:c,last:u,widest:h,highest:d}=this._getLabelSizes(),f=s.padding*2,g=Bt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){let b=s.mirror?0:m*h.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{let b=s.mirror?0:p*h.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,u,m,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,s,i){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,f=0;l?c?(d=i*t.width,f=s*n.height):(d=s*t.height,f=i*n.width):o==="start"?f=n.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=n.width/2),this.paddingLeft=Math.max((d-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-h+r)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=n.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){z(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,s;for(n=0,s=t.length;n<s;n++)W(t[n].label)&&(t.splice(n,1),s--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let n=this.options.ticks.sampleSize,s=this.ticks;n<s.length&&(s=Qa(s,n)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,s){let{ctx:i,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(n/Za(n,s)),c=0,u=0,h,d,f,g,p,m,b,x,v,y,_;for(h=0;h<n;h+=l){if(g=t[h].label,p=this._resolveTickFontOptions(h),i.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},x=p.lineHeight,v=y=0,!W(g)&&!U(g))v=En(i,b.data,b.gc,v,g),y=x;else if(U(g))for(d=0,f=g.length;d<f;++d)_=g[d],!W(_)&&!U(_)&&(v=En(i,b.data,b.gc,v,_),y+=x);r.push(v),a.push(y),c=Math.max(v,c),u=Math.max(y,u)}Sf(o,n);let w=r.indexOf(c),M=a.indexOf(u),S=L=>({width:r[L]||0,height:a[L]||0});return{first:S(0),last:S(n-1),widest:S(w),highest:S(M),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){let n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let n=this._startPixel+t*this._length;return da(this._alignToPixels?ne(this.chart,n,0):n)}getDecimalForPixel(t){let n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){let n=this.ticks||[];if(t>=0&&t<n.length){let s=n[t];return s.$context||(s.$context=Tf(this.getContext(),t,s))}return this.$context||(this.$context=Mf(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,n=Bt(this.labelRotation),s=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*i?a/s:l/i:l*i<a*s?l/s:a/i}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let n=this.axis,s=this.chart,i=this.options,{grid:o,position:r,border:a}=i,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=zn(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(Y){return ne(s,Y,p)},x,v,y,_,w,M,S,L,I,R,k,P;if(r==="top")x=b(this.bottom),M=this.bottom-d,L=x-m,R=b(t.top)+m,P=t.bottom;else if(r==="bottom")x=b(this.top),R=t.top,P=b(t.bottom)-m,M=x+m,L=this.top+d;else if(r==="left")x=b(this.right),w=this.right-d,S=x-m,I=b(t.left)+m,k=t.right;else if(r==="right")x=b(this.left),I=t.left,k=b(t.right)-m,w=x+m,S=this.left+d;else if(n==="x"){if(r==="center")x=b((t.top+t.bottom)/2+.5);else if(H(r)){let Y=Object.keys(r)[0],tt=r[Y];x=b(this.chart.scales[Y].getPixelForValue(tt))}R=t.top,P=t.bottom,M=x+m,L=M+d}else if(n==="y"){if(r==="center")x=b((t.left+t.right)/2);else if(H(r)){let Y=Object.keys(r)[0],tt=r[Y];x=b(this.chart.scales[Y].getPixelForValue(tt))}w=x-m,S=w-d,I=t.left,k=t.right}let j=D(i.ticks.maxTicksLimit,h),F=Math.max(1,Math.ceil(h/j));for(v=0;v<h;v+=F){let Y=this.getContext(v),tt=o.setContext(Y),Gt=a.setContext(Y),ye=tt.lineWidth,Ye=tt.color,gs=Gt.dash||[],$e=Gt.dashOffset,wn=tt.tickWidth,ve=tt.tickColor,kn=tt.tickBorderDash||[],we=tt.tickBorderDashOffset;y=kf(this,v,l),y!==void 0&&(_=ne(s,y,ye),c?w=S=I=k=_:M=L=R=P=_,f.push({tx1:w,ty1:M,tx2:S,ty2:L,x1:I,y1:R,x2:k,y2:P,width:ye,color:Ye,borderDash:gs,borderDashOffset:$e,tickWidth:wn,tickColor:ve,tickBorderDash:kn,tickBorderDashOffset:we}))}return this._ticksLength=h,this._borderValue=x,f}_computeLabelItems(t){let n=this.axis,s=this.options,{position:i,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:h}=o,d=zn(s.grid),f=d+u,g=h?-u:f,p=-Bt(this.labelRotation),m=[],b,x,v,y,_,w,M,S,L,I,R,k,P="middle";if(i==="top")w=this.bottom-g,M=this._getXAxisLabelAlignment();else if(i==="bottom")w=this.top+g,M=this._getXAxisLabelAlignment();else if(i==="left"){let F=this._getYAxisLabelAlignment(d);M=F.textAlign,_=F.x}else if(i==="right"){let F=this._getYAxisLabelAlignment(d);M=F.textAlign,_=F.x}else if(n==="x"){if(i==="center")w=(t.top+t.bottom)/2+f;else if(H(i)){let F=Object.keys(i)[0],Y=i[F];w=this.chart.scales[F].getPixelForValue(Y)+f}M=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")_=(t.left+t.right)/2-f;else if(H(i)){let F=Object.keys(i)[0],Y=i[F];_=this.chart.scales[F].getPixelForValue(Y)}M=this._getYAxisLabelAlignment(d).textAlign}n==="y"&&(l==="start"?P="top":l==="end"&&(P="bottom"));let j=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){v=a[b],y=v.label;let F=o.setContext(this.getContext(b));S=this.getPixelForTick(b)+o.labelOffset,L=this._resolveTickFontOptions(b),I=L.lineHeight,R=U(y)?y.length:1;let Y=R/2,tt=F.color,Gt=F.textStrokeColor,ye=F.textStrokeWidth,Ye=M;r?(_=S,M==="inner"&&(b===x-1?Ye=this.options.reverse?"left":"right":b===0?Ye=this.options.reverse?"right":"left":Ye="center"),i==="top"?c==="near"||p!==0?k=-R*I+I/2:c==="center"?k=-j.highest.height/2-Y*I+I:k=-j.highest.height+I/2:c==="near"||p!==0?k=I/2:c==="center"?k=j.highest.height/2-Y*I:k=j.highest.height-R*I,h&&(k*=-1),p!==0&&!F.showLabelBackdrop&&(_+=I/2*Math.sin(p))):(w=S,k=(1-R)*I/2);let gs;if(F.showLabelBackdrop){let $e=nt(F.backdropPadding),wn=j.heights[b],ve=j.widths[b],kn=k-$e.top,we=0-$e.left;switch(P){case"middle":kn-=wn/2;break;case"bottom":kn-=wn;break}switch(M){case"center":we-=ve/2;break;case"right":we-=ve;break;case"inner":b===x-1?we-=ve:b>0&&(we-=ve/2);break}gs={left:we,top:kn,width:ve+$e.width,height:wn+$e.height,color:F.backdropColor}}m.push({label:y,font:L,textOffset:k,options:{rotation:p,color:tt,strokeColor:Gt,strokeWidth:ye,textAlign:Ye,textBaseline:P,translation:[_,w],backdrop:gs}})}return m}_getXAxisLabelAlignment(){let{position:t,ticks:n}=this.options;if(-Bt(this.labelRotation))return t==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){let{position:n,ticks:{crossAlign:s,mirror:i,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width,c,u;return n==="left"?i?(u=this.right+o,s==="near"?c="left":s==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,s==="near"?c="right":s==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?i?(u=this.left+o,s==="near"?c="right":s==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,s==="near"?c="left":s==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:n},left:s,top:i,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(s,i,o,r),t.restore())}getLineWidthForValue(t){let n=this.options.grid;if(!this._isVisible()||!n.display)return 0;let i=this.ticks.findIndex(o=>o.value===t);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){let n=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,r,a=(l,c,u)=>{!u.width||!u.color||(s.save(),s.lineWidth=u.width,s.strokeStyle=u.color,s.setLineDash(u.borderDash||[]),s.lineDashOffset=u.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(n.display)for(o=0,r=i.length;o<r;++o){let l=i[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:n,options:{border:s,grid:i}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;let a=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,u,h,d;this.isHorizontal()?(c=ne(t,this.left,r)-r/2,u=ne(t,this.right,a)+a/2,h=d=l):(h=ne(t,this.top,r)-r/2,d=ne(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,h),n.lineTo(u,d),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;let s=this.ctx,i=this._computeLabelArea();i&&Dn(s,i);let o=this.getLabelItems(t);for(let r of o){let a=r.options,l=r.font,c=r.label,u=r.textOffset;Ee(s,c,0,u,l,a)}i&&On(s)}drawTitle(){let{ctx:t,options:{position:n,title:s,reverse:i}}=this;if(!s.display)return;let o=Z(s.font),r=nt(s.padding),a=s.align,l=o.lineHeight/2;n==="bottom"||n==="center"||H(n)?(l+=r.bottom,U(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;let{titleX:c,titleY:u,maxWidth:h,rotation:d}=Ef(this,l,n,a);Ee(t,s.text,0,0,o,{color:s.color,maxWidth:h,rotation:d,textAlign:Cf(a,n,i),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,n=t.ticks&&t.ticks.z||0,s=D(t.grid&&t.grid.z,-1),i=D(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",i=[],o,r;for(o=0,r=n.length;o<r;++o){let a=n[o];a[s]===this.id&&(!t||a.type===t)&&i.push(a)}return i}_resolveTickFontOptions(t){let n=this.options.ticks.setContext(this.getContext(t));return Z(n.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},nn=class{constructor(t,n,s){this.type=t,this.scope=n,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let n=Object.getPrototypeOf(t),s;Rf(n)&&(s=this.register(n));let i=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in i||(i[o]=t,Lf(t,r,s),this.override&&K.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){let n=this.items,s=t.id,i=this.scope;s in n&&delete n[s],i&&s in K[i]&&(delete K[i][s],this.override&&delete ee[s])}};function Lf(e,t,n){let s=Ge(Object.create(null),[n?K.get(n):{},K.get(t),e.defaults]);K.set(t,s),e.defaultRoutes&&Pf(t,e.defaultRoutes),e.descriptors&&K.describe(t,e.descriptors)}function Pf(e,t){Object.keys(t).forEach(n=>{let s=n.split("."),i=s.pop(),o=[e].concat(s).join("."),r=t[n].split("."),a=r.pop(),l=r.join(".");K.route(o,i,l,a)})}function Rf(e){return"id"in e&&"defaults"in e}var wo=class{constructor(){this.controllers=new nn(De,"datasets",!0),this.elements=new nn(Ct,"elements"),this.plugins=new nn(Object,"plugins"),this.scales=new nn(Ie,"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,n,s){[...n].forEach(i=>{let o=s||this._getRegistryForType(i);s||o.isForType(i)||o===this.plugins&&i.id?this._exec(t,o,i):B(i,r=>{let a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,s){let i=Cs(t);z(s["before"+i],[],s),n[t](s),z(s["after"+i],[],s)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){let s=this._typedRegistries[n];if(s.isForType(t))return s}return this.plugins}_get(t,n,s){let i=n.get(t);if(i===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return i}},Tt=new wo,ko=class{constructor(){this._init=[]}notify(t,n,s,i){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));let o=i?this._descriptors(t).filter(i):this._descriptors(t),r=this._notify(o,t,n,s);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,s,i){i=i||{};for(let o of t){let r=o.plugin,a=r[s],l=[n,i,o.options];if(z(a,l,r)===!1&&i.cancelable)return!1}return!0}invalidate(){W(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){let s=t&&t.config,i=D(s.options&&s.options.plugins,{}),o=Af(s);return i===!1&&!n?[]:Of(t,o,i,n)}_notifyStateChanges(t){let n=this._oldCache||[],s=this._cache,i=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(i(n,s),t,"stop"),this._notify(i(s,n),t,"start")}};function Af(e){let t={},n=[],s=Object.keys(Tt.plugins.items);for(let o=0;o<s.length;o++)n.push(Tt.getPlugin(s[o]));let i=e.plugins||[];for(let o=0;o<i.length;o++){let r=i[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function Df(e,t){return!t&&e===!1?null:e===!0?{}:e}function Of(e,{plugins:t,localIds:n},s,i){let o=[],r=e.getContext();for(let a of t){let l=a.id,c=Df(s[l],i);c!==null&&o.push({plugin:a,options:Hf(e.config,{plugin:a,local:n[l]},c,r)})}return o}function Hf(e,{plugin:t,local:n},s,i){let o=e.pluginScopeKeys(t),r=e.getOptionScopes(s,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function So(e,t){let n=K.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function If(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Ff(e,t){return e===t?"_index_":"_value_"}function el(e){if(e==="x"||e==="y"||e==="r")return e}function Bf(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Mo(e,...t){if(el(e))return e;for(let n of t){let s=n.axis||Bf(n.position)||e.length>1&&el(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function nl(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Nf(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(n.length)return nl(e,"x",n[0])||nl(e,"y",n[0])}return{}}function zf(e,t){let n=ee[e.type]||{scales:{}},s=t.scales||{},i=So(e.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{let a=s[r];if(!H(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=Mo(r,a,Nf(r,e),K.scales[a.type]),c=Ff(l,i),u=n.scales||{};o[r]=Ze(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,l=r.indexAxis||So(a,t),u=(ee[a]||{}).scales||{};Object.keys(u).forEach(h=>{let d=If(h,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),Ze(o[f],[{axis:d},s[f],u[h]])})}),Object.keys(o).forEach(r=>{let a=o[r];Ze(a,[K.scales[a.type],K.scale])}),o}function Fl(e){let t=e.options||(e.options={});t.plugins=D(t.plugins,{}),t.scales=zf(e,t)}function Bl(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Vf(e){return e=e||{},e.data=Bl(e.data),Fl(e),e}var sl=new Map,Nl=new Set;function Ns(e,t){let n=sl.get(e);return n||(n=t(),sl.set(e,n),Nl.add(n)),n}var Vn=(e,t,n)=>{let s=Pn(t,n);s!==void 0&&e.add(s)},To=class{constructor(t){this._config=Vf(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=Bl(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Fl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ns(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Ns(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Ns(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){let n=t.id,s=this.type;return Ns(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){let s=this._scopeCache,i=s.get(t);return(!i||n)&&(i=new Map,s.set(t,i)),i}getOptionScopes(t,n,s){let{options:i,type:o}=this,r=this._cachedScopes(t,s),a=r.get(n);if(a)return a;let l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(h=>Vn(l,t,h))),u.forEach(h=>Vn(l,i,h)),u.forEach(h=>Vn(l,ee[o]||{},h)),u.forEach(h=>Vn(l,K,h)),u.forEach(h=>Vn(l,Rs,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Nl.has(n)&&r.set(n,c),c}chartOptionScopes(){let{options:t,type:n}=this;return[t,ee[n]||{},K.datasets[n]||{},{type:n},K,Rs]}resolveNamedOptions(t,n,s,i=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=il(this._resolverCache,t,i),l=r;if(jf(r,n)){o.$shared=!1,s=It(s)?s():s;let c=this.createResolver(t,s,a);l=Te(r,s,c)}for(let c of n)o[c]=l[c];return o}createResolver(t,n,s=[""],i){let{resolver:o}=il(this._resolverCache,t,s);return H(n)?Te(o,n,void 0,i):o}};function il(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));let i=n.join(),o=s.get(i);return o||(o={resolver:Ds(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(i,o)),o}var Wf=e=>H(e)&&Object.getOwnPropertyNames(e).some(t=>It(e[t]));function jf(e,t){let{isScriptable:n,isIndexable:s}=to(e);for(let i of t){let o=n(i),r=s(i),a=(r||o)&&e[i];if(o&&(It(a)||Wf(a))||r&&U(a))return!0}return!1}var Uf="4.4.7",qf=["top","bottom","left","right","chartArea"];function ol(e,t){return e==="top"||e==="bottom"||qf.indexOf(e)===-1&&t==="x"}function rl(e,t){return function(n,s){return n[e]===s[e]?n[t]-s[t]:n[e]-s[e]}}function al(e){let t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),z(n&&n.onComplete,[e],t)}function Yf(e){let t=e.chart,n=t.options.animation;z(n&&n.onProgress,[e],t)}function zl(e){return Os()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var Ys={},ll=e=>{let t=zl(e);return Object.values(Ys).filter(n=>n.canvas===t).pop()};function $f(e,t,n){let s=Object.keys(e);for(let i of s){let o=+i;if(o>=t){let r=e[i];delete e[i],(n>0||o>t)&&(e[o+n]=r)}}}function Kf(e,t,n,s){return!n||e.type==="mouseout"?null:s?t:e}function zs(e,t,n){return e.options.clip?e[n]:t[n]}function Xf(e,t){let{xScale:n,yScale:s}=e;return n&&s?{left:zs(n,t,"left"),right:zs(n,t,"right"),top:zs(s,t,"top"),bottom:zs(s,t,"bottom")}:t}var it=class{static register(...t){Tt.add(...t),cl()}static unregister(...t){Tt.remove(...t),cl()}constructor(t,n){let s=this.config=new To(n),i=zl(t),o=ll(i);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.");let r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||mf(i)),this.platform.updateConfig(s);let a=this.platform.acquireContext(i,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=oa(),this.ctx=a,this.canvas=l,this.width=u,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 ko,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=_a(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],Ys[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}zt.listen(this,"complete",al),zt.listen(this,"progress",Yf),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:i,_aspectRatio:o}=this;return W(t)?n&&o?o:i?s/i: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 Tt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():so(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ji(this.canvas,this.ctx),this}stop(){return zt.stop(this),this}resize(t,n){zt.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){let s=this.options,i=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(i,t,n,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,so(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),z(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let n=this.options.scales||{};B(n,(s,i)=>{s.id=i})}buildOrUpdateScales(){let t=this.options,n=t.scales,s=this.scales,i=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{}),o=[];n&&(o=o.concat(Object.keys(n).map(r=>{let a=n[r],l=Mo(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),B(o,r=>{let a=r.options,l=a.id,c=Mo(l,a),u=D(a.type,r.dtype);(a.position===void 0||ol(a.position,c)!==ol(r.dposition))&&(a.position=r.dposition),i[l]=!0;let h=null;if(l in s&&s[l].type===u)h=s[l];else{let d=Tt.getScale(u);h=new d({id:l,type:u,ctx:this.ctx,chart:this}),s[h.id]=h}h.init(a,t)}),B(i,(r,a)=>{r||delete s[a]}),B(s,r=>{ie.configure(this,r,r.options),ie.addBox(this,r)})}_updateMetasets(){let t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((i,o)=>i.index-o.index),s>n){for(let i=n;i<s;++i)this._destroyDatasetMeta(i);t.splice(n,s-n)}this._sortedMetasets=t.slice(0).sort(rl("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((s,i)=>{n.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t=[],n=this.data.datasets,s,i;for(this._removeUnreferencedMetasets(),s=0,i=n.length;s<i;s++){let o=n[s],r=this.getDatasetMeta(s),a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||So(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{let l=Tt.getController(a),{datasetElementType:c,dataElementType:u}=K.datasets[a];Object.assign(l,{dataElementType:Tt.getElement(u),datasetElementType:c&&Tt.getElement(c)}),r.controller=new l(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){B(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let n=this.config;n.update();let s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c<u;c++){let{controller:h}=this.getDatasetMeta(c),d=!i&&o.indexOf(h)===-1;h.buildOrUpdateElements(d),r=Math.max(+h.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),i||B(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(rl("z","_idx"));let{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){B(this.scales,t=>{ie.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!zi(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(let{method:s,start:i,count:o}of n){let r=s==="_removeElements"?-o:o;$f(t,i,r)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let n=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),i=s(0);for(let o=1;o<n;o++)if(!zi(i,s(o)))return;return Array.from(i).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ie.update(this,this.width,this.height,t);let n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],B(this.boxes,i=>{s&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,It(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){let s=this.getDatasetMeta(t),i={meta:s,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(s.controller._update(n),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(zt.has(this)?this.attached&&!zt.running(this)&&zt.start(this):(this.draw(),al({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:s,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let n=this._sortedMetasets,s=[],i,o;for(i=0,o=n.length;i<o;++i){let r=n[i];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let n=this.ctx,s=t._clip,i=!s.disabled,o=Xf(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(i&&Dn(n,{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(),i&&On(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return kt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,i){let o=Xd.modes[n];return typeof o=="function"?o(this,t,s,i):[]}getDatasetMeta(t){let n=this.data.datasets[t],s=this._metasets,i=s.filter(o=>o&&o._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},s.push(i)),i}getContext(){return this.$context||(this.$context=Nt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let n=this.data.datasets[t];if(!n)return!1;let s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){let s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){let i=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,i);Rn(n)?(o.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?i:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){let n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),zt.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ji(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ys[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,n=this.platform,s=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},i=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};B(this.options.events,o=>s(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,n=this.platform,s=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},i=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},r,a=()=>{i("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){B(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},B(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){let i=s?"set":"remove",o,r,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];let c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[i+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let n=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{let a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Ln(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){let i=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(n,t),a=s?t:o(t,n);r.length&&this.updateHoverStyle(r,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(t,n){let s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},i=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,i)===!1)return;let o=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,i),(o||s.changed)&&this.render(),this}_handleEvent(t,n,s){let{_active:i=[],options:o}=this,r=n,a=this._getActiveElements(t,i,s,r),l=la(t),c=Kf(t,this._lastEvent,s,l);s&&(this._lastEvent=null,z(o.onHover,[t,a,this],this),l&&z(o.onClick,[t,a,this],this));let u=!Ln(a,i);return(u||n)&&(this._active=a,this._updateHoverStyles(a,i,n)),this._lastEvent=c,u}_getActiveElements(t,n,s,i){if(t.type==="mouseout")return[];if(!s)return n;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,i)}};E(it,"defaults",K),E(it,"instances",Ys),E(it,"overrides",ee),E(it,"registry",Tt),E(it,"version",Uf),E(it,"getChart",ll);function cl(){return B(it.instances,e=>e._plugins.invalidate())}function Vl(e,t,n=t){e.lineCap=D(n.borderCapStyle,t.borderCapStyle),e.setLineDash(D(n.borderDash,t.borderDash)),e.lineDashOffset=D(n.borderDashOffset,t.borderDashOffset),e.lineJoin=D(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=D(n.borderWidth,t.borderWidth),e.strokeStyle=D(n.borderColor,t.borderColor)}function Gf(e,t,n){e.lineTo(n.x,n.y)}function Jf(e){return e.stepped?Sa:e.tension||e.cubicInterpolationMode==="monotone"?Ma:Gf}function Wl(e,t,n={}){let s=e.length,{start:i=0,end:o=s-1}=n,{start:r,end:a}=t,l=Math.max(i,r),c=Math.min(o,a),u=i<r&&o<r||i>a&&o>a;return{count:s,start:l,loop:t.loop,ilen:c<l&&!u?s+c-l:c-l}}function Zf(e,t,n,s){let{points:i,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Wl(i,n,s),u=Jf(o),{move:h=!0,reverse:d}=s||{},f,g,p;for(f=0;f<=c;++f)g=i[(a+(d?c-f:f))%r],!g.skip&&(h?(e.moveTo(g.x,g.y),h=!1):u(e,p,g,d,o.stepped),p=g);return l&&(g=i[(a+(d?c:0))%r],u(e,p,g,d,o.stepped)),!!l}function Qf(e,t,n,s){let i=t.points,{count:o,start:r,ilen:a}=Wl(i,n,s),{move:l=!0,reverse:c}=s||{},u=0,h=0,d,f,g,p,m,b,x=y=>(r+(c?a-y:y))%o,v=()=>{p!==m&&(e.lineTo(u,m),e.lineTo(u,p),e.lineTo(u,b))};for(l&&(f=i[x(0)],e.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=i[x(d)],f.skip)continue;let y=f.x,_=f.y,w=y|0;w===g?(_<p?p=_:_>m&&(m=_),u=(h*u+y)/++h):(v(),e.lineTo(y,_),g=w,h=0,p=m=_),b=_}v()}function Co(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Qf:Zf}function tp(e){return e.stepped?Ha:e.tension||e.cubicInterpolationMode==="monotone"?Ia:Qt}function ep(e,t,n,s){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,s)&&i.closePath()),Vl(e,t.options),e.stroke(i)}function np(e,t,n,s){let{segments:i,options:o}=t,r=Co(t);for(let a of i)Vl(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+s-1})&&e.closePath(),e.stroke()}var sp=typeof Path2D=="function";function ip(e,t,n,s){sp&&!t.options.segment?ep(e,t,n,s):np(e,t,n,s)}var _t=class extends Ct{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,n){let s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){let i=s.spanGaps?this._loop:this._fullLoop;Aa(this._points,s,t,i,n),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=Ba(this,this.options.segment))}first(){let t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){let t=this.segments,n=this.points,s=t.length;return s&&n[t[s-1].end]}interpolate(t,n){let s=this.options,i=t[n],o=this.points,r=lo(this,{property:n,start:i,end:i});if(!r.length)return;let a=[],l=tp(s),c,u;for(c=0,u=r.length;c<u;++c){let{start:h,end:d}=r[c],f=o[h],g=o[d];if(f===g){a.push(f);continue}let p=Math.abs((i-f[n])/(g[n]-f[n])),m=l(f,g,p,s.stepped);m[n]=t[n],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,n,s){return Co(this)(t,this,n,s)}path(t,n,s){let i=this.segments,o=Co(this),r=this._loop;n=n||0,s=s||this.points.length-n;for(let a of i)r&=o(t,this,a,{start:n,end:n+s-1});return!!r}draw(t,n,s,i){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),ip(t,this,s,i),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};E(_t,"id","line"),E(_t,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),E(_t,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),E(_t,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function ul(e,t,n,s){let i=e.options,{[n]:o}=e.getProps([n],s);return Math.abs(t-o)<i.radius+i.hitRadius}var He=class extends Ct{constructor(n){super();E(this,"parsed");E(this,"skip");E(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,s,i){let o=this.options,{x:r,y:a}=this.getProps(["x","y"],i);return Math.pow(n-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(n,s){return ul(this,n,"x",s)}inYRange(n,s){return ul(this,n,"y",s)}getCenterPoint(n){let{x:s,y:i}=this.getProps(["x","y"],n);return{x:s,y:i}}size(n){n=n||this.options||{};let s=n.radius||0;s=Math.max(s,s&&n.hoverRadius||0);let i=s&&n.borderWidth||0;return(s+i)*2}draw(n,s){let i=this.options;this.skip||i.radius<.1||!kt(this,s,this.size(i)/2)||(n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.fillStyle=i.backgroundColor,As(n,i,this.x,this.y))}getRange(){let n=this.options||{};return n.radius+n.hitRadius}};E(He,"id","point"),E(He,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),E(He,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function op(e,t,n){let s=e.segments,i=e.points,o=t.points,r=[];for(let a of s){let{start:l,end:c}=a;c=Po(l,c,i);let u=Eo(n,i[l],i[c],a.loop);if(!t.segments){r.push({source:a,target:u,start:i[l],end:i[c]});continue}let h=lo(t,u);for(let d of h){let f=Eo(n,o[d.start],o[d.end],d.loop),g=ao(a,i,f);for(let p of g)r.push({source:p,target:d,start:{[n]:hl(u,f,"start",Math.max)},end:{[n]:hl(u,f,"end",Math.min)}})}}return r}function Eo(e,t,n,s){if(s)return;let i=t[e],o=n[e];return e==="angle"&&(i=rt(i),o=rt(o)),{property:e,start:i,end:o}}function rp(e,t){let{x:n=null,y:s=null}=e||{},i=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Po(r,a,i);let l=i[r],c=i[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:c.y}))}),o}function Po(e,t,n){for(;t>e;t--){let s=n[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function hl(e,t,n,s){return e&&t?s(e[n],t[n]):e?e[n]:t?t[n]:0}function jl(e,t){let n=[],s=!1;return U(e)?(s=!0,n=e):n=rp(e,t),n.length?new _t({points:n,options:{tension:0},_loop:s,_fullLoop:s}):null}function dl(e){return e&&e.fill!==!1}function ap(e,t,n){let i=e[t].fill,o=[t],r;if(!n)return i;for(;i!==!1&&o.indexOf(i)===-1;){if(!$(i))return i;if(r=e[i],!r)return!1;if(r.visible)return i;o.push(i),i=r.fill}return!1}function lp(e,t,n){let s=dp(e);if(H(s))return isNaN(s.value)?!1:s;let i=parseFloat(s);return $(i)&&Math.floor(i)===i?cp(s[0],t,i,n):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function cp(e,t,n,s){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=s?!1:n}function up(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:H(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function hp(e,t,n){let s;return e==="start"?s=n:e==="end"?s=t.options.reverse?t.min:t.max:H(e)?s=e.value:s=t.getBaseValue(),s}function dp(e){let t=e.options,n=t.fill,s=D(n&&n.target,n);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function fp(e){let{scale:t,index:n,line:s}=e,i=[],o=s.segments,r=s.points,a=pp(t,n);a.push(jl({x:null,y:t.bottom},s));for(let l=0;l<o.length;l++){let c=o[l];for(let u=c.start;u<=c.end;u++)mp(i,r[u],a)}return new _t({points:i,options:{}})}function pp(e,t){let n=[],s=e.getMatchingVisibleMetas("line");for(let i=0;i<s.length;i++){let o=s[i];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function mp(e,t,n){let s=[];for(let i=0;i<n.length;i++){let o=n[i],{first:r,last:a,point:l}=gp(o,t,"x");if(!(!l||r&&a)){if(r)s.unshift(l);else if(e.push(l),!a)break}}e.push(...s)}function gp(e,t,n){let s=e.interpolate(t,n);if(!s)return{};let i=s[n],o=e.segments,r=e.points,a=!1,l=!1;for(let c=0;c<o.length;c++){let u=o[c],h=r[u.start][n],d=r[u.end][n];if(Ce(i,h,d)){a=i===h,l=i===d;break}}return{first:a,last:l,point:s}}var Gs=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,s){let{x:i,y:o,radius:r}=this;return n=n||{start:0,end:lt},t.arc(i,o,r,n.end,n.start,!0),!s.bounds}interpolate(t){let{x:n,y:s,radius:i}=this,o=t.angle;return{x:n+Math.cos(o)*i,y:s+Math.sin(o)*i,angle:o}}};function bp(e){let{chart:t,fill:n,line:s}=e;if($(n))return _p(t,n);if(n==="stack")return fp(e);if(n==="shape")return!0;let i=xp(e);return i instanceof Gs?i:jl(i,s)}function _p(e,t){let n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function xp(e){return(e.scale||{}).getPointPositionForValue?vp(e):yp(e)}function yp(e){let{scale:t={},fill:n}=e,s=up(n,t);if($(s)){let i=t.isHorizontal();return{x:i?s:null,y:i?null:s}}return null}function vp(e){let{scale:t,fill:n}=e,s=t.options,i=t.getLabels().length,o=s.reverse?t.max:t.min,r=hp(n,t,o),a=[];if(s.grid.circular){let l=t.getPointPositionForValue(0,o);return new Gs({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<i;++l)a.push(t.getPointPositionForValue(l,r));return a}function go(e,t,n){let s=bp(t),{line:i,scale:o,axis:r}=t,a=i.options,l=a.fill,c=a.backgroundColor,{above:u=c,below:h=c}=l||{};s&&i.points.length&&(Dn(e,n),wp(e,{line:i,target:s,above:u,below:h,area:n,scale:o,axis:r}),On(e))}function wp(e,t){let{line:n,target:s,above:i,below:o,area:r,scale:a}=t,l=n._loop?"angle":t.axis;e.save(),l==="x"&&o!==i&&(fl(e,s,r.top),pl(e,{line:n,target:s,color:i,scale:a,property:l}),e.restore(),e.save(),fl(e,s,r.bottom)),pl(e,{line:n,target:s,color:o,scale:a,property:l}),e.restore()}function fl(e,t,n){let{segments:s,points:i}=t,o=!0,r=!1;e.beginPath();for(let a of s){let{start:l,end:c}=a,u=i[l],h=i[Po(l,c,i)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),r=!!t.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function pl(e,t){let{line:n,target:s,property:i,color:o,scale:r}=t,a=op(n,s,i);for(let{source:l,target:c,start:u,end:h}of a){let{style:{backgroundColor:d=o}={}}=l,f=s!==!0;e.save(),e.fillStyle=d,kp(e,r,f&&Eo(i,u,h)),e.beginPath();let g=!!n.pathSegment(e,l),p;if(f){g?e.closePath():ml(e,s,h,i);let m=!!s.pathSegment(e,c,{move:g,reverse:!0});p=g&&m,p||ml(e,s,u,i)}e.closePath(),e.fill(p?"evenodd":"nonzero"),e.restore()}}function kp(e,t,n){let{top:s,bottom:i}=t.chart.chartArea,{property:o,start:r,end:a}=n||{};o==="x"&&(e.beginPath(),e.rect(r,s,a-r,i-s),e.clip())}function ml(e,t,n,s){let i=t.interpolate(n,s);i&&e.lineTo(i.x,i.y)}var Ul={id:"filler",afterDatasetsUpdate(e,t,n){let s=(e.data.datasets||[]).length,i=[],o,r,a,l;for(r=0;r<s;++r)o=e.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof _t&&(l={visible:e.isDatasetVisible(r),index:r,fill:lp(a,r,s),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,i.push(l);for(r=0;r<s;++r)l=i[r],!(!l||l.fill===!1)&&(l.fill=ap(i,r,n.propagate))},beforeDraw(e,t,n){let s=n.drawTime==="beforeDraw",i=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=i.length-1;r>=0;--r){let a=i[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&go(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;let s=e.getSortedVisibleDatasetMetas();for(let i=s.length-1;i>=0;--i){let o=s[i].$filler;dl(o)&&go(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){let s=t.meta.$filler;!dl(s)||n.drawTime!=="beforeDatasetDraw"||go(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},gl=(e,t)=>{let{boxHeight:n=t,boxWidth:s=t}=e;return e.usePointStyle&&(n=Math.min(n,t),s=e.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:n,itemHeight:Math.max(t,n)}},Sp=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,Js=class extends Ct{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,n,s){this.maxWidth=t,this.maxHeight=n,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(){let t=this.options.labels||{},n=z(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(s=>t.filter(s,this.chart.data))),t.sort&&(n=n.sort((s,i)=>t.sort(s,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){let{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}let s=t.labels,i=Z(s.font),o=i.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=gl(s,o),c,u;n.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,i,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,s,i){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+a,h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-u;return this.legendItems.forEach((g,p)=>{let m=s+n/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(h+=u,c[c.length-(p>0?0:1)]=0,f+=u,d++),l[p]={left:0,top:f,row:d,width:m,height:i},c[c.length-1]+=m+a}),h}_fitCols(t,n,s,i){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t,h=a,d=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:x,itemHeight:v}=Mp(s,n,o,m,i);b>0&&f+v+2*a>u&&(h+=d+a,c.push({width:d,height:f}),g+=d+a,p++,d=f=0),l[b]={left:g,top:f,col:p,width:x,height:v},d=Math.max(d,x),f+=v+a}),h+=d,c.push({width:d,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:s,labels:{padding:i},rtl:o}}=this,r=Pe(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ut(s,this.left+i,this.right-this.lineWidths[a]);for(let c of n)a!==c.row&&(a=c.row,l=ut(s,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+t+i,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+i}else{let a=0,l=ut(s,this.top+t+i,this.bottom-this.columnSizes[a].height);for(let c of n)c.col!==a&&(a=c.col,l=ut(s,this.top+t+i,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+i,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Dn(t,this),this._draw(),On(t)}}_draw(){let{options:t,columnSizes:n,lineWidths:s,ctx:i}=this,{align:o,labels:r}=t,a=K.color,l=Pe(t.rtl,this.left,this.width),c=Z(r.font),{padding:u}=r,h=c.size,d=h/2,f;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;let{boxWidth:g,boxHeight:p,itemHeight:m}=gl(r,h),b=function(w,M,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;i.save();let L=D(S.lineWidth,1);if(i.fillStyle=D(S.fillStyle,a),i.lineCap=D(S.lineCap,"butt"),i.lineDashOffset=D(S.lineDashOffset,0),i.lineJoin=D(S.lineJoin,"miter"),i.lineWidth=L,i.strokeStyle=D(S.strokeStyle,a),i.setLineDash(D(S.lineDash,[])),r.usePointStyle){let I={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:L},R=l.xPlus(w,g/2),k=M+d;Zi(i,I,R,k,r.pointStyleWidth&&g)}else{let I=M+Math.max((h-p)/2,0),R=l.leftForLtr(w,g),k=Le(S.borderRadius);i.beginPath(),Object.values(k).some(P=>P!==0)?Hn(i,{x:R,y:I,w:g,h:p,radius:k}):i.rect(R,I,g,p),i.fill(),L!==0&&i.stroke()}i.restore()},x=function(w,M,S){Ee(i,S.text,w,M+m/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?f={x:ut(o,this.left+u,this.right-s[0]),y:this.top+u+y,line:0}:f={x:this.left+u,y:ut(o,this.top+y+u,this.bottom-n[0].height),line:0},oo(this.ctx,t.textDirection);let _=m+u;this.legendItems.forEach((w,M)=>{i.strokeStyle=w.fontColor,i.fillStyle=w.fontColor;let S=i.measureText(w.text).width,L=l.textAlign(w.textAlign||(w.textAlign=r.textAlign)),I=g+d+S,R=f.x,k=f.y;l.setWidth(this.width),v?M>0&&R+I+u>this.right&&(k=f.y+=_,f.line++,R=f.x=ut(o,this.left+u,this.right-s[f.line])):M>0&&k+_>this.bottom&&(R=f.x=R+n[f.line].width+u,f.line++,k=f.y=ut(o,this.top+y+u,this.bottom-n[f.line].height));let P=l.x(R);if(b(P,k,w),R=xa(L,R+g+d,v?R+I:this.right,t.rtl),x(l.x(R),k,w),v)f.x+=I+u;else if(typeof w.text!="string"){let j=c.lineHeight;f.y+=ql(w,j)+u}else f.y+=_}),ro(this.ctx,t.textDirection)}drawTitle(){let t=this.options,n=t.title,s=Z(n.font),i=nt(n.padding);if(!n.display)return;let o=Pe(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=s.size/2,c=i.top+l,u,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,h=ut(t.align,h,this.right-d);else{let g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);u=c+ut(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}let f=ut(a,h,h+d);r.textAlign=o.textAlign(Ki(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=s.string,Ee(r,n.text,f,u,s)}_computeTitleHeight(){let t=this.options.title,n=Z(t.font),s=nt(t.padding);return t.display?n.lineHeight+s.height:0}_getLegendItemAt(t,n){let s,i,o;if(Ce(t,this.left,this.right)&&Ce(n,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(i=o[s],Ce(t,i.left,i.left+i.width)&&Ce(n,i.top,i.top+i.height))return this.legendItems[s]}return null}handleEvent(t){let n=this.options;if(!Ep(t.type,n))return;let s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let i=this._hoveredItem,o=Sp(i,s);i&&!o&&z(n.onLeave,[t,i,this],this),this._hoveredItem=s,s&&!o&&z(n.onHover,[t,s,this],this)}else s&&z(n.onClick,[t,s,this],this)}};function Mp(e,t,n,s,i){let o=Tp(s,e,t,n),r=Cp(i,s,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Tp(e,t,n,s){let i=e.text;return i&&typeof i!="string"&&(i=i.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+s.measureText(i).width}function Cp(e,t,n){let s=e;return typeof t.text!="string"&&(s=ql(t,n)),s}function ql(e,t){let n=e.text?e.text.length:0;return t*n}function Ep(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Yl={id:"legend",_element:Js,start(e,t,n){let s=e.legend=new Js({ctx:e.ctx,options:n,chart:e});ie.configure(e,s,n),ie.addBox(e,s)},stop(e){ie.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let s=e.legend;ie.configure(e,s,n),s.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let s=t.datasetIndex,i=n.chart;i.isDatasetVisible(s)?(i.hide(s),t.hidden=!0):(i.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:i,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(n?0:void 0),u=nt(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:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};var jn={average(e){if(!e.length)return!1;let t,n,s=new Set,i=0,o=0;for(t=0,n=e.length;t<n;++t){let a=e[t].element;if(a&&a.hasValue()){let l=a.tooltipPosition();s.add(l.x),i+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:i/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,s=t.y,i=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){let l=e[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),u=Ms(t,c);u<i&&(i=u,a=l)}}if(a){let l=a.tooltipPosition();n=l.x,s=l.y}return{x:n,y:s}}};function Mt(e,t){return t&&(U(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Vt(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
`)>-1?e.split(`
`):e}function Lp(e,t){let{element:n,datasetIndex:s,index:i}=t,o=e.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(i);return{chart:e,label:r,parsed:o.getParsed(i),raw:e.data.datasets[s].data[i],formattedValue:a,dataset:o.getDataset(),dataIndex:i,datasetIndex:s,element:n}}function bl(e,t){let n=e.chart.ctx,{body:s,footer:i,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=Z(t.bodyFont),c=Z(t.titleFont),u=Z(t.footerFont),h=o.length,d=i.length,f=s.length,g=nt(t.padding),p=g.height,m=0,b=s.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){let y=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*y+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let x=0,v=function(y){m=Math.max(m,n.measureText(y).width+x)};return n.save(),n.font=c.string,B(e.title,v),n.font=l.string,B(e.beforeBody.concat(e.afterBody),v),x=t.displayColors?r+2+t.boxPadding:0,B(s,y=>{B(y.before,v),B(y.lines,v),B(y.after,v)}),x=0,n.font=u.string,B(e.footer,v),n.restore(),m+=g.width,{width:m,height:p}}function Pp(e,t){let{y:n,height:s}=t;return n<s/2?"top":n>e.height-s/2?"bottom":"center"}function Rp(e,t,n,s){let{x:i,width:o}=s,r=n.caretSize+n.caretPadding;if(e==="left"&&i+o+r>t.width||e==="right"&&i-o-r<0)return!0}function Ap(e,t,n,s){let{x:i,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e,c="center";return s==="center"?c=i<=(a+l)/2?"left":"right":i<=o/2?c="left":i>=r-o/2&&(c="right"),Rp(c,e,t,n)&&(c="center"),c}function _l(e,t,n){let s=n.yAlign||t.yAlign||Pp(e,n);return{xAlign:n.xAlign||t.xAlign||Ap(e,t,n,s),yAlign:s}}function Dp(e,t){let{x:n,width:s}=e;return t==="right"?n-=s:t==="center"&&(n-=s/2),n}function Op(e,t,n){let{y:s,height:i}=e;return t==="top"?s+=n:t==="bottom"?s-=i+n:s-=i/2,s}function xl(e,t,n,s){let{caretSize:i,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=i+o,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:f}=Le(r),g=Dp(t,a),p=Op(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(u,d)+i:a==="right"&&(g+=Math.max(h,f)+i),{x:pt(g,0,s.width-t.width),y:pt(p,0,s.height-t.height)}}function Vs(e,t,n){let s=nt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-s.right:e.x+s.left}function yl(e){return Mt([],Vt(e))}function Hp(e,t,n){return Nt(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function vl(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var $l={beforeTitle:St,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,s=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return n[t.dataIndex]}return""},afterTitle:St,beforeBody:St,beforeLabel:St,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");let n=e.formattedValue;return W(n)||(t+=n),t},labelColor(e){let n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:St,afterBody:St,beforeFooter:St,footer:St,afterFooter:St};function ht(e,t,n,s){let i=e[t].call(n,s);return typeof i=="undefined"?$l[t].call(n,s):i}var Un=class extends Ct{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(){let t=this._cachedAnimations;if(t)return t;let n=this.chart,s=this.options.setContext(this.getContext()),i=s.enabled&&n.options.animation&&s.animations,o=new $s(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Hp(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){let{callbacks:s}=n,i=ht(s,"beforeTitle",this,t),o=ht(s,"title",this,t),r=ht(s,"afterTitle",this,t),a=[];return a=Mt(a,Vt(i)),a=Mt(a,Vt(o)),a=Mt(a,Vt(r)),a}getBeforeBody(t,n){return yl(ht(n.callbacks,"beforeBody",this,t))}getBody(t,n){let{callbacks:s}=n,i=[];return B(t,o=>{let r={before:[],lines:[],after:[]},a=vl(s,o);Mt(r.before,Vt(ht(a,"beforeLabel",this,o))),Mt(r.lines,ht(a,"label",this,o)),Mt(r.after,Vt(ht(a,"afterLabel",this,o))),i.push(r)}),i}getAfterBody(t,n){return yl(ht(n.callbacks,"afterBody",this,t))}getFooter(t,n){let{callbacks:s}=n,i=ht(s,"beforeFooter",this,t),o=ht(s,"footer",this,t),r=ht(s,"afterFooter",this,t),a=[];return a=Mt(a,Vt(i)),a=Mt(a,Vt(o)),a=Mt(a,Vt(r)),a}_createItems(t){let n=this._active,s=this.chart.data,i=[],o=[],r=[],a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(Lp(this.chart,n[l]));return t.filter&&(a=a.filter((u,h,d)=>t.filter(u,h,d,s))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,s))),B(a,u=>{let h=vl(t.callbacks,u);i.push(ht(h,"labelColor",this,u)),o.push(ht(h,"labelPointStyle",this,u)),r.push(ht(h,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){let s=this.options.setContext(this.getContext()),i=this._active,o,r=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{let a=jn[s.position].call(this,i,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);let l=this._size=bl(this,s),c=Object.assign({},a,l),u=_l(this.chart,s,c),h=xl(s,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.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:n})}drawCaret(t,n,s,i){let o=this.getCaretPosition(t,s,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,s){let{xAlign:i,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=Le(a),{x:d,y:f}=t,{width:g,height:p}=n,m,b,x,v,y,_;return o==="center"?(y=f+p/2,i==="left"?(m=d,b=m-r,v=y+r,_=y-r):(m=d+g,b=m+r,v=y-r,_=y+r),x=m):(i==="left"?b=d+Math.max(l,u)+r:i==="right"?b=d+g-Math.max(c,h)-r:b=this.caretX,o==="top"?(v=f,y=v-r,m=b-r,x=b+r):(v=f+p,y=v+r,m=b+r,x=b-r),_=v),{x1:m,x2:b,x3:x,y1:v,y2:y,y3:_}}drawTitle(t,n,s){let i=this.title,o=i.length,r,a,l;if(o){let c=Pe(s.rtl,this.x,this.width);for(t.x=Vs(this,s.titleAlign,s),n.textAlign=c.textAlign(s.titleAlign),n.textBaseline="middle",r=Z(s.titleFont),a=s.titleSpacing,n.fillStyle=s.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(i[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,n,s,i,o){let r=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,u=Z(o.bodyFont),h=Vs(this,"left",o),d=i.x(h),f=l<u.lineHeight?(u.lineHeight-l)/2:0,g=n.y+f;if(o.usePointStyle){let p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=i.leftForLtr(d,c)+c/2,b=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,As(t,p,m,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,As(t,p,m,b)}else{t.lineWidth=H(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let p=i.leftForLtr(d,c),m=i.leftForLtr(i.xPlus(d,1),c-2),b=Le(r.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Hn(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Hn(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,n,s){let{body:i}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=s,h=Z(s.bodyFont),d=h.lineHeight,f=0,g=Pe(s.rtl,this.x,this.width),p=function(S){n.fillText(S,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r),b,x,v,y,_,w,M;for(n.textAlign=r,n.textBaseline="middle",n.font=h.string,t.x=Vs(this,m,s),n.fillStyle=s.bodyColor,B(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+u:c+2+u:0,y=0,w=i.length;y<w;++y){for(b=i[y],x=this.labelTextColors[y],n.fillStyle=x,B(b.before,p),v=b.lines,a&&v.length&&(this._drawColorBox(n,t,y,g,s),d=Math.max(h.lineHeight,l)),_=0,M=v.length;_<M;++_)p(v[_]),d=h.lineHeight;B(b.after,p)}f=0,d=h.lineHeight,B(this.afterBody,p),t.y-=o}drawFooter(t,n,s){let i=this.footer,o=i.length,r,a;if(o){let l=Pe(s.rtl,this.x,this.width);for(t.x=Vs(this,s.footerAlign,s),t.y+=s.footerMarginTop,n.textAlign=l.textAlign(s.footerAlign),n.textBaseline="middle",r=Z(s.footerFont),n.fillStyle=s.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(i[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+s.footerSpacing}}drawBackground(t,n,s,i){let{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:u}=s,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:g}=Le(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+h,l),r==="top"&&this.drawCaret(t,n,s,i),n.lineTo(a+c-d,l),n.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,n,s,i),n.lineTo(a+c,l+u-g),n.quadraticCurveTo(a+c,l+u,a+c-g,l+u),r==="bottom"&&this.drawCaret(t,n,s,i),n.lineTo(a+f,l+u),n.quadraticCurveTo(a,l+u,a,l+u-f),r==="center"&&o==="left"&&this.drawCaret(t,n,s,i),n.lineTo(a,l+h),n.quadraticCurveTo(a,l,a+h,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){let n=this.chart,s=this.$animations,i=s&&s.x,o=s&&s.y;if(i||o){let r=jn[t.position].call(this,this._active,this._eventPosition);if(!r)return;let a=this._size=bl(this,t),l=Object.assign({},r,this._size),c=_l(n,t,l),u=xl(t,l,c,n);(i._to!==u.x||o._to!==u.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,u))}}_willRender(){return!!this.opacity}draw(t){let n=this.options.setContext(this.getContext()),s=this.opacity;if(!s)return;this._updateAnimationTarget(n);let i={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;let r=nt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,i,n),oo(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),ro(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){let s=this._active,i=t.map(({datasetIndex:a,index:l})=>{let 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=!Ln(s,i),r=this._positionChanged(i,n);(o||r)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let i=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,s),a=this._positionChanged(r,t),l=n||!Ln(r,o)||a;return l&&(this._active=r,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,s,i){let o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,n){let{caretX:s,caretY:i,options:o}=this,r=jn[o.position].call(this,t,n);return r!==!1&&(s!==r.x||i!==r.y)}};E(Un,"positioners",jn);var Kl={id:"tooltip",_element:Un,positioners:jn,afterInit(e,t,n){n&&(e.tooltip=new Un({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:$l},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};var Ip=(e,t,n,s)=>(typeof t=="string"?(n=e.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Fp(e,t,n,s){let i=e.indexOf(t);if(i===-1)return Ip(e,t,n,s);let o=e.lastIndexOf(t);return i!==o?n:i}var Bp=(e,t)=>e===null?null:pt(Math.round(e),0,t);function wl(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var sn=class extends Ie{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let n=this._addedLabels;if(n.length){let s=this.getLabels();for(let{index:i,label:o}of n)s[i]===o&&s.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(W(t))return null;let s=this.getLabels();return n=isFinite(n)&&s[n]===t?n:Fp(s,t,D(n,t),this._addedLabels),Bp(n,s.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:s,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),n||(i=this.getLabels().length-1)),this.min=s,this.max=i}buildTicks(){let t=this.min,n=this.max,s=this.options.offset,i=[],o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=n;r++)i.push({value:r});return i}getLabelForValue(t){return wl.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};E(sn,"id","category"),E(sn,"defaults",{ticks:{callback:wl}});function Np(e,t){let n=[],{bounds:i,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:d}=e,f=o||1,g=u-1,{min:p,max:m}=t,b=!W(r),x=!W(a),v=!W(c),y=(m-p)/(h+1),_=Vi((m-p)/g/f)*f,w,M,S,L;if(_<1e-14&&!b&&!x)return[{value:p},{value:m}];L=Math.ceil(m/_)-Math.floor(p/_),L>g&&(_=Vi(L*_/g/f)*f),W(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),i==="ticks"?(M=Math.floor(p/_)*_,S=Math.ceil(m/_)*_):(M=p,S=m),b&&x&&o&&ua((a-r)/o,_/1e3)?(L=Math.round(Math.min((a-r)/_,u)),_=(a-r)/L,M=r,S=a):v?(M=b?r:M,S=x?a:S,L=c-1,_=(S-M)/L):(L=(S-M)/_,Qe(L,Math.round(L),_/1e3)?L=Math.round(L):L=Math.ceil(L));let I=Math.max(ji(_),ji(M));w=Math.pow(10,W(l)?I:l),M=Math.round(M*w)/w,S=Math.round(S*w)/w;let R=0;for(b&&(d&&M!==r?(n.push({value:r}),M<r&&R++,Qe(Math.round((M+R*_)*w)/w,r,kl(r,y,e))&&R++):M<r&&R++);R<L;++R){let k=Math.round((M+R*_)*w)/w;if(x&&k>a)break;n.push({value:k})}return x&&d&&S!==a?n.length&&Qe(n[n.length-1].value,a,kl(a,y,e))?n[n.length-1].value=a:n.push({value:a}):(!x||S===a)&&n.push({value:S}),n}function kl(e,t,{horizontal:n,minRotation:s}){let i=Bt(s),o=(n?Math.sin(i):Math.cos(i))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}var an=class extends Ie{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,n){return W(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds(),{min:i,max:o}=this,r=l=>i=n?i:l,a=l=>o=s?o:l;if(t){let l=Me(i),c=Me(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(i-l)}this.min=i,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:n,stepSize:s}=t,i;return s?(i=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,n=t.ticks,s=this.getTickLimit();s=Math.max(2,s);let i={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=Np(i,o);return t.bounds==="ticks"&&Wi(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(){let t=this.ticks,n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){let i=(s-n)/Math.max(t.length-1,1)/2;n-=i,s+=i}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return Ps(t,this.chart.options.locale,this.options.ticks.format)}},on=class extends an{determineDataLimits(){let{min:t,max:n}=this.getMinMax(!0);this.min=$(t)?t:0,this.max=$(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),n=t?this.width:this.height,s=Bt(this.options.ticks.minRotation),i=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};E(on,"id","linear"),E(on,"defaults",{ticks:{callback:An.formatters.numeric}});var Yn=e=>Math.floor(Ft(e)),Ae=(e,t)=>Math.pow(10,Yn(e)+t);function Sl(e){return e/Math.pow(10,Yn(e))===1}function Ml(e,t,n){let s=Math.pow(10,n),i=Math.floor(e/s);return Math.ceil(t/s)-i}function zp(e,t){let n=t-e,s=Yn(n);for(;Ml(e,t,s)>10;)s++;for(;Ml(e,t,s)<10;)s--;return Math.min(s,Yn(e))}function Vp(e,{min:t,max:n}){t=ct(e.min,t);let s=[],i=Yn(t),o=zp(t,n),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=i>o?Math.pow(10,i):0,c=Math.round((t-l)*r)/r,u=Math.floor((t-l)/a/10)*a*10,h=Math.floor((c-u)/Math.pow(10,o)),d=ct(e.min,Math.round((l+u+h*Math.pow(10,o))*r)/r);for(;d<n;)s.push({value:d,major:Sl(d),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),d=Math.round((l+u+h*Math.pow(10,o))*r)/r;let f=ct(e.max,d);return s.push({value:f,major:Sl(f),significand:h}),s}var Ws=class extends Ie{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){let s=an.prototype.parse.apply(this,[t,n]);if(s===0){this._zero=!0;return}return $(s)&&s>0?s:null}determineDataLimits(){let{min:t,max:n}=this.getMinMax(!0);this.min=$(t)?Math.max(0,t):null,this.max=$(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!$(this._userMin)&&(this.min=t===Ae(this.min,0)?Ae(this.min,-1):Ae(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:n}=this.getUserBounds(),s=this.min,i=this.max,o=a=>s=t?s:a,r=a=>i=n?i:a;s===i&&(s<=0?(o(1),r(10)):(o(Ae(s,-1)),r(Ae(i,1)))),s<=0&&o(Ae(i,-1)),i<=0&&r(Ae(s,1)),this.min=s,this.max=i}buildTicks(){let t=this.options,n={min:this._userMin,max:this._userMax},s=Vp(n,this);return t.bounds==="ticks"&&Wi(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":Ps(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Ft(t),this._valueRange=Ft(this.max)-Ft(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ft(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}};E(Ws,"id","logarithmic"),E(Ws,"defaults",{ticks:{callback:An.formatters.logarithmic,major:{enabled:!0}}});function Lo(e){let t=e.ticks;if(t.display&&e.display){let n=nt(t.backdropPadding);return D(t.font&&t.font.size,K.font.size)+n.height}return 0}function Wp(e,t,n){return n=U(n)?n:[n],{w:ka(e,t.string,n),h:n.length*t.lineHeight}}function Tl(e,t,n,s,i){return e===s||e===i?{start:t-n/2,end:t+n/2}:e<s||e>i?{start:t-n,end:t}:{start:t,end:t+n}}function jp(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),s=[],i=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?G/o:0;for(let l=0;l<o;l++){let c=r.setContext(e.getPointLabelContext(l));i[l]=c.padding;let u=e.getPointPosition(l,e.drawingArea+i[l],a),h=Z(c.font),d=Wp(e.ctx,h,e._pointLabels[l]);s[l]=d;let f=rt(e.getIndexAngle(l)+a),g=Math.round(Es(f)),p=Tl(g,u.x,d.w,0,180),m=Tl(g,u.y,d.h,90,270);Up(n,t,f,p,m)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=$p(e,s,i)}function Up(e,t,n,s,i){let o=Math.abs(Math.sin(n)),r=Math.abs(Math.cos(n)),a=0,l=0;s.start<t.l?(a=(t.l-s.start)/o,e.l=Math.min(e.l,t.l-a)):s.end>t.r&&(a=(s.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),i.start<t.t?(l=(t.t-i.start)/r,e.t=Math.min(e.t,t.t-l)):i.end>t.b&&(l=(i.end-t.b)/r,e.b=Math.max(e.b,t.b+l))}function qp(e,t,n){let s=e.drawingArea,{extra:i,additionalAngle:o,padding:r,size:a}=n,l=e.getPointPosition(t,s+i+r,o),c=Math.round(Es(rt(l.angle+at))),u=Gp(l.y,a.h,c),h=Kp(c),d=Xp(l.x,a.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function Yp(e,t){if(!t)return!0;let{left:n,top:s,right:i,bottom:o}=e;return!(kt({x:n,y:s},t)||kt({x:n,y:o},t)||kt({x:i,y:s},t)||kt({x:i,y:o},t))}function $p(e,t,n){let s=[],i=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Lo(o)/2,additionalAngle:r?G/i:0},c;for(let u=0;u<i;u++){l.padding=n[u],l.size=t[u];let h=qp(e,u,l);s.push(h),a==="auto"&&(h.visible=Yp(h,c),h.visible&&(c=h))}return s}function Kp(e){return e===0||e===180?"center":e<180?"left":"right"}function Xp(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function Gp(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function Jp(e,t,n){let{left:s,top:i,right:o,bottom:r}=n,{backdropColor:a}=t;if(!W(a)){let l=Le(t.borderRadius),c=nt(t.backdropPadding);e.fillStyle=a;let u=s-c.left,h=i-c.top,d=o-s+c.width,f=r-i+c.height;Object.values(l).some(g=>g!==0)?(e.beginPath(),Hn(e,{x:u,y:h,w:d,h:f,radius:l}),e.fill()):e.fillRect(u,h,d,f)}}function Zp(e,t){let{ctx:n,options:{pointLabels:s}}=e;for(let i=t-1;i>=0;i--){let o=e._pointLabelItems[i];if(!o.visible)continue;let r=s.setContext(e.getPointLabelContext(i));Jp(n,r,o);let a=Z(r.font),{x:l,y:c,textAlign:u}=o;Ee(n,e._pointLabels[i],l,c+a.lineHeight/2,a,{color:r.color,textAlign:u,textBaseline:"middle"})}}function Xl(e,t,n,s){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,lt);else{let o=e.getPointPosition(0,t);i.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=e.getPointPosition(r,t),i.lineTo(o.x,o.y)}}function Qp(e,t,n,s,i){let o=e.ctx,r=t.circular,{color:a,lineWidth:l}=t;!r&&!s||!a||!l||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(i.dash||[]),o.lineDashOffset=i.dashOffset,o.beginPath(),Xl(e,n,r,s),o.closePath(),o.stroke(),o.restore())}function tm(e,t,n){return Nt(e,{label:n,index:t,type:"pointLabel"})}var en=class extends an{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=nt(Lo(this.options)/2),n=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(n,s)/2)}determineDataLimits(){let{min:t,max:n}=this.getMinMax(!1);this.min=$(t)&&!isNaN(t)?t:0,this.max=$(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Lo(this.options))}generateTickLabels(t){an.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,s)=>{let i=z(this.options.pointLabels.callback,[n,s],this);return i||i===0?i:""}).filter((n,s)=>this.chart.getDataVisibility(s))}fit(){let t=this.options;t.display&&t.pointLabels.display?jp(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,s,i){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((s-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,s,i))}getIndexAngle(t){let n=lt/(this._pointLabels.length||1),s=this.options.startAngle||0;return rt(t*n+Bt(s))}getDistanceFromCenterForValue(t){if(W(t))return NaN;let n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(W(t))return NaN;let n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){let n=this._pointLabels||[];if(t>=0&&t<n.length){let s=n[t];return tm(this.getContext(),t,s)}}getPointPosition(t,n,s=0){let i=this.getIndexAngle(t)-at+s;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:n,top:s,right:i,bottom:o}=this._pointLabelItems[t];return{left:n,top:s,right:i,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:n}}=this.options;if(t){let s=this.ctx;s.save(),s.beginPath(),Xl(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){let t=this.ctx,n=this.options,{angleLines:s,grid:i,border:o}=n,r=this._pointLabels.length,a,l,c;if(n.pointLabels.display&&Zp(this,r),i.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);let d=this.getContext(h),f=i.setContext(d),g=o.setContext(d);Qp(this,f,l,r,g)}}),s.display){for(t.save(),a=r-1;a>=0;a--){let u=s.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,n=this.options,s=n.ticks;if(!s.display)return;let i=this.getIndexAngle(0),o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;let c=s.setContext(this.getContext(l)),u=Z(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;let h=nt(c.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}Ee(t,a.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};E(en,"id","radialLinear"),E(en,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:An.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),E(en,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),E(en,"descriptors",{angleLines:{_fallback:"grid"}});var Zs={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}},dt=Object.keys(Zs);function Cl(e,t){return e-t}function El(e,t){if(W(t))return null;let n=e._adapter,{parser:s,round:i,isoWeekday:o}=e._parseOpts,r=t;return typeof s=="function"&&(r=s(r)),$(r)||(r=typeof s=="string"?n.parse(r,s):n.parse(r)),r===null?null:(i&&(r=i==="week"&&(tn(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,i)),+r)}function Ll(e,t,n,s){let i=dt.length;for(let o=dt.indexOf(e);o<i-1;++o){let r=Zs[dt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=s)return dt[o]}return dt[i-1]}function em(e,t,n,s,i){for(let o=dt.length-1;o>=dt.indexOf(n);o--){let r=dt[o];if(Zs[r].common&&e._adapter.diff(i,s,r)>=t-1)return r}return dt[n?dt.indexOf(n):0]}function nm(e){for(let t=dt.indexOf(e)+1,n=dt.length;t<n;++t)if(Zs[dt[t]].common)return dt[t]}function Pl(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:s,hi:i}=Ls(n,t),o=n[s]>=t?n[s]:n[i];e[o]=!0}}function sm(e,t,n,s){let i=e._adapter,o=+i.startOf(t[0].value,s),r=t[t.length-1].value,a,l;for(a=o;a<=r;a=+i.add(a,1,s))l=n[a],l>=0&&(t[l].major=!0);return t}function Rl(e,t,n){let s=[],i={},o=t.length,r,a;for(r=0;r<o;++r)a=t[r],i[a]=r,s.push({value:a,major:!1});return o===0||!n?s:sm(e,s,i,n)}var rn=class extends Ie{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){let s=t.time||(t.time={}),i=this._adapter=new Ud._date(t.adapters.date);i.init(n),Ze(s.displayFormats,i.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:El(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,n=this._adapter,s=t.time.unit||"day",{min:i,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=$(i)&&!isNaN(i)?i:+n.startOf(Date.now(),s),o=$(o)&&!isNaN(o)?o:+n.endOf(Date.now(),s)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],s=t[t.length-1]),{min:n,max:s}}buildTicks(){let t=this.options,n=t.time,s=t.ticks,i=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);let o=this.min,r=this.max,a=pa(i,o,r);return this._unit=n.unit||(s.autoSkip?Ll(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):em(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:nm(this._unit),this.initOffsets(i),t.reverse&&a.reverse(),Rl(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,s=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;n=pt(n,0,r),s=pt(s,0,r),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){let t=this._adapter,n=this.min,s=this.max,i=this.options,o=i.time,r=o.unit||Ll(o.minUnit,n,s,this._getLabelCapacity(n)),a=D(i.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=tn(l)||l===!0,u={},h=n,d,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":r),t.diff(s,n,r)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+r);let g=i.ticks.source==="data"&&this.getDataTimestamps();for(d=h,f=0;d<s;d=+t.add(d,a,r),f++)Pl(u,d,g);return(d===s||i.bounds==="ticks"||f===1)&&Pl(u,d,g),Object.keys(u).sort(Cl).map(p=>+p)}getLabelForValue(t){let n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){let i=this.options.time.displayFormats,o=this._unit,r=n||i[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,s,i){let o=this.options,r=o.ticks.callback;if(r)return z(r,[t,n,s],this);let a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],h=c&&a[c],d=s[n],f=c&&h&&d&&d.major;return this._adapter.format(t,i||(f?h:u))}generateTickLabels(t){let n,s,i;for(n=0,s=t.length;n<s;++n)i=t[n],i.label=this._tickFormatFunction(i.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let n=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(t){let n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){let n=this.options.ticks,s=this.ctx.measureText(t).width,i=Bt(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(i),r=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){let n=this.options.time,s=n.displayFormats,i=s[n.unit]||s.millisecond,o=this._tickFormatFunction(t,0,Rl(this,[t],this._majorUnit),i),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;let i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,s=i.length;n<s;++n)t=t.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],n,s;if(t.length)return t;let i=this.getLabels();for(n=0,s=i.length;n<s;++n)t.push(El(this,i[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return ba(t.sort(Cl))}};E(rn,"id","time"),E(rn,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function js(e,t,n){let s=0,i=e.length-1,o,r,a,l;n?(t>=e[s].pos&&t<=e[i].pos&&({lo:s,hi:i}=te(e,"pos",t)),{pos:o,time:a}=e[s],{pos:r,time:l}=e[i]):(t>=e[s].time&&t<=e[i].time&&({lo:s,hi:i}=te(e,"time",t)),{time:o,pos:a}=e[s],{time:r,pos:l}=e[i]);let c=r-o;return c?a+(l-a)*(t-o)/c:a}var Us=class extends rn{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=js(n,this.min),this._tableRange=js(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:n,max:s}=this,i=[],o=[],r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=s&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(r=0,a=i.length;r<a;++r)u=i[r+1],l=i[r-1],c=i[r],Math.round((u+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){let t=this.min,n=this.max,s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(n)||s.length===1)&&s.push(n),s.sort((i,o)=>i-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(js(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return js(this._table,s*this._tableRange+this._minPos,!0)}};E(Us,"id","timeseries"),E(Us,"defaults",rn.defaults);function C(e,t){let n=T(e,t);if(n===null)throw new Error("dashboard: missing element #"+e);return n}function T(e,t){let n=document.getElementById(e);if(n===null)return null;if(!(n instanceof t))throw new Error("dashboard: element #"+e+" is not a "+t.name);return n}it.register(Oe,_t,He,on,sn,Yl,Kl,Ul);var oe=null,Fe=null,Be=null;function Gl(){let e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;return window.matchMedia&&!window.matchMedia("(prefers-color-scheme: light)").matches&&!window.matchMedia("(prefers-color-scheme: dark)").matches&&(e=!0),e}function Jl(){let e=Do();return{dark:Gl(),tick:e.tick,grid:e.grid,percentile:e.percentile}}function Do(){let e=Gl();return{rps:e?"#3d8bfd":"#0b5fff",fps:e?"#f07178":"#b42318",users:e?"#3dd68c":"#0a7a43",latency:e?"#e6b450":"#9a6700",grid:e?"rgba(154, 167, 184, 0.2)":"rgba(91, 107, 124, 0.2)",tick:e?"#9aa7b8":"#5b6b7c",percentile:e?"#ff8f45":"#c2410c"}}function im(e,t){for(let n of e){let s=n.datasetIndex==null?void 0:t[n.datasetIndex];s&&Array.isArray(s.borderDash)&&(n.lineDash=s.borderDash)}return e}function Ro(e){return{responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{labels:{color:e.tick,boxWidth:12,font:{size:11},usePointStyle:!0,pointStyle:"line",pointStyleWidth:30,generateLabels:t=>im(it.defaults.plugins.legend.labels.generateLabels(t),t.data.datasets)}}},scales:{x:{ticks:{color:e.tick,maxTicksLimit:8,font:{size:10}},grid:{color:e.grid}},y:{beginAtZero:!0,ticks:{color:e.tick,font:{size:10}},grid:{color:e.grid}}}}}function Ne(e){return e.slice(0,-1)}function om(e){return[{label:"RPS",data:[],borderColor:e.rps,backgroundColor:e.rps,borderWidth:1.5,pointRadius:0,tension:.15},{label:"Failures/s",data:[],borderColor:e.fps,backgroundColor:e.fps,borderWidth:1.5,borderDash:[6,4],pointRadius:0,tension:.15}]}function Oo(){let e=Do();if(!oe){let t={type:"line",data:{labels:[],datasets:om(e)},options:Ro(e)};oe=new it(C("chart-rps",HTMLCanvasElement),t)}if(!Fe){let t={type:"line",data:{labels:[],datasets:[{label:"Users",data:[],borderColor:e.users,backgroundColor:e.users,borderWidth:1.5,pointRadius:0,tension:.15,fill:!1}]},options:Ro(e)};Fe=new it(C("chart-users",HTMLCanvasElement),t)}if(!Be){let t={type:"line",data:{labels:[],datasets:[{label:"Avg ms",data:[],borderColor:e.latency,backgroundColor:e.latency,borderWidth:1.5,pointRadius:0,tension:.15}]},options:Ro(e)};Be=new it(C("chart-latency",HTMLCanvasElement),t)}}function Qs(e){return e!==null&&e.ctx!=null}function Zl(e,t){Oo();let n=e.start_second,s=e.rps,i=e.fps,o=e.users,r=e.avg_latency_ms,a=Math.max(s.length,i.length,o.length,r.length),l=[];for(let c=0;c<a;c++)l.push(String(n+c));if(Qs(oe)){let c=Ne(s),u=Ne(i);oe.data.labels=l.slice(0,Math.max(c.length,u.length)),oe.data.datasets[0].data=c,oe.data.datasets[1].data=u,oe.update("none")}if(Qs(Fe)&&(Fe.data.labels=l,Fe.data.datasets[0].data=o,Fe.update("none")),t&&Qs(Be)){let c=Ne(r);Be.data.labels=l.slice(0,c.length),Be.data.datasets[0].data=c,Be.update("none")}}function Ao(e,t,n){if(!Qs(e))return;e.data.datasets.forEach((r,a)=>{r.borderColor=n[a],r.backgroundColor=n[a]});let s=e.options,i=s.plugins&&s.plugins.legend&&s.plugins.legend.labels;i&&(i.color=t.tick);let o=s.scales||{};for(let r of[o.x,o.y])r&&(r.ticks&&(r.ticks.color=t.tick),r.grid&&(r.grid.color=t.grid));e.update("none")}function Ql(){let e=Do();Ao(oe,e,[e.rps,e.fps]),Ao(Fe,e,[e.users]),Ao(Be,e,[e.latency])}function Et(e){let t=document.createElement("td");return t.textContent=e==null?"":String(e),t}function X(e,t){let n=document.createElement("div");n.className="kv";let s=document.createElement("span");s.className="k",s.textContent=e;let i=document.createElement("span");return i.className="v",i.textContent=t==null?"\u2014":String(t),n.appendChild(s),n.appendChild(i),n}function O(e){return typeof e!="number"||!isFinite(e)?"\u2014":Math.round(e).toLocaleString()}function A(e){if(typeof e!="number"||!isFinite(e))return"\u2014";let t=Math.round(Math.abs(e)*1e3),n=Math.floor((t+5)/10),s=n<1e3?(n/100).toLocaleString(void 0,{maximumFractionDigits:2}):Math.floor((t+500)/1e3).toLocaleString();return e<0&&s!=="0"?"-"+s:s}function et(e){return typeof e!="number"||!isFinite(e)?"\u2014":e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}function Ho(e){if(typeof e!="number"||!isFinite(e)||e<=0||e>=.01)return Io(e);let t=Math.round(e*1e3);return t===0?"<0.1%":(t/10).toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})+"%"}function Io(e){return typeof e!="number"||!isFinite(e)?"\u2014":(e*100).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})+"%"}function Kn(e){if(typeof e!="number"||!isFinite(e))return"\u2014";let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),s=Math.floor(t%3600/60),i=t%60;return n>0?n+"h "+s+"m "+i+"s":s>0?s+"m "+i+"s":i+"s"}function N(e,t){return t==null?e:t/1e3}function Wt(e,t,n){return t==null?{value:e,title:null}:{value:t,title:"Measured: "+n(e)+" ms"}}function rm(e,t){let n=t.key,s=t.type,i=t.dir==="asc"?1:-1,o=e.slice();return o.sort((r,a)=>{let l=r[n],c=a[n];if(s==="num")return((typeof l=="number"?l:0)-(typeof c=="number"?c:0))*i;let u=l==null?"":String(l),h=c==null?"":String(c);return u<h?-1*i:u>h?1*i:0}),o}function ln(e){let{body:t,columns:n,filter:s}=e,i=e.sort,o=[],r=null,a=new Map,l=document.createElement("tr"),c=document.createElement("td");c.colSpan=n.length,c.className="empty",l.appendChild(c);function u(p){let m=new Set(p);for(let b=t.children.length-1;b>=0;b--){let x=t.children[b];m.has(x)||t.removeChild(x)}for(let b=0;b<p.length;b++)t.children[b]!==p[b]&&t.insertBefore(p[b],t.children[b]||null)}function h(p){c.textContent!==p&&(c.textContent=p),a=new Map,u([l])}function d(p,m){for(let b=0;b<n.length;b++){let x=n[b],v=p.cells[b]||p.appendChild(document.createElement("td")),y=x.format(m);v.textContent!==y&&(v.textContent=y);let _=x.title?x.title(m):null;_===null?v.removeAttribute("title"):v.title!==_&&(v.title=_)}}function f(){let p=r?e.disabledText(r):null;if(p!==null||o.length===0){h(p!==null?p:e.emptyText);return}let m=rm(o,i);if(s){let v=(s.input&&s.input.value?s.input.value:"").toLowerCase().trim();if(v&&(m=m.filter(y=>s.matches(y,v)),m.length===0)){h(s.noMatchText);return}}let b=new Map,x=[];for(let v=0;v<m.length;v++){let y=m[v],_=e.rowKey(y),w=a.get(_)||document.createElement("tr");d(w,y),b.set(_,w),x.push(w)}a=b,u(x)}function g(){let p=document.getElementById(e.tableId);if(!p)return;let m=p.querySelectorAll("thead th[data-sort]");for(let b=0;b<m.length;b++){let x=m[b],v=document.createElement("button");v.type="button",v.textContent=x.textContent,x.textContent="",x.appendChild(v),x.getAttribute("data-sort")===i.key&&x.setAttribute("aria-sort",i.dir==="asc"?"ascending":"descending"),x.addEventListener("click",()=>{let y=x.getAttribute("data-sort"),_=n.find(w=>w.key===y);if(_!==void 0){i.key===_.key?i={...i,dir:i.dir==="asc"?"desc":"asc"}:i={key:_.key,type:_.type,dir:_.type==="num"?"desc":"asc"};for(let w=0;w<m.length;w++)m[w].classList.remove("sorted","asc","desc"),m[w].removeAttribute("aria-sort");x.classList.add("sorted",i.dir),x.setAttribute("aria-sort",i.dir==="asc"?"ascending":"descending"),f()}})}}return{setRows(p,m){o=p,r=m,f()},init(){g(),s&&s.input&&s.input.addEventListener("input",f)}}}function cn(e,t,n){let s=C(e,HTMLDetailsElement),i=ln({tableId:t+"-table",body:C(t+"-rows",HTMLTableSectionElement),columns:n,sort:{key:"second",type:"num",dir:"asc"},rowKey:r=>String(r.second),emptyText:"No data yet",disabledText:()=>null}),o=[];return s.addEventListener("toggle",()=>{s.open&&i.setRows(o,null)}),r=>{o=r,s.open&&i.setRows(r,null)}}function ti(e,t){return e.toLowerCase().indexOf(t)>=0}function Lt(e,t){return e>0?t:""}var Fo=3;function am(e){if(e.length===0)return{shown:"",title:null,sort:""};let t=e.slice().sort((o,r)=>r[1]-o[1]||o[0]-r[0]),n=t.map(([o,r])=>o+" "+O(r)),s=n.slice(0,Fo);n.length>Fo&&s.push("+"+(n.length-Fo));let i=t.map(([o,r])=>String(o).padStart(5,"0")+":"+String(r).padStart(16,"0")).join(" ");return{shown:s.join(" \xB7 "),title:n.join(" \xB7 "),sort:i}}function lm(e){let t=e.percentile_ms,n=e.response_time_us;return{scenario_index:e.scenario_index,scenario_name:e.scenario_name,users:e.users,run_count:e.run_count,runs_per_second:e.runs_per_second,runs_per_user:e.users>0?e.run_count/e.users:0,response_time_avg_ms:e.response_time_avg_ms,p50:N(t.p50,n?n.p50:null),p95:N(t.p95,n?n.p95:null),p99:N(t.p99,n?n.p99:null)}}function cm(e){let t=e.percentile_ms,n=e.response_time_us;return{order:e.scenario_index*1e6+e.transaction_index,scenario_index:e.scenario_index,transaction_index:e.transaction_index,scenario_name:e.scenario_name,transaction_name:e.transaction_name,run_count:e.run_count,failure_count:e.failure_count,runs_per_second:e.runs_per_second,failures_per_second:e.failures_per_second,response_time_avg_ms:e.response_time_avg_ms,response_time_min_ms:N(e.response_time_min_ms,n?n.min:null),p50:N(t.p50,n?n.p50:null),p95:N(t.p95,n?n.p95:null),p99:N(t.p99,n?n.p99:null),response_time_max_ms:N(e.response_time_max_ms,n?n.max:null)}}function um(e){let t=e.percentile_ms,n=e.co_adjusted!=null?e.co_adjusted:null,s=n?n.percentile_ms:null,i=Wt(e.response_time_avg_ms,n?n.response_time_avg_ms:null,A),o=e.response_time_us,r=n?n.response_time_us:null,a=Wt(N(t.p50,o?o.p50:null),s?N(s.p50,r?r.p50:null):null,A),l=Wt(N(t.p95,o?o.p95:null),s?N(s.p95,r?r.p95:null):null,A),c=Wt(N(t.p99,o?o.p99:null),s?N(s.p99,r?r.p99:null):null,A),u=Wt(N(e.response_time_max_ms,o?o.max:null),n?N(n.response_time_max_ms,r?r.max:null):null,A),h=am(e.status_codes);return{method:e.method,name:e.name,request_count:e.request_count,failure_count:e.failure_count,requests_per_second:e.requests_per_second,failures_per_second:e.failures_per_second,response_time_avg_ms:i.value,response_time_min_ms:N(e.response_time_min_ms,o?o.min:null),p50:a.value,p95:l.value,p99:c.value,response_time_max_ms:u.value,status_codes:h.sort,status_codes_text:h.shown,measured:{response_time_avg_ms:i.title,p50:a.title,p95:l.title,p99:c.title,response_time_max_ms:u.title},status_codes_title:h.title}}var tc=ln({tableId:"scenarios-table",body:C("scenarios-body",HTMLTableSectionElement),columns:[{key:"scenario_index",type:"num",format:e=>String(e.scenario_index+1)},{key:"scenario_name",type:"str",format:e=>e.scenario_name},{key:"users",type:"num",format:e=>O(e.users)},{key:"run_count",type:"num",format:e=>O(e.run_count)},{key:"runs_per_second",type:"num",format:e=>et(e.runs_per_second)},{key:"runs_per_user",type:"num",format:e=>e.users>0?et(e.runs_per_user):""},{key:"response_time_avg_ms",type:"num",format:e=>Lt(e.run_count,A(e.response_time_avg_ms))},{key:"p50",type:"num",format:e=>Lt(e.run_count,A(e.p50))},{key:"p95",type:"num",format:e=>Lt(e.run_count,A(e.p95))},{key:"p99",type:"num",format:e=>Lt(e.run_count,A(e.p99))}],sort:{key:"scenario_index",type:"num",dir:"asc"},rowKey:e=>String(e.scenario_index),emptyText:"No scenarios yet",disabledText:e=>e.metrics_disabled?"Metrics disabled (--no-metrics).":e.scenario_metrics_disabled?"Scenario metrics disabled (--no-scenario-metrics).":null}),ec=ln({tableId:"transactions-table",body:C("transactions-body",HTMLTableSectionElement),columns:[{key:"order",type:"num",format:e=>e.scenario_index+1+"."+(e.transaction_index+1)},{key:"scenario_name",type:"str",format:e=>e.scenario_name},{key:"transaction_name",type:"str",format:e=>e.transaction_name},{key:"run_count",type:"num",format:e=>O(e.run_count)},{key:"failure_count",type:"num",format:e=>O(e.failure_count)},{key:"runs_per_second",type:"num",format:e=>et(e.runs_per_second)},{key:"failures_per_second",type:"num",format:e=>et(e.failures_per_second)},{key:"response_time_avg_ms",type:"num",format:e=>Lt(e.run_count,A(e.response_time_avg_ms))},{key:"response_time_min_ms",type:"num",format:e=>Lt(e.run_count,A(e.response_time_min_ms))},{key:"p50",type:"num",format:e=>Lt(e.run_count,A(e.p50))},{key:"p95",type:"num",format:e=>Lt(e.run_count,A(e.p95))},{key:"p99",type:"num",format:e=>Lt(e.run_count,A(e.p99))},{key:"response_time_max_ms",type:"num",format:e=>Lt(e.run_count,A(e.response_time_max_ms))}],sort:{key:"order",type:"num",dir:"asc"},rowKey:e=>String(e.order),emptyText:"No transactions yet",disabledText:e=>e.metrics_disabled?"Metrics disabled (--no-metrics).":e.transaction_metrics_disabled?"Transaction metrics disabled (--no-transaction-metrics).":null,filter:{input:T("transactions-filter",HTMLInputElement),matches:(e,t)=>ti(e.scenario_name,t)||ti(e.transaction_name,t),noMatchText:"No matching transactions"}}),nc=ln({tableId:"requests-table",body:C("requests-body",HTMLTableSectionElement),columns:[{key:"method",type:"str",format:e=>e.method},{key:"name",type:"str",format:e=>e.name},{key:"request_count",type:"num",format:e=>O(e.request_count)},{key:"failure_count",type:"num",format:e=>O(e.failure_count)},{key:"requests_per_second",type:"num",format:e=>et(e.requests_per_second)},{key:"failures_per_second",type:"num",format:e=>et(e.failures_per_second)},{key:"response_time_avg_ms",type:"num",format:e=>A(e.response_time_avg_ms),title:e=>e.measured.response_time_avg_ms},{key:"response_time_min_ms",type:"num",format:e=>A(e.response_time_min_ms)},{key:"p50",type:"num",format:e=>A(e.p50),title:e=>e.measured.p50},{key:"p95",type:"num",format:e=>A(e.p95),title:e=>e.measured.p95},{key:"p99",type:"num",format:e=>A(e.p99),title:e=>e.measured.p99},{key:"response_time_max_ms",type:"num",format:e=>A(e.response_time_max_ms),title:e=>e.measured.response_time_max_ms},{key:"status_codes",type:"str",format:e=>e.status_codes_text,title:e=>e.status_codes_title}],sort:{key:"request_count",type:"num",dir:"desc"},rowKey:e=>JSON.stringify([e.method,e.name]),emptyText:"No requests yet",disabledText:e=>e.metrics_disabled?"Metrics disabled (--no-metrics). Charts and request tables are empty.":null,filter:{input:T("requests-filter",HTMLInputElement),matches:(e,t)=>ti(e.method,t)||ti(e.name,t),noMatchText:"No matching requests"}}),sc=ln({tableId:"errors-table",body:C("errors-body",HTMLTableSectionElement),columns:[{key:"method",type:"str",format:e=>e.method},{key:"name",type:"str",format:e=>e.name},{key:"error",type:"str",format:e=>e.error},{key:"occurrences",type:"num",format:e=>O(e.occurrences)}],sort:{key:"occurrences",type:"num",dir:"desc"},rowKey:e=>JSON.stringify([e.method,e.name,e.error]),emptyText:"No errors",disabledText:()=>null}),ic=ln({tableId:"transaction-errors-table",body:C("transaction-errors-body",HTMLTableSectionElement),columns:[{key:"transaction",type:"str",format:e=>e.transaction},{key:"scenario",type:"str",format:e=>e.scenario},{key:"name",type:"str",format:e=>e.name},{key:"error",type:"str",format:e=>e.error},{key:"occurrences",type:"num",format:e=>O(e.occurrences)}],sort:{key:"occurrences",type:"num",dir:"desc"},rowKey:e=>JSON.stringify([e.transaction,e.error]),emptyText:"No transaction errors",disabledText:()=>null});function oc(e){tc.setRows(e.scenarios.map(lm),e.flags),ec.setRows(e.transactions.map(cm),e.flags),nc.setRows(e.requests.map(um),e.flags),sc.setRows(e.errors.slice(),e.flags),ic.setRows(e.transaction_errors.slice(),e.flags)}function rc(){tc.init(),ec.init(),nc.init(),sc.init(),ic.init()}var ei=10,hm=C("chart-rps-summary",HTMLElement),dm=C("chart-users-summary",HTMLElement),fm=C("chart-latency-summary",HTMLElement),pm=cn("chart-rps-details","chart-rps",[{key:"second",type:"num",format:e=>String(e.second)},{key:"rps",type:"num",format:e=>et(e.rps)},{key:"fps",type:"num",format:e=>et(e.fps)}]),mm=cn("chart-users-details","chart-users",[{key:"second",type:"num",format:e=>String(e.second)},{key:"users",type:"num",format:e=>O(e.users)}]),gm=cn("chart-latency-details","chart-latency",[{key:"second",type:"num",format:e=>String(e.second)},{key:"avg",type:"num",format:e=>A(e.avg)}]);function re(e){let t=(r,a)=>{let l=0;for(let c=r;c<a;c++)l+=e[c];return a>r?l/(a-r):0},n=e.length,s=t(Math.max(0,n-ei),n);if(n<2*ei)return{mean:s,trend:null};let i=t(n-2*ei,n-ei);if(i===0)return{mean:s,trend:null};let o=s>i*1.1?"rising":s<i*.9?"falling":"steady";return{mean:s,trend:o}}function Bo(e,t){return t===null?e:e+", "+t}function No(e,t){e.textContent!==t&&(e.textContent=t)}function ni(e){No(fm,e)}function ac(e,t,n){let s=e.start_second,i=Ne(e.rps),o=Ne(e.fps),r=re(i);No(hm,e.rps.length===0?"No data yet.":Bo("RPS "+et(r.mean),r.trend)+"; failures "+et(re(o).mean)+"/s."),pm(i.map((l,c)=>({second:s+c,rps:l,fps:o[c]||0})));let a=re(e.users);if(No(dm,e.users.length===0?"No data yet.":Bo("Users "+O(a.mean)+(n>0?" of "+O(n):""),a.trend)+"."),mm(e.users.map((l,c)=>({second:s+c,users:l}))),t){let l=Ne(e.avg_latency_ms),c=re(l);ni(e.avg_latency_ms.length===0?"No data yet.":Bo("Average "+A(c.mean)+" ms",c.trend)+"."),gm(l.map((u,h)=>({second:s+h,avg:u})))}}var si=C("banner",HTMLElement),lc=C("connection",HTMLElement),cc=C("connection-label",HTMLElement),zo=C("announce",HTMLElement),ii=!1;function oi(e){let t=ii?zo.textContent+" "+e:e;zo.textContent!==t&&(zo.textContent=t),ii||(ii=!0,queueMicrotask(()=>{ii=!1}))}var Vo="connecting",Wo=!1;function jt(e){let t="disconnected",n="disconnected";e==="live"?(t="live",n="SSE"):e==="poll"?(t="poll",n="poll"):e==="connecting"?(t="disconnected",n="connecting"):e==="closed"&&(t="finished",n="finished"),e==="disconnected"&&(Vo==="live"||Vo==="poll")?(Wo=!0,oi("Connection lost.")):(e==="live"||e==="poll")&&Wo&&(Wo=!1,oi("Connection restored.")),Vo=e,lc.className="connection "+t,cc.textContent=n}function uc(){lc.className="connection poll",cc.textContent="poll"}function ot(e,t){let n=e?"banner "+(t||"info"):"banner hidden";si.textContent===e&&si.className===n||(si.textContent=e,si.className=n)}var hc=1,$o="goose-dashboard-token",le="",Gn=null,ze=null,jo=0,ft=null,ae=null,un=!1,Ko=!1,ce=!1,ue=!1,qo=null,Yo=null,fc=()=>null,Uo=!1;function pc(e){fc=e}function mc(e,t){if(t===null)return e;let n=e.indexOf("?")>=0?"&":"?";return e+n+"heatmap_generation="+t.generation+"&heatmap_since="+t.since}function bm(){try{return window.sessionStorage.getItem($o)||""}catch(e){return""}}function _m(e){try{window.sessionStorage.setItem($o,e)}catch(t){}}function ai(){try{window.sessionStorage.removeItem($o)}catch(e){}}function gc(){let e=new URLSearchParams(window.location.search);if(le=e.get("token")||"",le){e.delete("token");let t=window.location.pathname+(e.toString()?"?"+e.toString():"")+window.location.hash;try{window.history.replaceState({},"",t)}catch(n){}_m(le)}else le=bm()}function hn(){return le}var bc=!0;function _c(e){bc=e,e||(le="")}function xc(){return bc}function yc(){return Ko}function vc(){Ko=!1}function Xo(e){if(!le)return e;let t=e.indexOf("?")>=0?"&":"?";return e+t+"token="+encodeURIComponent(le)}function wc(){return Xo(mc("/api/v1/snapshot",fc()))}function xm(){return Xo("/api/v1/events")}function kc(e,t){qo&&qo(e,t)}var ym=8e3,vm=5,ri=class extends Error{constructor(n){super("HTTP "+n);this.status=n}};function Jn(){Gn!=null&&(clearInterval(Gn),Gn=null),ze&&(ze.abort(),ze=null)}function Zn(){for(let e of[ft,ae])try{e&&e.close()}catch(t){}ft=null,ae=null}function Go(){ai(),Ko=!0,ce=!0,Jn(),un=!1,Zn(),jt("disconnected"),ot("Open this dashboard as http://host:port/?token=\u2026 (token required for metrics).","error")}function Sc(e,t,n){if(ce)return Promise.resolve({kind:"failed"});let s=mc("/api/v1/series?method="+encodeURIComponent(e)+"&name="+encodeURIComponent(t),n);return fetch(Xo(s)).then(i=>i.status===401?(Go(),{kind:"failed"}):i.status===404?{kind:"missing"}:i.ok?i.json().then(o=>({kind:"ok",series:o})):{kind:"failed"}).catch(()=>({kind:"failed"}))}function Mc(){Uo||ce||ue||(Uo=!0,Cc(un?"poll":"live").catch(()=>null).then(()=>{Uo=!1}))}function Tc(e){let t=typeof e=="object"&&e!==null?e.version:void 0;return t!==hc?(ot("This page reads snapshot version "+hc+" but the server sent "+String(t)+". Reload the page.","error"),null):e}function Cc(e,t){return ce?Promise.resolve(null):fetch(wc(),{signal:t}).then(n=>{if(n.status===401)return Go(),null;if(!n.ok)throw new ri(n.status);return n.json()}).then(n=>{if(ue||t&&t.aborted)return null;let s=n==null?null:Tc(n);return s&&kc(s,e||"poll"),s})}function dc(e=!1){if(!(ue||ce)){if(ae){if(!e)return;Zn()}Lc(!0)}}function Xn(){if(ue||ce||un&&Gn!=null)return;un=!0,jo=0,Zn(),uc();function e(){if(ce||ue||!un){Jn();return}if(jo+=1,jo%vm===0&&dc(!0),ze)return;let t=new AbortController;ze=t;let n=setTimeout(()=>t.abort(),ym),s=()=>{clearTimeout(n);let i=ze===t;return i&&(ze=null),i};Cc("poll",t.signal).then(s,i=>{s()&&(jt("disconnected"),i instanceof ri&&i.status===503&&dc())})}Jn(),e(),ce||(Gn=setInterval(e,2e3))}function Ec(e,t){qo=e,Yo=t||null,Lc(!1)}function Lc(e){let t;try{if(typeof EventSource=="undefined")throw new Error("no EventSource");e||jt("connecting"),t=new EventSource(xm())}catch(r){e||Xn();return}e?ae=t:ft=t;let n=()=>t===ft||t===ae,s=!1,i=0,o=3;t.addEventListener("snapshot",r=>{if(n())try{let a=Tc(JSON.parse(r.data));if(!a)return;t===ae&&(ae=null,ft=t),s=!0,i=0,un=!1,Jn(),kc(a,"live")}catch(a){ot("Bad snapshot event: "+String(a),"error")}}),t.addEventListener("closed",r=>{ue||!n()||(ue=!0,Zn(),Jn(),jt("closed"),Yo?Yo(typeof r.data=="string"?r.data:""):ot("Goose has exited.","info"))}),t.onerror=()=>{if(!(ue||!n())){if(t===ae){Zn();return}if(s){if(ft&&ft.readyState===EventSource.CLOSED){ft=null,Xn();return}if(i+=1,jt("disconnected"),i>=o){try{ft&&ft.close()}catch(r){}ft=null,Xn()}}else{try{ft&&ft.close()}catch(r){}ft=null,fetch(wc()).then(r=>{if(r.status===401){Go();return}Xn()}).catch(()=>{Xn()})}}}}var Qn=class{constructor(t,n,s=(i,o)=>i===o){this.label=t;this.note=n;this.same=s;this.server=null;this.baseline=null;this.edit=null;this.awaiting=[]}describe(t){return t===""?"none":t}blurred(){this.edit!==null&&this.awaiting.length===0&&this.server!==null&&this.same(this.edit,this.server)&&(this.edit=null)}pending(){return this.edit!==null}editIs(t){return this.edit!==null&&this.same(this.edit,t)}edited(t){this.edit===null&&this.awaiting.length===0&&(this.baseline=this.server),this.edit=t,this.show(t)}sending(t){this.edit===null&&this.awaiting.length===0&&(this.baseline=this.server),this.edit=t,this.awaiting.push(t),this.show(t)}accepted(t){this.edit===t&&(this.edit=null),this.show(t)}refused(t){this.awaiting=this.awaiting.filter(n=>n!==t)}discard(t){this.edit!==null&&(this.revert(),this.note(t+"; unapplied "+this.label+" edit discarded"))}revert(){this.edit=null,this.awaiting=[],this.baseline=this.server,this.show(this.server===null?"":this.server)}fromServer(t){if(t===null)return;this.server=t;let n=s=>s!==null&&this.same(s,t);if(this.awaiting.length>0){if(n(this.awaiting[this.awaiting.length-1])){this.awaiting=[],this.baseline=t,(this.edit===null||n(this.edit))&&(this.edit=null,this.show(t));return}if(n(this.baseline)||this.awaiting.some(n))return;this.awaiting=[],this.changedElsewhere(t);return}if(this.edit!==null){if(n(this.edit)){this.edit=null,this.baseline=t,this.show(t);return}n(this.baseline)||this.changedElsewhere(t);return}this.baseline=t,this.show(t)}changedElsewhere(t){this.edit=null,this.baseline=t,this.show(t),this.note(this.label+" changed elsewhere to "+this.describe(t))}},dn=class extends Qn{constructor(n,s,i,o){super(s,i,o);this.input=n;this.shown="";this.shown=n.value;let r=n instanceof HTMLSelectElement;n.addEventListener(r?"change":"input",()=>{if(r&&n.getAttribute("aria-disabled")==="true"){n.value=this.shown;return}this.edited(n.value)}),n.addEventListener("blur",()=>{this.blurred()})}text(){return this.input.value}show(n){this.shown=n,this.input.value!==n&&(this.input.value=n)}};function Ve(e,t){let n=(e.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);n.indexOf(t)<0&&n.push(t),e.setAttribute("aria-describedby",n.join(" "))}function We(e,t){let n=(e.getAttribute("aria-describedby")||"").split(/\s+/).filter(s=>s!==""&&s!==t);n.length?e.setAttribute("aria-describedby",n.join(" ")):e.removeAttribute("aria-describedby")}function xt(e,t){e instanceof HTMLInputElement&&(e.readOnly=t),t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled")}function Pt(e){let t=Math.max(0,Math.round(e)),n=Math.floor(t/3600),s=Math.floor(t%3600/60),i=t%60,o=[];return n&&o.push(n+" h"),s&&o.push(s+" min"),(i||o.length===0)&&o.push(i+" s"),o.join(" ")}function Jo(e){return String(Math.round(e*100)/100)+"/s"}function Zo(e){return e.host!=null?e.host:e.hosts.length?e.hosts.join(", "):"no host set"}function wm(e){let t=0,n=0,s=e.split(";");for(let i of s){let o=i.split(","),r=parseInt(o[0],10),a=parseInt(o[1],10);if(o.length!==2||!isFinite(r)||!isFinite(a))return null;t=Math.max(t,r),n+=a}return{steps:s.length,peak:t,secs:n}}function ts(e){return e===1?"1 user":String(e==null?0:e)+" users"}function Pc(e){return e.increase_time_secs!=null?"over "+Pt(e.increase_time_secs):e.increase_rate!=null?"at "+Jo(e.increase_rate):"at 1/s (default)"}function Ac(e){return e.decrease_time_secs!=null||e.decrease_rate!=null}function Dc(e,t){return e.decrease_time_secs!=null?t+"over "+Pt(e.decrease_time_secs):t+"at "+Jo(e.decrease_rate||0)}function Rc(e){let t=Ac(e);if(e.run_time_secs!=null){let n="hold "+Pt(e.run_time_secs);return t?e.decrease_time_secs!=null?n+" \xB7 then down over "+Pt(e.decrease_time_secs):n+" \xB7 then "+Jo(e.decrease_rate||0)+" down":n+" \xB7 then all stop"}return t?Dc(e,"then straight down "):"until stopped"}function es(e,t){let n=[];t&&n.push(Zo(e));let s=e.stage;if(s==="stopping")n.push("stopping");else if(e.test_plan!=null){let i=wm(e.test_plan);n.push(i?"test plan: "+i.steps+(i.steps===1?" step, peak ":" steps, peak ")+ts(i.peak)+", "+Pt(i.secs)+" total":"test plan")}else if(s==="ramp_up")n.push("ramping to "+ts(e.users)+" "+Pc(e)),n.push(Rc(e));else if(s==="hold"){let i=Ac(e)?"ramp down":"all stop";n.push(ts(e.users));let o=e.hold_ends_in_secs;n.push(o===0||o==null?i+" after this ramp":i+" in "+Pt(o))}else s==="hold_until_stopped"?(n.push(ts(e.users)),n.push("holding until stopped")):s==="ramping_down"?n.push(Dc(e,"ramping down ")):(n.push(ts(e.users)+" "+Pc(e)),n.push(Rc(e)));return n.join(" \xB7 ")}function Oc(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}var km={s:1,min:60,h:3600},Hc="goose-dashboard-settings-open";function zc(e){return e>0&&e%3600===0?[String(e/3600),"h"]:e>0&&e%60===0?[String(e/60),"min"]:[String(e),"s"]}function Qo(e,t){let n=e*(km[t]||1);return Math.abs(n-Math.round(n))<1e-6?Math.round(n):n}function os(e){if(e.trim()==="")return null;let t=Number(e);return isFinite(t)?t:NaN}function ss(e,t){return e+" "+t}function ns(e){let t=e.lastIndexOf(" ");return[e.slice(0,t),e.slice(t+1)]}function Ic(e,t){let[n,s]=ns(e),i=os(n);return i===null?t===null?"none":"none "+s:isNaN(i)?e:s==="rate"?"rate "+Math.fround(i):"s "+Qo(i,s)}var is=class extends Qn{constructor(n,s,i,o){super(s,i,(r,a)=>Ic(r,o)===Ic(a,o));this.els=n;this.emptyUnit=o;this.shownUnit=n.unit.value,n.number.addEventListener("input",()=>{this.edited(this.value())}),n.unit.addEventListener("change",()=>{if(n.unit.getAttribute("aria-disabled")==="true"){n.unit.value=this.shownUnit;return}this.edited(this.value())});for(let r of[n.number,n.unit])r.addEventListener("blur",()=>{this.blurred()})}value(){return ss(this.els.number.value,this.els.unit.value)}sendValue(){return os(this.numberText())!==null||this.emptyUnit===null?this.value():ss("",this.emptyUnit)}numberText(){return this.els.number.value}unitText(){return this.els.unit.value}blurred(){this.badNumber()||super.blurred()}badNumber(){let n=os(this.numberText());return n!==null&&isNaN(n)||this.els.number.validity.badInput}unitEdited(){return this.pending()&&this.server!==null&&ns(this.server)[1]!==this.unitText()}revert(){super.revert(),this.els.number.validity.badInput&&(this.els.number.value=ns(this.value())[0])}fromServer(n){if(n!==null&&this.pending()&&this.badNumber()){this.server=n;return}super.fromServer(n)}show(n){let[s,i]=ns(n);this.shownUnit=i,this.els.number.value!==s&&(this.els.number.value=s),this.els.unit.value!==i&&(this.els.unit.value=i)}describe(n){let[s,i]=ns(n);return s.trim()===""?"none":s+" "+(i==="rate"?"users per second":i)}},ci={host:!1,up:!1,upUnit:!1,down:!1,downUnit:!1,run:!1};function Fc(e,t){return e==="idle"?{host:!0,up:!0,upUnit:!0,down:!0,downUnit:!0,run:!0}:e==="ramp_up"||e==="hold"||e==="hold_until_stopped"?{...ci,up:t.increase_time_secs==null,down:t.decrease_time_secs==null,run:!0}:ci}function Sm(e){switch(e){case"ramp_up":case"hold":case"hold_until_stopped":return"Run started elsewhere";case"ramping_down":return"Ramp down started";case"test_plan":return"Test plan running";case"stopping":return"Run stopping";default:return"Run stopped"}}function Bc(e,t){return t!=null?zc(t):e!=null?[String(e),"rate"]:["","rate"]}var Nc={host:"set-host",increase_rate:"set-up",increase_time:"set-up",decrease_rate:"set-down",decrease_time:"set-down",run_time:"set-run"},ui=class e{constructor(t,n,s,i,o,r,a,l,c,u,h){this.details=t;this.summary=n;this.hostInput=s;this.hostHelp=i;this.hostReason=o;this.held=c;this.settings=null;this.stage="idle";this.editable=ci;this.opened=!1;this.sent={};this.canSend=!1;this.host=new dn(s,"Host",h),this.up=new is(r,"Ramp up",h,"rate"),this.down=new is(a,"Ramp down",h,"rate"),this.run=new is(l,"Run time",h,null);for(let d of[s,r.number,r.unit,a.number,a.unit,l.number,l.unit])d.addEventListener(d instanceof HTMLSelectElement?"change":"input",()=>{li(d,!1),this.refresh(),u()});t.addEventListener("toggle",()=>{try{window.localStorage.setItem(Hc,t.open?"open":"closed")}catch(d){}})}static find(t,n){let s=T("ctrl-settings",HTMLDetailsElement),i=T("ctrl-settings-label",HTMLElement),o=T("set-host",HTMLInputElement),r=u=>{let h=T(u,HTMLInputElement),d=T(u+"-unit",HTMLSelectElement);return!h||!d?null:{number:h,unit:d,reason:T(u+"-reason",HTMLElement),help:T(u+"-help",HTMLElement)}},a=r("set-up"),l=r("set-down"),c=r("set-run");return!s||!i||!o||!a||!l||!c?null:new e(s,i,o,T("set-host-help",HTMLElement),T("set-host-reason",HTMLElement),a,l,c,T("set-run-held",HTMLElement),t,n)}pendingCount(){let t=0;this.host.pending()&&t++;for(let n of[this.up,this.down,this.run])n.pending()&&t++;return t}body(){let t={};if(this.host.pending()){let i=this.host.text().trim();t.host=i===""?null:i}let n=this.stage==="idle",s=(i,o,r)=>{if(!i.pending())return;let a=os(i.numberText()),l=i.unitText();if(!n){t[o]=a;return}a===null?(t[o]=null,t[r]=null):l==="rate"?(t[o]=a,t[r]=null):(t[r]=Qo(a,l),t[o]=null)};if(s(this.up,"increase_rate","increase_time_secs"),s(this.down,"decrease_rate","decrease_time_secs"),this.run.pending()){let i=os(this.run.numberText());t.run_time_secs=i===null?null:Qo(i,this.run.unitText())}return t}hostChange(){if(!this.host.pending()||!this.settings)return null;let t=this.host.text().trim();return t===(this.settings.host||"")?null:t!==""?t:this.settings.hosts.length?"each scenario's own host":"no host"}sending(){this.clearInvalid(),this.sent={},this.host.pending()&&(this.sent.host=this.host.text(),this.host.sending(this.sent.host));let t=[["up",this.up],["down",this.down],["run",this.run]];for(let[n,s]of t){if(!s.pending())continue;let i=s.sendValue();this.sent[n]=i,s.sending(i)}}settled(t,n){let s=this.sent;this.sent={},s.host!==void 0&&(t?this.host.accepted(s.host):this.host.refused(s.host));let i=[[s.up,this.up],[s.down,this.down],[s.run,this.run]];for(let[o,r]of i)o!==void 0&&(t?r.accepted(o):r.refused(o));t&&n&&(this.settings=n,this.follow(n,s)),this.refresh()}discardAll(){this.clearInvalid(),this.host.revert();for(let t of[this.up,this.down,this.run])t.revert();this.refresh()}setPendingLabel(t){this.summary.textContent=t?"Edit settings ("+t+" unapplied)":"Edit settings"}open(){this.details.open=!0}refuseBadNumber(){for(let t of[this.up,this.down,this.run])if(!(!t.pending()||!t.badNumber()))return this.open(),li(t.els.number,!0),t.els.number.focus(),t.label;return null}focusField(t){let n=Nc[t];if(!n)return!1;let s=document.getElementById(n);return s?(this.open(),li(s,!0),s.focus(),!0):!1}clearInvalid(){for(let t of new Set(Object.values(Nc))){let n=document.getElementById(t);n&&li(n,!1)}}fromSnapshot(t){let n=this.editable,s=this.stage;if(this.stage=t.stage,!this.opened){this.opened=!0;let o=null;try{o=window.localStorage.getItem(Hc)}catch(r){o=null}this.details.open=o===null?t.stage==="idle":o==="open"}let i=Fc(t.stage,t);if(s!==t.stage){let o=this.serverValues(t),r=Sm(t.stage);n.host&&!i.host&&!this.host.editIs(o.host)&&this.host.discard(r);let a=[[this.up,o.up,n.up,i.up,i.upUnit,this.up.unitEdited()],[this.down,o.down,n.down,i.down,i.downUnit,this.down.unitEdited()],[this.run,o.run,n.run,i.run,!0,!1]];for(let[l,c,u,h,d,f]of a)l.editIs(c)&&!l.badNumber()||(u&&!h||f&&!d)&&l.discard(r)}this.follow(t),this.refresh()}follow(t,n={}){this.settings=t;let s=this.serverValues(t);n.host===void 0&&this.host.fromServer(s.host),n.up===void 0&&this.up.fromServer(s.up),n.down===void 0&&this.down.fromServer(s.down),n.run===void 0&&this.run.fromServer(s.run)}serverValues(t){let[n,s]=Bc(t.increase_rate,t.increase_time_secs),[i,o]=Bc(t.decrease_rate,t.decrease_time_secs),[r,a]=t.run_time_secs==null?["",this.run.unitText()]:zc(t.run_time_secs);return{host:t.host||"",up:ss(n,s),down:ss(i,o),run:ss(r,a==="rate"?"s":a)}}update(t){this.canSend=t,this.refresh()}refresh(){let t=this.settings,n=t?Fc(this.stage,t):ci;this.editable=n;let s=this.canSend;if(xt(this.hostInput,!(s&&n.host)),xt(this.up.els.number,!(s&&n.up)),xt(this.up.els.unit,!(s&&n.upUnit)),xt(this.down.els.number,!(s&&n.down)),xt(this.down.els.unit,!(s&&n.downUnit)),xt(this.run.els.number,!(s&&n.run)),xt(this.run.els.unit,!(s&&n.run)),!t)return;let i=this.stage!=="idle";for(let r of[this.up,this.down])for(let a of Array.from(r.els.unit.options))a.hidden=i&&a.value!=="rate"&&r.unitText()==="rate";let o=this.stageReasons(t);fn(this.hostReason,this.hostInput,o.host),this.hostHelp&&fn(this.hostHelp,this.hostInput,t.host==null&&t.hosts.length?"Overrides every scenario's host":""),this.hostInput.placeholder=t.host==null?"default: "+Zo(t):"";for(let[r,a]of[[this.up,o.up],[this.down,o.down],[this.run,o.run]])fn(r.els.reason,r.els.number,a),fn(r.els.reason,r.els.unit,a);if(this.up.els.number.placeholder="default: 1 user per second",this.down.els.number.placeholder="default: all stop at once",this.run.els.number.placeholder="default: none",this.run.els.help){let r=this.down.numberText().trim()!=="",a=["Time at full users after the ramp up, not total time."];a.push(r?"Empty: ramps straight down after the ramp up.":"Empty: holds until stopped."),i&&n.run&&a.push("While running, emptying it holds until stopped, refused while a ramp down is set."),fn(this.run.els.help,this.run.els.number,a.join(" "))}if(this.held){let r=t.run_time_secs,a=t.hold_ends_in_secs,l=this.stage==="hold"&&r!=null&&a!=null?"held "+Pt(Math.max(0,r-a))+" of "+Pt(r):"";fn(this.held,this.run.els.number,l)}}stageReasons(t){let n=this.stage;if(n==="idle")return{host:"",up:"",down:"",run:""};if(n==="ramp_up"||n==="hold"||n==="hold_until_stopped"){let i=o=>o!=null?"Set by time: "+Pt(o)+"; change it when idle":"Users per second while running; a time changes only when idle";return{host:"Host changes only when idle",up:i(t.increase_time_secs),down:i(t.decrease_time_secs),run:""}}let s=n==="test_plan"?"The test plan sets the ramp and how long it runs":n==="ramping_down"?"Ramp down started; ramp settings change again when idle":"Run stopping; settings change again when idle";return{host:"Host changes only when idle",up:s,down:s,run:s}}};function li(e,t){t?(e.setAttribute("aria-invalid","true"),Ve(e,"ctrl-status")):e.hasAttribute("aria-invalid")&&(e.removeAttribute("aria-invalid"),We(e,"ctrl-status"))}function fn(e,t,n){e&&(e.textContent=n,e.hidden=n==="",n===""?We(t,e.id):Ve(t,e.id))}var Vc=C("phase-badge",HTMLElement),Wc=T("subtitle",HTMLElement),jc=T("footer-note",HTMLElement),qt=T("control-panel",HTMLElement),rs=T("ctrl-notice",HTMLElement),Uc=T("no-auth-banner",HTMLElement),Rt=T("ctrl-start",HTMLButtonElement),hi=T("ctrl-stop",HTMLButtonElement),de=T("ctrl-quit",HTMLButtonElement),qc=T("ctrl-active",HTMLElement),J=T("ctrl-target",HTMLInputElement),di=T("ctrl-apply",HTMLButtonElement),fi=T("ctrl-minus",HTMLButtonElement),pi=T("ctrl-plus",HTMLButtonElement),fe=T("ctrl-step",HTMLInputElement),tr=T("ctrl-status",HTMLElement),mi=T("ctrl-summary",HTMLElement),pn=T("ctrl-target-help",HTMLElement),Mm=T("ctrl-target-reason",HTMLElement),mn=T("set-apply",HTMLButtonElement),gi=T("set-discard",HTMLButtonElement),Tm=T("set-reason",HTMLElement),ls=T("set-host-confirm",HTMLElement),bi=T("set-host-confirm-text",HTMLElement),_i=T("set-host-confirm-ok",HTMLButtonElement),Yc=T("set-host-confirm-cancel",HTMLButtonElement),Cm="Mid run changes ramp at the increase rate when adding users and the decrease rate (else the increase rate) when removing them, 1 per second when neither is set; increase and decrease times are not used.",Em="Applying a user count replaces the test plan with a users ramp.",Lm="Sent with your other edits: use Start with changes or Apply settings",Jc="Enter the control token to change settings",At=!1,je=!1,Zc=!1,q=J?new dn(J,"Target",e=>{Q(e,"info")}):null,V=ui.find(()=>{Dt()},e=>{Q(e,"info")}),Qc=!1,yt=null,sr=10,gt=!1,ir=null,ar="idle",Yt="idle",er=null,lr=!1,tu=!1,Ut=null;function eu(){return tu}function cr(){return!xc()||!!hn()}function nu(){return At}function xi(e,t=!0){let n=(e||"idle").toLowerCase(),i={idle:!0,increase:!0,maintain:!0,decrease:!0,shutdown:!0}[n]?n:"idle";t&&(er!==null&&er!==i&&oi(i==="idle"?"Test finished.":"Phase: "+i+"."),er=i),ar=i,Vc.className="phase-badge phase-"+i,Vc.textContent=n}function Q(e,t){tr&&(tr.textContent=e||"",tr.className="control-status"+(t?" "+t:""))}function pe(e){J&&(e?(J.setAttribute("aria-invalid","true"),Ve(J,"ctrl-status")):(J.removeAttribute("aria-invalid"),We(J,"ctrl-status")))}function Pm(e){if(e.phase==="idle")return e.settings.users==null?"":String(e.settings.users);for(let t of[e.target_users,e.maximum_users,e.active_users])if(t>=1)return String(t);return null}function Rm(e){return e?Yt==="test_plan"?"The test plan sets users; edit the plan, or stop and switch mode":Yt==="stopping"?"Users change again once the run is idle":"":Jc}function $c(e,t,n){e&&(e.textContent=n,e.hidden=n==="",t&&(n===""?We(t,e.id):Ve(t,e.id)))}function or(){let e=parseInt(fe&&fe.value?fe.value:"",10);return(!isFinite(e)||e<1)&&(e=10),sr=e,sr}function he(e,t){e&&e.setAttribute("aria-disabled",t?"false":"true")}function me(e){return!e||e.getAttribute("aria-disabled")==="true"}function yi(){return Yt==="idle"&&!!q&&q.pending()}function su(){return(V?V.pendingCount():0)+(yi()?1:0)}function Dt(){if(!qt||!At)return;let e=cr(),t=ar||"idle",n=e&&!gt&&t==="idle",s=su(),i=V?V.pendingCount():0;Rt&&(Rt.textContent=t==="idle"&&s>0?"Start with changes":"Start"),V&&V.update(e&&!gt),he(mn,e&&!gt&&s>0&&Yt!=="stopping"),he(gi,e&&!gt&&s>0),$c(Tm,null,e?"":Jc),V&&V.setPendingLabel(s);let o=e&&!gt&&(t==="increase"||t==="maintain"),r=Rm(e),a=r===""&&!gt&&!lr&&(t==="idle"||t==="increase"||t==="maintain"||t==="decrease");if(he(Rt,n),he(hi,o),de){let u=document.activeElement===de;de.hidden=t!=="idle",he(de,e&&!gt),u&&de.hidden&&Rt&&Rt.focus()}let l=Yt==="idle"&&i>0;he(di,a&&!l),he(fi,a),he(pi,a),J&&xt(J,r!==""||gt),fe&&xt(fe,r!==""||gt);let c=r!==""?r:l?Lm:"";$c(Mm,J,c),pn&&(pn.hidden=c!=="",J&&(c===""?Ve(J,pn.id):We(J,pn.id))),e?qt.classList.remove("disabled"):qt.classList.add("disabled"),au()}function Kc(e){return e==="test_plan"?"Test plan running":e==="stopping"?"Run stopping":""}function iu(e){if(!At||!qt)return;ir=e,lr=e.stopping===!0;let t=e.settings,n=Yt;if(Yt=t.stage,qc&&(qc.textContent=O(e.active_users)),mi&&(mi.textContent=es(t,!0)),V&&V.fromSnapshot(t),q){let s=Kc(Yt);s!==""&&s!==Kc(n)&&q.discard(s),q.fromServer(Pm(e)),q.pending()||pe(!1)}pn&&(pn.textContent=e.phase==="idle"&&t.test_plan!=null?Em:Cm),Dt()}function Am(e,t){let n={"Content-Type":"application/json"},s=hn();return s&&(n.Authorization="Bearer "+s),fetch(e,{method:"POST",headers:n,body:t===void 0?"{}":JSON.stringify(t)})}function Dm(e,t){let n=s=>{!q||typeof t!="number"||(s&&s.ok?q.accepted(String(t)):q.refused(String(t)))};return Om(e).then(s=>(n(s),s))}function Om(e){return e.status===401?(ai(),ot("Open this dashboard as http://host:port/?token=\u2026 (token required for control).","error"),Q("Unauthorized \u2014 reopen with ?token=","error"),Promise.resolve(null)):e.status===503?e.json().then(t=>{let n=t&&t.error?String(t.error):"",s=t&&t.message?String(t.message):"Control unavailable";return Q(n==="timeout"?"Timed out \u2014 check phase/users before retrying":n==="busy"?"Control busy \u2014 wait and retry":s,"error"),null},()=>(Q("Control unavailable","error"),null)):e.json().then(t=>t?t.ok?(Q(t.command==="quit"?"Goose is shutting down.":t.message||"OK","ok"),t.phase&&xi(t.phase,!1),t.command==="stop"&&(lr=!0),Dt(),t):(Q(t.message||Hm(t.reason),"error"),t.field==="users"&&pe(!0),t.phase&&xi(t.phase,!1),Dt(),t):(Q("Unexpected control response","error"),null),()=>(Q("HTTP "+e.status,"error"),null))}function Hm(e){return e==="cross_origin"?"Refused: the request's Origin doesn't match this dashboard's address (another site, or a proxy)":e==="host_not_allowed"?"Refused: open the dashboard by its IP address or its --dashboard-host name":"Control rejected"}function us(e,t,n,s){gt||!At||!cr()||(gt=!0,Dt(),pe(!1),Q("Sending\u2026","info"),Am(e,t).then(i=>Dm(i,n)).catch(i=>(Q("Request failed: "+String(i),"error"),null)).then(i=>{gt=!1,s&&s(i),Dt()}))}function ou(e){if(!V)return;let t=V.body(),n;yi()&&q&&(n=parseInt(q.text(),10),t.users=n,q.sending(String(n))),V.sending(),us(e,t,n,s=>{let i=!!(s&&s.ok);V.settled(i,s&&s.settings?s.settings:null),i&&s&&s.settings&&mi&&(mi.textContent=es(s.settings,!0)),!i&&s&&s.field&&(s.field==="users"&&J?(pe(!0),J.focus()):V.focusField(s.field))})}function ru(e,t){let n=V?V.hostChange():null;if(Qc||n===null||!ls||!bi||!_i){t();return}V&&V.open(),bi.textContent="Load will go to "+n,ls.hidden=!1,yt={trigger:e,destination:n,then:t},_i.focus()}function au(){if(!yt)return;let e=V?V.hostChange():null;if(e===null||me(yt.trigger)){cs();return}e!==yt.destination&&bi&&(yt.destination=e,bi.textContent="Load will go to "+e)}function cs(){let e=yt;if(yt=null,!ls)return e;let t=ls.contains(document.activeElement);return ls.hidden=!0,e&&t&&e.trigger.focus(),e}function Im(){if(!yt)return;let e=yt.destination;if(au(),!yt)return;if(yt.destination!==e){Q("Host changed: confirm where load will go","info");return}if(ur()){cs();return}let t=cs();t&&(Qc=!0,t.trigger.focus(),t.then())}function Fm(){let e=cs();e&&e.trigger.focus()}function ur(){let e=V?V.refuseBadNumber():null;if(e!==null)return Q(e+" must be a number","error"),!0;if(yi()&&q){let t=parseInt(q.text(),10);if(!isFinite(t)||t<1)return Q("Target must be an integer \u2265 1","error"),pe(!0),J&&J.focus(),!0}return!1}function Bm(){if(!me(Rt)){if(ar==="idle"&&su()>0&&Rt){if(ur())return;ru(Rt,()=>{ou("/api/v1/control/start")});return}us("/api/v1/control/start")}}function Nm(){me(mn)||!mn||ur()||ru(mn,()=>{ou("/api/v1/control/settings")})}function zm(){me(gi)||(cs(),V&&V.discardAll(),yi()&&q&&q.revert(),pe(!1),Q("Unapplied edits discarded","info"),Dt())}function Vm(){me(hi)||us("/api/v1/control/stop")}function Wm(){me(de)||us("/api/v1/control/quit")}function lu(e){q&&q.sending(String(e)),us("/api/v1/control/users",{users:e},e)}function jm(){if(me(di))return;let e=parseInt(q?q.text():"",10);if(!isFinite(e)||e<1){Q("Target must be an integer \u2265 1","error"),pe(!0);return}lu(e)}function Xc(e){if(me(e<0?fi:pi))return;or();let t=parseInt(q?q.text():"",10);isFinite(t)||(t=ir?ir.active_users:1);let n=Math.max(1,t+e*sr);if(Yt==="idle"&&V&&V.pendingCount()>0&&q){q.edited(String(n)),Dt();return}lu(n)}function rr(e){if(!Ut)return"";let t=[];return Ut.telnet&&t.push("the telnet controller listening on "+Ut.telnet),Ut.websocket&&t.push("the WebSocket controller listening on "+Ut.websocket),t.length===0?"No telnet or WebSocket controller is running.":e+t.join(" or ")+"."}function Gc(){if(Wc&&(Wc.textContent=At?je?"Live dashboard \xB7 control, no token":"Live dashboard \xB7 control":Zc?"Live dashboard":"Live dashboard \xB7 read-only"),jc){let e=At?["Start, stop, and adjust users from this panel"+(je?"":" (authenticated)")+". Stop begins a cancel ramp (decrease) before idle, and users cannot be changed until then.",rr("Advanced control remains on ")]:[rr("Control this test via "),"This dashboard is read-only."];jc.textContent=e.filter(t=>t!=="").join(" ")}}function hr(e){let t=document.createElement("code");return t.textContent=e,t}function nr(e){let t=document.createDocumentFragment();return e.split(" ").forEach((n,s)=>{s>0&&t.appendChild(document.createTextNode(" "));let i=hr(n);i.className="nowrap",t.appendChild(i)}),t}function as(...e){let t=document.createElement("p");for(let n of e)t.appendChild(typeof n=="string"?document.createTextNode(n):n);return t}function cu(e,t){if(!(!qt||!rs)){for(let n of Array.from(qt.children))n!==rs&&n.tagName!=="H2"&&(n.hidden=!0);rs.setAttribute("aria-label",e),rs.replaceChildren(...t),rs.hidden=!1,qt.classList.remove("hidden")}}function Um(){let e=je||hn()?as("To control it from here, restart Goose with ",nr("--dashboard-control")," added."):as("To control it from here, restart Goose with ",nr("--dashboard-control --dashboard-no-auth")," (no token), or with ",nr("--dashboard-control --dashboard-auth-token <token>")," and open ",hr("http://"+window.location.host+"/?token=<token>"),"."),t=[as("Read-only: this dashboard can't start, stop or change the test."),e];Ut&&(Ut.telnet||Ut.websocket)&&t.push(as(rr("Control this test via "))),cu("Read-only dashboard",t)}function qm(){cu("Control status unknown",[as("Couldn't check whether control is on (",hr("/api/v1/health")," failed). Reload to retry.")])}function Ym(){if(!Uc)return;let e=Uc;e.className="banner warn";let t="WARNING: the dashboard on http://"+window.location.host+" has no token (--dashboard-no-auth). "+(At?"Anyone who can reach this port can watch the test, start and stop it, and point the load at any host.":"Anyone who can reach this port can watch the test.");setTimeout(()=>{e.textContent=t},0)}function uu(){if(!qt)return Promise.resolve(!1);let e=fetch("/api/v1/health").then(t=>{if(!t.ok)throw new Error("HTTP "+t.status);return t.json()}).then(t=>(At=!!(t&&t.control_enabled),je=!!t&&t.auth_required===!1,_c(!je),je&&ai(),Ut=t&&t.controllers||null,je&&t.loopback===!1&&Ym(),Gc(),At?(qt.classList.remove("hidden"),cr()||(tu=!0,ot("Open this dashboard as http://host:port/?token=\u2026 (token required for control).","error")),Dt(),!0):(Um(),!1))).catch(()=>(At=!1,Zc=!0,Gc(),qm(),!1));return Rt&&Rt.addEventListener("click",Bm),mn&&mn.addEventListener("click",Nm),gi&&gi.addEventListener("click",zm),_i&&_i.addEventListener("click",Im),Yc&&Yc.addEventListener("click",Fm),hi&&hi.addEventListener("click",Vm),de&&de.addEventListener("click",Wm),di&&di.addEventListener("click",jm),fi&&fi.addEventListener("click",()=>{Xc(-1)}),pi&&pi.addEventListener("click",()=>{Xc(1)}),fe&&(fe.addEventListener("change",or),fe.addEventListener("input",or)),J&&J.addEventListener("input",()=>{pe(!1),Dt()}),e}var gr="Response times by second";var mu="Adjusted: includes the synthetic times coordinated omission mitigation adds.",gu="Percentiles are off for this run (--no-percentiles-over-time).",bu="Response times by second, heatmap";function br(e,t){let n,s,i=$m(t);if(t.since===0)n=new Map,s=i;else if(e!==null&&e.generation===t.generation&&e.rev===t.since)n=new Map(e.columns),s=i.length>=e.buckets.length?i:e.buckets;else return null;for(let o of t.columns)n.set(o.second,o);for(let o of Array.from(n.keys()))o<t.start_second&&n.delete(o);return{generation:t.generation,rev:t.rev,startSecond:t.start_second,endSecond:t.end_second,holdFrom:t.hold_from,buckets:s,columns:n}}function $m(e){return e.buckets_us.map(([t,n,s])=>[t/1e3,n/1e3,(s+1)/1e3-1])}function _r(e){return e===null?null:{generation:e.generation,since:e.rev}}var Km=[.1,.2,.5,1,2,5,10,20,50,100,200,500,1e3,2e3,5e3,1e4,2e4,6e4];function Xm(e){return e<1e3?e+" ms":e/1e3+" s"}function dr(e){let t=e[1],n=e[2]+1;return[t===0?n/2:t,n]}function hu(e,t,n){for(let s=0;s+1<t.length;s+=2){let i=e.get(t[s])||[0,0];i[0]+=t[s+1],n&&(i[1]+=t[s+1]),e.set(t[s],i)}}function _u(e,t){let n={startSecond:e?e.startSecond:0,columns:e?e.endSecond-e.startSecond+1:0,rows:[],cells:[],minCount:0,maxCount:0,ticks:[],secondTotals:new Map,percentiles:new Map};if(e===null)return n;let s=[],i=new Map,o=1/0,r=-1/0,a=1/0,l=0,c=Array.from(e.columns.keys()).sort((p,m)=>p-m);for(let p of c){if(p<e.startSecond||p>e.endSecond||p>=e.holdFrom)continue;let m=e.columns.get(p),b=new Map;hu(b,m.measured,!1),t&&hu(b,m.synthetic,!0);let x=0,v=Array.from(b.keys()).sort((y,_)=>y-_);for(let y of v){let[_,w]=b.get(y);_!==0&&(s.push({column:p-e.startSecond,second:p,bucket:y,count:_,synthetic:w}),x+=_,o=Math.min(o,y),r=Math.max(r,y),a=Math.min(a,_),l=Math.max(l,_))}x>0&&i.set(p,x)}if(s.length===0)return n;let u=Math.log(dr(mr(e,o))[0]),h=Math.log(dr(mr(e,r))[1]),d=p=>(h-Math.log(p))/(h-u),f=[];for(let p=o;p<=r;p++){let m=mr(e,p),[b,x]=dr(m);f.push({bucket:p,time:m[0],lowest:m[1],highest:m[2],top:d(x),bottom:d(b)})}let g=[];for(let p of Km){let m=d(p);m>=0&&m<=1&&g.push({ms:p,label:Xm(p),y:m})}return{startSecond:e.startSecond,columns:e.endSecond-e.startSecond+1,rows:f,cells:s,minCount:a,maxCount:l,ticks:g,secondTotals:i,percentiles:Gm(s,f)}}function fr(e,t,n){let s=Math.round(t*n),i=0;for(let[o,r]of e)if(i+=r,i>=s)return o;return 0}function Gm(e,t){let n=new Map;for(let o of t)n.set(o.bucket,o.time);let s=new Map;for(let o of e){let r=s.get(o.second);r===void 0&&(r=[],s.set(o.second,r)),r.push([n.get(o.bucket),o.count])}let i=new Map;for(let[o,r]of s){let a=r.reduce((l,[,c])=>l+c,0);i.set(o,{second:o,p50:fr(r,a,.5),p95:fr(r,a,.95),p99:fr(r,a,.99)})}return i}function vt(e){if(!isFinite(e))return"\u2014";let t=Math.round(e*1e3);return t<1e3?(Math.floor(t/100)/10).toLocaleString(void 0,{maximumFractionDigits:1}):Math.floor(t/1e3).toLocaleString()}var pr=[1,2,5,10,15,30,60,120,300];function Jm(e){for(let t of pr)if(Math.ceil(e/t)<=8)return t;return pr[pr.length-1]}function Zm(e,t){let n=Jm(t),s=[],i=Math.ceil(e/n)*n;for(let o=i;o<e+t;o+=n)s.push(o);return s}function mr(e,t){let n=e.buckets[t];if(n!==void 0)return n;let s=e.buckets.length-1,i=Math.round(e.buckets[s][0])+(t-s)*1e3;return[i,i-500,i+499]}var Qm=222,du={light:{from:[80,64],to:[85,22]},dark:{from:[75,56],to:[100,94]}};function tg(e,t,n){return n<=t?1:Math.min(1,Math.max(0,Math.log(e/t)/Math.log(n/t)))}function xr(e,t){let n=t?du.dark:du.light,s=n.from[0]+(n.to[0]-n.from[0])*e,i=n.from[1]+(n.to[1]-n.from[1])*e;return"hsl("+Qm+", "+s.toFixed(1)+"%, "+i.toFixed(1)+"%)"}function eg(e,t,n,s){return xr(tg(e,t,n),s)}function xu(e,t,n,s,i){let o=i.ms||i.int,r;n.highest+1<=1?r=o(n.lowest)+" to "+o(n.highest+1)+" ms":n.lowest===n.highest?r=i.int(n.lowest)+" ms":r=i.int(n.time)+" ms bucket ("+i.int(n.lowest)+" to "+i.int(n.highest)+" ms)";let a=e.secondTotals.get(t.second)||t.count,l="Second "+t.second+": "+r+", "+i.int(t.count)+" requests";s&&t.synthetic>0&&(l+=", of which "+i.int(t.synthetic)+" synthetic"),l+=" ("+i.pct(t.count/a)+" of the second's "+i.int(a)+")";let c=e.percentiles.get(t.second);return c!==void 0&&(l+=" p50 / p95 / p99: "+vt(c.p50)+" / "+vt(c.p95)+" / "+vt(c.p99)+" ms"),l}var gn={left:52,right:72,top:6,bottom:22},vi=[{key:"p50",width:2,dash:[]},{key:"p95",width:2,dash:[7,4]},{key:"p99",width:2,dash:[2,3]}];function ng(e){for(let t=e.columns-1;t>=0;t--){let n=e.percentiles.get(e.startSecond+t);if(n)return vi.map(s=>({key:s.key,value:n[s.key],y:0}))}return[]}var fu="last second";function pu(e,t=-1/0){let n=["p50","p95","p99"],s=new Map;for(let o of e){let r=s.get(o.value);r?r.keys.push(o.key):s.set(o.value,{keys:[o.key],y:o.y})}let i=[...s.entries()].map(([o,r])=>({text:r.keys.sort((a,l)=>n.indexOf(a)-n.indexOf(l)).join(", ")+": "+vt(o)+" ms",y:r.y}));i.sort((o,r)=>o.y-r.y),i.length&&i[0].y<t&&(i[0].y=t);for(let o=1;o<i.length;o++)i[o].y-i[o-1].y<12&&(i[o].y=i[o-1].y+12);return i}function yu(e,t){return e+":"+t}function vu(e,t,n,s){let i=e.getContext("2d");if(!i)return null;let o=window.devicePixelRatio||1,r=e.clientWidth||600,a=e.clientHeight||300;e.width=Math.round(r*o),e.height=Math.round(a*o),i.setTransform(o,0,0,o,0,0),i.clearRect(0,0,r,a);let l=getComputedStyle(e).fontFamily;i.font="11px "+l;let c=0,u=pu(ng(t));for(let k of u)c=Math.max(c,i.measureText(k.text).width);u.length&&(i.font="10px "+l,c=Math.max(c,i.measureText(fu).width));let h=Math.max(gn.right,Math.ceil(c)+12),d=gn.left,f=gn.top,g=Math.max(1,r-gn.left-h),p=Math.max(1,a-gn.top-gn.bottom),m={view:t,left:d,top:f,width:g,height:p,cells:new Map},b=getComputedStyle(e).getPropertyValue("--card").trim()||(n?"#1a2332":"#ffffff"),x=Math.max(1,t.columns),v=g/x,y=k=>Math.round(d+k*v),_=k=>Math.round(f+k*p),w=new Map;for(let k of t.rows)w.set(k.bucket,k);for(let k of t.cells){let P=w.get(k.bucket),j=y(k.column),F=_(P.top);i.fillStyle=eg(k.count,t.minCount,t.maxCount,n),i.fillRect(j,F,Math.max(1,y(k.column+1)-j),Math.max(1,_(P.bottom)-F)),m.cells.set(yu(k.column,k.bucket),k)}i.font="10px "+l,i.fillStyle=s.tick,i.strokeStyle=s.grid,i.lineWidth=1,i.setLineDash([]),i.textAlign="right",i.textBaseline="middle";for(let k of t.ticks){let P=_(k.y)+.5;i.beginPath(),i.moveTo(d,P),i.lineTo(d+g,P),i.stroke(),i.fillText(k.label,d-6,P)}i.textAlign="center",i.textBaseline="top";for(let k of Zm(t.startSecond,t.columns)){let P=k-t.startSecond;i.fillText(String(k),(y(P)+y(P+1))/2,f+p+6)}let M=new Map;for(let k of t.rows)M.set(k.time,k);let S=[],L=[];i.lineJoin="round",i.lineCap="butt";for(let k of vi){let P=[],j=[],F=null;for(let Y=0;Y<t.columns;Y++){let tt=t.percentiles.get(t.startSecond+Y),Gt=tt&&M.get(tt[k.key]);if(!tt||!Gt){j.length&&P.push(j),j=[];continue}let ye=f+(Gt.top+Gt.bottom)/2*p;j.push([(y(Y)+y(Y+1))/2,ye]),F={value:tt[k.key],y:ye}}j.length&&P.push(j),L.push(P),F&&S.push({key:k.key,value:F.value,y:F.y})}let I=k=>{for(let P of k){if(i.beginPath(),P.length===1){let j=Math.max(1,v/2);i.moveTo(P[0][0]-j,P[0][1]),i.lineTo(P[0][0]+j,P[0][1])}else{i.moveTo(P[0][0],P[0][1]);for(let[j,F]of P.slice(1))i.lineTo(j,F)}i.stroke()}};i.strokeStyle=b,i.setLineDash([]),vi.forEach((k,P)=>{i.lineWidth=k.width+3,I(L[P])}),i.strokeStyle=s.percentile,vi.forEach((k,P)=>{i.lineWidth=k.width,i.setLineDash(k.dash),I(L[P])}),i.setLineDash([]);let R=pu(S,f+19);i.textAlign="left",i.textBaseline="middle",R.length&&(i.fillStyle=s.tick,i.font="10px "+l,i.fillText(fu,d+g+6,R[0].y-14)),i.fillStyle=s.percentile,i.font="11px "+l;for(let k of R)i.fillText(k.text,d+g+6,k.y);return m}function wu(e,t,n){let{view:s,left:i,top:o,width:r,height:a}=e;if(t<i||t>=i+r||n<o||n>=o+a)return null;let l=Math.floor((t-i)/r*Math.max(1,s.columns)),c=(n-o)/a;for(let u of s.rows)if(c>=u.top&&c<=u.bottom){let h=e.cells.get(yu(l,u.bucket));if(h)return{cell:h,row:u}}return null}var sg="Average latency (ms)",Mu=C("chart-latency-title",HTMLElement),Mi=C("chart-latency-note",HTMLElement),Tu=C("heatmap-note",HTMLElement),Cu=C("heatmap-view",HTMLElement),Eu=C("heatmap-adjusted",HTMLButtonElement),Lu=C("heatmap-measured",HTMLButtonElement),bt=C("heatmap-request",HTMLSelectElement),kr=C("heatmap-wrap",HTMLElement),ds=C("chart-heatmap",HTMLCanvasElement),bn=C("heatmap-tooltip",HTMLElement),Pu=C("heatmap-legend",HTMLElement),ig=C("heatmap-legend-min",HTMLElement),og=C("heatmap-legend-bar",HTMLElement),rg=C("heatmap-legend-max",HTMLElement),Ru=C("chart-latency-wrap",HTMLElement),Au=C("heatmap-table",HTMLTableElement),Du=C("chart-latency-table",HTMLTableElement),ag=cn("chart-latency-details","heatmap",[{key:"second",type:"num",format:e=>String(e.second)},{key:"requests",type:"num",format:e=>O(e.requests)},{key:"p50",type:"num",format:e=>vt(e.p50)},{key:"p95",type:"num",format:e=>vt(e.p95)},{key:"p99",type:"num",format:e=>vt(e.p99)}]),lg={int:O,ms:A,pct:Io},fs=null,Ot=null,Ue=null,_n=!0,ki=null,wi=null,ps=!0,vr=!1,Ti=!0,Ou=[],ku="",hs=null,Hu=!1;function Iu(e,t){return e!==null&&e.method===t.method&&e.name===t.name}function Si(e){return e.method+`
`+e.name}function Fu(){return Ti?_r(fs):null}function Bu(){ki!==null&&(clearInterval(ki),ki=null)}function Su(){let e=Ot;if(e===null||wi===e)return;wi=e;let t=_n?null:_r(Ue);Sc(e.method,e.name,t).then(n=>{if(wi===e&&(wi=null),!!Iu(Ot,e))if(n.kind==="ok"){let s=br(Ue,n.series.heatmap);if(s===null){_n=!0;return}Ue=s,_n=!1,qe()}else n.kind==="missing"&&(Ue=null,_n=!0,qe())})}function wr(e){Bu(),Ot=e,Ue=null,_n=!0,bt.value=e===null?"":Si(e),e!==null&&(ki=setInterval(Su,1e3),Su()),qe()}function cg(e){let t=(n,s)=>n<s?-1:n>s?1:0;return e.requests.filter(n=>n.has_series).map(n=>({method:n.method,name:n.name})).sort((n,s)=>t(n.method,s.method)||t(n.name,s.name))}function Nu(){let e=Ou,t=e.map(Si).join("\0");if(t!==ku&&document.activeElement!==bt){ku=t,bt.textContent="";let s=document.createElement("option");s.value="",s.textContent="All requests",bt.appendChild(s);for(let i of e){let o=document.createElement("option");o.value=Si(i),o.textContent=i.method+" "+i.name,bt.appendChild(o)}}let n=Ot;if(n!==null&&!e.some(s=>Iu(n,s))){wr(null);return}bt.value=n===null?"":Si(n)}function yr(){Eu.setAttribute("aria-pressed",ps?"true":"false"),Lu.setAttribute("aria-pressed",ps?"false":"true")}function ug(e){let t=Array.from(e.percentiles.values());if(ag(t.map(a=>({...a,requests:e.secondTotals.get(a.second)||0}))),t.length===0){ni("No data yet.");return}let n=re(t.map(a=>a.p50)),s=re(t.map(a=>a.p95)),i=re(t.map(a=>a.p99)),o="p50 "+vt(n.mean)+" ms, p95 "+vt(s.mean)+" ms, p99 "+vt(i.mean)+" ms",r=s.trend===null?"":"; p95 "+s.trend;ni(o+r+".")}function Sr(){bn.hidden=!0}function qe(){let e=vr&&ps;Hu=e;let n=_u(Ot===null?fs:Ue,e);Mu.textContent=Ot===null?gr:gr+": "+Ot.method+" "+Ot.name,Mi.textContent=mu,Mi.hidden=!e,ds.setAttribute("aria-label",bu);let s=Jl();hs=vu(ds,n,s.dark,s),ug(n);let i=[];for(let o=0;o<=4;o++)i.push(xr(o/4,s.dark));og.style.background="linear-gradient(to right, "+i.join(", ")+")",ig.textContent=n.cells.length?O(n.minCount):"",rg.textContent=n.cells.length?O(n.maxCount):"",Sr()}function hg(e){if(hs===null)return;let t=ds.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top,i=wu(hs,n,s);if(i===null){Sr();return}bn.textContent=xu(hs.view,i.cell,i.row,Hu,lg),bn.hidden=!1;let o=bn.offsetWidth||200,r=Math.min(n+12,Math.max(0,kr.clientWidth-o));bn.style.left=r+"px",bn.style.top=s+12+"px"}function dg(e){Bu(),Ot=null,Ue=null,_n=!0,bt.value="",fs=null,hs=null,Mu.textContent=sg,Mi.textContent=gu,Mi.hidden=e,Tu.hidden=!0,Cu.hidden=!0,bt.hidden=!0,kr.hidden=!0,Pu.hidden=!0,Ru.hidden=!1,Au.hidden=!0,Du.hidden=!1}function fg(){Tu.hidden=!1,bt.hidden=!1,kr.hidden=!1,Pu.hidden=!1,Ru.hidden=!0,Au.hidden=!1,Du.hidden=!0}function zu(e){if(Ti=e.flags.percentiles_over_time,!Ti)return dg(e.flags.metrics_disabled),!0;fg(),vr=e.aggregate.co_active,Cu.hidden=!vr;let t=e.series.heatmap;if(t!==null){let n=br(fs,t);n===null?Mc():fs=n}return Ou=cg(e),Nu(),Ot===null&&qe(),!1}function Vu(){Ti&&qe()}function Wu(){yr(),bt.addEventListener("change",()=>{let e=bt.value;if(e===""){wr(null);return}let t=e.indexOf(`
`);wr({method:e.slice(0,t),name:e.slice(t+1)})}),Eu.addEventListener("click",()=>{ps=!0,yr(),qe()}),Lu.addEventListener("click",()=>{ps=!1,yr(),qe()}),ds.addEventListener("mousemove",hg),ds.addEventListener("mouseleave",Sr),bt.addEventListener("blur",Nu)}var ju=50,pg=[{label:"HTML",file:"report.html"},{label:"JSON",file:"report.json"},{label:"Markdown",file:"report.md"}],$t=T("save-report",HTMLInputElement),yn=T("graph-data",HTMLInputElement),wt=T("save-now",HTMLButtonElement),Mr=T("report-paths",HTMLElement),Tr=T("run-notes",HTMLElement),ge=T("run-banner",HTMLElement),Cr=T("folder-banner",HTMLElement),mg=T("runs-panel",HTMLElement),Er=T("runs-body",HTMLElement),Uu=T("runs-empty",HTMLElement),qu=T("runs-footer",HTMLElement),Ei=T("runs-show-all",HTMLButtonElement),Li=T("runs-compare",HTMLButtonElement),Lr=T("runs-compare-note",HTMLElement),Kt=T("runs-error",HTMLElement),Yu=T("runs-delete-col",HTMLElement),xn=null,Ar=!1,be=new Set,$u,Pr=!1,Rr=!1,ms=!1,Dr=null,Pi=!1,Or=!1,Zu="idle",_e=null,Ci=null;function Ri(){let e=hn();return e?{Authorization:"Bearer "+e}:{}}function Xt(e,t){e&&e.setAttribute("aria-disabled",t?"false":"true")}function Hr(e){return!e||e.getAttribute("aria-disabled")==="true"}function gg(e,t){let n=e.headers?e.headers.get("Content-Disposition"):null,s=n?/filename="([^"]+)"/.exec(n):null;return s?s[1]:t}function Qu(e,t){return fetch(e,{headers:Ri()}).then(n=>{if(!n.ok)return n.text().then(i=>i.trim()||"HTTP "+n.status,()=>"HTTP "+n.status);let s=gg(n,t);return n.blob().then(i=>{let o=URL.createObjectURL(i),r=document.createElement("a");return r.href=o,r.download=s,r.rel="noopener",r.style.display="none",document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(o),0),null})}).catch(n=>String(n))}function th(e,t){return"/api/v1/reports/"+encodeURIComponent(e)+"/"+t}function bg(e,t){Qu(th(e,t),"goose-"+e+"-"+t).then(eh)}function eh(e){vn(e?"Download failed: "+e:null)}function vn(e){Kt&&(Kt.textContent=e||"",Kt.hidden=!e)}function _g(e){window.confirm("Delete the reports and logs in "+e+"?")&&fetch("/api/v1/reports/"+encodeURIComponent(e),{method:"DELETE",headers:{"Content-Type":"application/json",...Ri()}}).then(t=>t.status===204?null:t.text().then(n=>n.trim()||"HTTP "+t.status,()=>"HTTP "+t.status),t=>String(t)).then(t=>{Dr=t?"Delete failed: "+t:null,be.delete(e),Nr()})}function xg(e){let t=document.createElement("button");return t.type="button",t.className="ctrl-btn run-delete",t.textContent="Delete",t.setAttribute("aria-label","Delete the report in "+e.name),Xt(t,!e.running),t.addEventListener("click",()=>{Hr(t)||_g(e.name)}),t}function nh(e){let t=document.createElement("span");t.className="run-downloads";for(let n of pg){let s=document.createElement("button");s.type="button",s.className="ctrl-btn run-download",s.textContent=n.label,s.setAttribute("aria-label","Download "+n.label+" report of "+e),s.addEventListener("click",()=>bg(e,n.file)),t.appendChild(s)}return t}function sh(e,t){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Ri()},body:t}).then(n=>n.json().then(s=>({ok:n.ok&&!!s.ok,message:s.message||"HTTP "+n.status}),()=>({ok:!1,message:"HTTP "+n.status}))).catch(n=>({ok:!1,message:String(n)}))}function Ir(e){return!!e&&ms&&!Pi&&!(e===$t&&_e)}function Ku(e,t){if(Hr(t)){t.checked=!t.checked;return}Pi=!0;for(let n of[$t,yn])Xt(n,!1);sh("/api/v1/control/report",JSON.stringify({[e]:t.checked})).then(n=>{Pi=!1;for(let s of[$t,yn])Xt(s,Ir(s));n.ok||(t.checked=!t.checked,vn("Couldn't change the switch: "+n.message))})}function Fr(){return ms&&Zu!=="idle"&&!Or&&!_e}function yg(){if(!wt||Hr(wt))return;let e=wt;Or=!0,Xt(e,!1),sh("/api/v1/control/report/now","{}").then(t=>{Or=!1,Xt(e,Fr()),vn(t.ok?null:"Couldn't save the report now: "+t.message)})}function Xu(e,t){e&&(Pi||(e.checked=t),Xt(e,Ir(e)))}function vg(e){if(e===Ci)return;let t=!!Kt&&!Kt.hidden&&Kt.textContent===Ci;Ci=e,e?vn(e):t&&vn(null)}function wg(){Cr&&(Cr.textContent=_e?"Save report is off for this run. "+_e:"",Cr.hidden=!_e)}var Gu=null;function kg(e,t){if(!ge)return;let n=t==="idle"?(e.last_report||"")+"|"+(e.error||""):"";if(n===Gu||(Gu=n,ge.textContent="",ge.className="run-banner",t!=="idle"))return;if(e.error){ge.className="run-banner error",ge.textContent="Couldn't save the report: "+e.error;return}if(!e.last_report)return;ge.className="run-banner info";let s=document.createElement("span");ge.appendChild(s),s.textContent="Report saved in "+e.last_report+".",e.last_report_name&&(s.textContent+=" Download HTML, JSON or Markdown.",ge.appendChild(nh(e.last_report_name)))}function ih(e){let t=e.report;Zu=e.phase;let n=e.phase!=="idle";_e=n&&!t.folder&&t.error?t.error:null,wg(),Xu($t,t.save),Xu(yn,t.graph_data);let s=$t?$t.closest("label"):null;s&&(s.title=_e?"Off for this run: "+_e:""),wt&&(wt.hidden=!ms,Xt(wt,Fr())),vg(n&&t.folder&&t.error?"Couldn't save the report: "+t.error:null),Mr&&(Mr.textContent=t.paths.length?"Also writes "+t.paths.join(", "):"",Mr.hidden=t.paths.length===0),Tr&&(Tr.textContent=t.notes||"",Tr.hidden=!t.notes),kg(t,e.phase);let i=(t.folder||"")+"|"+(t.last_report||"")+"|"+t.writes;i!==$u&&($u=i,Nr())}function oh(){return"Goose has exited."}function Sg(e){if(e.in_progress)return e.running?"Running":"Incomplete";switch(e.ended_by){case"completed":return"Finished";case"stopped":return"Stopped";case"users_exited":return"Users exited";case"canceled":return e.canceled_reason==="SIGINT received"?"Ctrl-C":"Canceled: "+(e.canceled_reason||"");default:return e.ended_by||""}}function Mg(e){if(!e)return"";let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleString()}function Br(){if(!Er||!xn)return;let e=xn.reports;Er.textContent="";for(let n of Array.from(be))e.some(s=>s.name===n&&s.requests>0)||be.delete(n);let t=Ar?e:e.slice(0,ju);for(let n of t){let s=document.createElement("tr"),i=Et(n.name);i.className="run-id",s.appendChild(i);let o=Et(Mg(n.started));o.className="run-started",s.appendChild(o);let r=Et(n.notes||"");r.className="run-notes",n.notes&&(r.title=n.notes),s.appendChild(r),s.appendChild(Et(Kn(n.duration_secs))),s.appendChild(Et(O(n.max_users))),s.appendChild(Et(O(n.requests))),s.appendChild(Et(O(n.failed_requests))),s.appendChild(Et(Sg(n))),s.appendChild(Et(n.test));let a=document.createElement("td");a.appendChild(nh(n.name)),s.appendChild(a);let l=document.createElement("td"),c=document.createElement("input");if(c.type="checkbox",c.className="run-compare",c.setAttribute("aria-label","Compare "+n.name),c.disabled=n.requests===0,c.checked=be.has(n.name),c.addEventListener("change",()=>{c.checked?be.add(n.name):be.delete(n.name),Ju()}),l.appendChild(c),s.appendChild(l),ms){let u=document.createElement("td");u.appendChild(xg(n)),s.appendChild(u)}Er.appendChild(s)}Uu&&(Uu.hidden=e.length>0),Ei&&(Ei.hidden=Ar||e.length<=ju),qu&&(qu.textContent=O(e.length)+(e.length===1?" report in ":" reports in ")+xn.dir),Ju()}function rh(){if(!xn||be.size!==2)return null;let e=xn.reports.filter(t=>be.has(t.name));return e.length!==2?null:[e[0],e[1]]}function Ju(){let e=rh();if(Li&&(Li.hidden=e===null),Lr){let t=e!==null&&e[0].test!==e[1].test;Lr.hidden=!t,Lr.textContent=t?"These runs are from different tests, so the comparison may not mean much.":""}}function Tg(){let e=rh();if(!e)return;let[t,n]=e,s=th(t.name,"compare.md")+"?baseline="+encodeURIComponent(n.name);Qu(s,"goose-"+t.name+"-vs-"+n.name+".md").then(eh)}function Nr(){if(mg){if(Pr){Rr=!0;return}Pr=!0,fetch("/api/v1/reports",{headers:Ri()}).then(e=>{if(!e.ok)throw new Error("HTTP "+e.status);return e.json()}).then(e=>{xn=e,Br(),vn(Dr||Ci)}).catch(e=>{Kt&&(Kt.textContent="Couldn't list the reports: "+String(e),Kt.hidden=!1)}).then(()=>{Pr=!1,Rr?(Rr=!1,Nr()):Dr=null})}}function ah(e){ms=e,Yu&&(Yu.hidden=!e);for(let t of[$t,yn])Xt(t,Ir(t));wt&&(wt.hidden=!e,Xt(wt,Fr())),Br()}function lh(){if(Ei&&Ei.addEventListener("click",()=>{Ar=!0,Br()}),Li&&Li.addEventListener("click",Tg),$t){let e=$t;e.addEventListener("change",()=>Ku("save",e))}if(yn){let e=yn;e.addEventListener("change",()=>Ku("graph_data",e))}wt&&wt.addEventListener("click",yg)}var Cg=C("hosts",HTMLElement),zr=C("run-settings",HTMLElement),Eg=C("duration",HTMLElement),xe=C("summary-body",HTMLElement),st=C("aggregate-body",HTMLElement),ch=C("kpi-users",HTMLElement),uh=C("kpi-rps",HTMLElement),Lg=C("kpi-fail",HTMLElement),Pg=C("kpi-p95",HTMLElement),Rg=C("kpi-avg",HTMLElement),Ag=C("kpi-p95-label",HTMLElement),Dg=C("kpi-avg-label",HTMLElement),Og=C("requests-co-note",HTMLElement);function Vr(e,t){return[N(e.p50,t?t.p50:null),N(e.p95,t?t.p95:null),N(e.p99,t?t.p99:null)].map(A).join(" / ")}function hh(e,t){return A(e)+" / "+A(t)}function Hg(e,t){let n=document.createElement("small");n.textContent=" / "+O(t),ch.textContent=O(e),ch.appendChild(n)}function Ig(e){uh.textContent=Math.round(e*100)>=1e4?O(e):et(e);let t=uh.parentElement;t&&(t.title="RPS "+et(e))}function dh(e,t,n){e.textContent=t,n===null?e.removeAttribute("title"):e.title=n}function Fg(e){let t=e.phase==="idle",n=!Oc(e.hosts,e.settings.hosts),s=e.hosts.length?e.hosts.join(", "):"\u2014";if(Cg.textContent=t&&n&&e.hosts.length?"Last run: "+s:s,nu()){zr.hidden=!0;return}zr.hidden=!1,zr.textContent=es(e.settings,t&&n)}function Bg(e,t){let n=e.flags;t==="live"?jt("live"):t==="poll"&&jt("poll"),xi(e.phase),Fg(e),Eg.textContent=Kn(e.duration_secs),Hg(e.active_users,e.target_users);let s=e.aggregate;Ig(s.requests_per_second),Lg.textContent=Ho(s.failure_rate);let i=s.percentile_ms,o=s.co_adjusted!=null?s.co_adjusted:null,r=o?" (whole run, adjusted)":" (whole run)",a=s.response_time_us,l=o?o.response_time_us:null,c=Wt(N(i.p95,a?a.p95:null),o?N(o.percentile_ms.p95,l?l.p95:null):null,A),u=Wt(s.response_time_avg_ms,o?o.response_time_avg_ms:null,A);Ag.textContent="p95 ms"+r,Dg.textContent="Avg ms"+r,dh(Pg,A(c.value),c.title),dh(Rg,A(u.value),u.title),Og.hidden=o===null,xe.textContent="",xe.appendChild(X("Phase",e.phase)),xe.appendChild(X("Duration",Kn(e.duration_secs))),xe.appendChild(X("Users",O(e.active_users)+" / "+O(e.target_users))),xe.appendChild(X("Total users",O(e.total_users))),xe.appendChild(X("Goose",e.goose_version)),xe.appendChild(X("Hosts",e.hosts.length?e.hosts.join(", "):"\u2014")),n.series_seconds&&xe.appendChild(X("Series window",O(n.series_seconds)+"s")),st.textContent="",st.appendChild(X("Requests",O(s.total_requests))),st.appendChild(X("Failures",O(s.total_failures))),st.appendChild(X("RPS",et(s.requests_per_second))),st.appendChild(X("Failures/s",et(s.failures_per_second))),st.appendChild(X("Fail %",Ho(s.failure_rate)));let h=hh(N(s.response_time_min_ms,a?a.min:null),N(s.response_time_max_ms,a?a.max:null));o?(st.appendChild(X("Avg ms (adjusted)",A(o.response_time_avg_ms))),st.appendChild(X("p50 / p95 / p99 (adjusted)",Vr(o.percentile_ms,l))),st.appendChild(X("Min / max ms (adjusted)",hh(N(s.response_time_min_ms,a?a.min:null),N(o.response_time_max_ms,l?l.max:null)))),st.appendChild(X("Avg ms (measured)",A(s.response_time_avg_ms))),st.appendChild(X("p50 / p95 / p99 (measured)",Vr(i,a))),st.appendChild(X("Min / max ms (measured)",h))):(st.appendChild(X("Avg ms",A(s.response_time_avg_ms))),st.appendChild(X("p50 / p95 / p99",Vr(i,a))),st.appendChild(X("Min / max ms",h))),s.co_active&&st.appendChild(X("Coordinated omission","active")),ih(e),oc(e);let d=zu(e);if(ac(e.series,d,e.target_users),Zl(e.series,d),iu(e),n.metrics_disabled)ot("Metrics are disabled (--no-metrics). The dashboard shell is live, but request/series data is empty.","warn");else if(n.requests_truncated||n.errors_truncated||n.transaction_errors_truncated){let f=[];n.requests_truncated&&f.push("request rows truncated"),n.errors_truncated&&f.push("error rows truncated"),n.transaction_errors_truncated&&f.push("transaction error rows truncated"),ot(f.join("; ")+" (showing top rows only).","info")}else eu()?ot("Open this dashboard as http://host:port/?token=\u2026 (token required for control).","error"):yc()?(ot(""),vc()):ot("")}gc();rc();Oo();Wu();pc(Fu);window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{Ql(),Vu()});lh();uu().then(ah);Ec(Bg,()=>ot(oh(),"info"));})();
/*! Bundled license information:

@kurkle/color/dist/color.esm.js:
  (*!
   * @kurkle/color v0.3.4
   * https://github.com/kurkle/color#readme
   * (c) 2024 Jukka Kurkela
   * Released under the MIT License
   *)

chart.js/dist/chunks/helpers.segment.js:
chart.js/dist/chart.js:
  (*!
   * Chart.js v4.4.7
   * https://www.chartjs.org
   * (c) 2024 Chart.js Contributors
   * Released under the MIT License
   *)
*/