text: !function(){return function t(e,i,n){function o(r,a){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(s)return s(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var c=i[r]={exports:{}};e[r][0].call(c.exports,function(t){return o(e[r][1][t]||t)},c,c.exports,t,e,i,n)}return i[r].exports}for(var s="function"==typeof require&&require,r=0;r<n.length;r++)o(n[r]);return o}}()({1:[function(t,e,i){var n,o;n=this,o=function(){"use strict";const t="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function e(e,i,n){const o=n||(t=>Array.prototype.slice.call(t));let s=!1,r=[];return function(...n){r=o(n),s||(s=!0,t.call(window,()=>{s=!1,e.apply(i,r)}))}}function i(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}const n=t=>"start"===t?"left":"end"===t?"right":"center",o=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,s=(t,e,i,n)=>{return t===(n?"left":"right")?i:"center"===t?(e+i)/2:e};var r=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach(n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=t.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)(s=o[r])._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};const a={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},l="0123456789ABCDEF",h=t=>l[15&t],c=t=>l[(240&t)>>4]+l[15&t],u=t=>(240&t)>>4==(15&t);function d(t){var e=function(t){return u(t.r)&&u(t.g)&&u(t.b)&&u(t.a)}(t)?h:c;return t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t}function p(t){return t+.5|0}const f=(t,e,i)=>Math.max(Math.min(t,i),e);function g(t){return f(p(2.55*t),0,255)}function m(t){return f(p(255*t),0,255)}function b(t){return f(p(t/2.55)/100,0,1)}function x(t){return f(p(100*t),0,100)}const y=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function v(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function w(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function C(t,e,i){const n=v(t,1,.5);let o;for(e+i>1&&(e*=o=1/(e+i),i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function O(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),r=(o+s)/2;let a,l,h;return o!==s&&(h=o-s,l=r>.5?h/(2-o-s):h/(o+s),a=60*(a=o===e?(i-n)/h+(i<n?6:0):o===i?(n-e)/h+2:(e-i)/h+4)+.5),[0|a,l||0,r]}function S(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(m)}function T(t,e,i){return S(v,t,e,i)}function I(t){return(t%360+360)%360}function M(t){const e=_.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?g(+e[5]):m(+e[5]));const o=I(+e[2]),s=+e[3]/100,r=+e[4]/100;return{r:(i="hwb"===e[1]?function(t,e,i){return S(C,t,e,i)}(o,s,r):"hsv"===e[1]?function(t,e,i){return S(w,t,e,i)}(o,s,r):T(o,s,r))[0],g:i[1],b:i[2],a:n}}const k={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"},L={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"};let E;function A(t){E||((E=function(){const t={},e=Object.keys(L),i=Object.keys(k);let n,o,s,r,a;for(n=0;n<e.length;n++){for(r=a=e[n],o=0;o<i.length;o++)s=i[o],a=a.replace(s,k[s]);s=parseInt(L[r],16),t[a]=[s>>16&255,s>>8&255,255&s]}return t}()).transparent=[0,0,0,0]);const e=E[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}function D(t,e,i){if(t){let n=O(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=T(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function R(t,e){return t?Object.assign(e||{},t):t}function P(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=m(t[3]))):(e=R(t,{r:0,g:0,b:0,a:1})).a=m(e.a),e}function F(t){return"r"===t.charAt(0)?function(t){const e=y.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=255&(e[8]?g(t):255*t)}return i=+e[1],n=+e[3],o=+e[5],{r:i=255&(e[2]?g(i):i),g:n=255&(e[4]?g(n):n),b:o=255&(e[6]?g(o):o),a:s}}}(t):M(t)}class N{constructor(t){if(t instanceof N)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=P(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*a[n[1]],g:255&17*a[n[2]],b:255&17*a[n[3]],a:5===s?17*a[n[4]]:255}:7!==s&&9!==s||(o={r:a[n[1]]<<4|a[n[2]],g:a[n[3]]<<4|a[n[4]],b:a[n[5]]<<4|a[n[6]],a:9===s?a[n[7]]<<4|a[n[8]]:255})),i=o||A(t)||F(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=R(this._rgb);return t&&(t.a=b(t.a)),t}set rgb(t){this._rgb=P(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${b(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?d(this._rgb):this._rgb}hslString(){return this._valid?function(t){if(!t)return;const e=O(t),i=e[0],n=x(e[1]),o=x(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${b(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):this._rgb}mix(t,e){const i=this;if(t){const n=i.rgb,o=t.rgb;let s;const r=e===s?.5:e,a=2*r-1,l=n.a-o.a,h=((a*l==-1?a:(a+l)/(1+a*l))+1)/2;s=1-h,n.r=255&h*n.r+s*o.r+.5,n.g=255&h*n.g+s*o.g+.5,n.b=255&h*n.b+s*o.b+.5,n.a=r*n.a+(1-r)*o.a,i.rgb=n}return i}clone(){return new N(this.rgb)}alpha(t){return this._rgb.a=m(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=p(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return D(this._rgb,2,t),this}darken(t){return D(this._rgb,2,-t),this}saturate(t){return D(this._rgb,1,t),this}desaturate(t){return D(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=O(t);i[0]=I(i[0]+e),i=T(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function B(t){return new N(t)}const H=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function V(t){return H(t)?t:B(t)}function G(t){return H(t)?t:B(t).saturate(.5).darken(.1).hexString()}function z(){}const $=function(){let t=0;return function(){return t++}}();function U(t){return null==t}function j(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.substr(0,7)&&"Array]"===e.substr(-6)}function W(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const X=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function Y(t,e){return X(t)?t:e}function K(t,e){return void 0===t?e:t}const q=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,J=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function Z(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function Q(t,e,i,n){let o,s,r;if(j(t))if(s=t.length,n)for(o=s-1;o>=0;o--)e.call(i,t[o],o);else for(o=0;o<s;o++)e.call(i,t[o],o);else if(W(t))for(s=(r=Object.keys(t)).length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function tt(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function et(t){if(j(t))return t.map(et);if(W(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=et(t[i[o]]);return e}return t}function it(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function nt(t,e,i,n){if(!it(t))return;const o=e[t],s=i[t];W(o)&&W(s)?ot(o,s,n):e[t]=et(s)}function ot(t,e,i){const n=j(e)?e:[e],o=n.length;if(!W(t))return t;const s=(i=i||{}).merger||nt;for(let r=0;r<o;++r){if(!W(e=n[r]))continue;const o=Object.keys(e);for(let n=0,r=o.length;n<r;++n)s(o[n],t,e,i)}return t}function st(t,e){return ot(t,e,{merger:rt})}function rt(t,e,i){if(!it(t))return;const n=e[t],o=i[t];W(n)&&W(o)?st(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=et(o))}const at="",lt=".";function ht(t,e){const i=t.indexOf(lt,e);return-1===i?t.length:i}function ct(t,e){if(e===at)return t;let i=0,n=ht(e,i);for(;t&&n>i;)t=t[e.substr(i,n-i)],n=ht(e,i=n+1);return t}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}const dt=t=>void 0!==t,pt=t=>"function"==typeof t,ft=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},gt=Object.create(null),mt=Object.create(null);function bt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function xt(t,e,i){return"string"==typeof e?ot(bt(t,e),i):ot(bt(t,""),e)}var yt=new class{constructor(t){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=(t=>t.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=((t,e)=>G(e.backgroundColor)),this.hoverBorderColor=((t,e)=>G(e.borderColor)),this.hoverColor=((t,e)=>G(e.color)),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0},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.describe(t)}set(t,e){return xt(this,t,e)}get(t){return bt(this,t)}describe(t,e){return xt(mt,t,e)}override(t,e){return xt(gt,t,e)}route(t,e,i,n){const o=bt(this,t),s=bt(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return W(t)?Object.assign({},e,t):K(t,e)},set(t){this[r]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});const _t=Math.PI,vt=2*_t,wt=vt+_t,Ct=Number.POSITIVE_INFINITY,Ot=_t/180,St=_t/2,Tt=_t/4,It=2*_t/3,Mt=Math.log10,kt=Math.sign;function Lt(t){const e=Math.round(t);t=Dt(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(Mt(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function Et(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort((t,e)=>t-e).pop(),e}function At(t){return!isNaN(parseFloat(t))&&isFinite(t)}function Dt(t,e,i){return Math.abs(t-e)<i}function Rt(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function Pt(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Ft(t){return t*(_t/180)}function Nt(t){return t*(180/_t)}function Bt(t){if(!X(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Ht(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*_t&&(s+=vt),{angle:s,distance:o}}function Vt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gt(t,e){return(t-e+wt)%vt-_t}function zt(t){return(t%vt+vt)%vt}function $t(t,e,i,n){const o=zt(t),s=zt(e),r=zt(i),a=zt(s-o),l=zt(r-o),h=zt(o-s),c=zt(o-r);return o===s||o===r||n&&s===r||a>l&&h<c}function Ut(t,e,i){return Math.max(e,Math.min(i,t))}function jt(t){return Ut(t,-32768,32767)}function Wt(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function Xt(t){return!t||U(t.size)||U(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Yt(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function Kt(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,h,c,u,d;for(l=0;l<a;l++)if(null!=(u=i[l])&&!0!==j(u))r=Yt(t,o,s,r,u);else if(j(u))for(h=0,c=u.length;h<c;h++)null==(d=u[h])||j(d)||(r=Yt(t,o,s,r,d));t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function qt(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function Jt(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Zt(t,e,i,n){let o,s,r,a,l;const h=e.pointStyle,c=e.rotation,u=e.radius;let d=(c||0)*Ot;if(h&&"object"==typeof h&&("[object HTMLImageElement]"===(o=h.toString())||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,n),t.rotate(d),t.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),void t.restore();if(!(isNaN(u)||u<=0)){switch(t.beginPath(),h){default:t.arc(i,n,u,0,vt),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(d)*u,n-Math.cos(d)*u),d+=It,t.lineTo(i+Math.sin(d)*u,n-Math.cos(d)*u),d+=It,t.lineTo(i+Math.sin(d)*u,n-Math.cos(d)*u),t.closePath();break;case"rectRounded":a=u-(l=.516*u),s=Math.cos(d+Tt)*a,r=Math.sin(d+Tt)*a,t.arc(i-s,n-r,l,d-_t,d-St),t.arc(i+r,n-s,l,d-St,d),t.arc(i+s,n+r,l,d,d+St),t.arc(i-r,n+s,l,d+St,d+_t),t.closePath();break;case"rect":if(!c){a=Math.SQRT1_2*u,t.rect(i-a,n-a,2*a,2*a);break}d+=Tt;case"rectRot":s=Math.cos(d)*u,r=Math.sin(d)*u,t.moveTo(i-s,n-r),t.lineTo(i+r,n-s),t.lineTo(i+s,n+r),t.lineTo(i-r,n+s),t.closePath();break;case"crossRot":d+=Tt;case"cross":s=Math.cos(d)*u,r=Math.sin(d)*u,t.moveTo(i-s,n-r),t.lineTo(i+s,n+r),t.moveTo(i+r,n-s),t.lineTo(i-r,n+s);break;case"star":s=Math.cos(d)*u,r=Math.sin(d)*u,t.moveTo(i-s,n-r),t.lineTo(i+s,n+r),t.moveTo(i+r,n-s),t.lineTo(i-r,n+s),d+=Tt,s=Math.cos(d)*u,r=Math.sin(d)*u,t.moveTo(i-s,n-r),t.lineTo(i+s,n+r),t.moveTo(i+r,n-s),t.lineTo(i-r,n+s);break;case"line":s=Math.cos(d)*u,r=Math.sin(d)*u,t.moveTo(i-s,n-r),t.lineTo(i+s,n+r);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(d)*u,n+Math.sin(d)*u)}t.fill(),e.borderWidth>0&&t.stroke()}}function Qt(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function te(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function ee(t){t.restore()}function ie(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function ne(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function oe(t,e,i,n,o,s={}){const r=j(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,h;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]);U(e.rotation)||t.rotate(e.rotation);e.color&&(t.fillStyle=e.color);e.textAlign&&(t.textAlign=e.textAlign);e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)h=r[l],a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),U(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(h,i,n,s.maxWidth)),t.fillText(h,i,n,s.maxWidth),se(t,i,n,h,s),n+=o.lineHeight;t.restore()}function se(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,h=i+s.actualBoundingBoxDescent,c=o.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,c),t.lineTo(a,c),t.stroke()}}function re(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,-St,_t,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,_t,St,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,St,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-St,!0),t.lineTo(i+r.topLeft,n)}function ae(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)i(n=s+o>>1)?s=n:o=n;return{lo:s,hi:o}}const le=(t,e,i)=>ae(t,i,n=>t[n][e]<i),he=(t,e,i)=>ae(t,i,n=>t[n][e]>=i);function ce(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}const ue=["push","pop","shift","splice","unshift"];function de(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ue.forEach(e=>{const i="_onData"+ut(e),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const o=n.apply(this,e);return t._chartjs.listeners.forEach(t=>{"function"==typeof t[i]&&t[i](...e)}),o}})}))}function pe(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(ue.forEach(e=>{delete t[e]}),delete t._chartjs)}function fe(t){const e=new Set;let i,n;for(i=0,n=t.length;i<n;++i)e.add(t[i]);return e.size===n?t:Array.from(e)}function ge(){return"undefined"!=typeof window&&"undefined"!=typeof document}function me(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function be(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const xe=t=>window.getComputedStyle(t,null);function ye(t,e){return xe(t).getPropertyValue(e)}const _e=["top","right","bottom","left"];function ve(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=_e[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const we=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function Ce(t,e){const{canvas:i,currentDevicePixelRatio:n}=e,o=xe(i),s="border-box"===o.boxSizing,r=ve(o,"padding"),a=ve(o,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.native||t,n=i.touches,o=n&&n.length?n[0]:i,{offsetX:s,offsetY:r}=o;let a,l,h=!1;if(we(s,r,i.target))a=s,l=r;else{const t=e.getBoundingClientRect();a=o.clientX-t.left,l=o.clientY-t.top,h=!0}return{x:a,y:l,box:h}}(t,i),u=r.left+(c&&a.left),d=r.top+(c&&a.top);let{width:p,height:f}=e;return s&&(p-=r.width+a.width,f-=r.height+a.height),{x:Math.round((l-u)/p*i.width/n),y:Math.round((h-d)/f*i.height/n)}}const Oe=t=>Math.round(10*t)/10;function Se(t,e,i,n){const o=xe(t),s=ve(o,"margin"),r=be(o.maxWidth,t,"clientWidth")||Ct,a=be(o.maxHeight,t,"clientHeight")||Ct,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=me(t);if(s){const t=s.getBoundingClientRect(),r=xe(s),a=ve(r,"border","width"),l=ve(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=be(r.maxWidth,s,"clientWidth"),o=be(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||Ct,maxHeight:o||Ct}}(t,e,i);let{width:h,height:c}=l;if("content-box"===o.boxSizing){const t=ve(o,"border","width"),e=ve(o,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-s.width),c=Math.max(0,n?Math.floor(h/n):c-s.height),h=Oe(Math.min(h,r,l.maxWidth)),c=Oe(Math.min(c,a,l.maxHeight)),h&&!c&&(c=Oe(h/2)),{width:h,height:c}}function Te(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=o/n,t.width=s/n;const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const Ie=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function Me(t,e){const i=ye(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function ke(t,e){return"native"in t?{x:t.x,y:t.y}:Ce(t,e)}function Le(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale;if(a&&e===a.axis&&r&&s.length){const t=a._reversePixels?he:le;if(!n)return t(s,e,i);if(o._sharedOptions){const n=s[0],o="function"==typeof n.getRange&&n.getRange(e);if(o){const n=t(s,e,i-o),r=t(s,e,i+o);return{lo:n.lo,hi:r.hi}}}}return{lo:0,hi:s.length-1}}function Ee(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:h}=Le(s[t],e,r,o);for(let t=l;t<=h;++t){const e=a[t];e.skip||n(e,i,t)}}}function Ae(t,e,i,n){const o=[];if(!Qt(e,t.chartArea,t._minPadding))return o;return Ee(t,i,e,function(t,i,s){t.inRange(e.x,e.y,n)&&o.push({element:t,datasetIndex:i,index:s})},!0),o}function De(t,e,i,n,o){const s=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let r=Number.POSITIVE_INFINITY,a=[];if(!Qt(e,t.chartArea,t._minPadding))return a;return Ee(t,i,e,function(i,l,h){if(n&&!i.inRange(e.x,e.y,o))return;const c=i.getCenterPoint(o);if(!Qt(c,t.chartArea,t._minPadding)&&!i.inRange(e.x,e.y,o))return;const u=s(e,c);u<r?(a=[{element:i,datasetIndex:l,index:h}],r=u):u===r&&a.push({element:i,datasetIndex:l,index:h})}),a}function Re(t,e,i,n){const o=ke(e,t),s=[],r=i.axis,a="x"===r?"inXRange":"inYRange";let l=!1;return function(t,e){const i=t.getSortedVisibleDatasetMetas();let n,o,s;for(let t=0,r=i.length;t<r;++t){({index:n,data:o}=i[t]);for(let t=0,i=o.length;t<i;++t)(s=o[t]).skip||e(s,n,t)}}(t,(t,e,i)=>{t[a](o[r],n)&&s.push({element:t,datasetIndex:e,index:i}),t.inRange(o.x,o.y,n)&&(l=!0)}),i.intersect&&!l?[]:s}var Pe={modes:{index(t,e,i,n){const o=ke(e,t),s=i.axis||"x",r=i.intersect?Ae(t,o,s,n):De(t,o,s,!1,n),a=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&a.push({element:i,datasetIndex:t.index,index:e})}),a):[]},dataset(t,e,i,n){const o=ke(e,t),s=i.axis||"xy";let r=i.intersect?Ae(t,o,s,n):De(t,o,s,!1,n);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,n)=>Ae(t,ke(e,t),i.axis||"xy",n),nearest:(t,e,i,n)=>De(t,ke(e,t),i.axis||"xy",i.intersect,n),x:(t,e,i,n)=>Re(t,e,{axis:"x",intersect:i.intersect},n),y:(t,e,i,n)=>Re(t,e,{axis:"y",intersect:i.intersect},n)}};const Fe=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),Ne=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function Be(t,e){const i=(""+t).match(Fe);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const He=t=>+t||0;function Ve(t,e){const i={},n=W(e),o=n?Object.keys(e):e,s=W(t)?n?i=>K(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=He(s(t));return i}function Ge(t){return Ve(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ze(t){return Ve(t,["topLeft","topRight","bottomLeft","bottomRight"])}function $e(t){const e=Ge(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ue(t,e){t=t||{},e=e||yt.font;let i=K(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=K(t.style,e.style);n&&!(""+n).match(Ne)&&(console.warn('Invalid font style specified: "'+n+'"'),n="");const o={family:K(t.family,e.family),lineHeight:Be(K(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:K(t.weight,e.weight),string:""};return o.string=Xt(o),o}function je(t,e,i,n){let o,s,r,a=!0;for(o=0,s=t.length;o<s;++o)if(void 0!==(r=t[o])&&(void 0!==e&&"function"==typeof r&&(r=r(e),a=!1),void 0!==i&&j(r)&&(r=r[i%r.length],a=!1),void 0!==r))return n&&!a&&(n.cacheable=!1),r}function We(t,e,i){const{min:n,max:o}=t,s=J(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}function Xe(t,e){return Object.assign(Object.create(t),e)}const Ye=["left","top","right","bottom"];function Ke(t,e){return t.filter(t=>t.pos===e)}function qe(t,e){return t.filter(t=>-1===Ye.indexOf(t.pos)&&t.box.axis===e)}function Je(t,e){return t.sort((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Ze(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!Ye.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],h=l&&a.stackWeight/l.weight;a.horizontal?(a.width=h?h*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=h?h*o:r&&e.availableHeight)}return i}function Qe(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function ti(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function ei(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!W(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&ti(r,s.getPadding());const a=Math.max(0,e.outerWidth-Qe(r,t,"left","right")),l=Math.max(0,e.outerHeight-Qe(r,t,"top","bottom")),h=a!==t.w,c=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function ii(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{n[t]=Math.max(e[t],i[t])}),n}return n(t?["left","right"]:["top","bottom"])}function ni(t,e,i,n){const o=[];let s,r,a,l,h,c;for(s=0,r=t.length,h=0;s<r;++s){(l=(a=t[s]).box).update(a.width||e.w,a.height||e.h,ii(a.horizontal,e));const{same:r,other:u}=ei(e,i,a,n);h|=r&&o.length,c=c||u,l.fullSize||o.push(a)}return h&&ni(o,e,i,n)||c}function oi(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function si(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*h,s=l.size||t.height;dt(l.start)&&(r=l.start),t.fullSize?oi(t,o.left,r,i.outerWidth-o.right-o.left,s):oi(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*h,r=l.size||t.width;dt(l.start)&&(s=l.start),t.fullSize?oi(t,s,o.top,r,i.outerHeight-o.bottom-o.top):oi(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}yt.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var ri={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=$e(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=Je(e.filter(t=>t.box.fullSize),!0),n=Je(Ke(e,"left"),!0),o=Je(Ke(e,"right")),s=Je(Ke(e,"top"),!0),r=Je(Ke(e,"bottom")),a=qe(e,"x"),l=qe(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:Ke(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,h=a.horizontal;Q(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});const c=l.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/c,hBoxMaxHeight:r/2}),d=Object.assign({},o);ti(d,$e(n));const p=Object.assign({maxPadding:d,w:s,h:r,x:o.left,y:o.top},o),f=Ze(l.concat(h),u);ni(a.fullSize,p,u,f),ni(l,p,u,f),ni(h,p,u,f)&&ni(l,p,u,f),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),si(a.leftAndTop,p,u,f),p.x+=p.w,p.y+=p.h,si(a.rightAndBottom,p,u,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Q(a.chartArea,e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};function ai(t,e=[""],i=t,n,o=(()=>t[0])){return dt(n)||(n=xi("_fallback",t)),new Proxy({[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:n,_getTarget:o,override:o=>ai([o,...t],e,i,n)},{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>di(i,n,()=>(function(t,e,i,n){let o;for(const s of e)if(o=xi(ci(s,t),i),dt(o))return ui(t,o)?mi(i,n,t,o):o})(n,e,t,i)),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>yi(t).includes(e),ownKeys:t=>yi(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function li(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:hi(t,n),setContext:e=>li(t,e,i,n),override:o=>li(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>di(t,e,()=>(function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];pt(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t),e=e(s,r||n),a.delete(t),ui(t,e)&&(e=mi(o._scopes,o,t,e));return e}(e,a,t,i));j(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(dt(s.index)&&n(t))e=e[s.index%e.length];else if(W(e[0])){const i=e,n=o._scopes.filter(t=>t!==i);e=[];for(const l of i){const i=mi(n,o,t,l);e.push(li(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));ui(e,a)&&(a=li(a,o,s&&s[e],r));return a})(t,e,i)),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function hi(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:pt(i)?i:()=>i,isIndexable:pt(n)?n:()=>n}}const ci=(t,e)=>t?t+ut(e):e,ui=(t,e)=>W(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function di(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const n=i();return t[e]=n,n}function pi(t,e,i){return pt(t)?t(e,i):t}const fi=(t,e)=>!0===t?e:"string"==typeof t?ct(e,t):void 0;function gi(t,e,i,n){for(const o of e){const e=fi(i,o);if(e){t.add(e);const o=pi(e._fallback,i,e);if(dt(o)&&o!==i&&o!==n)return o}else if(!1===e&&dt(n)&&i!==n)return null}return!1}function mi(t,e,i,n){const o=e._rootScopes,s=pi(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=bi(a,r,i,s||i);return null!==l&&((!dt(s)||s===i||null!==(l=bi(a,r,s,l)))&&ai(Array.from(a),[""],o,s,()=>(function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(j(o)&&W(i))return i;return o})(e,i,n)))}function bi(t,e,i,n){for(;i;)i=gi(t,e,i,n);return i}function xi(t,e){for(const i of e){if(!i)continue;const e=i[t];if(dt(e))return e}}function yi(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}(t._scopes)),e}const _i=Number.EPSILON||1e-14,vi=(t,e)=>e<t.length&&!t[e].skip&&t[e],wi=t=>"x"===t?"y":"x";function Ci(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=Vt(s,o),l=Vt(r,s);let h=a/(a+l),c=l/(a+l);const u=n*(h=isNaN(h)?0:h),d=n*(c=isNaN(c)?0:c);return{previous:{x:s.x-u*(r.x-o.x),y:s.y-u*(r.y-o.y)},next:{x:s.x+d*(r.x-o.x),y:s.y+d*(r.y-o.y)}}}function Oi(t,e="x"){const i=wi(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,h=vi(t,0);for(r=0;r<n;++r)if(a=l,l=h,h=vi(t,r+1),l){if(h){const t=h[e]-l[e];o[r]=0!==t?(h[i]-l[i])/t:0}s[r]=a?h?kt(o[r-1])!==kt(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,h=vi(t,0);for(let c=0;c<n-1;++c)l=h,h=vi(t,c+1),l&&h&&(Dt(e[c],0,_i)?i[c]=i[c+1]=0:(o=i[c]/e[c],s=i[c+1]/e[c],(a=Math.pow(o,2)+Math.pow(s,2))<=9||(r=3/Math.sqrt(a),i[c]=o*r*e[c],i[c+1]=s*r*e[c])))}(t,o,s),function(t,e,i="x"){const n=wi(i),o=t.length;let s,r,a,l=vi(t,0);for(let h=0;h<o;++h){if(r=a,a=l,l=vi(t,h+1),!a)continue;const o=a[i],c=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=c-s*e[h]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=c+s*e[h])}}(t,s,e)}function Si(t,e,i){return Math.max(Math.min(t,i),e)}function Ti(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)Oi(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)l=Ci(i,a=t[s],t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=Qt(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&Qt(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=Si(o.cp1x,e.left,e.right),o.cp1y=Si(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=Si(o.cp2x,e.left,e.right),o.cp2y=Si(o.cp2y,e.top,e.bottom)))}(t,i)}const Ii=t=>0===t||1===t,Mi=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*vt/i),ki=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*vt/i)+1,Li={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*St),easeOutSine:t=>Math.sin(t*St),easeInOutSine:t=>-.5*(Math.cos(_t*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Ii(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Ii(t)?t:Mi(t,.075,.3),easeOutElastic:t=>Ii(t)?t:ki(t,.075,.3),easeInOutElastic:t=>Ii(t)?t:t<.5?.5*Mi(2*t,.1125,.45):.5+.5*ki(2*t-1,.1125,.45),easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-Li.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*Li.easeInBounce(2*t):.5*Li.easeOutBounce(2*t-1)+.5};function Ei(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Ai(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function Di(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=Ei(t,o,i),a=Ei(o,s,i),l=Ei(s,e,i),h=Ei(r,a,i),c=Ei(a,l,i);return Ei(h,c,i)}const Ri=new Map;function Pi(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=Ri.get(i);return n||(n=new Intl.NumberFormat(t,e),Ri.set(i,n)),n}(e,i).format(t)}const Fi=function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}},Ni=function(){return{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}};function Bi(t,e,i){return t?Fi(e,i):Ni()}function Hi(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(n=[(i=t.canvas.style).getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Vi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Gi(t){return"angle"===t?{between:$t,compare:Gt,normalize:zt}:{between:Wt,compare:(t,e)=>t-e,normalize:t=>t}}function zi({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function $i(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:h}=Gi(n),{start:c,end:u,loop:d,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=Gi(n),l=e.length;let h,c,{start:u,end:d,loop:p}=t;if(p){for(u+=l,d+=l,h=0,c=l;h<c&&r(a(e[u%l][n]),o,s);++h)u--,d--;u%=l,d%=l}return d<u&&(d+=l),{start:u,end:d,loop:p,style:t.style}}(t,e,i),f=[];let g,m,b,x=!1,y=null;const _=()=>x||(()=>l(o,b,g)&&0!==a(o,b))(),v=()=>!x||(()=>0===a(s,g)||l(s,b,g))();for(let t=c,i=c;t<=u;++t)(m=e[t%r]).skip||(g=h(m[n]))!==b&&(x=l(g,o,s),null===y&&_()&&(y=0===a(g,o)?t:i),null!==y&&v()&&(f.push(zi({start:y,end:t,loop:d,count:r,style:p})),y=null),i=t,b=g);return null!==y&&f.push(zi({start:y,end:u,loop:d,count:r,style:p})),f}function Ui(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=$i(n[o],t.points,e);s.length&&i.push(...s)}return i}function ji(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return{start:o,end:s%=e}}(i,o,s,n);return Wi(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}function Wi(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Xi(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,h=[];let c=s,u=e[0].start,d=u;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:n,style:o}),c=o,u=e%l)}}for(const t of e){u=a?u:t.start;let e,s=i[u%l];for(d=u+1;d<=t.end;d++){const a=i[d%l];Yi(e=Xi(n.setContext(Xe(o,{type:"segment",p0:s,p1:a,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),c)&&p(u,d-1,t.loop,c),s=a,c=e}u<d-1&&p(u,d-1,t.loop,c)}return h}(t,e,i,n):e}function Xi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Yi(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var Ki=Object.freeze({__proto__:null,easingEffects:Li,color:V,getHoverColor:G,noop:z,uid:$,isNullOrUndef:U,isArray:j,isObject:W,isFinite:X,finiteOrDefault:Y,valueOrDefault:K,toPercentage:q,toDimension:J,callback:Z,each:Q,_elementsEqual:tt,clone:et,_merger:nt,merge:ot,mergeIf:st,_mergerIf:rt,_deprecated:function(t,e,i,n){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+n+'" instead')},resolveObjectKey:ct,_capitalize:ut,defined:dt,isFunction:pt,setsEqual:ft,toFontString:Xt,_measureText:Yt,_longestText:Kt,_alignPixel:qt,clearCanvas:Jt,drawPoint:Zt,_isPointInArea:Qt,clipArea:te,unclipArea:ee,_steppedLineTo:ie,_bezierCurveTo:ne,renderText:oe,addRoundedRectPath:re,_lookup:ae,_lookupByKey:le,_rlookupByKey:he,_filterBetween:ce,listenArrayEvents:de,unlistenArrayEvents:pe,_arrayUnique:fe,_createResolver:ai,_attachContext:li,_descriptors:hi,splineCurve:Ci,splineCurveMonotone:Oi,_updateBezierControlPoints:Ti,_isDomSupported:ge,_getParentNode:me,getStyle:ye,getRelativePosition:Ce,getMaximumSize:Se,retinaScale:Te,supportsEventListenerOptions:Ie,readUsedSize:Me,fontString:function(t,e,i){return e+" "+t+"px "+i},requestAnimFrame:t,throttled:e,debounce:i,_toLeftRightCenter:n,_alignStartEnd:o,_textX:s,_pointInLine:Ei,_steppedInterpolation:Ai,_bezierInterpolation:Di,formatNumber:Pi,toLineHeight:Be,_readValueToProps:Ve,toTRBL:Ge,toTRBLCorners:ze,toPadding:$e,toFont:Ue,resolve:je,_addGrace:We,createContext:Xe,PI:_t,TAU:vt,PITAU:wt,INFINITY:Ct,RAD_PER_DEG:Ot,HALF_PI:St,QUARTER_PI:Tt,TWO_THIRDS_PI:It,log10:Mt,sign:kt,niceNum:Lt,_factorize:Et,isNumber:At,almostEquals:Dt,almostWhole:Rt,_setMinAndMaxByKey:Pt,toRadians:Ft,toDegrees:Nt,_decimalPlaces:Bt,getAngleFromPoint:Ht,distanceBetweenPoints:Vt,_angleDiff:Gt,_normalizeAngle:zt,_angleBetween:$t,_limitValue:Ut,_int16Range:jt,_isBetween:Wt,getRtlAdapter:Bi,overrideTextDirection:Hi,restoreTextDirection:Vi,_boundSegment:$i,_boundSegments:Ui,_computeSegments:ji});class qi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class Ji extends qi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Zi="$chartjs",Qi={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},tn=t=>null===t||""===t,en=!!Ie&&{passive:!0};function nn(t,e,i){t.canvas.removeEventListener(e,i,en)}function on(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function sn(t,e,i){const n=t.canvas,o=new MutationObserver(t=>{let e=!1;for(const i of t)e=(e=e||on(i.addedNodes,n))&&!on(i.removedNodes,n);e&&i()});return o.observe(document,{childList:!0,subtree:!0}),o}function rn(t,e,i){const n=t.canvas,o=new MutationObserver(t=>{let e=!1;for(const i of t)e=(e=e||on(i.removedNodes,n))&&!on(i.addedNodes,n);e&&i()});return o.observe(document,{childList:!0,subtree:!0}),o}const an=new Map;let ln=0;function hn(){const t=window.devicePixelRatio;t!==ln&&(ln=t,an.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function cn(t,i,n){const o=t.canvas,s=o&&me(o);if(!s)return;const r=e((t,e)=>{const i=s.clientWidth;n(t,e),i<s.clientWidth&&n()},window),a=new ResizeObserver(t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||r(i,n)});return a.observe(s),function(t,e){an.size||window.addEventListener("resize",hn),an.set(t,e)}(t,r),a}function un(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){an.delete(t),an.size||window.removeEventListener("resize",hn)}(t)}function dn(t,i,n){const o=t.canvas,s=e(e=>{null!==t.ctx&&n(function(t,e){const i=Qi[t.type]||t.type,{x:n,y:o}=Ce(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))},t,t=>{const e=t[0];return[e,e.offsetX,e.offsetY]});return function(t,e,i){t.addEventListener(e,i,en)}(o,i,s),s}class pn extends qi{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[Zi]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",tn(o)){const e=Me(t,"width");void 0!==e&&(t.width=e)}if(tn(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Me(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Zi])return!1;const i=e[Zi].initial;["height","width"].forEach(t=>{const n=i[t];U(n)?e.removeAttribute(t):e.setAttribute(t,n)});const n=i.style||{};return Object.keys(n).forEach(t=>{e.style[t]=n[t]}),e.width=e.width,delete e[Zi],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:sn,detach:rn,resize:cn}[e]||dn;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];n&&(({attach:un,detach:un,resize:un}[e]||nn)(t,e,n),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Se(t,e,i,n)}isAttached(t){const e=me(t);return!(!e||!e.isConnected)}}function fn(t){return!ge()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Ji:pn}var gn=Object.freeze({__proto__:null,_detectPlatform:fn,BasePlatform:qi,BasicPlatform:Ji,DomPlatform:pn});const mn={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=V(t||"transparent"),o=n.valid&&V(e||"transparent");return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class bn{constructor(t,e,i,n){const o=e[i];n=je([t.to,n,o,t.from]);const s=je([t.from,o,n]);this._active=!0,this._fn=t.fn||mn[t.type||typeof s],this._easing=Li[t.easing]||Li.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=je([t.to,e,n,t.from]),this._from=je([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}yt.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const xn=Object.keys(yt.animation);yt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),yt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),yt.describe("animations",{_fallback:"animation"}),yt.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=>0|t}}}});class yn{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!W(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const n=t[i];if(!W(n))return;const o={};for(const t of xn)o[t]=n[t];(j(n.properties)&&n.properties||[i]).forEach(t=>{t!==i&&e.has(t)||e.set(t,o)})})}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const h=e[l];let c=o[l];const u=i.get(l);if(c){if(u&&c.active()){c.update(u,h,r);continue}c.cancel()}u&&u.duration?(o[l]=c=new bn(u,t,l,h),n.push(c)):t[l]=h}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(r.add(this._chart,i),!0):void 0}}function _n(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function vn(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function wn(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,h;if(null!==e){for(r=0,a=o.length;r<a;++r){if((l=+o[r])===i){if(n.all)continue;break}h=t.values[l],X(h)&&(s||0===e||kt(e)===kt(h))&&(e+=h)}return e}}function Cn(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function On(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Sn(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function Tn(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,h=r.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),u=e.length;let d;for(let t=0;t<u;++t){const i=e[t],{[l]:s,[h]:u}=i;(d=(i._stacks||(i._stacks={}))[h]=On(o,c,s))[a]=u,d._top=Sn(d,r,!0,n.type),d._bottom=Sn(d,r,!1,n.type)}}function In(t,e){const i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function Mn(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i]}}}const kn=t=>"reset"===t||"none"===t,Ln=(t,e)=>e?t:Object.assign({},t),En=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:vn(i,!0),values:null};class An{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Cn(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Mn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=K(i.xAxisID,In(t,"x")),s=e.yAxisID=K(i.yAxisID,In(t,"y")),r=e.rAxisID=K(i.rAxisID,In(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),h=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&pe(this._data,this),t._stacked&&Mn(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(W(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n],i[n]={x:s,y:t[s]};return i}(e);else if(i!==e){if(i){pe(i,this);const t=this._cachedMeta;Mn(t),t._parsed=[]}e&&Object.isExtensible(e)&&de(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Cn(e.vScale,e),e.stack!==i.stack&&(n=!0,Mn(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&Tn(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,h,c=0===t&&e===n.length||i._sorted,u=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,h=n;else{h=j(n[t])?this.parseArrayData(i,n,t,e):W(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||u&&l[r]<u[r];for(a=0;a<e;++a)i._parsed[a+t]=l=h[a],c&&(o()&&(c=!1),u=l);i._sorted=c}s&&Tn(this,h)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),h=o===s,c=new Array(n);let u,d,p;for(u=0,d=n;u<d;++u)p=u+i,c[u]={[r]:h||o.parse(l[p],p),[a]:s.parse(e[p],p)};return c}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,h,c;for(a=0,l=n;a<l;++a)c=e[h=a+i],r[a]={x:o.parse(c[0],h),y:s.parse(c[1],h)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let h,c,u,d;for(h=0,c=n;h<c;++h)d=e[u=h+i],l[h]={x:o.parse(ct(d,r),u),y:s.parse(ct(d,a),u)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return wn({keys:vn(n,!0),values:e._stacks[t.axis]},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=wn(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=En(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let u,d;function p(){const e=(d=n[u])[r.axis];return!X(d[t.axis])||h>e||c<e}for(u=0;u<s&&(p()||(this.updateRangeFromParsed(l,t,d,a),!o));++u);if(o)for(u=s-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(l,t,d,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],X(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return W(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(K(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=_n(t,i),o=_n(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r;let l;for(i.dataset&&i.dataset.draw(t,o,r,a),l=r;l<r+a;++l){const e=n[l];e.hidden||(e.active?s.push(e):e.draw(t,o))}for(l=0;l<s.length;++l)s[l].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];(o=e.$context||(e.$context=function(t,e,i){return Xe(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e))).parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else(o=this.$context||(this.$context=function(t,e){return Xe(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index))).dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&dt(i);if(r)return Ln(r,a);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=n?[`${t}Hover`,"hover",t,""]:[t,""],u=l.getOptionScopes(this.getDataset(),h),d=Object.keys(yt.elements[t]),p=l.resolveNamedOptions(u,d,()=>this.getContext(i,n),c);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(Ln(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new yn(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||kn(t)||this.chart._animationsDisabled}updateElement(t,e,i,n){kn(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!kn(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&Mn(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}An.defaults={},An.prototype.datasetElementType=null,An.prototype.dataElementType=null;class Dn{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return At(this.x)&&At(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach(t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),n}}Dn.defaults={},Dn.defaultRoutes=void 0;const Rn={values:t=>j(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=Mt(Math.abs(s)),a=Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Pi(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=t/Math.pow(10,Math.floor(Mt(t)));return 1===n||2===n||5===n?Rn.numeric.call(this,t,e,i):""}};var Pn={formatters:Rn};function Fn(t,e){const i=t.options.ticks,n=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],s=o.length,r=o[0],a=o[s-1],l=[];if(s>n)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),r=i[++s*n])}(e,l,o,s/n),l;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=Et(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(o,e,n);if(s>0){let t,i;const n=s>1?Math.round((a-r)/(s-1)):null;for(Nn(e,l,h,U(n)?0:r-n,r),t=0,i=s-1;t<i;t++)Nn(e,l,h,o[t],o[t+1]);return Nn(e,l,h,a,U(n)?e.length:a+n),l}return Nn(e,l,h),l}function Nn(t,e,i,n,o){const s=K(n,0),r=Math.min(K(o,t.length),t.length);let a,l,h,c=0;for(i=Math.ceil(i),o&&(i=(a=o-n)/Math.floor(a/i)),h=s;h<0;)c++,h=Math.round(s+c*i);for(l=Math.max(s,0);l<r;l++)l===h&&(e.push(t[l]),c++,h=Math.round(s+c*i))}yt.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth: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:Pn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),yt.route("scale.ticks","color","","color"),yt.route("scale.grid","color","","borderColor"),yt.route("scale.grid","borderColor","","borderColor"),yt.route("scale.title","color","","color"),yt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),yt.describe("scales",{_fallback:"scale"}),yt.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Bn=t=>"left"===t?"right":"right"===t?"left":t,Hn=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Vn(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function Gn(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel;let a,l=t.getPixelForTick(o);if(!(i&&(a=1===n?Math.max(l-s,r-l):0===e?(t.getPixelForTick(1)-l)/2:(l-t.getPixelForTick(o-1))/2,(l+=o<e?a:-a)<s-1e-6||l>r+1e-6)))return l}function zn(t){return t.drawTicks?t.tickLength:0}function $n(t,e){if(!t.display)return 0;const i=Ue(t.font,e),n=$e(t.padding);return(j(t.text)?t.text.length:1)*i.lineHeight+n.height}function Un(t,e,i){let o=n(t);return(i&&"right"!==e||!i&&"right"===e)&&(o=Bn(o)),o}class jn extends Dn{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=Y(t,Number.POSITIVE_INFINITY),e=Y(e,Number.NEGATIVE_INFINITY),i=Y(i,Number.POSITIVE_INFINITY),n=Y(n,Number.NEGATIVE_INFINITY),{min:Y(t,i),max:Y(e,n),minDefined:X(t),maxDefined:X(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return{min:Y(i=s&&i>n?n:i,Y(n=o&&i>n?i:n,i)),max:Y(n,Y(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Z(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=We(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?Vn(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=Fn(this,this.ticks),this._labelSizes=null),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Z(this.options.afterUpdate,[this])}beforeSetDimensions(){Z(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Z(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Z(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Z(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)(o=t[i]).label=Z(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){Z(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Z(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=this.ticks.length,n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const h=this._getLabelSizes(),c=h.widest.width,u=h.highest.height,d=Ut(this.chart.width-c,0,this.maxWidth);c+6>(s=t.offset?this.maxWidth/i:d/(i-1))&&(s=d/(i-(t.offset?.5:1)),r=this.maxHeight-zn(t.grid)-e.padding-$n(t.title,this.chart.options.font),a=Math.sqrt(c*c+u*u),l=Nt(Math.min(Math.asin(Ut((h.highest.height+6)/s,-1,1)),Math.asin(Ut(r/a,-1,1))-Math.asin(Ut(u/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){Z(this.options.afterCalculateLabelRotation,[this])}beforeFit(){Z(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=$n(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=zn(o)+s):(t.height=this.maxHeight,t.width=zn(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=Ft(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(r){const e=i.mirror?0:c*o.width+h*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:h*o.width+c*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,c,h)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,u=0;a?l?(c=n*t.width,u=i*e.height):(c=i*t.height,u=n*e.width):"start"===o?u=e.width:"end"===o?c=t.width:(c=t.width/2,u=e.width/2),this.paddingLeft=Math.max((c-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((u-h+s)*this.width/(this.width-h),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){Z(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)U(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Vn(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:n}=this,o=[],s=[];let r,a,l,h,c,u,d,p,f,g,m,b=0,x=0;for(r=0;r<e;++r){if(h=t[r].label,c=this._resolveTickFontOptions(r),i.font=u=c.string,d=n[u]=n[u]||{data:{},gc:[]},p=c.lineHeight,f=g=0,U(h)||j(h)){if(j(h))for(a=0,l=h.length;a<l;++a)U(m=h[a])||j(m)||(f=Yt(i,d.data,d.gc,f,m),g+=p)}else f=Yt(i,d.data,d.gc,f,h),g=p;o.push(f),s.push(g),b=Math.max(f,b),x=Math.max(g,x)}!function(t,e){Q(t,t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}})}(n,e);const y=o.indexOf(b),_=s.indexOf(x),v=t=>({width:o[t]||0,height:s[t]||0});return{first:v(0),last:v(e-1),widest:v(y),highest:v(_),widths:o,heights:s}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return jt(this._alignToPixels?qt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Xe(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Xe(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Ft(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s}=n,r=o.offset,a=this.isHorizontal(),l=this.ticks.length+(r?1:0),h=zn(o),c=[],u=o.setContext(this.getContext()),d=u.drawBorder?u.borderWidth:0,p=d/2,f=function(t){return qt(i,t,d)};let g,m,b,x,y,_,v,w,C,O,S,T;if("top"===s)g=f(this.bottom),_=this.bottom-h,w=g-p,O=f(t.top)+p,T=t.bottom;else if("bottom"===s)g=f(this.top),O=t.top,T=f(t.bottom)-p,_=g+p,w=this.top+h;else if("left"===s)g=f(this.right),y=this.right-h,v=g-p,C=f(t.left)+p,S=t.right;else if("right"===s)g=f(this.left),C=t.left,S=f(t.right)-p,y=g+p,v=this.left+h;else if("x"===e){if("center"===s)g=f((t.top+t.bottom)/2+.5);else if(W(s)){const t=Object.keys(s)[0],e=s[t];g=f(this.chart.scales[t].getPixelForValue(e))}O=t.top,T=t.bottom,w=(_=g+p)+h}else if("y"===e){if("center"===s)g=f((t.left+t.right)/2);else if(W(s)){const t=Object.keys(s)[0],e=s[t];g=f(this.chart.scales[t].getPixelForValue(e))}v=(y=g-p)-h,C=t.left,S=t.right}const I=K(n.ticks.maxTicksLimit,l),M=Math.max(1,Math.ceil(l/I));for(m=0;m<l;m+=M){const t=o.setContext(this.getContext(m)),e=t.lineWidth,n=t.color,s=o.borderDash||[],l=t.borderDashOffset,h=t.tickWidth,u=t.tickColor,d=t.tickBorderDash||[],p=t.tickBorderDashOffset;void 0!==(b=Gn(this,m,r))&&(x=qt(i,b,e),a?y=v=C=S=x:_=w=O=T=x,c.push({tx1:y,ty1:_,tx2:v,ty2:w,x1:C,y1:O,x2:S,y2:T,width:e,color:n,borderDash:s,borderDashOffset:l,tickWidth:h,tickColor:u,tickBorderDash:d,tickBorderDashOffset:p}))}return this._ticksLength=l,this._borderValue=g,c}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:h,mirror:c}=o,u=zn(i.grid),d=u+h,p=c?-h:d,f=-Ft(this.labelRotation),g=[];let m,b,x,y,_,v,w,C,O,S,T,I,M="middle";if("top"===n)v=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)v=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(u);w=t.textAlign,_=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(u);w=t.textAlign,_=t.x}else if("x"===e){if("center"===n)v=(t.top+t.bottom)/2+d;else if(W(n)){const t=Object.keys(n)[0],e=n[t];v=this.chart.scales[t].getPixelForValue(e)+d}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)_=(t.left+t.right)/2-d;else if(W(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(u).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const k=this._getLabelSizes();for(m=0,b=r.length;m<b;++m){y=(x=r[m]).label;const t=o.setContext(this.getContext(m));C=this.getPixelForTick(m)+o.labelOffset,S=(O=this._resolveTickFontOptions(m)).lineHeight;const e=(T=j(y)?y.length:1)/2,i=t.color,a=t.textStrokeColor,h=t.textStrokeWidth;let u;if(s?(_=C,I="top"===n?"near"===l||0!==f?-T*S+S/2:"center"===l?-k.highest.height/2-e*S+S:-k.highest.height+S/2:"near"===l||0!==f?S/2:"center"===l?k.highest.height/2-e*S:k.highest.height-T*S,c&&(I*=-1)):(v=C,I=(1-T)*S/2),t.showLabelBackdrop){const e=$e(t.backdropPadding),i=k.heights[m],n=k.widths[m];let o=v+I-e.top,s=_-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n}u={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}g.push({rotation:f,label:y,font:O,color:i,strokeColor:a,strokeWidth:h,textOffset:I,textAlign:w,textBaseline:M,translation:[_,v],backdrop:u})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Ft(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align&&(i="right"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex(e=>e.value===t);if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{grid:i}}=this,n=i.setContext(this.getContext()),o=i.drawBorder?n.borderWidth:0;if(!o)return;const s=i.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let a,l,h,c;this.isHorizontal()?(a=qt(t,this.left,o)-o/2,l=qt(t,this.right,s)+s/2,h=c=r):(h=qt(t,this.top,o)-o/2,c=qt(t,this.bottom,s)+s/2,a=l=r),e.save(),e.lineWidth=n.borderWidth,e.strokeStyle=n.borderColor,e.beginPath(),e.moveTo(a,h),e.lineTo(l,c),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&te(e,i);const n=this._labelItems||(this._labelItems=this._computeLabelItems(t));let o,s;for(o=0,s=n.length;o<s;++o){const t=n[o],i=t.font,s=t.label;t.backdrop&&(e.fillStyle=t.backdrop.color,e.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),oe(e,s,0,t.textOffset,i,t)}i&&ee(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const s=Ue(i.font),r=$e(i.padding),a=i.align;let l=s.lineHeight/2;"bottom"===e||"center"===e||W(e)?(l+=r.bottom,j(i.text)&&(l+=s.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:h,titleY:c,maxWidth:u,rotation:d}=function(t,e,i,n){const{top:s,left:r,bottom:a,right:l,chart:h}=t,{chartArea:c,scales:u}=h;let d,p,f,g=0;const m=a-s,b=l-r;if(t.isHorizontal()){if(p=o(n,r,l),W(i)){const t=Object.keys(i)[0],n=i[t];f=u[t].getPixelForValue(n)+m-e}else f="center"===i?(c.bottom+c.top)/2+m-e:Hn(t,i,e);d=l-r}else{if(W(i)){const t=Object.keys(i)[0],n=i[t];p=u[t].getPixelForValue(n)-b+e}else p="center"===i?(c.left+c.right)/2-b+e:Hn(t,i,e);f=o(n,a,s),g="left"===i?-St:St}return{titleX:p,titleY:f,maxWidth:d,rotation:g}}(this,l,e,a);oe(t,i.text,0,0,s,{color:i.color,maxWidth:u,rotation:d,textAlign:Un(a,e,n),textBaseline:"middle",translation:[h,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=K(t.grid&&t.grid.z,-1);return this._isVisible()&&this.draw===jn.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return Ue(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Wn{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n?s:(n[o]=t,function(t,e,i){const n=ot(Object.create(null),[i?yt.get(i):{},yt.get(e),t.defaults]);yt.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach(i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");yt.route(s,o,l,a)})}(e,t.defaultRoutes);t.descriptors&&yt.describe(e,t.descriptors)}(t,s,i),this.override&&yt.override(t.id,t.overrides),s)}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in yt[n]&&(delete yt[n][i],this.override&&delete gt[i])}}var Xn=new class{constructor(){this.controllers=new Wn(An,"datasets",!0),this.elements=new Wn(Dn,"elements"),this.plugins=new Wn(Object,"plugins"),this.scales=new Wn(jn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):Q(e,e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)})})}_exec(t,e,i){const n=ut(t);Z(i["before"+n],[],i),e[t](i),Z(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}};class Yn{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"destroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===Z(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){U(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=K(i.options&&i.options.plugins,{}),o=function(t){const e=[],i=Object.keys(Xn.plugins.items);for(let t=0;t<i.length;t++)e.push(Xn.getPlugin(i[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const i=n[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==n||e?function(t,e,i,n){const o=[],s=t.getContext();for(let r=0;r<e.length;r++){const a=e[r],l=a.id,h=Kn(i[l],n);null!==h&&o.push({plugin:a,options:qn(t.config,a,h,s)})}return o}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function Kn(t,e){return e||!1!==t?!0===t?{}:t:null}function qn(t,e,i,n){const o=t.pluginScopeKeys(e),s=t.getOptionScopes(i,o);return t.createResolver(s,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Jn(t,e){const i=yt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Zn(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function Qn(t){const e=t.options||(t.options={});e.plugins=K(e.plugins,{}),e.scales=function(t,e){const i=gt[t.type]||{scales:{}},n=e.scales||{},o=Jn(t.type,e),s=Object.create(null),r=Object.create(null);return Object.keys(n).forEach(t=>{const e=n[t];if(!W(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const a=Zn(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),h=i.scales||{};s[a]=s[a]||t,r[t]=st(Object.create(null),[{axis:a},e,h[a],h[l]])}),t.data.datasets.forEach(i=>{const o=i.type||t.type,a=i.indexAxis||Jn(o,e),l=(gt[o]||{}).scales||{};Object.keys(l).forEach(t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,a),o=i[e+"AxisID"]||s[e]||e;r[o]=r[o]||Object.create(null),st(r[o],[{axis:e},n[o],l[t]])})}),Object.keys(r).forEach(t=>{const e=r[t];st(e,[yt.scales[e.type],yt.scale])}),r}(t,e)}function to(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const eo=new Map,io=new Set;function no(t,e){let i=eo.get(t);return i||(i=e(),eo.set(t,i),io.add(i)),i}const oo=(t,e,i)=>{const n=ct(e,i);void 0!==n&&t.add(n)};class so{constructor(t){this._config=function(t){return(t=t||{}).data=to(t.data),Qn(t),t}(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=to(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Qn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return no(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return no(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return no(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id;return no(`${this.type}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach(e=>{t&&(a.add(t),e.forEach(e=>oo(a,t,e))),e.forEach(t=>oo(a,n,t)),e.forEach(t=>oo(a,gt[o]||{},t)),e.forEach(t=>oo(a,yt,t)),e.forEach(t=>oo(a,mt,t))});const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),io.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,gt[e]||{},yt.datasets[e]||{},{type:e},yt,mt]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=ro(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=hi(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(pt(r)||ao(r))||s&&j(r))return!0}return!1}(s,e)){o.$shared=!1,a=li(s,i=pt(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=ro(this._resolverCache,t,i);return W(e)?li(o,e,void 0,n):o}}function ro(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:ai(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},n.set(o,s)}return s}const ao=t=>W(t)&&Object.getOwnPropertyNames(t).reduce((e,i)=>e||pt(t[i]),!1),lo=["top","bottom","left","right","chartArea"];function ho(t,e){return"top"===t||"bottom"===t||-1===lo.indexOf(t)&&"x"===e}function co(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function uo(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),Z(i&&i.onComplete,[t],e)}function po(t){const e=t.chart,i=e.options.animation;Z(i&&i.onProgress,[t],e)}function fo(t){return ge()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const go={},mo=t=>{const e=fo(t);return Object.values(go).filter(t=>t.canvas===e).pop()};function bo(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}class xo{constructor(t,e){const n=this.config=new so(e),o=fo(t),s=mo(o);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas can be reused.");const a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||fn(o)),this.platform.updateConfig(n);const l=this.platform.acquireContext(o,a.aspectRatio),h=l&&l.canvas,c=h&&h.height,u=h&&h.width;this.id=$(),this.ctx=l,this.canvas=h,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Yn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=i(t=>this.update(t),a.resizeDelay||0),this._dataChanges=[],go[this.id]=this,l&&h?(r.listen(this,"complete",uo),r.listen(this,"progress",po),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return U(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Te(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Jt(this.canvas,this.ctx),this}stop(){return r.stop(this),this}resize(t,e){r.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Te(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),Z(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){Q(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{});let o=[];e&&(o=o.concat(Object.keys(e).map(t=>{const i=e[t],n=Zn(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}}))),Q(o,e=>{const o=e.options,s=o.id,r=Zn(s,o),a=K(o.type,e.dtype);void 0!==o.position&&ho(o.position,r)===ho(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(Xn.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)}),Q(n,(t,e)=>{t||delete i[e]}),Q(i,t=>{ri.configure(this,t,t.options),ri.addBox(this,t)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(co("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||Jn(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=Xn.getController(s),{datasetElementType:n,dataElementType:r}=yt.datasets[s];Object.assign(e.prototype,{dataElementType:Xn.getElement(r),datasetElementType:n&&Xn.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){Q(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||Q(o,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(co("z","_idx")),this._lastEvent&&this._eventHandler(this._lastEvent,!0),this.render()}_updateScales(){Q(this.scales,t=>{ri.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);ft(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){bo(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),n=i(0);for(let t=1;t<e;t++)if(!ft(n,i(t)))return;return Array.from(n).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ri.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],Q(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,pt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(r.has(this)?this.attached&&!r.running(this)&&r.start(this):(this.draw(),uo({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resize(t,e),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=this.chartArea,s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&te(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&ee(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}getElementsAtEventForMode(t,e,i,n){const o=Pe.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter(t=>t&&t._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Xe(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);dt(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update(e=>e.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),r.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Jt(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete go[this.id]}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};Q(this.options.events,t=>i(t,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=(()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)}),e.isAttached(this.canvas)?r():s()}unbindEvents(){Q(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},Q(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex)).controller["_"+n+"DatasetHoverStyle"](),r=0,a=t.length;r<a;++r){const e=(s=t[r])&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}});!tt(i,e)&&(this._active=i,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e){const{_active:i=[],options:n}=this,o=n.hover,s=e;let r=[],a=!1,l=null;return"mouseout"!==t.type&&(r=this.getElementsAtEventForMode(t,o.mode,o,s),l="click"===t.type?this._lastEvent:t),this._lastEvent=null,Qt(t,this.chartArea,this._minPadding)&&(Z(n.onHover,[t,r,this],this),"mouseup"!==t.type&&"click"!==t.type&&"contextmenu"!==t.type||Z(n.onClick,[t,r,this],this)),((a=!tt(r,i))||e)&&(this._active=r,this._updateHoverStyles(r,i,e)),this._lastEvent=l,a}}const yo=()=>Q(xo.instances,t=>t._plugins.invalidate());function _o(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}Object.defineProperties(xo,{defaults:{enumerable:!0,value:yt},instances:{enumerable:!0,value:go},overrides:{enumerable:!0,value:gt},registry:{enumerable:!0,value:Xn},version:{enumerable:!0,value:"3.6.2"},getChart:{enumerable:!0,value:mo},register:{enumerable:!0,value:(...t)=>{Xn.add(...t),yo()}},unregister:{enumerable:!0,value:(...t)=>{Xn.remove(...t),yo()}}});class vo{constructor(t){this.options=t||{}}formats(){return _o()}parse(t,e){return _o()}format(t,e){return _o()}add(t,e,i){return _o()}diff(t,e,i){return _o()}startOf(t,e,i){return _o()}endOf(t,e){return _o()}}vo.override=function(t){Object.assign(vo.prototype,t)};var wo={_date:vo};function Co(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=fe(n.sort((t,e)=>t-e))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(dt(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function Oo(t,e,i,n){return j(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,h=a;Math.abs(r)>Math.abs(a)&&(l=a,h=r),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function So(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let h,c,u,d;for(h=i,c=i+n;h<c;++h)d=e[h],(u={})[o.axis]=a||o.parse(r[h],h),l.push(Oo(d,u,s,h));return l}function To(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Io(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);const{start:r,end:a,reverse:l,top:h,bottom:c}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=h:(i._bottom||0)===n?o=c:(s[Mo(c,r,a,l)]=!0,o=h)),s[Mo(o,r,a,l)]=!0,t.borderSkipped=s}function Mo(t,e,i,n){var o,s,r;return n?(r=i,t=ko(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=ko(t,e,i),t}function ko(t,e,i){return"start"===t?e:"end"===t?i:t}function Lo(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class Eo extends An{parsePrimitiveData(t,e,i,n){return So(t,e,i,n)}parseArrayData(t,e,i,n){return So(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,h="x"===s.axis?r:a,c=[];let u,d,p,f;for(u=i,d=i+n;u<d;++u)f=e[u],(p={})[o.axis]=o.parse(ct(f,l),u),c.push(Oo(ct(f,h),p,s,u));return c}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=To(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),h=this._getRuler(),c=this.resolveDataElementOptions(e,n),u=this.getSharedOptions(c),d=this.includeOptions(n,u);this.updateSharedOptions(u,n,c);for(let c=e;c<e+i;c++){const e=this.getParsed(c),i=o||U(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(c),p=this._calculateBarIndexPixels(c,h),f=(e._stacks||{})[r.axis],g={horizontal:l,base:i.base,enableBorderRadius:!f||To(e._custom)||s===f._top||s===f._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(g.options=u||this.resolveDataElementOptions(c,t[c].active?"active":n));const m=g.options||t[c].options;Io(g,m,f,s),Lo(g,m,h.ratio),this.updateElement(t[c],c,g,n)}}_getStacks(t,e){const i=this._cachedMeta.iScale,n=i.getMatchingVisibleMetas(this._type),o=i.options.stacked,s=n.length,r=[];let a,l;for(a=0;a<s;++a)if((l=n[a]).controller.options.grouped){if(void 0!==e){const t=l.controller.getParsed(e)[l.controller._cachedMeta.vScale.axis];if(U(t)||isNaN(t))continue}if((!1===o||-1===r.indexOf(l.stack)||void 0===o&&void 0===l.stack)&&r.push(l.stack),l.index===t)break}return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||Co(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i},options:{base:n,minBarLength:o}}=this,s=n||0,r=this.getParsed(t),a=r._custom,l=To(a);let h,c,u=r[e.axis],d=0,p=i?this.applyStack(e,r,i):u;p!==u&&(d=p-u,p=u),l&&(u=a.barStart,p=a.barEnd-a.barStart,0!==u&&kt(u)!==kt(a.barEnd)&&(d=0),d+=u);const f=U(n)||l?d:n;let g=e.getPixelForValue(f);if(c=(h=this.chart.getDataVisibility(t)?e.getPixelForValue(d+p):g)-g,Math.abs(c)<o&&(c=function(t,e,i){return 0!==t?kt(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(c,e,s)*o,u===s&&(g-=c/2),h=g+c),g===e.getPixelForValue(s)){const t=kt(c)*e.getLineWidthForValue(s)/2;g+=t,c-=t}return{size:c,base:g,head:h,center:h+c/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=K(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const h=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:h}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return U(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),h=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*h+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null!==this.getParsed(o)[e.axis]&&i[o].draw(this._ctx)}}Eo.id="bar",Eo.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},Eo.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class Ao extends An{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=K(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=K(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:n}=e,o=this.getParsed(t),s=i.getLabelForValue(o.x),r=n.getLabelForValue(o.y),a=o._custom;return{label:e.label,value:"("+s+", "+r+(a?", "+a:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,a=this.resolveDataElementOptions(e,n),l=this.getSharedOptions(a),h=this.includeOptions(n,l),c=s.axis,u=r.axis;for(let a=e;a<e+i;a++){const e=t[a],i=!o&&this.getParsed(a),l={},d=l[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),p=l[u]=o?r.getBasePixel():r.getPixelForValue(i[u]);l.skip=isNaN(d)||isNaN(p),h&&(l.options=this.resolveDataElementOptions(a,e.active?"active":n),o&&(l.options.radius=0)),this.updateElement(e,a,l,n)}this.updateSharedOptions(l,n,a)}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=K(i&&i._custom,o),n}}Ao.id="bubble",Ao.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},Ao.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class Do extends An{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(W(i[t])){const{key:t="value"}=this._parsing;r=(e=>+ct(i[e],t))}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return Ft(this.options.rotation-90)}_getCircumference(){return Ft(this.options.circumference)}_getRotationExtents(){let t=vt,e=-vt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min(q(this.options.cutout,r),1),l=this._getRingWeight(this.index),{circumference:h,rotation:c}=this._getRotationExtents(),{ratioX:u,ratioY:d,offsetX:p,offsetY:f}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<vt){const a=t,l=a+e,h=Math.cos(a),c=Math.sin(a),u=Math.cos(l),d=Math.sin(l),p=(t,e,n)=>$t(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),f=(t,e,n)=>$t(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),g=p(0,h,u),m=p(St,c,d),b=f(_t,h,u),x=f(_t+St,c,d);n=(g-b)/2,o=(m-x)/2,s=-(g+b)/2,r=-(m+x)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(c,h,a),g=(i.width-s)/u,m=(i.height-s)/d,b=Math.max(Math.min(g,m)/2,0),x=J(this.options.radius,b),y=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*x,this.offsetY=f*x,n.total=this.calculateTotal(),this.outerRadius=x-y*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-y*l,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/vt)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,h=(r.top+r.bottom)/2,c=o&&a.animateScale,u=c?0:this.innerRadius,d=c?0:this.outerRadius,p=this.resolveDataElementOptions(e,n),f=this.getSharedOptions(p),g=this.includeOptions(n,f);let m,b=this._getRotation();for(m=0;m<e;++m)b+=this._circumference(m,o);for(m=e;m<e+i;++m){const e=this._circumference(m,o),i=t[m],s={x:l+this.offsetX,y:h+this.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:d,innerRadius:u};g&&(s.options=f||this.resolveDataElementOptions(m,i.active?"active":n)),b+=e,this.updateElement(i,m,s,n)}this.updateSharedOptions(f,n,p)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?vt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Pi(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){t=(s=i.getDatasetMeta(n)).data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)"inner"!==(a=r.resolveDataElementOptions(n)).borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(K(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Do.id="doughnut",Do.defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"},Do.descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t},Do.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return j(e)?(e=e.slice())[0]+=i:e+=i,e}}}}};class Ro extends An{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=function(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,_parsed:a}=t,l=r.axis,{min:h,max:c,minDefined:u,maxDefined:d}=r.getUserBounds();u&&(o=Ut(Math.min(le(a,r.axis,h).lo,i?n:le(e,l,r.getPixelForValue(h)).lo),0,n-1)),s=d?Ut(Math.max(le(a,r.axis,c).hi+1,i?0:le(e,l,r.getPixelForValue(c)).hi+1),o,n)-o:n-o}return{start:o,count:s}}(e,n,s);this._drawStart=r,this._drawCount=a,function(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),c=this.getSharedOptions(h),u=this.includeOptions(n,c),d=s.axis,p=r.axis,{spanGaps:f,segment:g}=this.options,m=At(f)?f:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||"none"===n;let x=e>0&&this.getParsed(e-1);for(let h=e;h<e+i;++h){const e=t[h],i=this.getParsed(h),f=b?e:{},y=U(i[p]),_=f[d]=s.getPixelForValue(i[d],h),v=f[p]=o||y?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],h);f.skip=isNaN(_)||isNaN(v)||y,f.stop=h>0&&i[d]-x[d]>m,g&&(f.parsed=i,f.raw=l.data[h]),u&&(f.options=c||this.resolveDataElementOptions(h,e.active?"active":n)),b||this.updateElement(e,h,f,n),x=i}this.updateSharedOptions(c,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Ro.id="line",Ro.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Ro.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Po extends An{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Pi(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=this.getDataset(),a=s.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,c=l.yCenter,u=l.getIndexAngle(0)-.5*_t;let d,p=u;const f=360/this.countVisibleElements();for(d=0;d<e;++d)p+=this._computeAngle(d,n,f);for(d=e;d<e+i;d++){const e=t[d];let i=p,g=p+this._computeAngle(d,n,f),m=s.getDataVisibility(d)?l.getDistanceFromCenterForValue(r.data[d]):0;p=g,o&&(a.animateScale&&(m=0),a.animateRotate&&(i=g=u));const b={x:h,y:c,innerRadius:0,outerRadius:m,startAngle:i,endAngle:g,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,b,n)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let i=0;return e.data.forEach((e,n)=>{!isNaN(t.data[n])&&this.chart.getDataVisibility(n)&&i++}),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Ft(this.resolveDataElementOptions(t,e).angle||i):0}}Po.id="polarArea",Po.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Po.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Fo extends Do{}Fo.id="pie",Fo.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class No extends An{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this.getDataset(),s=this._cachedMeta.rScale,r="reset"===n;for(let a=e;a<e+i;a++){const e=t[a],i=this.resolveDataElementOptions(a,e.active?"active":n),l=s.getPointPositionForValue(a,o.data[a]),h=r?s.xCenter:l.x,c=r?s.yCenter:l.y,u={x:h,y:c,angle:l.angle,skip:isNaN(h)||isNaN(c),options:i};this.updateElement(e,a,u,n)}}}No.id="radar",No.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},No.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class Bo extends Ro{}Bo.id="scatter",Bo.defaults={showLine:!1,fill:!1},Bo.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var Ho=Object.freeze({__proto__:null,BarController:Eo,BubbleController:Ao,DoughnutController:Do,LineController:Ro,PolarAreaController:Po,PieController:Fo,RadarController:No,ScatterController:Bo});function Vo(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let h=o/a;t.beginPath(),t.arc(s,r,a,n-h,i+h),l>o?(h=o/l,t.arc(s,r,l,i+h,n-h,!0)):t.arc(s,r,o,i+St,n-St),t.closePath(),t.clip()}function Go(t,e,i,n){const o=Ve(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return Ut(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:Ut(o.innerStart,0,r),innerEnd:Ut(o.innerEnd,0,r)}}function zo(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function $o(t,e,i,n,o){const{x:s,y:r,startAngle:a,pixelMargin:l,innerRadius:h}=e,c=Math.max(e.outerRadius+n+i-l,0),u=h>0?h+n+i+l:0;let d=0;const p=o-a;if(n){const t=((h>0?h-n:0)+(c>0?c-n:0))/2;d=(p-(0!==t?p*t/(t+n):p))/2}const f=(p-Math.max(.001,p*c-i/_t)/c)/2,g=a+f+d,m=o-f-d,{outerStart:b,outerEnd:x,innerStart:y,innerEnd:_}=Go(e,u,c,m-g),v=c-b,w=c-x,C=g+b/v,O=m-x/w,S=u+y,T=u+_,I=g+y/S,M=m-_/T;if(t.beginPath(),t.arc(s,r,c,C,O),x>0){const e=zo(w,O,s,r);t.arc(e.x,e.y,x,O,m+St)}const k=zo(T,m,s,r);if(t.lineTo(k.x,k.y),_>0){const e=zo(T,M,s,r);t.arc(e.x,e.y,_,m+St,M+Math.PI)}if(t.arc(s,r,u,m-_/u,g+y/u,!0),y>0){const e=zo(S,I,s,r);t.arc(e.x,e.y,y,I+Math.PI,g-St)}const L=zo(v,g,s,r);if(t.lineTo(L.x,L.y),b>0){const e=zo(v,C,s,r);t.arc(e.x,e.y,b,g-St,C)}t.closePath()}function Uo(t,e,i,n,o){const{options:s}=e,r="inner"===s.borderAlign;s.borderWidth&&(r?(t.lineWidth=2*s.borderWidth,t.lineJoin="round"):(t.lineWidth=s.borderWidth,t.lineJoin="bevel"),e.fullCircles&&function(t,e,i){const{x:n,y:o,startAngle:s,pixelMargin:r,fullCircles:a}=e,l=Math.max(e.outerRadius-r,0),h=e.innerRadius+r;let c;for(i&&Vo(t,e,s+vt),t.beginPath(),t.arc(n,o,h,s+vt,s,!0),c=0;c<a;++c)t.stroke();for(t.beginPath(),t.arc(n,o,l,s,s+vt),c=0;c<a;++c)t.stroke()}(t,e,r),r&&Vo(t,e,o),$o(t,e,i,n,o),t.stroke())}class jo extends Dn{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=Ht(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:h,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=this.options.spacing/2,d=K(c,a-r)>=vt||$t(o,r,a),p=Wt(s,l+u,h+u);return d&&p}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:a,spacing:l}=this.options,h=(n+o)/2,c=(s+r+l+a)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/2,o=(e.spacing||0)/2;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>vt?Math.floor(i/vt):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let s=0;if(n){s=n/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*s,Math.sin(e)*s),this.circumference>=_t&&(s=n)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const r=function(t,e,i,n){const{fullCircles:o,startAngle:s,circumference:r}=e;let a=e.endAngle;if(o){$o(t,e,i,n,s+vt);for(let e=0;e<o;++e)t.fill();isNaN(r)||(a=s+r%vt,r%vt==0&&(a+=vt))}return $o(t,e,i,n,a),t.fill(),a}(t,this,s,o);Uo(t,this,s,o,r),t.restore()}}function Wo(t,e,i=e){t.lineCap=K(i.borderCapStyle,e.borderCapStyle),t.setLineDash(K(i.borderDash,e.borderDash)),t.lineDashOffset=K(i.borderDashOffset,e.borderDashOffset),t.lineJoin=K(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=K(i.borderWidth,e.borderWidth),t.strokeStyle=K(i.borderColor,e.borderColor)}function Xo(t,e,i){t.lineTo(i.x,i.y)}function Yo(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),h=Math.min(s,a),c=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:h<l&&!c?n+h-l:h-l}}function Ko(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:h}=Yo(o,i,n),c=function(t){return t.stepped?ie:t.tension||"monotone"===t.cubicInterpolationMode?ne:Xo}(s);let u,d,p,{move:f=!0,reverse:g}=n||{};for(u=0;u<=h;++u)(d=o[(a+(g?h-u:u))%r]).skip||(f?(t.moveTo(d.x,d.y),f=!1):c(t,p,d,g,s.stepped),p=d);return l&&c(t,p,d=o[(a+(g?h:0))%r],g,s.stepped),!!l}function qo(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=Yo(o,i,n),{move:l=!0,reverse:h}=n||{};let c,u,d,p,f,g,m=0,b=0;const x=t=>(r+(h?a-t:t))%s,y=()=>{p!==f&&(t.lineTo(m,f),t.lineTo(m,p),t.lineTo(m,g))};for(l&&(u=o[x(0)],t.moveTo(u.x,u.y)),c=0;c<=a;++c){if((u=o[x(c)]).skip)continue;const e=u.x,i=u.y,n=0|e;n===d?(i<p?p=i:i>f&&(f=i),m=(b*m+e)/++b):(y(),t.lineTo(e,i),d=n,b=0,p=f=i),g=i}y()}function Jo(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?qo:Ko}jo.id="arc",jo.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},jo.defaultRoutes={backgroundColor:"backgroundColor"};const Zo="function"==typeof Path2D;function Qo(t,e,i,n){Zo&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),Wo(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=Jo(e);for(const a of o)Wo(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class ts extends Dn{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Ti(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ji(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Ui(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?Ai:t.tension||"monotone"===t.cubicInterpolationMode?Di:Ei}(i);let l,h;for(l=0,h=s.length;l<h;++l){const{start:h,end:c}=s[l],u=o[h],d=o[c];if(u===d){r.push(u);continue}const p=a(u,d,Math.abs((n-u[e])/(d[e]-u[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return Jo(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=Jo(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Qo(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function es(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}ts.id="line",ts.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},ts.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},ts.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class is extends Dn{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return es(this,t,"x",e)}inYRange(t,e){return es(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;return 2*((e=Math.max(e,e&&t.hoverRadius||0))+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Qt(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Zt(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function ns(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,h,c,u;return t.horizontal?(u=r/2,a=Math.min(i,o),l=Math.max(i,o),h=n-u,c=n+u):(a=i-(u=s/2),l=i+u,h=Math.min(n,o),c=Math.max(n,o)),{left:a,top:h,right:l,bottom:c}}function os(t,e,i,n){return t?0:Ut(e,i,n)}function ss(t){const e=ns(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=Ge(n);return{t:os(o.top,s.top,0,i),r:os(o.right,s.right,0,e),b:os(o.bottom,s.bottom,0,i),l:os(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=ze(o),r=Math.min(e,i),a=t.borderSkipped,l=n||W(o);return{topLeft:os(!l||a.top||a.left,s.topLeft,0,r),topRight:os(!l||a.top||a.right,s.topRight,0,r),bottomLeft:os(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:os(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function rs(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&ns(t,n);return r&&(o||Wt(e,r.left,r.right))&&(s||Wt(i,r.top,r.bottom))}function as(t,e){t.rect(e.x,e.y,e.w,e.h)}function ls(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}is.id="point",is.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},is.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class hs extends Dn{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=ss(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?re:as;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,ls(s,e,o)),t.clip(),r(t,ls(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,ls(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return rs(this,t,e,i)}inXRange(t,e){return rs(this,t,null,e)}inYRange(t,e){return rs(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}hs.id="bar",hs.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0},hs.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var cs=Object.freeze({__proto__:null,ArcElement:jo,LineElement:ts,PointElement:is,BarElement:hs});function us(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}function ds(t){t.data.datasets.forEach(t=>{us(t)})}var ps={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void ds(t);const n=t.width;t.data.datasets.forEach((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===je([r,t.options.indexAxis]))return;if("line"!==a.type)return;const h=t.scales[a.xAxisID];if("linear"!==h.type&&"time"!==h.type)return;if(t.options.parsing)return;let{start:c,count:u}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:h}=s.getUserBounds();return l&&(o=Ut(le(e,s.axis,r).lo,0,i-1)),{start:o,count:n=h?Ut(le(e,s.axis,a).hi+1,o,i)-o:i-o}}(a,l);if(u<=(i.threshold||4*n))return void us(e);let d;switch(U(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":d=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const h=e+i-1;let c,u,d,p,f,g=e;for(r[l++]=t[g],c=0;c<s-2;c++){let n,o=0,s=0;const h=Math.floor((c+1)*a)+1+e,m=Math.min(Math.floor((c+2)*a)+1,i)+e,b=m-h;for(n=h;n<m;n++)o+=t[n].x,s+=t[n].y;o/=b,s/=b;const x=Math.floor(c*a)+1+e,y=Math.min(Math.floor((c+1)*a)+1,i)+e,{x:_,y:v}=t[g];for(d=p=-1,n=x;n<y;n++)(p=.5*Math.abs((_-o)*(t[n].y-v)-(_-t[n].x)*(s-v)))>d&&(d=p,u=t[n],f=n);r[l++]=u,g=f}return r[l++]=t[h],r}(l,c,u,n,i);break;case"min-max":d=function(t,e,i,n){let o,s,r,a,l,h,c,u,d,p,f=0,g=0;const m=[],b=e+i-1,x=t[e].x,y=t[b].x-x;for(o=e;o<e+i;++o){r=((s=t[o]).x-x)/y*n,a=s.y;const e=0|r;if(e===l)a<d?(d=a,h=o):a>p&&(p=a,c=o),f=(g*f+s.x)/++g;else{const i=o-1;if(!U(h)&&!U(c)){const e=Math.min(h,c),n=Math.max(h,c);e!==u&&e!==i&&m.push({...t[e],x:f}),n!==u&&n!==i&&m.push({...t[n],x:f})}o>0&&i!==u&&m.push(t[i]),m.push(s),l=e,g=0,d=p=a,h=c=u=o}}return m}(l,c,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=d})},destroy(t){ds(t)}};function fs(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=K(i&&i.target,i);return void 0===n&&(n=!!e.backgroundColor),!1!==n&&null!==n&&(!0===n?"origin":n)}(t);if(W(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return X(o)&&Math.floor(o)===o?("-"!==n[0]&&"+"!==n[0]||(o=e+o),!(o===e||o<0||o>=i)&&o):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}class gs{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:vt},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function ms(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=[],r=n.reverse?e.max:e.min,a=n.reverse?e.min:e.max;let l,h,c;if(c="start"===i?r:"end"===i?a:W(i)?i.value:e.getBaseValue(),n.grid.circular)return h=e.getPointPositionForValue(0,r),new gs({x:h.x,y:h.y,radius:e.getDistanceFromCenterForValue(c)});for(l=0;l<o;++l)s.push(e.getPointPositionForValue(l,c));return s}(t):function(t){const{scale:e={},fill:i}=t;let n,o=null;return"start"===i?o=e.bottom:"end"===i?o=e.top:W(i)?o=e.getPixelForValue(i.value):e.getBasePixel&&(o=e.getBasePixel()),X(o)?{x:(n=e.isHorizontal())?o:null,y:n?null:o}:null}(t)}function bs(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function xs(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=ys(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function ys(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],h=r[e.end][i];if(Wt(o,n,h)){a=o===n,l=o===h;break}}return{first:a,last:l,point:n}}function _s(t){const{chart:e,fill:i,line:n}=t;if(X(i))return function(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(vs({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)xs(o,r[t],a)}return new ts({points:o,options:{}})}(t);if("shape"===i)return!0;const o=ms(t);return o instanceof gs?o:vs(o,n)}function vs(t,e){let i=[],n=!1;return j(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach(({start:t,end:e})=>{e=bs(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))}),s}(t,e),i.length?new ts({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function ws(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!X(n))return n;if(!(s=t[n]))return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function Cs(t,e,i){t.beginPath(),e.path(t),t.lineTo(e.last().x,i),t.lineTo(e.first().x,i),t.closePath(),t.clip()}function Os(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=zt(o),s=zt(s)),{property:t,start:o,end:s}}function Ss(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function Ts(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function Is(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}function Ms(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=bs(n,a,o);const l=Os(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const h=Ui(e,l);for(const e of h){const n=Os(i,s[e.start],s[e.end],e.loop),a=$i(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:Ss(l,n,"start",Math.max)},end:{[i]:Ss(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:h,end:c}of a){const{style:{backgroundColor:a=s}={}}=e,u=!0!==n;t.save(),t.fillStyle=a,Ts(t,r,u&&Os(o,h,c)),t.beginPath();const d=!!i.pathSegment(t,e);let p;if(u){d?t.closePath():Is(t,n,c,o);const e=!!n.pathSegment(t,l,{move:d,reverse:!0});(p=d&&e)||Is(t,n,h,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function ks(t,e,i){const n=_s(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,h=a.backgroundColor,{above:c=h,below:u=h}=l||{};n&&o.points.length&&(te(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(Cs(t,n,r.top),Ms(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),Cs(t,n,r.bottom)),Ms(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:c,below:u,area:i,scale:s,axis:r}),ee(t))}var Ls={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)l=null,(a=(s=t.getDatasetMeta(r)).dataset)&&a.options&&a instanceof ts&&(l={visible:t.isDatasetVisible(r),index:r,fill:fs(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)(l=o[r])&&!1!==l.fill&&(l.fill=ws(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&ks(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&ks(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;n&&!1!==n.fill&&"beforeDatasetDraw"===i.drawTime&&ks(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Es=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}},As=(t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Ds extends Dn{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=Z(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=Ue(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=Es(i,o);let l,h;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(s,o,r,a)+10):(h=this.maxHeight,l=this._fitCols(s,o,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],h=n+r;let c=t;o.textAlign="left",o.textBaseline="middle";let u=-1,d=-h;return this.legendItems.forEach((t,p)=>{const f=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+f+2*r>s)&&(c+=h,l[l.length-(p>0?0:1)]=0,d+=h,u++),a[p]={left:0,top:d,row:u,width:f,height:n},l[l.length-1]+=f+r}),c}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],h=s-t;let c=r,u=0,d=0,p=0,f=0;return this.legendItems.forEach((t,s)=>{const g=i+e/2+o.measureText(t.text).width;s>0&&d+n+2*r>h&&(c+=u+r,l.push({width:u,height:d}),p+=u+r,f++,u=d=0),a[s]={left:p,top:d,col:f,width:g,height:n},u=Math.max(u,g),d+=n+r}),c+=u,l.push({width:u,height:d}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:s}}=this,r=Bi(s,this.left,this.width);if(this.isHorizontal()){let s=0,a=o(i,this.left+n,this.right-this.lineWidths[s]);for(const l of e)s!==l.row&&(s=l.row,a=o(i,this.left+n,this.right-this.lineWidths[s])),l.top+=this.top+t+n,l.left=r.leftForLtr(r.x(a),l.width),a+=l.width+n}else{let s=0,a=o(i,this.top+t+n,this.bottom-this.columnSizes[s].height);for(const l of e)l.col!==s&&(s=l.col,a=o(i,this.top+t+n,this.bottom-this.columnSizes[s].height)),l.top=a,l.left+=this.left+n,l.left=r.leftForLtr(r.x(l.left),l.width),a+=l.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;te(t,this),this._draw(),ee(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:r,labels:a}=t,l=yt.color,h=Bi(t.rtl,this.left,this.width),c=Ue(a.font),{color:u,padding:d}=a,p=c.size,f=p/2;let g;this.drawTitle(),n.textAlign=h.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:m,boxHeight:b,itemHeight:x}=Es(a,p),y=this.isHorizontal(),_=this._computeTitleHeight();g=y?{x:o(r,this.left+d,this.right-i[0]),y:this.top+d+_,line:0}:{x:this.left+d,y:o(r,this.top+_+d,this.bottom-e[0].height),line:0},Hi(this.ctx,t.textDirection);const v=x+d;this.legendItems.forEach((w,C)=>{n.strokeStyle=w.fontColor||u,n.fillStyle=w.fontColor||u;const O=n.measureText(w.text).width,S=h.textAlign(w.textAlign||(w.textAlign=a.textAlign)),T=m+f+O;let I=g.x,M=g.y;h.setWidth(this.width),y?C>0&&I+T+d>this.right&&(M=g.y+=v,g.line++,I=g.x=o(r,this.left+d,this.right-i[g.line])):C>0&&M+v>this.bottom&&(I=g.x=I+e[g.line].width+d,g.line++,M=g.y=o(r,this.top+_+d,this.bottom-e[g.line].height)),function(t,e,i){if(isNaN(m)||m<=0||isNaN(b)||b<0)return;n.save();const o=K(i.lineWidth,1);if(n.fillStyle=K(i.fillStyle,l),n.lineCap=K(i.lineCap,"butt"),n.lineDashOffset=K(i.lineDashOffset,0),n.lineJoin=K(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=K(i.strokeStyle,l),n.setLineDash(K(i.lineDash,[])),a.usePointStyle){const s={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},r=h.xPlus(t,m/2);Zt(n,s,r,e+f)}else{const s=e+Math.max((p-b)/2,0),r=h.leftForLtr(t,m),a=ze(i.borderRadius);n.beginPath(),Object.values(a).some(t=>0!==t)?re(n,{x:r,y:s,w:m,h:b,radius:a}):n.rect(r,s,m,b),n.fill(),0!==o&&n.stroke()}n.restore()}(h.x(I),M,w),I=s(S,I+m+f,y?I+T:this.right,t.rtl),function(t,e,i){oe(n,i.text,t,e+x/2,c,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})}(h.x(I),M,w),y?g.x+=T+d:g.y+=v}),Vi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Ue(e.font),s=$e(e.padding);if(!e.display)return;const r=Bi(t.rtl,this.left,this.width),a=this.ctx,l=e.position,h=i.size/2,c=s.top+h;let u,d=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),u=this.top+c,d=o(t.align,d,this.right-p);else{const e=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);u=c+o(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const f=o(l,d,d+p);a.textAlign=r.textAlign(n(l)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,oe(a,e.text,f,u,i)}_computeTitleHeight(){const t=this.options.title,e=Ue(t.font),i=$e(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Wt(t,this.left,this.right)&&Wt(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(Wt(t,(n=o[i]).left,n.left+n.width)&&Wt(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if("mousemove"===t&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type){const n=this._hoveredItem,o=As(n,i);n&&!o&&Z(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&Z(e.onHover,[t,i,this],this)}else i&&Z(e.onClick,[t,i,this],this)}}var Rs={id:"legend",_element:Ds,start(t,e,i){const n=t.legend=new Ds({ctx:t.ctx,options:i,chart:t});ri.configure(t,n,i),ri.addBox(t,n)},stop(t){ri.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;ri.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const r=t.controller.getStyle(i?0:void 0),a=$e(r.borderWidth);return{text:e[t.index].label,fillStyle:r.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:(a.width+a.height)/4,strokeStyle:r.borderColor,pointStyle:n||r.pointStyle,rotation:r.rotation,textAlign:o||r.textAlign,borderRadius:0,datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Ps extends Dn{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=j(i.text)?i.text.length:1;this._padding=$e(i.padding);const o=n*Ue(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:s,options:r}=this,a=r.align;let l,h,c,u=0;return this.isHorizontal()?(h=o(a,i,s),c=e+t,l=s-i):("left"===r.position?(h=i+t,c=o(a,n,e),u=-.5*_t):(h=s-t,c=o(a,e,n),u=.5*_t),l=n-e),{titleX:h,titleY:c,maxWidth:l,rotation:u}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Ue(e.font),o=i.lineHeight/2+this._padding.top,{titleX:s,titleY:r,maxWidth:a,rotation:l}=this._drawArgs(o);oe(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:l,textAlign:n(e.align),textBaseline:"middle",translation:[s,r]})}}var Fs={id:"title",_element:Ps,start(t,e,i){!function(t,e){const i=new Ps({ctx:t.ctx,options:e,chart:t});ri.configure(t,i,e),ri.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ri.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;ri.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ns=new WeakMap;var Bs={id:"subtitle",start(t,e,i){const n=new Ps({ctx:t.ctx,options:i,chart:t});ri.configure(t,n,i),ri.addBox(t,n),Ns.set(t,n)},stop(t){ri.removeBox(t,Ns.get(t)),Ns.delete(t)},beforeUpdate(t,e,i){const n=Ns.get(t);ri.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Hs={average(t){if(!t.length)return!1;let e,i,n=0,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n+=t.x,o+=t.y,++s}}return{x:n/s,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=Vt(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function Vs(t,e){return e&&(j(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Gs(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function zs(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function $s(t,e){const i=t._chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=Ue(e.bodyFont),h=Ue(e.titleFont),c=Ue(e.footerFont),u=s.length,d=o.length,p=n.length,f=$e(e.padding);let g=f.height,m=0,b=n.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(g+=u*h.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){g+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(b-p)*l.lineHeight+(b-1)*e.bodySpacing}d&&(g+=e.footerMarginTop+d*c.lineHeight+(d-1)*e.footerSpacing);let x=0;const y=function(t){m=Math.max(m,i.measureText(t).width+x)};return i.save(),i.font=h.string,Q(t.title,y),i.font=l.string,Q(t.beforeBody.concat(t.afterBody),y),x=e.displayColors?r+2+e.boxPadding:0,Q(n,t=>{Q(t.before,y),Q(t.lines,y),Q(t.after,y)}),x=0,i.font=c.string,Q(t.footer,y),i.restore(),{width:m+=f.width,height:g}}function Us(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let h="center";return"center"===n?h=o<=(a+l)/2?"left":"right":o<=s/2?h="left":o>=r-s/2&&(h="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(h,t,e,i)&&(h="center"),h}function js(t,e,i){const n=e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:e.xAlign||Us(t,e,i,n),yAlign:n}}function Ws(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,h=o+s,{topLeft:c,topRight:u,bottomLeft:d,bottomRight:p}=ze(r);let f=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const g=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,h);return"center"===l?"left"===a?f+=h:"right"===a&&(f-=h):"left"===a?f-=Math.max(c,d)+o:"right"===a&&(f+=Math.max(u,p)+o),{x:Ut(f,0,n.width-e.width),y:Ut(g,0,n.height-e.height)}}function Xs(t,e,i){const n=$e(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function Ys(t){return Vs([],Gs(t))}function Ks(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class qs extends Dn{constructor(t){super(),this.opacity=0,this._active=[],this._chart=t._chart,this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this._chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new yn(this._chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this._chart.getContext(),e=this,i=this._tooltipItems,Xe(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=i.beforeTitle.apply(this,[t]),o=i.title.apply(this,[t]),s=i.afterTitle.apply(this,[t]);let r=[];return r=Vs(r,Gs(n)),r=Vs(r,Gs(o)),r=Vs(r,Gs(s))}getBeforeBody(t,e){return Ys(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,n=[];return Q(t,t=>{const e={before:[],lines:[],after:[]},o=Ks(i,t);Vs(e.before,Gs(o.beforeLabel.call(this,t))),Vs(e.lines,o.label.call(this,t)),Vs(e.after,Gs(o.afterLabel.call(this,t))),n.push(e)}),n}getAfterBody(t,e){return Ys(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,n=i.beforeFooter.apply(this,[t]),o=i.footer.apply(this,[t]),s=i.afterFooter.apply(this,[t]);let r=[];return r=Vs(r,Gs(n)),r=Vs(r,Gs(o)),r=Vs(r,Gs(s))}_createItems(t){const e=this._active,i=this._chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(zs(this._chart,e[r]));return t.filter&&(l=l.filter((e,n,o)=>t.filter(e,n,o,i))),t.itemSort&&(l=l.sort((e,n)=>t.itemSort(e,n,i))),Q(l,e=>{const i=Ks(t.callbacks,e);n.push(i.labelColor.call(this,e)),o.push(i.labelPointStyle.call(this,e)),s.push(i.labelTextColor.call(this,e))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=Hs[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=$s(this,i),r=Object.assign({},t,e),a=js(this._chart,i,r),l=Ws(i,r,a,this._chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this._chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:h,bottomRight:c}=ze(r),{x:u,y:d}=t,{width:p,height:f}=e;let g,m,b,x,y,_;return"center"===o?(y=d+f/2,"left"===n?(m=(g=u)-s,x=y+s,_=y-s):(m=(g=u+p)+s,x=y-s,_=y+s),b=g):(m="left"===n?u+Math.max(a,h)+s:"right"===n?u+p-Math.max(l,c)-s:this.caretX,"top"===o?(y=(x=d)-s,g=m-s,b=m+s):(y=(x=d+f)+s,g=m+s,b=m-s),_=x),{x1:g,x2:m,x3:b,y1:x,y2:y,y3:_}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=Bi(i.rtl,this.x,this.width);for(t.x=Xs(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=Ue(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l,boxPadding:h}=o,c=Ue(o.bodyFont),u=Xs(this,"left",o),d=n.x(u),p=a<c.lineHeight?(c.lineHeight-a)/2:0,f=e.y+p;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,h=f+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Zt(t,e,i,h),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Zt(t,e,i,h)}else{t.lineWidth=s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l-h),i=n.leftForLtr(n.xPlus(d,1),l-h-2),r=ze(s.borderRadius);Object.values(r).some(t=>0!==t)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,re(t,{x:e,y:f,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),re(t,{x:i,y:f+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,f,l,a),t.strokeRect(e,f,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,f+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:h}=i,c=Ue(i.bodyFont);let u=c.lineHeight,d=0;const p=Bi(i.rtl,this.x,this.width),f=function(i){e.fillText(i,p.x(t.x+d),t.y+u/2),t.y+=u+o},g=p.textAlign(s);let m,b,x,y,_,v,w;for(e.textAlign=s,e.textBaseline="middle",e.font=c.string,t.x=Xs(this,g,i),e.fillStyle=i.bodyColor,Q(this.beforeBody,f),d=r&&"right"!==g?"center"===s?l/2+h:l+2+h:0,y=0,v=n.length;y<v;++y){for(m=n[y],b=this.labelTextColors[y],e.fillStyle=b,Q(m.before,f),x=m.lines,r&&x.length&&(this._drawColorBox(e,t,y,p,i),u=Math.max(c.lineHeight,a)),_=0,w=x.length;_<w;++_)f(x[_]),u=c.lineHeight;Q(m.after,f)}d=0,u=c.lineHeight,Q(this.afterBody,f),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=Bi(i.rtl,this.x,this.width);for(t.x=Xs(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=Ue(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:h}=i,{topLeft:c,topRight:u,bottomLeft:d,bottomRight:p}=ze(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+c,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-u,a),e.quadraticCurveTo(r+l,a,r+l,a+u),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+h-p),e.quadraticCurveTo(r+l,a+h,r+l-p,a+h),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+d,a+h),e.quadraticCurveTo(r,a+h,r,a+h-d),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+c),e.quadraticCurveTo(r,a,r+c,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this._chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=Hs[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=$s(this,t),r=Object.assign({},i,this._size),a=js(e,t,r),l=Ws(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=$e(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Hi(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Vi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map(({datasetIndex:t,index:e})=>{const i=this._chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),o=!tt(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this.update(!0))}handleEvent(t,e){const i=this.options,n=this._active||[];let o=!1,s=[];"mouseout"!==t.type&&(s=this._chart.getElementsAtEventForMode(t,i.mode,i,e),i.reverse&&s.reverse());const r=this._positionChanged(s,t);return(o=e||!tt(s,n)||r)&&(this._active=s,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),o}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=Hs[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}qs.positioners=Hs;var Js={id:"tooltip",_element:qs,positioners:Hs,afterInit(t,e,i){i&&(t.tooltip=new qs({_chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip,i={tooltip:e};!1!==t.notifyPlugins("beforeTooltipDraw",i)&&(e&&e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i))},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:{beforeTitle:z,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:z,beforeBody:z,beforeLabel:z,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return U(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:z,afterBody:z,beforeFooter:z,footer:z,afterFooter:z}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Zs=Object.freeze({__proto__:null,Decimation:ps,Filler:Ls,Legend:Rs,SubTitle:Bs,Title:Fs,Tooltip:Js});const Qs=(t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i),tr=(t,e)=>null===t?null:Ut(Math.round(t),0,e);class er extends jn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(U(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:function(t,e,i,n){const o=t.indexOf(e);return-1===o?Qs(t,e,i,n):o!==t.lastIndexOf(e)?i:o}(i,t,K(e,t),this._addedLabels),tr(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function ir(t,e,{horizontal:i,minRotation:n}){const o=Ft(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}er.id="category",er.defaults={ticks:{callback:er.prototype.getLabelForValue}};class nr extends jn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return U(t)?null:("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=kt(n),e=kt(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=1;(o>=Number.MAX_SAFE_INTEGER||n<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*o)),r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();const n=function(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:h,maxDigits:c,includeBounds:u}=t,d=o||1,p=h-1,{min:f,max:g}=e,m=!U(s),b=!U(r),x=!U(l),y=(g-f)/(c+1);let _,v,w,C,O=Lt((g-f)/p/d)*d;if(O<1e-14&&!m&&!b)return[{value:f},{value:g}];(C=Math.ceil(g/O)-Math.floor(f/O))>p&&(O=Lt(C*O/p/d)*d),U(a)||(_=Math.pow(10,a),O=Math.ceil(O*_)/_),"ticks"===n?(v=Math.floor(f/O)*O,w=Math.ceil(g/O)*O):(v=f,w=g),m&&b&&o&&Rt((r-s)/o,O/1e3)?(O=(r-s)/(C=Math.round(Math.min((r-s)/O,h))),v=s,w=r):x?O=((w=b?r:w)-(v=m?s:v))/(C=l-1):C=Dt(C=(w-v)/O,Math.round(C),O/1e3)?Math.round(C):Math.ceil(C);const S=Math.max(Bt(O),Bt(v));_=Math.pow(10,U(a)?S:a),v=Math.round(v*_)/_,w=Math.round(w*_)/_;let T=0;for(m&&(u&&v!==s?(i.push({value:s}),v<s&&T++,Dt(Math.round((v+T*O)*_)/_,s,ir(s,y,t))&&T++):v<s&&T++);T<C;++T)i.push({value:Math.round((v+T*O)*_)/_});return b&&u&&w!==r?i.length&&Dt(i[i.length-1].value,r,ir(r,y,t))?i[i.length-1].value=r:i.push({value:r}):b&&w!==r||i.push({value:w}),i}({maxTicks:i=Math.max(2,i),bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Pt(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Pi(t,this.chart.options.locale,this.options.ticks.format)}}class or extends nr{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?t:0,this.max=X(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Ft(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function sr(t){return 1===t/Math.pow(10,Math.floor(Mt(t)))}or.id="linear",or.defaults={ticks:{callback:Pn.formatters.numeric}};class rr extends jn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=nr.prototype.parse.apply(this,[t,e]);if(0!==i)return X(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?Math.max(0,t):null,this.max=X(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t,r=(t,e)=>Math.pow(10,Math.floor(Mt(t))+e);i===n&&(i<=0?(o(1),s(10)):(o(r(i,-1)),s(r(n,1)))),i<=0&&o(r(n,-1)),n<=0&&s(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&o(r(i,-1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(Mt(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),o=[];let s=Y(t.min,Math.pow(10,Math.floor(Mt(e.min)))),r=Math.floor(Mt(s)),a=Math.floor(s/Math.pow(10,r)),l=r<0?Math.pow(10,Math.abs(r)):1;do{o.push({value:s,major:sr(s)}),10==++a&&(a=1,l=++r>=0?1:l),s=Math.round(a*Math.pow(10,r)*l)/l}while(r<i||r===i&&a<n);const h=Y(t.max,s);return o.push({value:h,major:sr(s)}),o}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Pt(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":Pi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Mt(t),this._valueRange=Mt(this.max)-Mt(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Mt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function ar(t){const e=t.ticks;if(e.display&&t.display){const t=$e(e.backdropPadding);return K(e.font&&e.font.size,yt.font.size)+t.height}return 0}function lr(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function hr(t){const e={l:0,r:t.width,t:0,b:t.height-t.paddingTop},i={},n=[],o=[],s=t.getLabels().length;for(let h=0;h<s;h++){const s=t.options.pointLabels.setContext(t.getPointLabelContext(h));o[h]=s.padding;const c=t.getPointPosition(h,t.drawingArea+o[h]),u=Ue(s.font),d=(r=t.ctx,a=u,l=j(l=t._pointLabels[h])?l:[l],{w:Kt(r,a.string,l),h:l.length*a.lineHeight});n[h]=d;const p=t.getIndexAngle(h),f=Nt(p),g=lr(f,c.x,d.w,0,180),m=lr(f,c.y,d.h,90,270);g.start<e.l&&(e.l=g.start,i.l=p),g.end>e.r&&(e.r=g.end,i.r=p),m.start<e.t&&(e.t=m.start,i.t=p),m.end>e.b&&(e.b=m.end,i.b=p)}var r,a,l;t._setReductions(t.drawingArea,e,i),t._pointLabelItems=function(t,e,i){const n=[],o=t.getLabels().length,s=t.options,r=ar(s),a=t.getDistanceFromCenterForValue(s.ticks.reverse?t.min:t.max);for(let s=0;s<o;s++){const o=0===s?r/2:0,l=t.getPointPosition(s,a+o+i[s]),h=Nt(t.getIndexAngle(s)),c=e[s],u=dr(l.y,c.h,h),d=cr(h),p=ur(l.x,c.w,d);n.push({x:l.x,y:u,textAlign:d,left:p,top:u,right:p+c.w,bottom:u+c.h})}return n}(t,n,o)}function cr(t){return 0===t||180===t?"center":t<180?"left":"right"}function ur(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function dr(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function pr(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,vt);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}function fr(t){return At(t)?t:0}rr.id="logarithmic",rr.defaults={ticks:{callback:Pn.formatters.logarithmic,major:{enabled:!0}}};class gr extends nr{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){this.width=this.maxWidth,this.height=this.maxHeight,this.paddingTop=ar(this.options)/2,this.xCenter=Math.floor(this.width/2),this.yCenter=Math.floor((this.height-this.paddingTop)/2),this.drawingArea=Math.min(this.height-this.paddingTop,this.width)/2}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=X(t)&&!isNaN(t)?t:0,this.max=X(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ar(this.options))}generateTickLabels(t){nr.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{const i=Z(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})}fit(){const t=this.options;t.display&&t.pointLabels.display?hr(this):this.setCenterPoint(0,0,0,0)}_setReductions(t,e,i){let n=e.l/Math.sin(i.l),o=Math.max(e.r-this.width,0)/Math.sin(i.r),s=-e.t/Math.cos(i.t),r=-Math.max(e.b-(this.height-this.paddingTop),0)/Math.cos(i.b);n=fr(n),o=fr(o),s=fr(s),r=fr(r),this.drawingArea=Math.max(t/2,Math.min(Math.floor(t-(n+o)/2),Math.floor(t-(s+r)/2))),this.setCenterPoint(n,o,s,r)}setCenterPoint(t,e,i,n){const o=this.width-e-this.drawingArea,s=t+this.drawingArea,r=i+this.drawingArea,a=this.height-this.paddingTop-n-this.drawingArea;this.xCenter=Math.floor((s+o)/2+this.left),this.yCenter=Math.floor((r+a)/2+this.top+this.paddingTop)}getIndexAngle(t){return zt(t*(vt/this.getLabels().length)+Ft(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(U(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(U(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Xe(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e){const i=this.getIndexAngle(t)-St;return{x:Math.cos(i)*e+this.xCenter,y:Math.sin(i)*e+this.yCenter,angle:i}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),pr(this,this.getDistanceFromCenterForValue(this._endValue),e,this.getLabels().length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n}=e,o=this.getLabels().length;let s,r,a;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=n.setContext(t.getPointLabelContext(o)),s=Ue(e.font),{x:r,y:a,textAlign:l,left:h,top:c,right:u,bottom:d}=t._pointLabelItems[o],{backdropColor:p}=e;if(!U(p)){const t=$e(e.backdropPadding);i.fillStyle=p,i.fillRect(h-t.left,c-t.top,u-h+t.width,d-c+t.height)}oe(i,t._pointLabels[o],r,a+s.lineHeight/2,s,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,o),n.display&&this.ticks.forEach((t,e)=>{if(0!==e){r=this.getDistanceFromCenterForValue(t.value),function(t,e,i,n){const o=t.ctx,s=e.circular,{color:r,lineWidth:a}=e;!s&&!n||!r||!a||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=a,o.setLineDash(e.borderDash),o.lineDashOffset=e.borderDashOffset,o.beginPath(),pr(t,i,s,n),o.closePath(),o.stroke(),o.restore())}(this,n.setContext(this.getContext(e-1)),r,o)}}),i.display){for(t.save(),s=this.getLabels().length-1;s>=0;s--){const n=i.setContext(this.getPointLabelContext(s)),{color:o,lineWidth:l}=n;l&&o&&(t.lineWidth=l,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,r=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),a=this.getPointPosition(s,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(a.x,a.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((n,r)=>{if(0===r&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=Ue(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=$e(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}oe(t,n.label,0,-o,l,{color:a.color})}),t.restore()}drawTitle(){}}gr.id="radialLinear",gr.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Pn.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5}},gr.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},gr.descriptors={angleLines:{_fallback:"grid"}};const mr={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}},br=Object.keys(mr);function xr(t,e){return t-e}function yr(t,e){if(U(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),X(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!At(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function _r(t,e,i,n){const o=br.length;for(let s=br.indexOf(t);s<o-1;++s){const t=mr[br[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return br[s]}return br[o-1]}function vr(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=ae(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function wr(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)o[a=e[r]]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))(l=i[a])>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class Cr extends jn{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){const i=t.time||(t.time={}),n=this._adapter=new wo._date(t.adapters.date);st(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:yr(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=X(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=X(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=ce(n,o,this.max);return this._unit=e.unit||(i.autoSkip?_r(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=br.length-1;s>=br.indexOf(i);s--){const i=br[s];if(mr[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return br[i?br.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=br.indexOf(t)+1,i=br.length;e<i;++e)if(mr[br[e]].common)return br[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),wr(this,s,this._majorUnit)}initOffsets(t){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=Ut(n,0,s),o=Ut(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||_r(o.minUnit,e,i,this._getLabelCapacity(e)),r=K(o.stepSize,1),a="week"===s&&o.isoWeekday,l=At(a)||!0===a,h={};let c,u,d=e;if(l&&(d=+t.startOf(d,"isoWeek",a)),d=+t.startOf(d,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(c=d,u=0;c<i;c=+t.add(c,r,s),u++)vr(h,c,p);return c!==i&&"ticks"!==n.bounds&&1!==u||vr(h,c,p),Object.keys(h).sort((t,e)=>t-e).map(t=>+t)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.time.displayFormats,r=this._unit,a=this._majorUnit,l=r&&s[r],h=a&&s[a],c=i[e],u=a&&h&&c&&c.major,d=this._adapter.format(t,n||(u?h:l)),p=o.ticks.callback;return p?Z(p,[d,e,i],this):d}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)(n=t[e]).label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=Ft(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,wr(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(yr(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return fe(t.sort(xr))}}function Or(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=le(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=le(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const h=o-n;return h?s+(r-s)*(e-n)/h:s}Cr.id="time",Cr.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class Sr extends Cr{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Or(e,this.min),this._tableRange=Or(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,h;for(s=0,r=t.length;s<r;++s)(l=t[s])>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)h=n[s+1],a=n[s-1],l=n[s],Math.round((h+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t}getDecimalForValue(t){return(Or(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Or(this._table,i*this._tableRange+this._minPos,!0)}}Sr.id="timeseries",Sr.defaults=Cr.defaults;var Tr=Object.freeze({__proto__:null,CategoryScale:er,LinearScale:or,LogarithmicScale:rr,RadialLinearScale:gr,TimeScale:Cr,TimeSeriesScale:Sr});return xo.register(Ho,Tr,cs,Zs),xo.helpers={...Ki},xo._adapters=wo,xo.Animation=bn,xo.Animations=yn,xo.animator=r,xo.controllers=Xn.controllers.items,xo.DatasetController=An,xo.Element=Dn,xo.elements=cs,xo.Interaction=Pe,xo.layouts=ri,xo.platforms=gn,xo.Scale=jn,xo.Ticks=Pn,Object.assign(xo,Ho,Tr,cs,Zs,gn),xo.Chart=xo,"undefined"!=typeof window&&(window.Chart=xo),xo},"object"==typeof i&&void 0!==e?e.exports=o():"function"==typeof define&&define.amd?define(o):(n="undefined"!=typeof globalThis?globalThis:n||self).Chart=o()},{}],2:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ADCExperimentController=i.CHART_EACH_INTERVAL=i.DE_de=void 0;const n=t("./utils"),o=t("chart.js"),s=t("./ScreenController"),r=t("./flowchart/SerializeContext");i.DE_de=new Intl.NumberFormat("de-DE"),i.CHART_EACH_INTERVAL=2;i.ADCExperimentController=class extends s.ScreenController{constructor(t,e){super(t,e),this.counter=12,this.seconds=0,this.recording=!1,this.butRecord=document.getElementById("adcexperiment_butRecord"),this.butStop=document.getElementById("adcexperiment_butStop"),this.butStop.hidden=!0,this.butDelete=document.getElementById("adcexperiment_butDelete"),this.tbody=document.getElementById("adcexperiment_tabBody"),this.tfirstRow=document.getElementById("adcexperiment_tabFirstRow");let i=document.getElementById("adcexperiment_chart");this.chart=new o.Chart(i,{type:"line",data:{labels:[],datasets:[{label:"Input 0 [V]",data:[],backgroundColor:"red",borderColor:"red",fill:!1},{label:"Input 1 [V]",data:[],backgroundColor:"green",borderColor:"green",fill:!1},{label:"Input 2 [V]",data:[],backgroundColor:"blue",borderColor:"blue",fill:!1},{label:"Input 3 [V]",data:[],backgroundColor:"grey",borderColor:"grey",fill:!1}]},options:{responsive:!0,maintainAspectRatio:!1,hover:{mode:"nearest",intersect:!0},scales:{y:{beginAtZero:!0}}}}),this.butStop.onclick=(t=>{this.butStop.hidden=!0,this.butRecord.hidden=!1,this.recording=!1}),this.butRecord.onclick=(t=>{this.butRecord.hidden=!0,this.butStop.hidden=!1,this.recording=!0}),this.butDelete.onclick=(t=>{this.resetData()})}onFirstStart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},1e3)}onRestart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},1e3)}onStop(){window.clearInterval(this.timer),this.butStop.hidden=!0,this.butRecord.hidden=!1,this.counter=12}onCreate(){this.resetData()}resetData(){this.chart.data.labels=[],this.chart.data.datasets.forEach(t=>{t.data=[]}),this.chart.update(),this.tbody.innerText="",this.seconds=0}sendAndReceive(){let t=new XMLHttpRequest;t.onerror=(t=>{console.log("Fehler beim XMLHttpRequest!")}),t.open("GET","/adcexperiment",!0),t.responseType="arraybuffer",t.onload=(e=>{var o,s,a,l,h,c,u,d,p;let f=[0,0,0,0],g=t.response;if(g||16==g.byteLength){let t=new r.SerializeContext(g);f[0]=t.readF32(),f[1]=t.readF32(),f[2]=t.readF32(),f[3]=t.readF32()}let m=new Date(Date.now());if(this.recording){let t=n.$.HtmlAsFirstChild(this.tbody,"tr",[]);for(let e=0;e<6;e++)n.$.Html(t,"td",[],[],this.tfirstRow.children[e].textContent);this.counter>=i.CHART_EACH_INTERVAL&&(this.chart.data.labels.length>100&&(null===(o=this.chart.data.labels)||void 0===o||o.shift(),this.chart.data.datasets.forEach(t=>{t.data.shift()})),this.chart.data.labels.push(m.toLocaleTimeString("de-DE")),null===(a=null===(s=this.chart.data)||void 0===s?void 0:s.datasets[0].data)||void 0===a||a.push(f[0]),null===(h=null===(l=this.chart.data)||void 0===l?void 0:l.datasets[1].data)||void 0===h||h.push(f[1]),null===(u=null===(c=this.chart.data)||void 0===c?void 0:c.datasets[2].data)||void 0===u||u.push(f[2]),null===(p=null===(d=this.chart.data)||void 0===d?void 0:d.datasets[3].data)||void 0===p||p.push(f[3]),this.chart.update(),this.counter=0),this.counter++,this.seconds++}this.tfirstRow.children[0].textContent=m.toLocaleTimeString("de-DE"),this.tfirstRow.children[1].textContent=i.DE_de.format(this.seconds),this.tfirstRow.children[2].textContent=i.DE_de.format(f[0]),this.tfirstRow.children[3].textContent=i.DE_de.format(f[1]),this.tfirstRow.children[4].textContent=i.DE_de.format(f[2]),this.tfirstRow.children[5].textContent=i.DE_de.format(f[3])}),t.send()}}},{"./ScreenController":9,"./flowchart/SerializeContext":16,"./utils":20,"chart.js":1}],3:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.AirspeedExperimentController=void 0;const n=t("./utils"),o=t("chart.js"),s=t("./ScreenController"),r=t("./flowchart/SerializeContext"),a=new Intl.NumberFormat("de-DE"),l=2;i.AirspeedExperimentController=class extends s.ScreenController{constructor(t,e){super(t,e),this.counter=12,this.mode=0,this.seconds=0,this.recording=!1,this.butRecord=document.getElementById("airspeedexperiment_butRecord"),this.butStop=document.getElementById("airspeedexperiment_butStop"),this.butStop.hidden=!0,this.butDelete=document.getElementById("airspeedexperiment_butDelete"),this.tbody=document.getElementById("airspeedexperiment_tabBody"),this.tfirstRow=document.getElementById("airspeedexperiment_tabFirstRow"),this.inputSetpointFan=document.getElementById("airspeedexperiment_inpSetpointFan"),this.inputServoOL=document.getElementById("airspeedexperiment_inpFanOL"),this.inputSetpointAirspeed=document.getElementById("airspeedexperiment_inpSetpointAirspeed"),this.inputServoCL=document.getElementById("airspeedexperiment_inpFanCL"),this.inputKP=document.getElementById("airspeedexperiment_inpKP"),this.inputKI=document.getElementById("airspeedexperiment_inpKI"),this.inputKD=document.getElementById("airspeedexperiment_inpKD"),this.onModeChange(0);let i=document.getElementById("airspeedexperiment_chart");this.chart=new o.Chart(i,{type:"line",data:{labels:[],datasets:[{label:"Setpoint Airspeed [m/s]",data:[],backgroundColor:"red",borderColor:"red",fill:!1},{label:"Actual Airspeed [m/s]",data:[],backgroundColor:"green",borderColor:"green",fill:!1},{label:"Fan Power [%]",data:[],backgroundColor:"blue",borderColor:"blue",fill:!1},{label:"Servo Position [deg]",data:[],backgroundColor:"grey",borderColor:"grey",fill:!1}]},options:{responsive:!0,maintainAspectRatio:!1,hover:{mode:"nearest",intersect:!0},scales:{y:{beginAtZero:!0}}}}),document.querySelectorAll('input[name="airspeedexperiment_mode"]').forEach((t,e)=>{let i=t;i.onclick=(t=>{let e=parseInt(i.value);this.mode!=e&&this.onModeChange(e)})});let n=(t,e)=>{let i=t.valueAsNumber,n=t.min?parseInt(t.min):0,o=100*(i-n)/((t.max?parseInt(t.max):100)-n);e.innerHTML=""+i,e.style.left=`calc(${o}% + (${8-.15*o}px))`};document.querySelectorAll(".range-wrap.airspeedexperiment").forEach(t=>{let e=t.querySelector("input[type='range']"),i=t.querySelector("output.bubble");e.oninput=(t=>n(e,i)),n(e,i)}),this.butStop.onclick=(t=>{this.butStop.hidden=!0,this.butRecord.hidden=!1,this.recording=!1}),this.butRecord.onclick=(t=>{this.butRecord.hidden=!0,this.butStop.hidden=!1,this.recording=!0}),this.butDelete.onclick=(t=>{this.resetData()})}onFirstStart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},1e3)}onRestart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},1e3)}onStop(){window.clearInterval(this.timer),this.butStop.hidden=!0,this.butRecord.hidden=!1,this.counter=12}onCreate(){this.resetData()}resetData(){this.chart.data.labels=[],this.chart.data.datasets.forEach(t=>{t.data=[]}),this.chart.update(),this.tbody.innerText="",this.seconds=0}onModeChange(t){switch(t){case 0:document.querySelectorAll(".airspeedexperiment_closedloopctrl").forEach((t,e)=>{t.style.display="none"}),document.querySelectorAll(".airspeedexperiment_openloopctrl").forEach((t,e)=>{t.style.display="none"});break;case 1:document.querySelectorAll(".airspeedexperiment_closedloopctrl").forEach((t,e)=>{t.style.display="none"}),document.querySelectorAll(".airspeedexperiment_openloopctrl").forEach((t,e)=>{t.style.display="inline-block"});break;case 2:document.querySelectorAll(".airspeedexperiment_closedloopctrl").forEach((t,e)=>{t.style.display="inline-block"}),document.querySelectorAll(".airspeedexperiment_openloopctrl").forEach((t,e)=>{t.style.display="none"})}this.mode=t}sendAndReceive(){let t=new ArrayBuffer(256),e=new r.SerializeContext(t);e.writeU32(this.mode),0==this.mode?(e.writeF32(0),e.writeF32(0)):1==this.mode?(e.writeF32(this.inputSetpointFan.valueAsNumber),e.writeF32(this.inputServoOL.valueAsNumber)):(e.writeF32(this.inputSetpointAirspeed.valueAsNumber),e.writeF32(this.inputServoCL.valueAsNumber)),e.writeF32(this.inputKP.valueAsNumber),e.writeF32(this.inputKI.valueAsNumber),e.writeF32(this.inputKD.valueAsNumber);let i=new XMLHttpRequest;i.onerror=(t=>{console.log("Fehler beim XMLHttpRequest!")}),i.open("PUT","/airspeedexperiment",!0),i.responseType="arraybuffer",i.onload=(t=>{var e,o,s,h,c,u,d,p,f;let g,m,b,x,y=i.response;if(y&&16==y.byteLength){let t=new r.SerializeContext(y);g=t.readF32(),m=t.readF32(),b=t.readF32(),x=t.readF32()}else console.error("! arrayBuffer || arrayBuffer.byteLength!=4+4+4+4"),g=0,m=0,b=0,x=10*Math.random()-5+20;let _=new Date(Date.now());if(this.recording){let t=n.$.HtmlAsFirstChild(this.tbody,"tr",[]);for(let e=0;e<6;e++)n.$.Html(t,"td",[],[],this.tfirstRow.children[e].textContent);this.counter>=l&&(this.chart.data.labels.length>100&&(null===(e=this.chart.data.labels)||void 0===e||e.shift(),this.chart.data.datasets.forEach(t=>{t.data.shift()})),this.chart.data.labels.push(_.toLocaleTimeString("de-DE")),null===(s=null===(o=this.chart.data)||void 0===o?void 0:o.datasets[0].data)||void 0===s||s.push(g),null===(c=null===(h=this.chart.data)||void 0===h?void 0:h.datasets[1].data)||void 0===c||c.push(x),null===(d=null===(u=this.chart.data)||void 0===u?void 0:u.datasets[2].data)||void 0===d||d.push(m),null===(f=null===(p=this.chart.data)||void 0===p?void 0:p.datasets[3].data)||void 0===f||f.push(b),this.chart.update(),this.counter=0),this.counter++,this.seconds++}this.tfirstRow.children[0].textContent=_.toLocaleTimeString("de-DE"),this.tfirstRow.children[1].textContent=a.format(this.seconds),this.tfirstRow.children[2].textContent=a.format(g),this.tfirstRow.children[3].textContent=a.format(x),this.tfirstRow.children[4].textContent=a.format(m),this.tfirstRow.children[5].textContent=a.format(b)}),i.send(e.getResult())}}},{"./ScreenController":9,"./flowchart/SerializeContext":16,"./utils":20,"chart.js":1}],4:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});const n=t("./HeaterExperimentController"),o=t("./ScreenController"),s=t("./DevelopCFCController"),r=t("./DialogController"),a=t("./ADCExperimentController"),l=t("./AirspeedExperimentController"),h=t("./FFTExperimentController");class c extends o.ScreenController{onFirstStart(){}onRestart(){}onStop(){}onCreate(){}constructor(t,e){super(t,e)}}class u extends o.ScreenController{onFirstStart(){}onRestart(){}onStop(){}constructor(t,e){super(t,e)}onCreate(){}}class d{constructor(){this.stateDiv=document.getElementById("spnConnectionState"),this.screenControllers=[],this.activeControllerIndex=0,this.dialogController=new r.DialogController(this)}DialogController(){return this.dialogController}SetApplicationState(t){this.stateDiv.innerHTML=t}setActiveScreen(t){this.screenControllers.forEach((e,i)=>{i==t?(e.showDIV(),e.State==o.ControllerState.CREATED?(e.onFirstStart(),e.State=o.ControllerState.STARTED):(e.onRestart(),e.State=o.ControllerState.STARTED)):(e.hideDIV(),e.State==o.ControllerState.STARTED&&(e.onStop(),e.State=o.ControllerState.STOPPED))}),this.activeControllerIndex=t}startup(){this.dialogController.init(),this.screenControllers.push(new c(this,document.getElementById("screen_dashboard"))),this.screenControllers.push(new s.DevelopCFCController(this,document.getElementById("screen_develop"))),this.screenControllers.push(new u(this,document.getElementById("screen_reports"))),this.screenControllers.push(new n.HeaterExperimentController(this,document.getElementById("screen_heaterexperiment"))),this.screenControllers.push(new l.AirspeedExperimentController(this,document.getElementById("screen_airspeedexperiment"))),this.screenControllers.push(new a.ADCExperimentController(this,document.getElementById("screen_adcexperiment"))),this.screenControllers.push(new h.FFTExperimentController(this,document.getElementById("screen_fftexperiment"))),this.screenControllers.forEach(t=>t.onCreate()),this.setActiveScreen(1);let t=new Map;this.screenControllers.forEach((e,i)=>{t.set("show_"+e.ElementId,i)}),document.querySelectorAll("nav a").forEach(e=>{e.id;let i=t.get(e.id)||0;e.onclick=(t=>this.setActiveScreen(i))})}}let p;document.addEventListener("DOMContentLoaded",t=>{(p=new d).startup()})},{"./ADCExperimentController":2,"./AirspeedExperimentController":3,"./DevelopCFCController":5,"./DialogController":6,"./FFTExperimentController":7,"./HeaterExperimentController":8,"./ScreenController":9}],5:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.DevelopCFCController=void 0;const n=t("./flowchart/Flowchart"),o=t("./ScreenController");i.DevelopCFCController=class extends o.ScreenController{constructor(t,e){super(t,e);let i=new n.FlowchartOptions;i.data={operators:[{index:0,caption:"RedButton",globalTypeIndex:30,posX:10,posY:10,configurationData:null},{index:1,caption:"GreenButton",globalTypeIndex:33,posX:10,posY:150,configurationData:null},{index:2,caption:"AND",globalTypeIndex:1,posX:250,posY:10,configurationData:null},{index:3,caption:"RedLed",globalTypeIndex:46,posX:500,posY:10,configurationData:null}],links:[{color:"black",fromOperatorIndex:0,fromOutput:0,toOperatorIndex:2,toInput:0},{color:"black",fromOperatorIndex:1,fromOutput:0,toOperatorIndex:2,toInput:1},{color:"black",fromOperatorIndex:2,fromOutput:0,toOperatorIndex:3,toInput:0}]},this.fc=new n.Flowchart(this.appManagement,this.div,i)}onFirstStart(){this.timer=window.setInterval(()=>{this.fc.triggerDebug()},1e3),this.fc.onFirstStart()}onRestart(){this.timer=window.setInterval(()=>{this.fc.triggerDebug()},1e3)}onStop(){window.clearInterval(this.timer)}onCreate(){}}},{"./ScreenController":9,"./flowchart/Flowchart":10}],6:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.DialogController=void 0;const n=t("./utils");i.DialogController=class{constructor(t){this.appManagement=t,this.dialog=document.getElementById("dialog"),this.dialogHeading=document.getElementById("dialog-heading"),this.dialogBody=document.getElementById("dialog-body"),this.dialogFooter=document.getElementById("dialog-footer")}init(){document.getElementById("dialog-close").onclick=(t=>{}),this.dialog.onclick=(t=>{t.target,this.dialog})}showEnterFilenameDialog(t,e,i){this.prepareDialog(),this.dialogHeading.innerText="Enter Filename",n.$.Html(this.dialogBody,"p",[],[],e);let o=n.$.Html(this.dialogBody,"input",["pattern","^[A-Za-z0-9]{1,10}$"],[]);this.dialogFooter.innerText="",n.$.Html(this.dialogFooter,"button",[],[],"OK").onclick=(t=>{null!=i&&i(o.value)})}showOKDialog(t,e,i){this.prepareDialog(),this.dialogHeading.innerText="Message",this.dialogBody.innerText=e,this.dialogFooter.innerText="",n.$.Html(this.dialogFooter,"button",["type","button"],[],"OK").onclick=(t=>{null!=i&&i("OK")})}prepareDialog(){this.dialogHeading.innerText="",this.dialogBody.innerText="",this.dialogFooter.innerText=""}showFilelist(t,e,i,o){this.prepareDialog(),this.dialogHeading.innerText="Please select a file to load",n.$.Html(this.dialogFooter,"button",["type","button"],[],"Cancel").onclick=(t=>{});let s=n.$.Html(this.dialogBody,"table",[],[]),r=n.$.Html(s,"thead",[],[]),a=n.$.Html(r,"tr",[],[]);n.$.Html(a,"th",[],[],"File Name"),n.$.Html(a,"th",[],[],"File Operation");let l=n.$.Html(s,"tbody",[],[]);for(let t of e){if(!t.endsWith(".json"))continue;t=t.substring(0,t.length-5);let e=n.$.Html(l,"tr",[],[]);n.$.Html(e,"td",[],[],t);let s=n.$.Html(e,"td",[],[]),r=n.$.Html(s,"button",["type","button"],[]);n.$.SvgIcon(r,"folder-open"),r.onclick=(e=>{i(t)});let a=n.$.Html(s,"button",["type","button"],[]);n.$.SvgIcon(a,"bin2"),a.onclick=(e=>{o(t)})}}}},{"./utils":20}],7:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.FFTExperimentController=void 0;const n=t("chart.js"),o=t("./ScreenController"),s=t("./flowchart/SerializeContext"),r=[11,21,31,42,53,64,75,97,118,139,161,183,205,227,258,291,323,355,388,431,474,517,560,614,668,721,786,851,915,991,1066,1152,1238,1335,1443,1550,1669,1798,1938,2089,2239,2401,2584,2778,2982,3198,3435,3682,3951,4231,4533,4856,5200,5566,5965,6385,6837,7321,7838,8398,8990,9625,10304,11025],a=2e3,l=Array.from(Array(64).keys());i.FFTExperimentController=class extends o.ScreenController{constructor(t,e){super(t,e),this.COLORS=["#4dc9f6","#f67019","#f53794","#537bc4","#acc236","#166a8f","#00a950","#58595b","#8549ba"],this.recording=!1,this.butRecord=document.getElementById("fftexperiment_butRecord"),this.butStop=document.getElementById("fftexperiment_butStop"),this.butSave=document.getElementById("fftexperiment_butSave"),this.butDelete=document.getElementById("fftexperiment_butDelete"),this.inputFan=document.getElementById("fftexperiment_inpFan"),this.butStop.hidden=!0,this.tbody=document.getElementById("adcexperiment_tabBody");let i=document.getElementById("fftexperiment_chart");this.chart=new n.Chart(i,{type:"line",data:{labels:r,datasets:[]},options:{responsive:!0,maintainAspectRatio:!1,hover:{mode:"nearest",intersect:!0},scales:{y:{beginAtZero:!0,max:10}}}}),this.chart.update();let o=(t,e)=>{let i=t.valueAsNumber,n=t.min?parseInt(t.min):0,o=100*(i-n)/((t.max?parseInt(t.max):100)-n);e.innerHTML=""+i,e.style.left=`calc(${o}% + (${8-.15*o}px))`};document.querySelectorAll(".range-wrap.fftexperiment").forEach(t=>{let e=t.querySelector("input[type='range']"),i=t.querySelector("output.bubble");e.oninput=(t=>o(e,i)),o(e,i)}),this.butStop.onclick=(()=>{this.butStop.hidden=!0,this.butRecord.hidden=!1,this.recording=!1,this.chart.data.datasets.shift(),this.chart.update()}),this.butRecord.onclick=(()=>{this.butRecord.hidden=!0,this.butStop.hidden=!1,this.chart.data.datasets.unshift({label:"Magnitudes",data:l,borderColor:this.color(0),backgroundColor:this.color(0)}),this.recording=!0,this.chart.update()}),this.butSave.onclick=(()=>{let t={label:"Magnitudes saved "+new Date(Date.now()).toLocaleTimeString("de-DE"),data:this.chart.data.datasets[0].data,borderColor:this.color(this.chart.data.datasets.length),backgroundColor:this.color(this.chart.data.datasets.length)};this.chart.data.datasets.splice(1,0,t),this.chart.update()}),this.butDelete.onclick=(()=>{this.chart.data.datasets.length<2||(this.chart.data.datasets.pop(),this.chart.update())})}onFirstStart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},a)}onRestart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},a)}onStop(){window.clearInterval(this.timer),this.butStop.hidden=!0,this.butRecord.hidden=!1}onCreate(){}resetData(){this.chart.data.labels=[],this.chart.data.datasets.forEach(t=>{t.data=[]}),this.chart.update(),this.tbody.innerText=""}color(t){return this.COLORS[t%this.COLORS.length]}sendAndReceive(){let t=new ArrayBuffer(256),e=new s.SerializeContext(t);e.writeF32(this.inputFan.valueAsNumber),e.writeF32(0),e.writeF32(0),e.writeF32(0),e.writeF32(0),e.writeF32(0),e.writeF32(0),e.writeF32(0);let i=new XMLHttpRequest;i.onerror=(t=>{console.log("Fehler beim XMLHttpRequest!")}),i.open("PUT","/fftexperiment",!0),i.responseType="arraybuffer",i.onload=(t=>{let e=[],n=i.response;if(n&&256==n.byteLength){let t=new s.SerializeContext(n);for(let i=0;i<64;i++)e.push(Math.log10(t.readF32()))}else{console.error("!arrayBuffer || arrayBuffer.byteLength != 256 --\x3eproviding fake data");for(let t=0;t<64;t++)e.push(5+5*Math.random())}this.recording&&(this.chart.data.datasets[0].data=e,this.chart.update())}),i.send(e.getResult())}}},{"./ScreenController":9,"./flowchart/SerializeContext":16,"chart.js":1}],8:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.HeaterExperimentController=i.CHART_EACH_INTERVAL=i.DE_de=void 0;const n=t("./utils"),o=t("chart.js"),s=t("./ScreenController"),r=t("./flowchart/SerializeContext");i.DE_de=new Intl.NumberFormat("de-DE"),i.CHART_EACH_INTERVAL=2;i.HeaterExperimentController=class extends s.ScreenController{constructor(t,e){super(t,e),this.counter=12,this.mode=0,this.seconds=0,this.recording=!1,this.butRecord=document.getElementById("heaterexperiment_butRecord"),this.butStop=document.getElementById("heaterexperiment_butStop"),this.butStop.hidden=!0,this.butDelete=document.getElementById("heaterexperiment_butDelete"),this.tbody=document.getElementById("heaterexperiment_tabBody"),this.tfirstRow=document.getElementById("heaterexperiment_tabFirstRow"),this.inputSetpointHeater=document.getElementById("heaterexperiment_inpSetpointHeater"),this.inputFanOL=document.getElementById("heaterexperiment_inpFanOL"),this.inputSetpointTemperature=document.getElementById("heaterexperiment_inpSetpointTemperature"),this.inputFanCL=document.getElementById("heaterexperiment_inpFanCL"),this.inputKP=document.getElementById("heaterexperiment_inpKP"),this.inputTN=document.getElementById("heaterexperiment_inpTN"),this.inputTV=document.getElementById("heaterexperiment_inpTV"),this.onModeChange(0);let i=document.getElementById("heaterexperiment_chart");this.chart=new o.Chart(i,{type:"line",data:{labels:[],datasets:[{label:"Setpoint Temperature [°C]",data:[],backgroundColor:"red",borderColor:"red",fill:!1},{label:"Actual Temperature [°C]",data:[],backgroundColor:"green",borderColor:"green",fill:!1},{label:"Heater Power [%]",data:[],backgroundColor:"blue",borderColor:"blue",fill:!1},{label:"Fan Power [%]",data:[],backgroundColor:"grey",borderColor:"grey",fill:!1}]},options:{responsive:!0,maintainAspectRatio:!1,hover:{mode:"nearest",intersect:!0},scales:{y:{beginAtZero:!0}}}}),document.querySelectorAll('input[name="heaterexperiment_mode"]').forEach((t,e)=>{let i=t;i.onclick=(t=>{let e=parseInt(i.value);this.mode!=e&&this.onModeChange(e)})});let n=(t,e)=>{let i=t.valueAsNumber,n=t.min?parseInt(t.min):0,o=100*(i-n)/((t.max?parseInt(t.max):100)-n);e.innerHTML=""+i,e.style.left=`calc(${o}% + (${8-.15*o}px))`};document.querySelectorAll(".range-wrap.heaterexperiment").forEach(t=>{let e=t.querySelector("input[type='range']"),i=t.querySelector("output.bubble");e.oninput=(t=>n(e,i)),n(e,i)}),this.butStop.onclick=(t=>{this.butStop.hidden=!0,this.butRecord.hidden=!1,this.recording=!1}),this.butRecord.onclick=(t=>{this.butRecord.hidden=!0,this.butStop.hidden=!1,this.recording=!0}),this.butDelete.onclick=(t=>{this.resetData()})}onFirstStart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},1e3)}onRestart(){this.timer=window.setInterval(()=>{this.sendAndReceive()},1e3)}onStop(){window.clearInterval(this.timer),this.butStop.hidden=!0,this.butRecord.hidden=!1,this.counter=12}onCreate(){this.resetData()}resetData(){this.chart.data.labels=[],this.chart.data.datasets.forEach(t=>{t.data=[]}),this.chart.update(),this.tbody.innerText="",this.seconds=0}onModeChange(t){switch(t){case 0:document.querySelectorAll(".heaterexperiment_closedloopctrl").forEach((t,e)=>{t.style.display="none"}),document.querySelectorAll(".heaterexperiment_openloopctrl").forEach((t,e)=>{t.style.display="none"});break;case 1:document.querySelectorAll(".heaterexperiment_closedloopctrl").forEach((t,e)=>{t.style.display="none"}),document.querySelectorAll(".heaterexperiment_openloopctrl").forEach((t,e)=>{t.style.display="inline-block"});break;case 2:document.querySelectorAll(".heaterexperiment_closedloopctrl").forEach((t,e)=>{t.style.display="inline-block"}),document.querySelectorAll(".heaterexperiment_openloopctrl").forEach((t,e)=>{t.style.display="none"})}this.mode=t}sendAndReceive(){let t=new ArrayBuffer(256),e=new r.SerializeContext(t);e.writeU32(this.mode),0==this.mode?(e.writeF32(0),e.writeF32(0)):1==this.mode?(e.writeF32(this.inputSetpointHeater.valueAsNumber),e.writeF32(this.inputFanOL.valueAsNumber)):(e.writeF32(this.inputSetpointTemperature.valueAsNumber),e.writeF32(this.inputFanCL.valueAsNumber)),e.writeF32(this.inputKP.valueAsNumber),e.writeF32(this.inputTN.valueAsNumber),e.writeF32(this.inputTV.valueAsNumber);let o=new XMLHttpRequest;o.onerror=(t=>{console.log("Fehler beim XMLHttpRequest!")}),o.open("PUT","/heaterexperiment",!0),o.responseType="arraybuffer",o.onload=(t=>{var e,s,a,l,h,c,u,d,p;let f,g,m,b,x=o.response;if(x&&16==x.byteLength){let t=new r.SerializeContext(x);f=t.readF32(),g=t.readF32(),m=t.readF32(),b=t.readF32()}else console.error("! arrayBuffer || arrayBuffer.byteLength!=4+4+4+4"),f=0,g=0,m=0,b=10*Math.random()-5+20;let y=new Date(Date.now());if(this.recording){let t=n.$.HtmlAsFirstChild(this.tbody,"tr",[]);for(let e=0;e<6;e++)n.$.Html(t,"td",[],[],this.tfirstRow.children[e].textContent);this.counter>=i.CHART_EACH_INTERVAL&&(this.chart.data.labels.length>100&&(null===(e=this.chart.data.labels)||void 0===e||e.shift(),this.chart.data.datasets.forEach(t=>{t.data.shift()})),this.chart.data.labels.push(y.toLocaleTimeString("de-DE")),null===(a=null===(s=this.chart.data)||void 0===s?void 0:s.datasets[0].data)||void 0===a||a.push(f),null===(h=null===(l=this.chart.data)||void 0===l?void 0:l.datasets[1].data)||void 0===h||h.push(b),null===(u=null===(c=this.chart.data)||void 0===c?void 0:c.datasets[2].data)||void 0===u||u.push(g),null===(p=null===(d=this.chart.data)||void 0===d?void 0:d.datasets[3].data)||void 0===p||p.push(m),this.chart.update(),this.counter=0),this.counter++,this.seconds++}this.tfirstRow.children[0].textContent=y.toLocaleTimeString("de-DE"),this.tfirstRow.children[1].textContent=i.DE_de.format(this.seconds),this.tfirstRow.children[2].textContent=i.DE_de.format(f),this.tfirstRow.children[3].textContent=i.DE_de.format(b),this.tfirstRow.children[4].textContent=i.DE_de.format(g),this.tfirstRow.children[5].textContent=i.DE_de.format(m)}),o.send(e.getResult())}}},{"./ScreenController":9,"./flowchart/SerializeContext":16,"./utils":20,"chart.js":1}],9:[function(t,e,i){"use strict";var n;Object.defineProperty(i,"__esModule",{value:!0}),i.ScreenController=i.ControllerState=void 0,function(t){t[t.CREATED=0]="CREATED",t[t.STARTED=1]="STARTED",t[t.STOPPED=2]="STOPPED"}(n=i.ControllerState||(i.ControllerState={}));i.ScreenController=class{constructor(t,e){this.appManagement=t,this.div=e,this.hideDIV(),this.state=n.CREATED}get ElementId(){return this.div.id}get State(){return this.state}set State(t){this.state=t}showDIV(){this.div.style.display="block"}hideDIV(){this.div.style.display="none"}}},{}],10:[function(t,e,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&n(e,t,i);return o(e,t),e};Object.defineProperty(i,"__esModule",{value:!0}),i.Flowchart=i.FlowchartOptions=void 0;const r=t("./FlowchartConnector"),a=t("./FlowchartCompiler"),l=t("./FlowchartLink"),h=s(t("./FlowchartOperatorImpl")),c=t("../utils"),u=t("./SerializeContext"),d=t("./SimulationManager");i.FlowchartOptions=class{constructor(){this.canUserEditLinks=!0,this.canUserMoveOperators=!0,this.data=void 0,this.distanceFromArrow=3,this.defaultOperatorClass="flowchart-default-operator",this.defaultLinkColor="#3366ff",this.defaultSelectedLinkColor="black",this.linkWidth=10,this.grid=10,this.multipleLinksOnOutput=!0,this.multipleLinksOnInput=!1,this.linkVerticalDecal=0}};class p{constructor(t,e,i){if(this.appManagement=t,this.container=e,this.options=i,this.operators=new Map,this.links=new Map,this.currentDebugInfo=null,this.lastOutputConnectorClicked=null,this.selectedOperator=null,this.selectedLink=null,this.positionRatio=1,this.temporaryLinkSnapped=!1,!this.container)throw new Error("container is null");this.operatorRegistry=h.OperatorRegistry.Build();let n=c.$.Html(this.container,"div",[],["develop-ui"]);n.onclick=(t=>{t.target.classList.contains("dropbtn")||Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")})}),this.buildMenu(n);let o=c.$.Html(n,"div",["tabindex","0"],["develop-workspace"]);this.propertyGridHtmlDiv=c.$.Html(n,"div",[],["develop-properties"]),this.flowchartContainerSvgSvg=c.$.Svg(o,"svg",["width","100%","height","100%"],["flowchart-container"]),this.linksLayer=c.$.Svg(this.flowchartContainerSvgSvg,"g",[],["flowchart-links-layer"]),this.operatorsLayer=c.$.Svg(this.flowchartContainerSvgSvg,"g",[],["flowchart-operators-layer","unselectable"]),this.tempLayer=c.$.Svg(this.flowchartContainerSvgSvg,"g",[],["flowchart-temporary-link-layer"]),this.tempLayer.style.visibility="hidden";let s=c.$.Svg(this.tempLayer,"defs",[]),r=c.$.Svg(s,"marker",["id","marker-arrow","markerWidth","4","markerHeight","4","refX","1","refY","2","orient","0"]);this.markerArrow=c.$.Svg(r,"path",["d","M0,0 L0,4 L2,2 z","fill","red","stroke","black","stroke-width","0.5"]);let a=c.$.Svg(s,"marker",["id","marker-circle","markerWidth","4","markerHeight","4","refX","2","refY","2","orient","0"]);this.markerCircle=c.$.Svg(a,"circle",["cx","2","cy","2","r","2","fill","red","stroke-width","1px","stroke","black"]),this.temporaryLink=c.$.Svg(this.tempLayer,"line",["x1","0","y1","0","x2","0","y2","0","stroke-dasharray","6,6","stroke-width","4","stroke","black","fill","none","marker-end","url(#marker-arrow)"]);let l=c.$.Svg(this.flowchartContainerSvgSvg,"rect",["width","40","height","100%","fill","white","fill-opacity","0"]);this.operatorLibDiv=c.$.Html(o,"div",[],["flowchart-operatorlibdiv","unselectable"]),this.operatorLibDiv.style.display="none",l.onmouseenter=(t=>{this.operatorLibDiv.style.display="inline"}),this.operatorLibDiv.onmouseleave=(t=>{this.operatorLibDiv.style.display="none"}),this.flowchartContainerSvgSvg.onclick=(t=>{t.target==this.Element&&(this.unselectOperator(),this.unselectLink())}),o.onkeyup=(t=>{"Delete"==t.key?(console.log("Flowchart workspace.onkeyup with e.target="+t.target+" und Delete-Key"),this.deleteSelectedThing()):console.log("Flowchart workspace.onkeyup with e.target="+t.target+" und key "+t.key)}),this.operatorRegistry.populateOperatorLib(this.operatorLibDiv,(t,e)=>{let i=e.OperatorName,n=this.createOperatorInternal(e.GlobalTypeIndex,i,null),o=c.Utils.EventCoordinatesInSVG(t,this.Element);n.MoveTo(o.x-10,o.y-10),n.RegisterDragging(t),this.operators.set(n.GlobalOperatorIndex,n)})}get SelectedLink(){return this.selectedLink}get Options(){return this.options}get PositionRatio(){return this.positionRatio}get Element(){return this.flowchartContainerSvgSvg}get LinkLayer(){return this.linksLayer}get OperatorsLayer(){return this.operatorsLayer}get ToolsLayer(){return this.operatorLibDiv}triggerDebug(){if(null==this.currentDebugInfo)return;let t=new XMLHttpRequest;t.onerror=(t=>{console.log("Fehler beim XMLHttpRequest!")}),t.open("GET","/fbd",!0),t.responseType="arraybuffer",t.onload=(e=>{if(null==this.currentDebugInfo)return;let i=t.response;if(!i||i.byteLength<=16)return console.info("! arrayBuffer || arrayBuffer.byteLength<16"),void(this.currentDebugInfo=null);let n=new u.SerializeContext(i);if(n.readU32()!=this.currentDebugInfo.hash)return console.info("hash!=this.currentDebugInfo.hash"),void(this.currentDebugInfo=null);let o=n.readU32();for(let t=0;t<o;t++){let e=n.readU32();if(t<2)continue;let i=r.ConnectorType.BOOLEAN,o=this.currentDebugInfo.typeIndex2adressOffset2ListOfLinks.get(i).get(t);void 0!==o?o.forEach(t=>{t.SetColor(1==e?"red":"grey"),t.SetCaption(""+e)}):console.error(`linksToColorize===undefined for connectorType ${i} addressOffset ${t} and value ${e}`)}let s=n.readU32();for(let t=0;t<s;t++){let e=n.readS32();if(t<2)continue;let i=r.ConnectorType.INTEGER,o=this.currentDebugInfo.typeIndex2adressOffset2ListOfLinks.get(i).get(t);void 0!==o?o.forEach(t=>{t.SetCaption(""+e)}):console.error(`linksToColorize===undefined for connectorType ${i} addressOffset ${t} and value ${e}`)}let a=n.readU32();for(let t=0;t<a;t++){let e=n.readF32();if(t<2)continue;let i=r.ConnectorType.FLOAT,o=this.currentDebugInfo.typeIndex2adressOffset2ListOfLinks.get(i).get(t);void 0!==o?o.forEach(t=>{t.SetCaption(""+e)}):console.error(`linksToColorize===undefined for connectorType ${i} addressOffset ${t} and value ${e}`)}let l=n.readU32();for(let t=0;t<l;t++){let e=n.readU32();if(t<2)continue;let i=r.ConnectorType.COLOR,o=this.currentDebugInfo.typeIndex2adressOffset2ListOfLinks.get(i).get(t);void 0!==o?o.forEach(t=>{t.SetCaption(""+e),t.SetColor(c.$.ColorNumColor2ColorDomString(e))}):console.error(`linksToColorize===undefined for connectorType ${i} addressOffset ${t} and value ${e}`)}}),t.send()}_notifyGlobalMousemoveWithLink(t){if(null!=this.lastOutputConnectorClicked&&!this.temporaryLinkSnapped){let e=c.Utils.EventCoordinatesInSVG(t,this.flowchartContainerSvgSvg,this.positionRatio);this.temporaryLink.setAttribute("x2",""+e.x),this.temporaryLink.setAttribute("y2",""+e.y)}}_notifyGlobalMouseupWithLink(t){this.unsetTemporaryLink()}_notifyOutputConnectorMousedown(t,e){this.temporaryLinkSnapped=!1;let i=t.GetLinkpoint(),n=c.Utils.EventCoordinatesInSVG(e,this.flowchartContainerSvgSvg,this.positionRatio);this.temporaryLink.setAttribute("x1",""+i.x),this.temporaryLink.setAttribute("y1",""+i.y),this.temporaryLink.setAttribute("x2",""+n.x),this.temporaryLink.setAttribute("y2",""+n.y),this.setTemporaryLink(t),document.onmouseup=(t=>{document.onmouseup=null,document.onmousemove=null,this._notifyGlobalMouseupWithLink(t)}),document.onmousemove=(t=>{this._notifyGlobalMousemoveWithLink(t)})}_notifyInputConnectorMouseup(t,e){null!=this.lastOutputConnectorClicked&&(!this.options.multipleLinksOnInput&&t.LinksLength>0||(this.lastOutputConnectorClicked.Type==t.Type&&this.createLink(null,this.lastOutputConnectorClicked,t),this.unsetTemporaryLink()))}_notifyOperatorClicked(t,e){this.SelectOperator(t)}_notifyLinkClicked(t,e){this.selectLink(t)}_notifyInputConnectorMouseenter(t,e){if(null==this.lastOutputConnectorClicked||this.lastOutputConnectorClicked.Type!=t.Type)return;if(!this.options.multipleLinksOnInput&&t.LinksLength>0)return;this.temporaryLinkSnapped=!0;let i=t.GetLinkpoint();this.temporaryLink.setAttribute("marker-end","url(#marker-circle)"),this.temporaryLink.setAttribute("x2",""+i.x),this.temporaryLink.setAttribute("y2",""+i.y)}_notifyInputConnectorMouseleave(t,e){this.temporaryLinkSnapped=!1,this.temporaryLink.setAttribute("marker-end","url(#marker-arrow)")}unselectLink(){if(null!=this.selectedLink){if(this.options.onLinkUnselect&&!this.options.onLinkUnselect(this.selectedLink))return;this.selectedLink.UnsetColor(),this.selectedLink=null}}selectLink(t){this.unselectLink(),this.options.onLinkSelect&&!this.options.onLinkSelect(t)||(this.unselectOperator(),this.selectedLink=t,t.SetColor(this.options.defaultSelectedLinkColor))}deleteSelectedThing(){this.selectedOperator?this.DeleteOperator(this.selectedOperator.GlobalOperatorIndex):this.selectedLink&&this.DeleteLink(this.selectedLink.GlobalLinkIndex)}fbd2json(){let t=[],e=[];for(const e of this.operators.values())t.push({globalTypeIndex:e.TypeInfo.GlobalTypeIndex,caption:e.Caption,index:e.GlobalOperatorIndex,posX:e.Xpos,posY:e.Ypos,configurationData:e.Config_Copy});for(const t of this.links.values())e.push({color:"blue",fromOperatorIndex:t.From.Parent.GlobalOperatorIndex,fromOutput:t.From.LocalConnectorIndex,toOperatorIndex:t.To.Parent.GlobalOperatorIndex,toInput:t.To.LocalConnectorIndex});let i={operators:t,links:e};return JSON.stringify(i)}saveJSONToLocalFile(){let t=this.fbd2json();var e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),e.setAttribute("download","functionBlockDiagram.json"),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}saveBinToLocalFile(){this.fbd2json();let t=new a.FlowchartCompiler(this.operators).Compile(),e=new Blob([new Uint8Array(t.buf,0,t.buf.byteLength)],{type:"octet/stream"}),i=window.URL.createObjectURL(e);var n=document.createElement("a");n.style.display="none",n.href=i,n.download="functionBlockDiagram.bin",document.body.appendChild(n),n.click(),document.body.removeChild(n)}openFromLocalFile(t){if(null==t||1!=t.length)return;const e=new FileReader;e.onloadend=(t=>{let e=t.target.result,i=JSON.parse(e);this.setData(i)}),e.readAsText(t[0])}put2fbd(t){let e=new XMLHttpRequest;e.open("PUT","/fbd",!0),e.onloadend=(t=>{200==e.status?this.appManagement.DialogController().showOKDialog(16,"Successfully saved",null):this.appManagement.DialogController().showOKDialog(16,`HTTP Error ${e.status}`,null)}),e.onerror=(t=>{this.appManagement.DialogController().showOKDialog(16,"Generic Error",null)}),e.send(t)}saveJSONToLabathomeFile(){this.appManagement.DialogController().showEnterFilenameDialog(10,"Enter filename (without Extension",t=>{let e=new XMLHttpRequest;e.open("POST","/fbdstorejson/"+t,!0),e.onloadend=(t=>{200==e.status?this.appManagement.DialogController().showOKDialog(16,"Successfully saved",null):this.appManagement.DialogController().showOKDialog(16,`HTTP Error ${e.status}`,null)}),e.onerror=(t=>{this.appManagement.DialogController().showOKDialog(16,"Generic Error",null)}),e.send(this.fbd2json())})}saveJSONandBINToLabathomeDefaultFile(t){let e=new XMLHttpRequest;e.open("POST","/fbddefaultbin",!0),e.onloadend=(t=>{if(200!=e.status)return void this.appManagement.DialogController().showOKDialog(16,`HTTP Error ${e.status}`,null);let i=new XMLHttpRequest;i.open("POST","/fbddefaultjson",!0),i.onloadend=(t=>{200==i.status?this.appManagement.DialogController().showOKDialog(16,"Successfully set a new default FBD",null):this.appManagement.DialogController().showOKDialog(16,`HTTP Error ${i.status}`,null)}),i.onerror=(t=>{this.appManagement.DialogController().showOKDialog(16,"Generic Error",null)}),i.send(this.fbd2json())}),e.onerror=(t=>{this.appManagement.DialogController().showOKDialog(16,"Generic Error",null)}),e.send(t)}openJSONFromLabathome(){let t=new XMLHttpRequest;t.open("GET","/fbdstorejson/",!0),t.onload=(e=>{let i=t.responseText,n=JSON.parse(i);this.appManagement.DialogController().showFilelist(1e3,n,t=>{let e=new XMLHttpRequest;e.open("GET","/fbdstorejson/"+t,!0),e.onload=(t=>{let i=e.responseText,n=JSON.parse(i);this.setData(n)}),e.send()},t=>{let e=new XMLHttpRequest;e.open("DELETE","/fbdstorejson/"+t,!0),e.onloadend=(e=>{this.appManagement.DialogController().showOKDialog(1,`File ${t} deleted successfully`,null)}),e.send()})}),t.send()}openDefaultJSONFromLabathome(){let t=new XMLHttpRequest;t.open("GET","/fbddefaultjson",!0),t.onload=(e=>{let i=t.responseText,n=JSON.parse(i);this.setData(n)}),t.send()}buildMenu(t){let e=c.$.Html(t,"input",["type","file","id","fileInput","accept",".json"]);e.style.display="none",e.onchange=(t=>{this.openFromLocalFile(e.files)});let i=c.$.Html(t,"div",[],["develop-toolbar"]),n=c.$.Html(i,"div",[],["dropdown"]),o=c.$.Html(n,"button",[],["dropbtn"],"File ▼"),s=c.$.Html(n,"div",[],["dropdown-content"]);o.onclick=(t=>{s.classList.toggle("show")}),c.$.Html(s,"a",["href","#"],[],"📂 Open (Local)").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),e.click(),t.preventDefault()}),c.$.Html(s,"a",["href","#"],[],"📂 Open (labathome)").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),this.openJSONFromLabathome(),t.preventDefault()}),c.$.Html(s,"a",["href","#"],[],"📂 Open Default (labathome)").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),this.openDefaultJSONFromLabathome(),t.preventDefault()}),c.$.Html(s,"a",["href","#"],[],"💾 Save (Local)").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),this.saveJSONToLocalFile(),t.preventDefault()}),c.$.Html(s,"a",["href","#"],[],"💾 Save (labathome)").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),this.saveJSONToLabathomeFile(),t.preventDefault()}),c.$.Html(s,"a",["href","#"],[],"💾 Save Bin (Local)").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),this.saveBinToLocalFile(),t.preventDefault()});let r=c.$.Html(i,"div",[],["dropdown"]),l=c.$.Html(r,"button",[],["dropbtn"],"Debug ▼"),h=c.$.Html(r,"div",[],["dropdown-content"]);l.onclick=(t=>{h.classList.toggle("show")}),c.$.Html(h,"a",["href","#"],[],"☭ Run Now").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")});let e=new a.FlowchartCompiler(this.operators).Compile();this.currentDebugInfo=e,this.put2fbd(e.buf),t.preventDefault()}),c.$.Html(h,"a",["href","#"],[],"👣 Set as Startup-App").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")});let e=new a.FlowchartCompiler(this.operators).Compile();this.saveJSONandBINToLabathomeDefaultFile(e.buf),t.preventDefault()});let u=c.$.Html(i,"div",[],["dropdown"]),p=c.$.Html(u,"button",[],["dropbtn"],"Simulation ▼"),f=c.$.Html(u,"div",[],["dropdown-content"]);p.onclick=(t=>{f.classList.toggle("show")}),c.$.Html(f,"a",["href","#"],[],"➤ Start Simulation").onclick=(t=>{Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")});let e=new a.FlowchartCompiler(this.operators);this.simulationManager=new d.SimulationManager(e.CompileForSimulation()),this.simulationManager.Start(!1),t.preventDefault()}),c.$.Html(f,"a",["href","#"],[],"× Stop Simulation").onclick=(t=>{var e;Array.prototype.forEach.call(document.getElementsByClassName("dropdown-content"),t=>{t.classList.remove("show")}),null===(e=this.simulationManager)||void 0===e||e.Stop(),t.preventDefault()})}onFirstStart(){void 0!==typeof this.options.data&&null!=this.options.data&&this.setData(this.options.data)}createOperatorInternal(t,e,i){if(!this.operatorRegistry.IsIndexKnown(t))throw new Error(`Unknown globalTypeIndex ${t}`);if(this.options.onOperatorCreate&&!this.options.onOperatorCreate(e,null,!1))throw new Error(`Creation of operator of globalTypeIndex ${t} prevented by onOperatorCreate plugin`);let n=this.operatorRegistry.CreateByIndex(t,this,e,i);return this.currentDebugInfo=null,n}setData(t){this.links.forEach(t=>t.RemoveFromDOM()),this.links.clear(),this.operators.forEach(t=>t.RemoveFromDOM()),this.operators.clear();let e=new Map;for(const i of t.operators){let t=this.createOperatorInternal(i.globalTypeIndex,i.caption,i.configurationData);t.MoveTo(i.posX,i.posY),this.operators.set(t.GlobalOperatorIndex,t),e.set(i.index,t)}for(const i of t.links){let t=e.get(i.fromOperatorIndex),n=e.get(i.toOperatorIndex);if(void 0===t||void 0===n)continue;let o=t.GetOutputConnectorByIndex(i.fromOutput),s=n.GetInputConnectorByIndex(i.toInput);null!=o&&null!=s&&this.createLink(i,o,s)}}DeleteLink(t){this.currentDebugInfo=null;let e=this.links.get(t);if(void 0===e)throw Error("Link to delete is undefined");this.selectedLink==e&&this.unselectLink(),e.RemoveFromDOM(),this.links.delete(t),e.To.RemoveLink(e),e.From.RemoveLink(e)}DeleteOperator(t){this.currentDebugInfo=null;let e=this.operators.get(t);if(void 0===e)throw Error("Operator to delete is undefined");this.selectedOperator==e&&this.unselectOperator(),e.RemoveFromDOM(),this.operators.delete(e.GlobalOperatorIndex);for(const t of e.OutputsKVIt)for(const e of t[1].LinksKVIt)this.DeleteLink(e[1].GlobalLinkIndex);for(const t of e.InputsKVIt)for(const e of t[1].LinksKVIt)this.DeleteLink(e[1].GlobalLinkIndex)}createLink(t,e,i){if(this.options.onLinkCreate&&!this.options.onLinkCreate(e.Caption,t))return null;if(!this.options.multipleLinksOnOutput&&e.LinksLength>0)return null;if(!this.options.multipleLinksOnInput&&i.LinksLength>0)return null;this.currentDebugInfo=null;let n=new l.FlowchartLink(this,"",this.Options.defaultLinkColor,e,i);return e.AddLink(n),i.AddLink(n),this.links.set(n.GlobalLinkIndex,n),n}unsetTemporaryLink(){this.lastOutputConnectorClicked=null,this.tempLayer.style.visibility="hidden"}setTemporaryLink(t){this.lastOutputConnectorClicked=t;let e=p.DATATYPE2COLOR.get(t.Type);e||(e="BLACK"),this.markerArrow.style.fill=e,this.markerCircle.style.fill=e,this.tempLayer.style.visibility="visible"}unselectOperator(){this.options.onOperatorUnselect&&!this.options.onOperatorUnselect()||(this.propertyGridHtmlDiv.innerText="",null!=this.selectedOperator&&(this.selectedOperator.ShowAsSelected(!1),this.selectedOperator=null))}SelectOperator(t){if(this.options.onOperatorSelect&&!this.options.onOperatorSelect(t.Caption))return;this.unselectLink(),null!=this.selectedOperator&&this.selectedOperator.ShowAsSelected(!1),t.ShowAsSelected(!0),this.selectedOperator=t,this.propertyGridHtmlDiv.innerText="",c.$.Html(this.propertyGridHtmlDiv,"p",[],["develop-propertygrid-head"],`Properties for ${this.selectedOperator.Caption}`);let e=c.$.Html(this.propertyGridHtmlDiv,"table",[],["develop-propertygrid-table"]),i=c.$.Html(e,"thead",[],[]),n=c.$.Html(i,"tr",[],["develop-propertygrid-tr"]);c.$.Html(n,"th",[],["develop-propertygrid-th"],"Key"),c.$.Html(n,"th",[],["develop-propertygrid-th"],"Value");let o=c.$.Html(e,"tbody",[],[]);this.selectedOperator.PopulateProperyGrid(o)?c.$.Html(this.propertyGridHtmlDiv,"button",[],["develop-propertygrid-button"],"Save").onclick=(e=>{this.currentDebugInfo=null,t.SavePropertyGrid(o)}):(this.propertyGridHtmlDiv.innerText="",c.$.Html(this.propertyGridHtmlDiv,"p",[],["develop-propertygrid-head"],`No Properties for ${this.selectedOperator.Caption}`))}static _shadeColor(t,e){var i=parseInt(t.slice(1),16),n=e<0?0:255,o=e<0?-1*e:e,s=i>>16,r=i>>8&255,a=255&i;return"#"+(16777216+65536*(Math.round((n-s)*o)+s)+256*(Math.round((n-r)*o)+r)+(Math.round((n-a)*o)+a)).toString(16).slice(1)}}i.Flowchart=p,p.DATATYPE2COLOR=new Map([[r.ConnectorType.BOOLEAN,"RED"],[r.ConnectorType.COLOR,"GREEN"],[r.ConnectorType.FLOAT,"BLUE"],[r.ConnectorType.INTEGER,"YELLOW"],[r.ConnectorType.COLOR,"PURPLE"]])},{"../utils":20,"./FlowchartCompiler":11,"./FlowchartConnector":12,"./FlowchartLink":13,"./FlowchartOperatorImpl":15,"./SerializeContext":16,"./SimulationManager":17}],11:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.FlowchartCompiler=void 0;const n=t("./FlowchartOperator"),o=t("./FlowchartConnector"),s=t("./TopologicalSorfDFS"),r=t("./SerializeContext");i.FlowchartCompiler=class{constructor(t){this.index2operator=t}sortOperators(){let t=new Map;this.index2operator.forEach((e,i,n)=>{t.set(e.GlobalOperatorIndex,new s.NodeWrapper(e))});let e=[];for(let i of t.values()){let o=new Set;for(const e of i.Payload.InputsKVIt)for(const i of e[1].LinksKVIt){let e=i[1].From.Parent,n=t.get(e.GlobalOperatorIndex);if(!n)throw new Error("Implementation Error: dependentWrappedNode is undefined");o.add(n)}o.forEach(t=>i.DependendNodes.push(t)),i.Payload.TypeInfo.Position==n.PositionType.Output&&e.push(i)}return(new s.TopologicalSortDFS).sort(e).map(t=>t.Payload)}CompileForSimulation(){let t=this.sortOperators();for(const e in t)t[e].SetDebugInfoText("Sequence "+e);let e=this.createLookupMaps(t);return{sortedOperators:t,typeIndex2globalConnectorIndex2adressOffset:e.typeIndex2globalConnectorIndex2adressOffset,typeIndex2adressOffset2ListOfLinks:e.typeIndex2adressOffset2ListOfLinks,typeIndex2maxOffset:e.typeIndex2maxOffset}}Compile(){let t=this.sortOperators();for(const e in t)t[e].SetDebugInfoText("Sequence "+e);let e=this.createLookupMaps(t),i=this.serialize(t,e),n=new DataView(i.buf),o="const uint8_t code[] = {";for(let t=0;t<n.byteLength;t++)o+="0x"+n.getUint8(t).toString(16)+", ";return o+="};",console.log(o),{hash:i.hash,buf:i.buf,typeIndex2globalConnectorIndex2adressOffset:e.typeIndex2globalConnectorIndex2adressOffset,typeIndex2adressOffset2ListOfLinks:e.typeIndex2adressOffset2ListOfLinks,typeIndex2maxOffset:e.typeIndex2maxOffset}}createLookupMaps(t){let e=new Map,i=new Map,n=new Map;for(let t in o.ConnectorType)isNaN(Number(t))||(e.set(Number(t),new Map),i.set(Number(t),2),n.set(Number(t),new Map));for(const o of t)for(const t of o.OutputsKVIt)if(0==t[1].LinksLength)e.get(t[1].Type).set(t[1].GlobalConnectorIndex,0);else{let o=i.get(t[1].Type);e.get(t[1].Type).set(t[1].GlobalConnectorIndex,o),n.get(t[1].Type).set(o,t[1].GetLinksCopy()),o++,i.set(t[1].Type,o)}return{typeIndex2globalConnectorIndex2adressOffset:e,typeIndex2adressOffset2ListOfLinks:n,typeIndex2maxOffset:i}}serialize(t,e){let i=new ArrayBuffer(Math.pow(2,16)),n=new r.SerializeContext(i,0),s={typeIndex2globalConnectorIndex2adressOffset:e.typeIndex2globalConnectorIndex2adressOffset,ctx:n};n.writeU32(2952710910),n.writeU32(0);for(let t in o.ConnectorType)isNaN(Number(t))||n.writeU32(e.typeIndex2maxOffset.get(Number(t)));n.writeU32(t.length);for(const e of t)e.SerializeToBinary(s);let a=n.funhash(8,33);return n.overwriteU32(a,4),{hash:a,buf:s.ctx.getResult()}}}},{"./FlowchartConnector":12,"./FlowchartOperator":14,"./SerializeContext":16,"./TopologicalSorfDFS":19}],12:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.FlowchartOutputConnector=i.FlowchartInputConnector=i.FlowchartConnector=i.ConnectorType=void 0;const n=t("./Flowchart"),o=t("../utils"),s=20;var r;!function(t){t[t.BOOLEAN=0]="BOOLEAN",t[t.INTEGER=1]="INTEGER",t[t.FLOAT=2]="FLOAT",t[t.COLOR=3]="COLOR"}(r=i.ConnectorType||(i.ConnectorType={}));class a{constructor(t,e,i,l){this.parent=t,this.caption=e,this.localIndex=i,this.type=l,this.links=new Map,this.HasLink=(t=>this.links.has(t)),this.AddLink=(t=>this.links.set(t.GlobalLinkIndex,t)),this.RemoveLink=(t=>this.links.delete(t.GlobalLinkIndex)),this.globalConnectorIndex=a.INDEX++;let h=this.getIOSpecifics(),c=s*h.parent.childElementCount;this.element=o.$.Svg(h.parent,"g",["transform",`translate(0 ${c})`],[`operator-${h.inputOrOutput}`]),this.element.setAttribute("data-connector-datatype",r[l]),o.$.Svg(this.element,"text",["dx",""+h.dx,"dy","4"],[`operator-${h.inputOrOutput}-caption`]).textContent=e,this.connectorGroup=o.$.Svg(this.element,"g",[]),this.connector=o.$.Svg(this.connectorGroup,"circle",["r","4"],[`operator-${h.inputOrOutput}-connector`,r[l]]),this.snapper=o.$.Svg(this.connectorGroup,"circle",["r","10"],[`operator-${h.inputOrOutput}-snapper`]),this.element.onmouseover=(t=>{for(const t of this.links.values())t&&t!=this.parent.Parent.SelectedLink&&t.SetColor(n.Flowchart._shadeColor(this.parent.Parent.Options.defaultLinkColor,-.4))}),this.element.onmouseout=(t=>{for(const t of this.links.values())t&&t!=this.parent.Parent.SelectedLink&&t.UnsetColor()})}get GlobalConnectorIndex(){return this.globalConnectorIndex}get LocalConnectorIndex(){return this.localIndex}get Element(){return this.element}get LinksLength(){return this.links.size}GetLinksCopy(){return Array.from(this.links.values())}get LinksKVIt(){return this.links.entries()}RefreshLinkPositions(){this.links.forEach(t=>{t.RefreshPosition()})}get Parent(){return this.parent}get Caption(){return this.caption}get Type(){return this.type}GetLinkpoint(){let t=this.Parent.Parent,e=t.PositionRatio,i=t.Element.getBoundingClientRect(),n=this.connector.getBoundingClientRect();return{x:(n.left-i.left)/e+n.width/2,y:(n.top-i.top)/e+n.height/2}}}i.FlowchartConnector=a,a.INDEX=0;i.FlowchartInputConnector=class extends a{constructor(t,e,i,n){super(t,e,i,n),this.connectorGroup.onmouseup=(e=>{t.Parent._notifyInputConnectorMouseup(this,e)}),this.connectorGroup.onmouseenter=(e=>{t.Parent._notifyInputConnectorMouseenter(this,e)}),this.connectorGroup.onmouseleave=(e=>{t.Parent._notifyInputConnectorMouseleave(this,e)})}GetLinkpointXOffset(t){return 0}getIOSpecifics(){return{inputOrOutput:"input",parent:this.Parent.InputSvgG,translateY:0,dx:8}}GetGlobalConnectorIndexOfSignalSource(){for(let t of this.links.values())return t.From.GlobalConnectorIndex;return-1}};i.FlowchartOutputConnector=class extends a{constructor(t,e,i,n){super(t,e,i,n),this.element.onmousedown=(e=>{t.Parent._notifyOutputConnectorMousedown(this,e)})}GetLinkpointXOffset(t){return t}getIOSpecifics(){return{inputOrOutput:"output",parent:this.Parent.OutputSvgG,translateY:140,dx:-8}}}},{"../utils":20,"./Flowchart":10}],13:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.FlowchartLink=void 0;const n=t("../utils");class o{constructor(t,e,i,s,r){this.parent=t,this.caption=e,this.color=i,this.from=s,this.to=r,this.index=o.MAX_INDEX++,this.element=n.$.Svg(t.LinkLayer,"path",["stroke-width",""+this.parent.Options.linkWidth,"fill","none","id","LINK"+this.index]),this.RefreshPosition(),this.UnsetColor(),this.parent.LinkLayer.appendChild(this.element),this.captionElement=n.$.Svg(t.LinkLayer,"text",[]),this.captionPath=n.$.Svg(this.captionElement,"textPath",["startOffset","50%","text-anchor","middle"]),this.captionPath.setAttributeNS(n.$.XLINKNS,"href","#LINK"+this.index),this.captionPath.innerHTML=e,this.element.onclick=(t=>{this.parent._notifyLinkClicked(this,t)})}get GlobalLinkIndex(){return this.index}get From(){return this.from}get To(){return this.to}set Color(t){this.color=t}RemoveFromDOM(){this.element.remove(),this.captionElement.remove()}SetColor(t){this.element.setAttribute("stroke",t)}SetCaption(t){this.captionPath.innerHTML=t}UnsetColor(){this.SetColor(this.parent.Options.defaultLinkColor)}RefreshPosition(){let t=this.from.GetLinkpoint(),e=this.to.GetLinkpoint(),i=t.x,n=t.y+this.parent.Options.linkVerticalDecal,o=e.x,s=e.y+this.parent.Options.linkVerticalDecal,r=this.parent.Options.distanceFromArrow,a=i+r,l=o+1,h=Math.min(100,Math.max(Math.abs(a-l)/2,Math.abs(n-s)));this.element.setAttribute("d","M"+a+","+n+" C"+(i+r+h)+","+n+" "+(o-h)+","+s+" "+l+","+s)}}i.FlowchartLink=o,o.MAX_INDEX=0},{"../utils":20}],14:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.FlowchartOperator=i.TypeInfo=i.SingletonType=i.PositionType=void 0;const n=t("../utils");!function(t){t[t.Default=0]="Default",t[t.Input=1]="Input",t[t.Output=2]="Output"}(i.PositionType||(i.PositionType={})),function(t){t[t.Default=0]="Default",t[t.Singleton=1]="Singleton"}(i.SingletonType||(i.SingletonType={}));i.TypeInfo=class{constructor(t,e,i,n,o,s){this.GlobalTypeIndex=t,this.GroupName=e,this.OperatorName=i,this.Position=n,this.Singleton=o,this.Builder=s}};class o{constructor(t,e,i,s){this.parent=t,this.caption=e,this.typeInfo=i,this.configurationData=s,this.Inputs=[],this.Outputs=[],this.x=0,this.y=0,this.GetOutputConnectorByIndex=(t=>this.Outputs[t]),this.GetInputConnectorByIndex=(t=>this.Inputs[t]),this.index=o.MAX_INDEX++,this.elementSvgG=n.$.Svg(t.OperatorsLayer,"g",[],["operator"]),this.elementSvgG.setAttribute("data-operator-index",""+this.index);let r=n.$.Svg(this.elementSvgG,"g",[],[]);this.box=n.$.Svg(r,"rect",["width","140","height","100","rx","10","ry","10"],["operator-box"]),n.$.Svg(r,"text",["x","5","y","21"],["operator-title"]).textContent=e,this.debugInfoSvgText=n.$.Svg(r,"text",["x","0","y","100"],["operator-debuginfo"]),this.debugInfoSvgText.textContent="No debug info",this.inputSvgG=n.$.Svg(this.elementSvgG,"g",["transform","translate(0 50)"],["operator-inputs"]),this.outputSvgG=n.$.Svg(this.elementSvgG,"g",["transform","translate(140 50)"],["operator-outputs"]),this.elementSvgG.onclick=(e=>{console.log("FlowchartOperator this.elementSvgG.onclick"),t._notifyOperatorClicked(this,e)}),this.parent.Options.canUserMoveOperators&&(r.onmousedown=(t=>{this.RegisterDragging(t)}))}get GlobalOperatorIndex(){return this.index}get ElementSvgG(){return this.elementSvgG}get InputSvgG(){return this.inputSvgG}get OutputSvgG(){return this.outputSvgG}get TypeInfo(){return this.typeInfo}get Xpos(){return this.x}get Ypos(){return this.y}get Config_Copy(){return this.configurationData?this.configurationData.slice(0):null}ShowAsSelected(t){t?this.box.classList.add("selected"):this.box.classList.remove("selected")}SetDebugInfoText(t){this.debugInfoSvgText.textContent=t}cfg_setDefault(t,e){null==this.configurationData&&(this.configurationData=[]);for(const e of this.configurationData)if(e.key==t)return;this.configurationData.push({key:t,value:e})}cfg_getValue(t,e){null==this.configurationData&&(this.configurationData=[]);for(const e of this.configurationData)if(e.key==t)return e.value;return this.configurationData.push({key:t,value:e}),e}cfg_setValue(t,e){null==this.configurationData&&(this.configurationData=[]);for(const i of this.configurationData)if(i.key==t)return void(i.value=e);this.configurationData.push({key:t,value:e})}RegisterDragging(t){let e=t.clientX-this.x,i=t.clientY-this.y;document.onmouseup=(t=>{document.onmouseup=null,document.onmousemove=null}),document.onmousemove=(t=>{this.MoveTo(t.clientX-e,t.clientY-i)})}get Parent(){return this.parent}get Caption(){return this.caption}get InputsKVIt(){return this.Inputs.entries()}get OutputsKVIt(){return this.Outputs.entries()}RemoveFromDOM(){this.elementSvgG.remove()}AppendConnectors(t,e){if(0!=this.Inputs.length||0!=this.Outputs.length)throw new Error("AppendConnectors may only be called once!");for(const e of t)e.Parent==this&&this.Inputs.push(e);for(const t of e)t.Parent==this&&this.Outputs.push(t);let i=50+20*Math.max(this.Inputs.length,this.Outputs.length)+10;this.box.setAttribute("height",""+i),this.debugInfoSvgText.setAttribute("y",""+i)}MoveTo(t,e){let i=this.parent.Options.grid;this.x=Math.round(t/i)*i,this.y=Math.round(e/i)*i,this.elementSvgG.setAttribute("transform",`translate(${this.x} ${this.y})`);for(const t of this.Inputs)t.RefreshLinkPositions();for(const t of this.Outputs)t.RefreshLinkPositions()}PopulateProperyGrid(t){return!1}SavePropertyGrid(t){}OnSimulationStart(t){}OnSimulationStep(t){}OnSimulationStop(t){}SerializeInputsAndOutputs(t){for(const e of this.Inputs){let i=0,n=e.GetLinksCopy();if(0==n.length)i=1;else{let e=n[0].From;i=t.typeIndex2globalConnectorIndex2adressOffset.get(e.Type).get(e.GlobalConnectorIndex)||1}t.ctx.writeU32(i)}for(const e of this.Outputs){let i=0;i=0==e.LinksLength?0:t.typeIndex2globalConnectorIndex2adressOffset.get(e.Type).get(e.GlobalConnectorIndex)||1,t.ctx.writeU32(i)}}SerializeToBinary(t){t.ctx.writeU32(this.TypeInfo.GlobalTypeIndex),t.ctx.writeU32(this.GlobalOperatorIndex),this.SerializeInputsAndOutputs(t),this.SerializeFurtherProperties(t)}SerializeFurtherProperties(t){}}i.FlowchartOperator=o,o.MAX_INDEX=0},{"../utils":20}],15:[function(t,e,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&n(e,t,i);return o(e,t),e};Object.defineProperty(i,"__esModule",{value:!0}),i.Int2BoolConvert=i.Bool2IntConvert=i.Bool2ColorConvert=i.Arithmetic_ConstINTOperator=i.Sound_Melody=i.Basic_ConstFALSEOperator=i.Basic_ConstTRUEOperator=i.Output_Led7Operator=i.Output_Led6Operator=i.Output_Led5Operator=i.Output_Led4Operator=i.Output_Led3Operator=i.Output_CommonRGBLedOperator=i.Output_GreenLedOperator=i.Output_YellowLedOperator=i.Output_RedLedOperator=i.Output_PowerLedOperator=i.Output_Fan2Operator=i.Output_Fan1Operator=i.Output_RelayOperator=i.Input_EncoderTicksOperator=i.Input_RedButtonOperator=i.Input_EncoderButtonOperator=i.Input_GreenButtonOperator=i.Basic_NotOperator=i.Basic_TimekeeperOperator=i.Basic_CNTOperator=i.Basic_SROperator=i.Basic_RSOperator=i.Arithmetic_MINOperator=i.Arithmetic_MAXOperator=i.Arithmetic_DIVIDEOperator=i.Arithmetic_MULTIPLYOperator=i.Arithmetic_SUBOperator=i.Arithmetic_ADDOperator=i.Basic_XOROperator=i.Basic_OROperator=i.Basic_ANDOperator=i.Sensor_MovementOperator=i.Sensor_ExternalPressure=i.Sensor_AmbientNoise=i.Sensor_AmbientBrightnessOperator=i.Sensor_AirQualityOperator=i.Sensor_AirCO2Operator=i.Sensor_AirPressureOperator=i.Sensor_AirHumidityOperator=i.Sensor_AirTemperatureBMEOperator=i.Sensor_AirTemperatureDS18Operator=i.Sensor_HeaterTemperatureOperator=i.OperatorRegistry=void 0,i.Control_PID=i.Custom_XYZBlock=i.Arithmetic_LessThanOperator=i.Arithmetic_GreaterThanOperator=i.Arithmetic_LIMITMONITOROperator=i.Arithmetic_LIMITOperator=i.Basic_TOFOperator=i.Basic_TONOperator=i.Float2IntConvert=i.Int2ColorConvert=i.Int2FloatConvert=void 0;const r=t("./FlowchartOperator"),a=t("./FlowchartConnector"),l=t("../utils"),h=s(t("./Songs")),c="Basic",u="Arithmetic",d="Input",p="Sensor",f="Output",g="Converter",m="Sound",b="Control",x="Custom",y="Constant",_="Song Index";class v{constructor(){this.index2Info=new Map,this.groupName2operatorName2Info=new Map}IsIndexKnown(t){return this.index2Info.has(t)}Register(t,e,i,n,o,s){let a=new r.TypeInfo(t,e,i,n,o,s);if(this.index2Info.has(t))throw new Error(`this.index2Info.has(globalTypeIndex) for ${e}::${i}`);this.index2Info.set(t,a),this.groupName2operatorName2Info.has(e)||this.groupName2operatorName2Info.set(e,new Map);let l=this.groupName2operatorName2Info.get(e);if(l.has(i))throw new Error(`operatorName2Info.has(operatorName) for ${e}::${i}`);l.set(i,a)}CreateByIndex(t,e,i,n){let o=this.index2Info.get(t);return void 0===o?null:o.Builder(e,i,o,n)}GetTypeInfo(t){let e=this.index2Info.get(t);return void 0===e?null:e}populateOperatorLib(t,e){let i=l.$.Html(t,"ul",[],[]);for(const t of this.groupName2operatorName2Info.entries()){let n=t[0];l.$.Html(i,"li",[],[],n);let o=l.$.Html(i,"ul",[],["nested"]);for(const i of t[1].values()){l.$.Html(o,"li",[],[],i.OperatorName).onmousedown=(t=>e(t,i))}}}static Build(){let t=new v;return t.Register(1,c,"AND",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new R(t,e,i,n)),t.Register(2,c,"OR",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new P(t,e,i,n)),t.Register(3,c,"XOR",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new F(t,e,i,n)),t.Register(4,c,"NOT",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new X(t,e,i,n)),t.Register(5,c,"RS",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new $(t,e,i,n)),t.Register(6,c,"SR",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new U(t,e,i,n)),t.Register(7,c,"ConstTRUE",r.PositionType.Input,r.SingletonType.Default,(t,e,i,n)=>new pt(t,e,i,n)),t.Register(8,c,"ConstFALSE",r.PositionType.Input,r.SingletonType.Default,(t,e,i,n)=>new ft(t,e,i,n)),t.Register(9,c,"CNT",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new j(t,e,i,n)),t.Register(10,c,"Timekeeper",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new W(t,e,i,n)),t.Register(11,c,"TON",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new It(t,e,i,n)),t.Register(12,c,"TOF",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Mt(t,e,i,n)),t.Register(13,u,"ADD",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new N(t,e,i,n)),t.Register(14,u,"SUB",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new B(t,e,i,n)),t.Register(15,u,"MULTIPLY",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new H(t,e,i,n)),t.Register(16,u,"DIVIDE",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new V(t,e,i,n)),t.Register(17,u,"MAX",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new G(t,e,i,n)),t.Register(18,u,"MIN",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new z(t,e,i,n)),t.Register(19,u,"GreaterThan",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Et(t,e,i,n)),t.Register(20,u,"LessThan",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new At(t,e,i,n)),t.Register(21,u,"ConstINT",r.PositionType.Input,r.SingletonType.Default,(t,e,i,n)=>new mt(t,e,i,n)),t.Register(22,u,"LIMIT",r.PositionType.Input,r.SingletonType.Default,(t,e,i,n)=>new kt(t,e,i,n)),t.Register(23,u,"LIMITMONITOR",r.PositionType.Input,r.SingletonType.Default,(t,e,i,n)=>new Lt(t,e,i,n)),t.Register(24,g,"Bool2Color",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new yt(t,e,i,n)),t.Register(25,g,"Bool2Int",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new wt(t,e,i,n)),t.Register(26,g,"Int2Bool",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Ct(t,e,i,n)),t.Register(27,g,"Int2Float",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Ot(t,e,i,n)),t.Register(28,g,"Int2Color",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new St(t,e,i,n)),t.Register(29,g,"Float2Int",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Tt(t,e,i,n)),t.Register(30,d,"GreenButton",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new K(t,e,i,n)),t.Register(31,d,"EncoderButton",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new q(t,e,i,n)),t.Register(32,d,"EncoderTicks",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new Z(t,e,i,n)),t.Register(33,d,"RedButton",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new J(t,e,i,n)),t.Register(34,p,"Movement",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new D(t,e,i,n)),t.Register(35,p,"AirTemperatureDS18",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new O(t,e,i,n)),t.Register(36,p,"AirTemperatureBME",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new S(t,e,i,n)),t.Register(37,p,"AirHumidity",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new T(t,e,i,n)),t.Register(38,p,"AirPressure",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new I(t,e,i,n)),t.Register(39,p,"AirCO2",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new M(t,e,i,n)),t.Register(40,p,"AirQuality",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new k(t,e,i,n)),t.Register(41,p,"AmbientBrightness",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new L(t,e,i,n)),t.Register(42,p,"AmbientNoise",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new E(t,e,i,n)),t.Register(43,p,"ExternalPressure",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new A(t,e,i,n)),t.Register(44,p,"HeaterTemperature",r.PositionType.Input,r.SingletonType.Singleton,(t,e,i,n)=>new C(t,e,i,n)),t.Register(45,f,"Relay",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new Q(t,e,i,n)),t.Register(46,f,"RedLed",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new ot(t,e,i,n)),t.Register(47,f,"YellowLed",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new st(t,e,i,n)),t.Register(48,f,"GreenLed",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new rt(t,e,i,n)),t.Register(49,f,"LED3",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new lt(t,e,i,n)),t.Register(50,f,"LED4",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new ht(t,e,i,n)),t.Register(51,f,"LED5",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new ct(t,e,i,n)),t.Register(52,f,"LED6",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new ut(t,e,i,n)),t.Register(53,f,"LED7",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new dt(t,e,i,n)),t.Register(54,f,"Fan1",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new tt(t,e,i,n)),t.Register(55,f,"Fan2",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new et(t,e,i,n)),t.Register(56,f,"PowerLed",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new it(t,e,i,n)),t.Register(57,m,"Melody",r.PositionType.Output,r.SingletonType.Singleton,(t,e,i,n)=>new gt(t,e,i,n)),t.Register(58,b,"PID",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Rt(t,e,i,n)),t.Register(100,x,"XYZXYZBlock",r.PositionType.Default,r.SingletonType.Default,(t,e,i,n)=>new Dt(t,e,i,n)),t}}i.OperatorRegistry=v;class w extends r.FlowchartOperator{constructor(t,e,i,n,o,s,r){super(t,e,i,n),this.minOutput=s,this.maxOutput=r,this.sensorValue=0,this.O=new a.FlowchartOutputConnector(this,o,0,a.ConnectorType.INTEGER),this.AppendConnectors([],[this.O]),this.ElementSvgG.onclick=(e=>{console.log("Input_CommonButtonOperator this.ElementSvgG.onclick"),t._notifyOperatorClicked(this,e),this.sensorValue=this.sensorValue==this.minOutput?this.maxOutput:this.minOutput})}OnSimulationStart(t){this.sensorValue=this.minOutput}OnSimulationStep(t){t.SetInteger(this.O,this.sensorValue)}}class C extends w{constructor(t,e,i,n){super(t,e,i,n,"DegreesCelsius",25,65)}}i.Sensor_HeaterTemperatureOperator=C;class O extends w{constructor(t,e,i,n){super(t,e,i,n,"Temperature*10",180,250)}}i.Sensor_AirTemperatureDS18Operator=O;class S extends w{constructor(t,e,i,n){super(t,e,i,n,"Temperature*10",180,250)}}i.Sensor_AirTemperatureBMEOperator=S;class T extends w{constructor(t,e,i,n){super(t,e,i,n,"RelHumid%",40,60)}}i.Sensor_AirHumidityOperator=T;class I extends w{constructor(t,e,i,n){super(t,e,i,n,"Pa",800,1200)}}i.Sensor_AirPressureOperator=I;class M extends w{constructor(t,e,i,n){super(t,e,i,n,"CO2ppm",400,1500)}}i.Sensor_AirCO2Operator=M;class k extends w{constructor(t,e,i,n){super(t,e,i,n,"Quality%",20,80)}}i.Sensor_AirQualityOperator=k;class L extends w{constructor(t,e,i,n){super(t,e,i,n,"Lux",200,700)}}i.Sensor_AmbientBrightnessOperator=L;class E extends w{constructor(t,e,i,n){super(t,e,i,n,"NoisedBA",30,80)}}i.Sensor_AmbientNoise=E;class A extends w{constructor(t,e,i,n){super(t,e,i,n,"Pa",1e3,2e3)}}i.Sensor_ExternalPressure=A;class D extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n);let o=new a.FlowchartOutputConnector(this,"Movement",0,a.ConnectorType.BOOLEAN);this.AppendConnectors([],[o]),this.StorageId="4711"}}i.Sensor_MovementOperator=D;class R extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.BOOLEAN),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.BOOLEAN),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetBoolean(this.A),i=t.GetBoolean(this.B);t.SetBoolean(this.C,e&&i)}}i.Basic_ANDOperator=R;class P extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.BOOLEAN),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.BOOLEAN),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetBoolean(this.A),i=t.GetBoolean(this.B);t.SetBoolean(this.C,e||i)}}i.Basic_OROperator=P;class F extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.BOOLEAN),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.BOOLEAN),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetBoolean(this.A),i=t.GetBoolean(this.B);t.SetBoolean(this.C,e?!i:i)}}i.Basic_XOROperator=F;class N extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetInteger(this.A),i=t.GetInteger(this.B);t.SetInteger(this.C,e+i)}}i.Arithmetic_ADDOperator=N;class B extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetInteger(this.A),i=t.GetInteger(this.B);t.SetInteger(this.C,e-i)}}i.Arithmetic_SUBOperator=B;class H extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetInteger(this.A),i=t.GetInteger(this.B);t.SetInteger(this.C,e*i)}}i.Arithmetic_MULTIPLYOperator=H;class V extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetInteger(this.A),i=t.GetInteger(this.B);t.SetInteger(this.C,e/i)}}i.Arithmetic_DIVIDEOperator=V;class G extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetInteger(this.A),i=t.GetInteger(this.B);t.SetInteger(this.C,Math.max(e,i))}}i.Arithmetic_MAXOperator=G;class z extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.A=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),this.B=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.A,this.B],[this.C])}OnSimulationStep(t){let e=t.GetInteger(this.A),i=t.GetInteger(this.B);t.SetInteger(this.C,Math.min(e,i))}}i.Arithmetic_MINOperator=z;class $ extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.state=!1,this.R=new a.FlowchartInputConnector(this,"R",0,a.ConnectorType.BOOLEAN),this.S=new a.FlowchartInputConnector(this,"S",1,a.ConnectorType.BOOLEAN),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.R,this.S],[this.C])}OnSimulationStart(t){this.state=!1}OnSimulationStep(t){t.GetBoolean(this.R)?this.state=!1:t.GetBoolean(this.S)&&(this.state=!0),t.SetBoolean(this.C,this.state)}}i.Basic_RSOperator=$;class U extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.state=!1,this.R=new a.FlowchartInputConnector(this,"R",0,a.ConnectorType.BOOLEAN),this.S=new a.FlowchartInputConnector(this,"S",1,a.ConnectorType.BOOLEAN),this.C=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.R,this.S],[this.C])}OnSimulationStart(t){this.state=!1}OnSimulationStep(t){t.GetBoolean(this.S)?this.state=!0:t.GetBoolean(this.R)&&(this.state=!1),t.SetBoolean(this.C,this.state)}}i.Basic_SROperator=U;class j extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this._CurrentValue=0,this.lastInputValue=!1,this.CountUp=new a.FlowchartInputConnector(this,"CU",0,a.ConnectorType.BOOLEAN),this.Reset=new a.FlowchartInputConnector(this,"Reset",1,a.ConnectorType.BOOLEAN),this.PresetValue=new a.FlowchartInputConnector(this,"PV",2,a.ConnectorType.INTEGER),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.BOOLEAN),this.CurrentValue=new a.FlowchartOutputConnector(this,"CV",1,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.CountUp,this.Reset,this.PresetValue],[this.OUT,this.CurrentValue])}OnSimulationStart(t){this._CurrentValue=0}OnSimulationStep(t){let e=t.GetBoolean(this.CountUp),i=t.GetInteger(this.PresetValue);t.GetBoolean(this.Reset)?this._CurrentValue=0:0==this.lastInputValue&&1==e&&this._CurrentValue<i&&(this._CurrentValue++,console.log("Logic_CNTOperator this._CurrentValue++; "+this._CurrentValue)),t.SetBoolean(this.OUT,this._CurrentValue>=i),t.SetInteger(this.CurrentValue,this._CurrentValue),this.lastInputValue=e}}i.Basic_CNTOperator=j;class W extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this._CurrentValueMs=0,this.lastInputValue=!1,this.lastMillis=0,this.CountUp=new a.FlowchartInputConnector(this,"CU",0,a.ConnectorType.BOOLEAN),this.Reset=new a.FlowchartInputConnector(this,"Reset",1,a.ConnectorType.BOOLEAN),this.PresetValue=new a.FlowchartInputConnector(this,"PV_ms",2,a.ConnectorType.INTEGER),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.BOOLEAN),this.CurrentValue=new a.FlowchartOutputConnector(this,"CV_ms",1,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.CountUp,this.Reset,this.PresetValue],[this.OUT,this.CurrentValue])}OnSimulationStart(t){this._CurrentValueMs=0}OnSimulationStep(t){let e=t.GetBoolean(this.CountUp),i=t.GetInteger(this.PresetValue);if(t.GetBoolean(this.Reset))this._CurrentValueMs=0,this.lastMillis=t.GetMillis();else if(0==this.lastInputValue&&1==e&&this._CurrentValueMs<i){let e=t.GetMillis();this._CurrentValueMs+=e-this.lastMillis,this.lastMillis=e,console.log("Logic_CNTOperator this._CurrentValue++; "+this._CurrentValueMs)}t.SetBoolean(this.OUT,this._CurrentValueMs>=i),t.SetInteger(this.CurrentValue,this._CurrentValueMs),this.lastInputValue=e}}i.Basic_TimekeeperOperator=W;class X extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.BOOLEAN),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.IN],[this.OUT])}OnSimulationStep(t){t.SetBoolean(this.OUT,!t.GetBoolean(this.IN))}}i.Basic_NotOperator=X;class Y extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.state=!1,this.O=new a.FlowchartOutputConnector(this,"IsPressed",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([],[this.O]),this.ElementSvgG.onclick=(e=>{console.log("Input_CommonButtonOperator this.ElementSvgG.onclick"),t._notifyOperatorClicked(this,e),this.state=!this.state})}OnSimulationStart(t){this.state=!1}OnSimulationStep(t){this.box.classList.remove(this.state?"False":"True"),this.box.classList.add(this.state?"True":"False"),t.SetBoolean(this.O,this.state)}OnSimulationStop(t){this.box.classList.remove("False","True")}}class K extends Y{constructor(t,e,i,n){super(t,e,i,n)}}i.Input_GreenButtonOperator=K;class q extends Y{constructor(t,e,i,n){super(t,e,i,n)}}i.Input_EncoderButtonOperator=q;class J extends Y{constructor(t,e,i,n){super(t,e,i,n)}}i.Input_RedButtonOperator=J;class Z extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.O=new a.FlowchartOutputConnector(this,"Ticks",0,a.ConnectorType.INTEGER),this.AppendConnectors([],[this.O]),this.StorageId="4711"}OnSimulationStart(t){t.SetInteger(this.O,1e3)}}i.Input_EncoderTicksOperator=Z;class Q extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.I=new a.FlowchartInputConnector(this,"Relay",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.I],[])}OnSimulationStep(t){let e=t.GetBoolean(this.I);this.box.classList.remove(e?"False":"True"),this.box.classList.add(e?"True":"False")}}i.Output_RelayOperator=Q;class tt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.I=new a.FlowchartInputConnector(this,"Power%",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.I],[])}OnSimulationStep(t){let e=t.GetInteger(this.I);this.box.innerHTML=e+"%"}}i.Output_Fan1Operator=tt;class et extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.I=new a.FlowchartInputConnector(this,"Power%",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.I],[])}OnSimulationStep(t){let e=t.GetInteger(this.I);this.box.innerHTML=e+"%"}}i.Output_Fan2Operator=et;class it extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.I=new a.FlowchartInputConnector(this,"Power%",0,a.ConnectorType.FLOAT),this.AppendConnectors([this.I],[])}OnSimulationStep(t){let e=t.GetFloat(this.I);this.box.innerHTML=e+"%"}}i.Output_PowerLedOperator=it;class nt extends r.FlowchartOperator{constructor(t,e,i,n,o,s){super(t,e,i,n),this.colorOnTRUE=o,this.colorOnFALSE=s,this.I=new a.FlowchartInputConnector(this,"LED",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.I],[])}OnSimulationStep(t){let e=t.GetBoolean(this.I);this.box.style.fill=e?this.colorOnTRUE:this.colorOnFALSE}OnSimulationStop(t){this.box.style.removeProperty("fill")}}class ot extends nt{constructor(t,e,i,n){super(t,e,i,n,"red","grey")}}i.Output_RedLedOperator=ot;class st extends nt{constructor(t,e,i,n){super(t,e,i,n,"yellow","grey")}}i.Output_YellowLedOperator=st;class rt extends nt{constructor(t,e,i,n){super(t,e,i,n,"green","grey")}}i.Output_GreenLedOperator=rt;class at extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.LED=new a.FlowchartInputConnector(this,"LED",0,a.ConnectorType.COLOR),this.AppendConnectors([this.LED],[])}OnSimulationStep(t){this.box.style.fill=t.GetColor(this.LED)}OnSimulationStop(t){this.box.style.removeProperty("fill")}}i.Output_CommonRGBLedOperator=at;class lt extends at{constructor(t,e,i,n){super(t,e,i,n)}}i.Output_Led3Operator=lt;class ht extends at{constructor(t,e,i,n){super(t,e,i,n)}}i.Output_Led4Operator=ht;class ct extends at{constructor(t,e,i,n){super(t,e,i,n)}}i.Output_Led5Operator=ct;class ut extends at{constructor(t,e,i,n){super(t,e,i,n)}}i.Output_Led6Operator=ut;class dt extends at{constructor(t,e,i,n){super(t,e,i,n)}}i.Output_Led7Operator=dt;class pt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.O=new a.FlowchartOutputConnector(this,"TRUE",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([],[this.O])}OnSimulationStart(t){t.SetBoolean(this.O,!1)}}i.Basic_ConstTRUEOperator=pt;class ft extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.O=new a.FlowchartOutputConnector(this,"TRUE",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([],[this.O])}OnSimulationStart(t){t.SetBoolean(this.O,!0)}}i.Basic_ConstFALSEOperator=ft;class gt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.songIndexHTMLSelect=null;let o=new a.FlowchartInputConnector(this,"Trigger",0,a.ConnectorType.BOOLEAN);this.AppendConnectors([o],[]),this.cfg_setDefault(_,0)}PopulateProperyGrid(t){return this.songIndexHTMLSelect=l.$.InputSelect(t,h.default(),_,this.configurationData),!0}SavePropertyGrid(t){null!=this.songIndexHTMLSelect&&this.cfg_setValue(_,parseInt(this.songIndexHTMLSelect.value))}SerializeFurtherProperties(t){t.ctx.writeS32(this.cfg_getValue(_,0))}}i.Sound_Melody=gt;class mt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.constantHTMLInput=null,this.O=new a.FlowchartOutputConnector(this,"Out",0,a.ConnectorType.INTEGER),this.AppendConnectors([],[this.O]),this.cfg_setDefault(y,0)}PopulateProperyGrid(t){return this.constantHTMLInput=l.$.InputNumber(t,-32768,32767,y,this.configurationData),!0}SavePropertyGrid(t){null!=this.constantHTMLInput&&this.cfg_setValue(y,this.constantHTMLInput.valueAsNumber)}SerializeFurtherProperties(t){t.ctx.writeS32(this.cfg_getValue(y,0))}OnSimulationStart(t){t.SetInteger(this.O,this.cfg_getValue(y,0))}}i.Arithmetic_ConstINTOperator=mt;const bt="Color for TRUE",xt="Color for FALSE";class yt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.colorTRUEHTMLInput=null,this.colorFALSEHTMLInput=null,this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.BOOLEAN),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.COLOR),this.AppendConnectors([this.IN],[this.OUT])}PopulateProperyGrid(t){return this.colorTRUEHTMLInput=l.$.InputColor(t,bt,this.configurationData),this.colorFALSEHTMLInput=l.$.InputColor(t,xt,this.configurationData),!0}SavePropertyGrid(t){null!=this.colorTRUEHTMLInput&&null!=this.colorFALSEHTMLInput&&(this.cfg_setValue(bt,this.colorTRUEHTMLInput.value),this.cfg_setValue(xt,this.colorFALSEHTMLInput.value))}SerializeFurtherProperties(t){let e=this.cfg_getValue(bt,"#ff0000"),i=l.$.ColorDomString2ColorNum(e);t.ctx.writeU32(i),e=this.cfg_getValue(xt,"#000000"),i=l.$.ColorDomString2ColorNum(e),t.ctx.writeU32(i)}OnSimulationStep(t){let e=t.GetBoolean(this.IN)?this.cfg_getValue(bt,"RED"):this.cfg_getValue(xt,"GREY");t.SetColor(this.OUT,e)}}i.Bool2ColorConvert=yt;const _t="Number for TRUE",vt="Number for FALSE";class wt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.numberTRUEHTMLInput=null,this.numberFALSEHTMLInput=null,this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.BOOLEAN),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.IN],[this.OUT])}PopulateProperyGrid(t){return this.numberTRUEHTMLInput=l.$.InputNumber(t,Number.MIN_VALUE,Number.MAX_VALUE,_t,this.configurationData),this.numberFALSEHTMLInput=l.$.InputNumber(t,Number.MIN_VALUE,Number.MAX_VALUE,vt,this.configurationData),!0}SavePropertyGrid(t){null!=this.numberFALSEHTMLInput&&null!=this.numberTRUEHTMLInput&&(this.cfg_setValue(_t,this.numberTRUEHTMLInput.valueAsNumber),this.cfg_setValue(vt,this.numberFALSEHTMLInput.valueAsNumber))}SerializeFurtherProperties(t){t.ctx.writeS32(this.cfg_getValue(_t,1)),t.ctx.writeS32(this.cfg_getValue(vt,0))}OnSimulationStep(t){let e=t.GetBoolean(this.IN);t.SetInteger(this.OUT,e?this.cfg_getValue(_t,1):this.cfg_getValue(vt,0))}}i.Bool2IntConvert=wt;class Ct extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.INTEGER),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.IN],[this.OUT])}OnSimulationStep(t){let e=t.GetInteger(this.IN);t.SetBoolean(this.OUT,0!=e)}}i.Int2BoolConvert=Ct;class Ot extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.INTEGER),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.FLOAT),this.AppendConnectors([this.IN],[this.OUT])}OnSimulationStep(t){let e=t.GetInteger(this.IN);t.SetFloat(this.OUT,e)}}i.Int2FloatConvert=Ot;class St extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.INTEGER),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.COLOR),this.AppendConnectors([this.IN],[this.OUT])}OnSimulationStep(t){let e=t.GetInteger(this.IN);t.SetColor(this.OUT,e?"RED":"GREY")}}i.Int2ColorConvert=St;class Tt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.IN=new a.FlowchartInputConnector(this,"IN",0,a.ConnectorType.FLOAT),this.OUT=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.IN],[this.OUT])}OnSimulationStep(t){let e=t.GetFloat(this.IN);t.SetInteger(this.OUT,e)}}i.Float2IntConvert=Tt;class It extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.lastInputValue=!1,this.inputPositiveEdge=Number.MAX_VALUE,this.inputTRIGGER=new a.FlowchartInputConnector(this,"TRIGGER",0,a.ConnectorType.BOOLEAN),this.inputPresetTime_msecs=new a.FlowchartInputConnector(this,"PT_MS",1,a.ConnectorType.INTEGER),this.output=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.BOOLEAN),this.outputElapsedTime_msecs=new a.FlowchartOutputConnector(this,"ET_MS",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.inputTRIGGER,this.inputPresetTime_msecs],[this.output,this.outputElapsedTime_msecs])}OnSimulationStart(t){this.inputPositiveEdge=Number.MAX_VALUE}OnSimulationStep(t){let e=t.GetBoolean(this.inputTRIGGER),i=t.GetInteger(this.inputPresetTime_msecs),n=t.GetMillis();0==this.lastInputValue&&1==e?this.inputPositiveEdge=n:0==e&&(this.inputPositiveEdge=Number.MAX_VALUE),this.lastInputValue=e;let o=n-this.inputPositiveEdge;t.SetBoolean(this.output,o>=i),t.SetInteger(this.outputElapsedTime_msecs,o)}}i.Basic_TONOperator=It;class Mt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.lastInputValue=!1,this.inputNegativeEdge=0,this.inputTRIGGER=new a.FlowchartInputConnector(this,"TRIGGER",0,a.ConnectorType.BOOLEAN),this.inputPresetTime_msecs=new a.FlowchartInputConnector(this,"PT_MS",1,a.ConnectorType.INTEGER),this.output=new a.FlowchartOutputConnector(this,"OUT",0,a.ConnectorType.BOOLEAN),this.outputElapsedTime_msecs=new a.FlowchartOutputConnector(this,"ET_MS",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.inputTRIGGER,this.inputPresetTime_msecs],[this.output,this.outputElapsedTime_msecs])}OnSimulationStart(t){this.inputNegativeEdge=0}OnSimulationStep(t){let e=t.GetBoolean(this.inputTRIGGER),i=t.GetInteger(this.inputPresetTime_msecs),n=t.GetMillis();1==this.lastInputValue&&0==e?this.inputNegativeEdge=n:1==e&&(this.inputNegativeEdge=0),this.lastInputValue=e;let o=n-this.inputNegativeEdge;o=Math.min(o,i),t.SetBoolean(this.output,e||o<i),t.SetInteger(this.outputElapsedTime_msecs,o)}}i.Basic_TOFOperator=Mt;class kt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.Minimum=new a.FlowchartInputConnector(this,"Minimum",0,a.ConnectorType.INTEGER),this.Input=new a.FlowchartInputConnector(this,"Input",1,a.ConnectorType.INTEGER),this.Maximum=new a.FlowchartInputConnector(this,"Maximum",2,a.ConnectorType.INTEGER),this.Output=new a.FlowchartOutputConnector(this,"Output",0,a.ConnectorType.INTEGER),this.AppendConnectors([this.Minimum,this.Input,this.Maximum],[this.Output])}OnSimulationStep(t){let e=t.GetInteger(this.Input),i=t.GetInteger(this.Minimum),n=t.GetInteger(this.Minimum);t.SetInteger(this.Output,e>n?n:e<i?i:e)}}i.Arithmetic_LIMITOperator=kt;class Lt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.Minimum=new a.FlowchartInputConnector(this,"Minimum",0,a.ConnectorType.INTEGER),this.Input=new a.FlowchartInputConnector(this,"Input",1,a.ConnectorType.INTEGER),this.Maximum=new a.FlowchartInputConnector(this,"Maximum",2,a.ConnectorType.INTEGER),this.Hysterese=new a.FlowchartInputConnector(this,"Hysterese",3,a.ConnectorType.INTEGER),this.LLE=new a.FlowchartOutputConnector(this,"LLE",0,a.ConnectorType.BOOLEAN),this.ULE=new a.FlowchartOutputConnector(this,"ULE",1,a.ConnectorType.BOOLEAN),this.AppendConnectors([this.Minimum,this.Input,this.Maximum],[this.LLE,this.ULE])}OnSimulationStep(t){let e=t.GetInteger(this.Input),i=t.GetInteger(this.Minimum),n=t.GetInteger(this.Minimum),o=t.GetInteger(this.Hysterese);e>n?t.SetBoolean(this.ULE,!0):e<=n-o&&t.SetBoolean(this.ULE,!1),e<i?t.SetBoolean(this.LLE,!0):e>=i+o&&t.SetBoolean(this.LLE,!1)}}i.Arithmetic_LIMITMONITOROperator=Lt;class Et extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n);let o=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),s=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),r=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN);this.AppendConnectors([o,s],[r])}}i.Arithmetic_GreaterThanOperator=Et;class At extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n);let o=new a.FlowchartInputConnector(this,"A",0,a.ConnectorType.INTEGER),s=new a.FlowchartInputConnector(this,"B",1,a.ConnectorType.INTEGER),r=new a.FlowchartOutputConnector(this,"C",0,a.ConnectorType.BOOLEAN);this.AppendConnectors([o,s],[r])}}i.Arithmetic_LessThanOperator=At;class Dt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.value1HTMLInput=null,this.value2HTMLInput=null,this.value3HTMLInput=null,this.color1HTMLInput=null;let o=new a.FlowchartInputConnector(this,"TempVL",0,a.ConnectorType.INTEGER),s=new a.FlowchartInputConnector(this,"TempRL",1,a.ConnectorType.INTEGER),r=new a.FlowchartInputConnector(this,"Switch",2,a.ConnectorType.BOOLEAN),l=new a.FlowchartOutputConnector(this,"Motor",0,a.ConnectorType.BOOLEAN),h=new a.FlowchartOutputConnector(this,"Valve",1,a.ConnectorType.INTEGER);this.AppendConnectors([o,s,r],[l,h])}PopulateProperyGrid(t){return this.value1HTMLInput=l.$.InputNumber(t,-32768,32767,"Value1",this.configurationData),this.value1HTMLInput=l.$.InputNumber(t,-32768,32767,"Value2",this.configurationData),this.value1HTMLInput=l.$.InputNumber(t,-32768,32767,"Value3",this.configurationData),this.color1HTMLInput=l.$.InputColor(t,"Color1",this.configurationData),!0}SavePropertyGrid(t){this.cfg_setValue("Value1",this.value1HTMLInput.valueAsNumber),this.cfg_setValue("Value2",this.value2HTMLInput.valueAsNumber),this.cfg_setValue("Value3",this.value3HTMLInput.valueAsNumber),this.cfg_setValue("Color1",this.color1HTMLInput.valueAsNumber)}SerializeFurtherProperties(t){t.ctx.writeS32(this.cfg_getValue("Value1",0)),t.ctx.writeS32(this.cfg_getValue("Value2",0)),t.ctx.writeS32(this.cfg_getValue("Value3",0));let e=this.cfg_getValue("Color1","#000000"),i=l.$.ColorDomString2ColorNum(e);t.ctx.writeU32(i)}}i.Custom_XYZBlock=Dt;class Rt extends r.FlowchartOperator{constructor(t,e,i,n){super(t,e,i,n),this.inputActualValue=new a.FlowchartInputConnector(this,"Actual",0,a.ConnectorType.FLOAT),this.inputSetpoint=new a.FlowchartInputConnector(this,"Setpoint",1,a.ConnectorType.FLOAT),this.inputKP=new a.FlowchartInputConnector(this,"KP",2,a.ConnectorType.FLOAT),this.inputKI=new a.FlowchartInputConnector(this,"KI",3,a.ConnectorType.FLOAT),this.inputKD=new a.FlowchartInputConnector(this,"KD",4,a.ConnectorType.FLOAT),this.output=new a.FlowchartOutputConnector(this,"Out",1,a.ConnectorType.INTEGER),this.AppendConnectors([this.inputActualValue,this.inputSetpoint,this.inputKP,this.inputKI,this.inputKD],[this.output])}}i.Control_PID=Rt},{"../utils":20,"./FlowchartConnector":12,"./FlowchartOperator":14,"./Songs":18}],16:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.SerializeContext=void 0;i.SerializeContext=class{constructor(t,e=0){this.buffer=t,this.bufferOffset=e,this.bufferDV=new DataView(t)}writeGUID(t){for(let e=0;e<16;e++)this.bufferDV.setUint8(this.bufferOffset+e,t[e]);this.bufferOffset+=16}consumeGUIDandCompare(t){let e=!0;for(let i=0;i<16;i++)if(t[i]!=this.bufferDV.getUint8(this.bufferOffset+i)){e=!1;break}return this.bufferOffset+=16,e}funhash(t,e){e=Math.min(e,this.bufferDV.byteLength);for(var i=t,n=3735928559;i<e;i++)n=Math.imul(n^this.bufferDV.getUint8(i),2654435761);return(n^n>>>16)>>>0}overwriteU32(t,e){if(e>this.bufferOffset-4)throw new Error("offset>this.bufferOffset-4");this.bufferDV.setUint32(e,t,!0)}writeS32(t){this.bufferDV.setInt32(this.bufferOffset,t,!0),this.bufferOffset+=4}writeU32(t){this.bufferDV.setUint32(this.bufferOffset,t,!0),this.bufferOffset+=4}writeF32(t){this.bufferDV.setFloat32(this.bufferOffset,t,!0),this.bufferOffset+=4}readF32(){let t=this.bufferDV.getFloat32(this.bufferOffset,!0);return this.bufferOffset+=4,t}readU32(){let t=this.bufferDV.getUint32(this.bufferOffset,!0);return this.bufferOffset+=4,t}readS32(){let t=this.bufferDV.getInt32(this.bufferOffset,!0);return this.bufferOffset+=4,t}getResult(){return this.buffer.slice(0,this.bufferOffset)}}},{}],17:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.SimulationManager=void 0;i.SimulationManager=class{constructor(t){this.sortedOperatorsAndMaps=t,this.running=!1,this.resetDatastructures()}resetDatastructures(){this.booleans=new Array(this.sortedOperatorsAndMaps.typeIndex2maxOffset.get(0)),this.integers=new Array(this.sortedOperatorsAndMaps.typeIndex2maxOffset.get(1)),this.floats=new Array(this.sortedOperatorsAndMaps.typeIndex2maxOffset.get(2)),this.colors=new Array(this.sortedOperatorsAndMaps.typeIndex2maxOffset.get(3)),this.millisSince1970=Date.now()}SetBoolean(t,e){let i=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(0).get(t.GlobalConnectorIndex);this.booleans[i]=e}SetInteger(t,e){let i=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(1).get(t.GlobalConnectorIndex);this.integers[i]=e}SetFloat(t,e){let i=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(2).get(t.GlobalConnectorIndex);this.floats[i]=e}SetColor(t,e){let i=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(3).get(t.GlobalConnectorIndex);this.colors[i]=e}GetBoolean(t){let e=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(0).get(t.GetGlobalConnectorIndexOfSignalSource());return this.booleans[e]}GetInteger(t){let e=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(1).get(t.GetGlobalConnectorIndexOfSignalSource());return this.integers[e]}GetFloat(t){let e=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(2).get(t.GetGlobalConnectorIndexOfSignalSource());return this.floats[e]}GetColor(t){let e=this.sortedOperatorsAndMaps.typeIndex2globalConnectorIndex2adressOffset.get(3).get(t.GetGlobalConnectorIndexOfSignalSource());return this.colors[e]}Start(t=!1){t||this.resetDatastructures(),this.running=!0;for(let t of this.sortedOperatorsAndMaps.sortedOperators)t.OnSimulationStart(this);window.requestAnimationFrame(()=>this.Step())}Stop(){this.running=!1}Step(){this.millisSince1970=Date.now();for(let t of this.sortedOperatorsAndMaps.sortedOperators)t.OnSimulationStep(this);for(let t of this.sortedOperatorsAndMaps.typeIndex2adressOffset2ListOfLinks.get(0).entries()){let e=t[0];if(e<2)continue;let i=this.booleans[e];t[1].forEach(t=>{t.SetColor(i?"red":"grey"),t.SetCaption(""+i)})}for(let t of this.sortedOperatorsAndMaps.typeIndex2adressOffset2ListOfLinks.get(1).entries()){let e=t[0];if(e<2)continue;let i=this.integers[e];t[1].forEach(t=>{t.SetCaption(""+i)})}for(let t of this.sortedOperatorsAndMaps.typeIndex2adressOffset2ListOfLinks.get(2).entries()){let e=t[0];if(e<2)continue;let i=this.floats[e];t[1].forEach(t=>{t.SetCaption(""+i)})}for(let t of this.sortedOperatorsAndMaps.typeIndex2adressOffset2ListOfLinks.get(3).entries()){let e=t[0];if(e<2)continue;let i=this.colors[e];t[1].forEach(t=>{t.SetCaption(i),t.SetColor(i)})}if(this.running)window.requestAnimationFrame(()=>this.Step());else{for(let t of this.sortedOperatorsAndMaps.sortedOperators)t.OnSimulationStop(this);for(let t of this.sortedOperatorsAndMaps.typeIndex2adressOffset2ListOfLinks.values())for(let e of t.entries()){let t=e[0];t<2||(this.booleans[t],e[1].forEach(t=>{t.SetColor("blue"),t.SetCaption("")}))}}}GetMillis(){return this.millisSince1970}}},{}],18:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});const n=t("../utils");i.default=function(){return[new n.StringNumberTuple("No Song",0),new n.StringNumberTuple("positive",1),new n.StringNumberTuple("negative",2),new n.StringNumberTuple("Barbie_girl",3),new n.StringNumberTuple("HauntedHouse",4),new n.StringNumberTuple("axelf",5),new n.StringNumberTuple("Bond_007",6)]}},{"../utils":20}],19:[function(t,e,i){"use strict";var n;Object.defineProperty(i,"__esModule",{value:!0}),i.TopologicalSortDFS=i.NodeWrapper=void 0,function(t){t[t.NONE=0]="NONE",t[t.TEMPORARY=1]="TEMPORARY",t[t.PERMANENT=2]="PERMANENT"}(n||(n={}));i.NodeWrapper=class{constructor(t){this.payload=t,this.Mark=n.NONE,this.DependendNodes=[]}get Payload(){return this.payload}};i.TopologicalSortDFS=class{constructor(){this.L=new Array}sort(t){return this.L=new Array,t.forEach(t=>this.visit(t)),this.L}visit(t){if(t.Mark!=n.PERMANENT){if(t.Mark==n.TEMPORARY)throw new Error("not a DAG");t.Mark=n.TEMPORARY;for(const e of t.DependendNodes)this.visit(e);t.Mark=n.PERMANENT,this.L.push(t)}}}},{}],20:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.$=i.StringNumberTuple=i.Utils=void 0;i.Utils=class{static EventCoordinatesInSVG(t,e,i=1){let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/i,y:(t.clientY-n.top)/i}}};i.StringNumberTuple=class{constructor(t,e){this.s=t,this.n=e}};class n{static Svg(t,e,i,o){return t.appendChild(n.Elem(n.SVGNS,e,i,o))}static SvgIcon(t,e){let i=n.Svg(t,"svg",[],["icon","icon-"+e]);return n.Svg(i,"use",[],[]).setAttributeNS(this.XLINKNS,"href","#icon-"+e),t.appendChild(i),i}static ColorNumColor2ColorDomString(t){let e=t.toString(16);for(;e.length<6;)e="0"+t;return"#"+e}static ColorDomString2ColorNum(t){return parseInt(t.substring(1),16)}static Html(t,e,i,o,s){return t.appendChild(n.Elem(n.HTMLNS,e,i,o,s))}static HtmlAsFirstChild(t,e,i,o,s){return t.firstChild?t.insertBefore(n.Elem(n.HTMLNS,e,i,o,s),t.firstChild):t.appendChild(n.Elem(n.HTMLNS,e,i,o,s))}static Elem(t,e,i,n,o){let s,r=document.createElementNS(t,e);if(n)for(const t of n)r.classList.add(t);for(s=0;s<i.length;s+=2)r.setAttribute(i[s],i[s+1]);return o&&(r.textContent=o),r}static InputNumber(t,e,i,o,s){let r=0;if(null!=s)for(const t of s)if(t.key==o&&!isNaN(t.value)){r=t.value;break}let a=n.Html(t,"tr",[],["develop-propertygrid-tr"]);n.Html(a,"td",[],["develop-propertygrid-td"],o);let l=n.Html(a,"td",[],["develop-propertygrid-td"]);return n.Html(l,"input",["type","number","min",""+Math.round(e),"max",""+Math.round(i),"value",""+Math.round(r)])}static InputSelect(t,e,i,o){let s=0;if(null!=o)for(const t of o)if(t.key==i&&!isNaN(t.value)){s=t.value;break}let r=n.Html(t,"tr",[],["develop-propertygrid-tr"]);n.Html(r,"td",[],["develop-propertygrid-td"],i);let a=n.Html(r,"td",[],["develop-propertygrid-td"]),l=n.Html(a,"select",[],[]);for(let t=0;t<e.length;t++){let i=n.Html(l,"option",["value",""+e[t].n],[],e[t].s);t==s&&i.setAttribute("selected","")}return l}static InputColor(t,e,i){let o="#ff0000";if(null!=i)for(const t of i)if(t.key==e){o=t.value;break}let s=n.Html(t,"tr",[],["develop-propertygrid-tr"]);n.Html(s,"td",[],["develop-propertygrid-td"],e);let r=n.Html(s,"td",[],["develop-propertygrid-td"]);return n.Html(r,"input",["type","color","value",o])}}i.$=n,n.SVGNS="http://www.w3.org/2000/svg",n.XLINKNS="http://www.w3.org/1999/xlink",n.HTMLNS="http://www.w3.org/1999/xhtml"},{}]},{},[4]);
  //# sourceMappingURL=bundle-min.js.map
  