itowns 2.36.2 → 2.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +30 -17
- package/changelog.md +52 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +2 -0
- package/dist/itowns_widgets.js.map +1 -0
- package/examples/config.json +25 -6
- package/examples/css/widgets.css +248 -0
- package/examples/geoid_geoidLayer.html +102 -0
- package/examples/images/compass.svg +60 -0
- package/examples/images/widget-logo.svg +66 -0
- package/examples/itowns-potree.html +252 -0
- package/examples/js/GUI/GuiTools.js +17 -0
- package/examples/js/Scale.js +1 -0
- package/examples/source_file_from_fetched_data.html +90 -0
- package/examples/source_file_from_format.html +85 -0
- package/examples/source_file_from_methods.html +87 -0
- package/examples/source_file_from_parsed_data.html +104 -0
- package/examples/source_file_geojson_raster.html +21 -45
- package/examples/source_file_gpx_raster.html +28 -36
- package/examples/source_file_kml_raster.html +1 -4
- package/examples/source_file_shapefile.html +39 -34
- package/examples/source_stream_wfs_25d.html +21 -13
- package/examples/source_stream_wfs_3d.html +21 -12
- package/examples/source_stream_wfs_raster.html +20 -20
- package/examples/view_immersive.html +13 -14
- package/examples/widgets_minimap.html +122 -0
- package/examples/widgets_navigation.html +119 -0
- package/lib/Controls/GlobeControls.js +13 -0
- package/lib/Controls/PlanarControls.js +1 -1
- package/lib/Converter/convertToTile.js +5 -1
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
- package/lib/Core/Deprecated/Undeprecator.js +1 -1
- package/lib/Core/Feature.js +3 -4
- package/lib/Core/Geographic/Extent.js +1 -1
- package/lib/Core/Geographic/GeoidGrid.js +143 -0
- package/lib/Core/MainLoop.js +1 -1
- package/lib/Core/Math/Ellipsoid.js +1 -1
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
- package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
- package/lib/Core/Style.js +1 -1
- package/lib/Core/TileGeometry.js +3 -1
- package/lib/Core/TileMesh.js +11 -17
- package/lib/Core/View.js +40 -2
- package/lib/Layer/ElevationLayer.js +6 -2
- package/lib/Layer/FeatureGeometryLayer.js +3 -1
- package/lib/Layer/GeoidLayer.js +131 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/Layer.js +1 -1
- package/lib/Layer/LayerUpdateStrategy.js +1 -1
- package/lib/Layer/PotreeLayer.js +3 -1
- package/lib/Layer/TiledGeometryLayer.js +3 -1
- package/lib/Main.js +214 -174
- package/lib/MainBundle.js +1 -1
- package/lib/Parser/B3dmParser.js +2 -1
- package/lib/Parser/GDFParser.js +118 -0
- package/lib/Parser/GTXParser.js +92 -0
- package/lib/Parser/ISGParser.js +121 -0
- package/lib/Parser/LASParser.js +3 -1
- package/lib/Parser/XbilParser.js +1 -1
- package/lib/Process/3dTilesProcessing.js +2 -2
- package/lib/Process/FeatureProcessing.js +3 -1
- package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
- package/lib/Provider/URLBuilder.js +1 -1
- package/lib/Renderer/LayeredMaterial.js +2 -2
- package/lib/Renderer/OBB.js +18 -25
- package/lib/Renderer/PointsMaterial.js +5 -6
- package/lib/Renderer/RasterTile.js +1 -1
- package/lib/Renderer/Shader/ShaderUtils.js +4 -2
- package/lib/Source/C3DTilesSource.js +3 -1
- package/lib/Source/EntwinePointTileSource.js +3 -1
- package/lib/Source/PotreeSource.js +3 -1
- package/lib/Source/Source.js +15 -10
- package/lib/Source/WMTSSource.js +3 -1
- package/lib/ThreeExtended/loaders/GLTFLoader.js +85 -35
- package/lib/Utils/CameraUtils.js +11 -1
- package/lib/Utils/DEMUtils.js +1 -1
- package/lib/Utils/FeaturesUtils.js +8 -4
- package/package.json +25 -25
package/dist/debug.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see debug.js.LICENSE.txt */
|
|
2
|
-
"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("debug",[],e):"object"==typeof exports?exports.debug=e():t.debug=e()}(self,(function(){return(self.webpackChunk_name_=self.webpackChunk_name_||[]).push([[711],{85003:(t,e,n)=>{n.r(e),n.d(e,{Debug:()=>ba,GeometryDebug:()=>Oa,PotreeDebug:()=>_a,create3dTilesDebugUI:()=>Fa,createTileDebugUI:()=>Ia});var i=n(2212),o=n(45622),a=n(21538),s=n(97661);const r="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function l(t,e,n){const i=n||(t=>Array.prototype.slice.call(t));let o=!1,a=[];return function(...n){a=i(n),o||(o=!0,r.call(window,(()=>{o=!1,t.apply(e,a)})))}}const c=(t,e,n)=>"start"===t?e:"end"===t?n:(e+n)/2,d=function(){let t=0;return function(){return t++}}();function h(t){return null==t}function u(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 f(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const g=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function p(t,e){return g(t)?t:e}function m(t,e){return void 0===t?e:t}const b=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function x(t,e,n){if(t&&"function"==typeof t.call)return t.apply(n,e)}function y(t,e,n,i){let o,a,s;if(u(t))if(a=t.length,i)for(o=a-1;o>=0;o--)e.call(n,t[o],o);else for(o=0;o<a;o++)e.call(n,t[o],o);else if(f(t))for(s=Object.keys(t),a=s.length,o=0;o<a;o++)e.call(n,t[s[o]],s[o])}function _(t,e){let n,i,o,a;if(!t||!e||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;++n)if(o=t[n],a=e[n],o.datasetIndex!==a.datasetIndex||o.index!==a.index)return!1;return!0}function v(t){if(u(t))return t.map(v);if(f(t)){const e=Object.create(null),n=Object.keys(t),i=n.length;let o=0;for(;o<i;++o)e[n[o]]=v(t[n[o]]);return e}return t}function w(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function M(t,e,n,i){if(!w(t))return;const o=e[t],a=n[t];f(o)&&f(a)?k(o,a,i):e[t]=v(a)}function k(t,e,n){const i=u(e)?e:[e],o=i.length;if(!f(t))return t;const a=(n=n||{}).merger||M;for(let s=0;s<o;++s){if(!f(e=i[s]))continue;const o=Object.keys(e);for(let i=0,s=o.length;i<s;++i)a(o[i],t,e,n)}return t}function S(t,e){return k(t,e,{merger:C})}function C(t,e,n){if(!w(t))return;const i=e[t],o=n[t];f(i)&&f(o)?S(i,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=v(o))}function D(t,e){const n=t.indexOf(".",e);return-1===n?t.length:n}function P(t,e){if(""===e)return t;let n=0,i=D(e,n);for(;t&&i>n;)t=t[e.substr(n,i-n)],n=i+1,i=D(e,n);return t}function O(t){return t.charAt(0).toUpperCase()+t.slice(1)}const A=t=>void 0!==t,T=t=>"function"==typeof t,E=Math.PI,R=2*E,L=R+E,I=Number.POSITIVE_INFINITY,z=E/180,F=E/2,V=E/4,B=2*E/3,j=Math.log10,W=Math.sign;function N(t){const e=Math.round(t);t=$(t,e,t/1e3)?e:t;const n=Math.pow(10,Math.floor(j(t))),i=t/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function H(t){return!isNaN(parseFloat(t))&&isFinite(t)}function $(t,e,n){return Math.abs(t-e)<n}function U(t,e,n){let i,o,a;for(i=0,o=t.length;i<o;i++)a=t[i][n],isNaN(a)||(e.min=Math.min(e.min,a),e.max=Math.max(e.max,a))}function Y(t){return t*(E/180)}function X(t){return t*(180/E)}function q(t){if(!g(t))return;let e=1,n=0;for(;Math.round(t*e)/e!==t;)e*=10,n++;return n}function Z(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+L)%R-E}function G(t){return(t%R+R)%R}function Q(t,e,n,i){const o=G(t),a=G(e),s=G(n),r=G(a-o),l=G(s-o),c=G(o-a),d=G(o-s);return o===a||o===s||i&&a===s||r>l&&c<d}function J(t,e,n){return Math.max(e,Math.min(n,t))}const tt=t=>0===t||1===t,et=(t,e,n)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*R/n),nt=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*R/n)+1,it={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*F),easeOutSine:t=>Math.sin(t*F),easeInOutSine:t=>-.5*(Math.cos(E*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=>tt(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=>tt(t)?t:et(t,.075,.3),easeOutElastic:t=>tt(t)?t:nt(t,.075,.3),easeInOutElastic(t){const e=.1125;return tt(t)?t:t<.5?.5*et(2*t,e,.45):.5+.5*nt(2*t-1,e,.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-it.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375},easeInOutBounce:t=>t<.5?.5*it.easeInBounce(2*t):.5*it.easeOutBounce(2*t-1)+.5},ot={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},at="0123456789ABCDEF",st=t=>at[15&t],rt=t=>at[(240&t)>>4]+at[15&t],lt=t=>(240&t)>>4==(15&t);function ct(t){return t+.5|0}const dt=(t,e,n)=>Math.max(Math.min(t,n),e);function ht(t){return dt(ct(2.55*t),0,255)}function ut(t){return dt(ct(255*t),0,255)}function ft(t){return dt(ct(t/2.55)/100,0,1)}function gt(t){return dt(ct(100*t),0,100)}const pt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,mt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function bt(t,e,n){const i=e*Math.min(n,1-n),o=(e,o=(e+t/30)%12)=>n-i*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function xt(t,e,n){const i=(i,o=(i+t/60)%6)=>n-n*e*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function yt(t,e,n){const i=bt(t,1,.5);let o;for(e+n>1&&(o=1/(e+n),e*=o,n*=o),o=0;o<3;o++)i[o]*=1-e-n,i[o]+=e;return i}function _t(t){const e=t.r/255,n=t.g/255,i=t.b/255,o=Math.max(e,n,i),a=Math.min(e,n,i),s=(o+a)/2;let r,l,c;return o!==a&&(c=o-a,l=s>.5?c/(2-o-a):c/(o+a),r=o===e?(n-i)/c+(n<i?6:0):o===n?(i-e)/c+2:(e-n)/c+4,r=60*r+.5),[0|r,l||0,s]}function vt(t,e,n,i){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,i)).map(ut)}function wt(t,e,n){return vt(bt,t,e,n)}function Mt(t){return(t%360+360)%360}const kt={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"},St={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 Ct;function Dt(t,e,n){if(t){let i=_t(t);i[e]=Math.max(0,Math.min(i[e]+i[e]*n,0===e?360:1)),i=wt(i),t.r=i[0],t.g=i[1],t.b=i[2]}}function Pt(t,e){return t?Object.assign(e||{},t):t}function Ot(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=ut(t[3]))):(e=Pt(t,{r:0,g:0,b:0,a:1})).a=ut(e.a),e}function At(t){return"r"===t.charAt(0)?function(t){const e=pt.exec(t);let n,i,o,a=255;if(e){if(e[7]!==n){const t=+e[7];a=255&(e[8]?ht(t):255*t)}return n=+e[1],i=+e[3],o=+e[5],n=255&(e[2]?ht(n):n),i=255&(e[4]?ht(i):i),o=255&(e[6]?ht(o):o),{r:n,g:i,b:o,a}}}(t):function(t){const e=mt.exec(t);let n,i=255;if(!e)return;e[5]!==n&&(i=e[6]?ht(+e[5]):ut(+e[5]));const o=Mt(+e[2]),a=+e[3]/100,s=+e[4]/100;return n="hwb"===e[1]?function(t,e,n){return vt(yt,t,e,n)}(o,a,s):"hsv"===e[1]?function(t,e,n){return vt(xt,t,e,n)}(o,a,s):wt(o,a,s),{r:n[0],g:n[1],b:n[2],a:i}}(t)}class Tt{constructor(t){if(t instanceof Tt)return t;const e=typeof t;let n;var i,o,a;"object"===e?n=Ot(t):"string"===e&&(a=(i=t).length,"#"===i[0]&&(4===a||5===a?o={r:255&17*ot[i[1]],g:255&17*ot[i[2]],b:255&17*ot[i[3]],a:5===a?17*ot[i[4]]:255}:7!==a&&9!==a||(o={r:ot[i[1]]<<4|ot[i[2]],g:ot[i[3]]<<4|ot[i[4]],b:ot[i[5]]<<4|ot[i[6]],a:9===a?ot[i[7]]<<4|ot[i[8]]:255})),n=o||function(t){Ct||(Ct=function(){const t={},e=Object.keys(St),n=Object.keys(kt);let i,o,a,s,r;for(i=0;i<e.length;i++){for(s=r=e[i],o=0;o<n.length;o++)a=n[o],r=r.replace(a,kt[a]);a=parseInt(St[s],16),t[r]=[a>>16&255,a>>8&255,255&a]}return t}(),Ct.transparent=[0,0,0,0]);const e=Ct[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||At(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=Pt(this._rgb);return t&&(t.a=ft(t.a)),t}set rgb(t){this._rgb=Ot(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${ft(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?(t=this._rgb,e=function(t){return lt(t.r)&<(t.g)&<(t.b)&<(t.a)}(t)?st:rt,t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t):this._rgb;var t,e}hslString(){return this._valid?function(t){if(!t)return;const e=_t(t),n=e[0],i=gt(e[1]),o=gt(e[2]);return t.a<255?`hsla(${n}, ${i}%, ${o}%, ${ft(t.a)})`:`hsl(${n}, ${i}%, ${o}%)`}(this._rgb):this._rgb}mix(t,e){const n=this;if(t){const i=n.rgb,o=t.rgb;let a;const s=e===a?.5:e,r=2*s-1,l=i.a-o.a,c=((r*l==-1?r:(r+l)/(1+r*l))+1)/2;a=1-c,i.r=255&c*i.r+a*o.r+.5,i.g=255&c*i.g+a*o.g+.5,i.b=255&c*i.b+a*o.b+.5,i.a=s*i.a+(1-s)*o.a,n.rgb=i}return n}clone(){return new Tt(this.rgb)}alpha(t){return this._rgb.a=ut(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=ct(.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 Dt(this._rgb,2,t),this}darken(t){return Dt(this._rgb,2,-t),this}saturate(t){return Dt(this._rgb,1,t),this}desaturate(t){return Dt(this._rgb,1,-t),this}rotate(t){return function(t,e){var n=_t(t);n[0]=Mt(n[0]+e),n=wt(n),t.r=n[0],t.g=n[1],t.b=n[2]}(this._rgb,t),this}}function Et(t){return new Tt(t)}const Rt=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function Lt(t){return Rt(t)?t:Et(t)}function It(t){return Rt(t)?t:Et(t).saturate(.5).darken(.1).hexString()}const zt=Object.create(null),Ft=Object.create(null);function Vt(t,e){if(!e)return t;const n=e.split(".");for(let e=0,i=n.length;e<i;++e){const i=n[e];t=t[i]||(t[i]=Object.create(null))}return t}function Bt(t,e,n){return"string"==typeof e?k(Vt(t,e),n):k(Vt(t,""),e)}var jt=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)=>It(e.backgroundColor),this.hoverBorderColor=(t,e)=>It(e.borderColor),this.hoverColor=(t,e)=>It(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 Bt(this,t,e)}get(t){return Vt(this,t)}describe(t,e){return Bt(Ft,t,e)}override(t,e){return Bt(zt,t,e)}route(t,e,n,i){const o=Vt(this,t),a=Vt(this,n),s="_"+e;Object.defineProperties(o,{[s]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[s],e=a[i];return f(t)?Object.assign({},e,t):m(t,e)},set(t){this[s]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Wt(t,e,n,i,o){let a=e[o];return a||(a=e[o]=t.measureText(o).width,n.push(o)),a>i&&(i=a),i}function Nt(t,e,n,i){let o=(i=i||{}).data=i.data||{},a=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(o=i.data={},a=i.garbageCollect=[],i.font=e),t.save(),t.font=e;let s=0;const r=n.length;let l,c,d,h,f;for(l=0;l<r;l++)if(h=n[l],null!=h&&!0!==u(h))s=Wt(t,o,a,s,h);else if(u(h))for(c=0,d=h.length;c<d;c++)f=h[c],null==f||u(f)||(s=Wt(t,o,a,s,f));t.restore();const g=a.length/2;if(g>n.length){for(l=0;l<g;l++)delete o[a[l]];a.splice(0,g)}return s}function Ht(t,e,n){const i=t.currentDevicePixelRatio,o=0!==n?Math.max(n/2,.5):0;return Math.round((e-o)*i)/i+o}function $t(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Ut(t,e,n,i){let o,a,s,r,l;const c=e.pointStyle,d=e.rotation,h=e.radius;let u=(d||0)*z;if(c&&"object"==typeof c&&(o=c.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(n,i),t.rotate(u),t.drawImage(c,-c.width/2,-c.height/2,c.width,c.height),void t.restore();if(!(isNaN(h)||h<=0)){switch(t.beginPath(),c){default:t.arc(n,i,h,0,R),t.closePath();break;case"triangle":t.moveTo(n+Math.sin(u)*h,i-Math.cos(u)*h),u+=B,t.lineTo(n+Math.sin(u)*h,i-Math.cos(u)*h),u+=B,t.lineTo(n+Math.sin(u)*h,i-Math.cos(u)*h),t.closePath();break;case"rectRounded":l=.516*h,r=h-l,a=Math.cos(u+V)*r,s=Math.sin(u+V)*r,t.arc(n-a,i-s,l,u-E,u-F),t.arc(n+s,i-a,l,u-F,u),t.arc(n+a,i+s,l,u,u+F),t.arc(n-s,i+a,l,u+F,u+E),t.closePath();break;case"rect":if(!d){r=Math.SQRT1_2*h,t.rect(n-r,i-r,2*r,2*r);break}u+=V;case"rectRot":a=Math.cos(u)*h,s=Math.sin(u)*h,t.moveTo(n-a,i-s),t.lineTo(n+s,i-a),t.lineTo(n+a,i+s),t.lineTo(n-s,i+a),t.closePath();break;case"crossRot":u+=V;case"cross":a=Math.cos(u)*h,s=Math.sin(u)*h,t.moveTo(n-a,i-s),t.lineTo(n+a,i+s),t.moveTo(n+s,i-a),t.lineTo(n-s,i+a);break;case"star":a=Math.cos(u)*h,s=Math.sin(u)*h,t.moveTo(n-a,i-s),t.lineTo(n+a,i+s),t.moveTo(n+s,i-a),t.lineTo(n-s,i+a),u+=V,a=Math.cos(u)*h,s=Math.sin(u)*h,t.moveTo(n-a,i-s),t.lineTo(n+a,i+s),t.moveTo(n+s,i-a),t.lineTo(n-s,i+a);break;case"line":a=Math.cos(u)*h,s=Math.sin(u)*h,t.moveTo(n-a,i-s),t.lineTo(n+a,i+s);break;case"dash":t.moveTo(n,i),t.lineTo(n+Math.cos(u)*h,i+Math.sin(u)*h)}t.fill(),e.borderWidth>0&&t.stroke()}}function Yt(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.x<e.right+n&&t.y>e.top-n&&t.y<e.bottom+n}function Xt(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function qt(t){t.restore()}function Zt(t,e,n,i,o){if(!e)return t.lineTo(n.x,n.y);if("middle"===o){const i=(e.x+n.x)/2;t.lineTo(i,e.y),t.lineTo(i,n.y)}else"after"===o!=!!i?t.lineTo(e.x,n.y):t.lineTo(n.x,e.y);t.lineTo(n.x,n.y)}function Kt(t,e,n,i){if(!e)return t.lineTo(n.x,n.y);t.bezierCurveTo(i?e.cp1x:e.cp2x,i?e.cp1y:e.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function Gt(t,e,n,i,o,a={}){const s=u(e)?e:[e],r=a.strokeWidth>0&&""!==a.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),h(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,a),l=0;l<s.length;++l)c=s[l],r&&(a.strokeColor&&(t.strokeStyle=a.strokeColor),h(a.strokeWidth)||(t.lineWidth=a.strokeWidth),t.strokeText(c,n,i,a.maxWidth)),t.fillText(c,n,i,a.maxWidth),Qt(t,n,i,c,a),i+=o.lineHeight;t.restore()}function Qt(t,e,n,i,o){if(o.strikethrough||o.underline){const a=t.measureText(i),s=e-a.actualBoundingBoxLeft,r=e+a.actualBoundingBoxRight,l=n-a.actualBoundingBoxAscent,c=n+a.actualBoundingBoxDescent,d=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(s,d),t.lineTo(r,d),t.stroke()}}function Jt(t,e){const{x:n,y:i,w:o,h:a,radius:s}=e;t.arc(n+s.topLeft,i+s.topLeft,s.topLeft,-F,E,!0),t.lineTo(n,i+a-s.bottomLeft),t.arc(n+s.bottomLeft,i+a-s.bottomLeft,s.bottomLeft,E,F,!0),t.lineTo(n+o-s.bottomRight,i+a),t.arc(n+o-s.bottomRight,i+a-s.bottomRight,s.bottomRight,F,0,!0),t.lineTo(n+o,i+s.topRight),t.arc(n+o-s.topRight,i+s.topRight,s.topRight,0,-F,!0),t.lineTo(n+s.topLeft,i)}const te=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),ee=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function ne(t,e){const n=(""+t).match(te);if(!n||"normal"===n[1])return 1.2*e;switch(t=+n[2],n[3]){case"px":return t;case"%":t/=100}return e*t}function ie(t,e){const n={},i=f(e),o=i?Object.keys(e):e,a=f(t)?i?n=>m(t[n],t[e[n]]):e=>t[e]:()=>t;for(const t of o)n[t]=+a(t)||0;return n}function oe(t){return ie(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ae(t){return ie(t,["topLeft","topRight","bottomLeft","bottomRight"])}function se(t){const e=oe(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function re(t,e){t=t||{},e=e||jt.font;let n=m(t.size,e.size);"string"==typeof n&&(n=parseInt(n,10));let i=m(t.style,e.style);i&&!(""+i).match(ee)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const o={family:m(t.family,e.family),lineHeight:ne(m(t.lineHeight,e.lineHeight),n),size:n,style:i,weight:m(t.weight,e.weight),string:""};return o.string=function(t){return!t||h(t.size)||h(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function le(t,e,n,i){let o,a,s,r=!0;for(o=0,a=t.length;o<a;++o)if(s=t[o],void 0!==s&&(void 0!==e&&"function"==typeof s&&(s=s(e),r=!1),void 0!==n&&u(s)&&(s=s[n%s.length],r=!1),void 0!==s))return i&&!r&&(i.cacheable=!1),s}function ce(t,e,n){n=n||(n=>t[n]<e);let i,o=t.length-1,a=0;for(;o-a>1;)i=a+o>>1,n(i)?a=i:o=i;return{lo:a,hi:o}}const de=(t,e,n)=>ce(t,n,(i=>t[i][e]<n)),he=(t,e,n)=>ce(t,n,(i=>t[i][e]>=n)),ue=["push","pop","shift","splice","unshift"];function fe(t,e){const n=t._chartjs;if(!n)return;const i=n.listeners,o=i.indexOf(e);-1!==o&&i.splice(o,1),i.length>0||(ue.forEach((e=>{delete t[e]})),delete t._chartjs)}function ge(t){const e=new Set;let n,i;for(n=0,i=t.length;n<i;++n)e.add(t[n]);return e.size===i?t:Array.from(e)}function pe(t,e=[""],n=t,i,o=(()=>t[0])){A(i)||(i=Ce("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:n,_fallback:i,_getTarget:o,override:o=>pe([o,...t],e,n,i)};return new Proxy(a,{deleteProperty:(e,n)=>(delete e[n],delete e._keys,delete t[0][n],!0),get:(n,i)=>_e(n,i,(()=>function(t,e,n,i){let o;for(const a of e)if(o=Ce(xe(a,t),n),A(o))return ye(t,o)?ke(n,i,t,o):o}(i,e,t,n))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>De(t).includes(e),ownKeys:t=>De(t),set:(t,e,n)=>((t._storage||(t._storage=o()))[e]=n,delete t[e],delete t._keys,!0)})}function me(t,e,n,i){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:be(t,i),setContext:e=>me(t,e,n,i),override:o=>me(t.override(o),e,n,i)};return new Proxy(o,{deleteProperty:(e,n)=>(delete e[n],delete t[n],!0),get:(t,e,n)=>_e(t,e,(()=>function(t,e,n){const{_proxy:i,_context:o,_subProxy:a,_descriptors:s}=t;let r=i[e];return T(r)&&s.isScriptable(e)&&(r=function(t,e,n,i){const{_proxy:o,_context:a,_subProxy:s,_stack:r}=n;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);return r.add(t),e=e(a,s||i),r.delete(t),f(e)&&(e=ke(o._scopes,o,t,e)),e}(e,r,t,n)),u(r)&&r.length&&(r=function(t,e,n,i){const{_proxy:o,_context:a,_subProxy:s,_descriptors:r}=n;if(A(a.index)&&i(t))e=e[a.index%e.length];else if(f(e[0])){const n=e,i=o._scopes.filter((t=>t!==n));e=[];for(const l of n){const n=ke(i,o,t,l);e.push(me(n,a,s&&s[t],r))}}return e}(e,r,t,s.isIndexable)),ye(e,r)&&(r=me(r,o,a&&a[e],s)),r}(t,e,n))),getOwnPropertyDescriptor:(e,n)=>e._descriptors.allKeys?Reflect.has(t,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,n),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,n)=>Reflect.has(t,n),ownKeys:()=>Reflect.ownKeys(t),set:(e,n,i)=>(t[n]=i,delete e[n],!0)})}function be(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:i=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:n,indexable:i,isScriptable:T(n)?n:()=>n,isIndexable:T(i)?i:()=>i}}const xe=(t,e)=>t?t+O(e):e,ye=(t,e)=>f(e)&&"adapters"!==t;function _e(t,e,n){let i=t[e];return A(i)||(i=n(),A(i)&&(t[e]=i)),i}function ve(t,e,n){return T(t)?t(e,n):t}const we=(t,e)=>!0===t?e:"string"==typeof t?P(e,t):void 0;function Me(t,e,n,i){for(const o of e){const e=we(n,o);if(e){t.add(e);const o=ve(e._fallback,n,e);if(A(o)&&o!==n&&o!==i)return o}else if(!1===e&&A(i)&&n!==i)return null}return!1}function ke(t,e,n,i){const o=e._rootScopes,a=ve(e._fallback,n,i),s=[...t,...o],r=new Set;r.add(i);let l=Se(r,s,n,a||n);return null!==l&&(!A(a)||a===n||(l=Se(r,s,a,l),null!==l))&&pe(Array.from(r),[""],o,a,(()=>function(t,e,n){const i=t._getTarget();e in i||(i[e]={});const o=i[e];return u(o)&&f(n)?n:o}(e,n,i)))}function Se(t,e,n,i){for(;n;)n=Me(t,e,n,i);return n}function Ce(t,e){for(const n of e){if(!n)continue;const e=n[t];if(A(e))return e}}function De(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const n of t)for(const t of Object.keys(n).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}const Pe=Number.EPSILON||1e-14,Oe=(t,e)=>e<t.length&&!t[e].skip&&t[e],Ae=t=>"x"===t?"y":"x";function Te(t,e,n,i){const o=t.skip?e:t,a=e,s=n.skip?e:n,r=Z(a,o),l=Z(s,a);let c=r/(r+l),d=l/(r+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;const h=i*c,u=i*d;return{previous:{x:a.x-h*(s.x-o.x),y:a.y-h*(s.y-o.y)},next:{x:a.x+u*(s.x-o.x),y:a.y+u*(s.y-o.y)}}}function Ee(t,e,n){return Math.max(Math.min(t,n),e)}function Re(t,e,n,i,o){let a,s,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){const n=Ae(e),i=t.length,o=Array(i).fill(0),a=Array(i);let s,r,l,c=Oe(t,0);for(s=0;s<i;++s)if(r=l,l=c,c=Oe(t,s+1),l){if(c){const t=c[e]-l[e];o[s]=0!==t?(c[n]-l[n])/t:0}a[s]=r?c?W(o[s-1])!==W(o[s])?0:(o[s-1]+o[s])/2:o[s-1]:o[s]}!function(t,e,n){const i=t.length;let o,a,s,r,l,c=Oe(t,0);for(let d=0;d<i-1;++d)l=c,c=Oe(t,d+1),l&&c&&($(e[d],0,Pe)?n[d]=n[d+1]=0:(o=n[d]/e[d],a=n[d+1]/e[d],r=Math.pow(o,2)+Math.pow(a,2),r<=9||(s=3/Math.sqrt(r),n[d]=o*s*e[d],n[d+1]=a*s*e[d])))}(t,o,a),function(t,e,n="x"){const i=Ae(n),o=t.length;let a,s,r,l=Oe(t,0);for(let c=0;c<o;++c){if(s=r,r=l,l=Oe(t,c+1),!r)continue;const o=r[n],d=r[i];s&&(a=(o-s[n])/3,r[`cp1${n}`]=o-a,r[`cp1${i}`]=d-a*e[c]),l&&(a=(l[n]-o)/3,r[`cp2${n}`]=o+a,r[`cp2${i}`]=d+a*e[c])}}(t,a,e)}(t,o);else{let n=i?t[t.length-1]:t[0];for(a=0,s=t.length;a<s;++a)r=t[a],l=Te(n,r,t[Math.min(a+1,s-(i?0:1))%s],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,n=r}e.capBezierPoints&&function(t,e){let n,i,o,a,s,r=Yt(t[0],e);for(n=0,i=t.length;n<i;++n)s=a,a=r,r=n<i-1&&Yt(t[n+1],e),a&&(o=t[n],s&&(o.cp1x=Ee(o.cp1x,e.left,e.right),o.cp1y=Ee(o.cp1y,e.top,e.bottom)),r&&(o.cp2x=Ee(o.cp2x,e.left,e.right),o.cp2y=Ee(o.cp2y,e.top,e.bottom)))}(t,n)}function Le(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Ie(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ze(t,e,n){let i;return"string"==typeof t?(i=parseInt(t,10),-1!==t.indexOf("%")&&(i=i/100*e.parentNode[n])):i=t,i}const Fe=t=>window.getComputedStyle(t,null),Ve=["top","right","bottom","left"];function Be(t,e,n){const i={};n=n?"-"+n:"";for(let o=0;o<4;o++){const a=Ve[o];i[a]=parseFloat(t[e+"-"+a+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function je(t,e){const{canvas:n,currentDevicePixelRatio:i}=e,o=Fe(n),a="border-box"===o.boxSizing,s=Be(o,"padding"),r=Be(o,"border","width"),{x:l,y:c,box:d}=function(t,e){const n=t.native||t,i=n.touches,o=i&&i.length?i[0]:n,{offsetX:a,offsetY:s}=o;let r,l,c=!1;if(((t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot))(a,s,n.target))r=a,l=s;else{const t=e.getBoundingClientRect();r=o.clientX-t.left,l=o.clientY-t.top,c=!0}return{x:r,y:l,box:c}}(t,n),h=s.left+(d&&r.left),u=s.top+(d&&r.top);let{width:f,height:g}=e;return a&&(f-=s.width+r.width,g-=s.height+r.height),{x:Math.round((l-h)/f*n.width/i),y:Math.round((c-u)/g*n.height/i)}}const We=t=>Math.round(10*t)/10;function Ne(t,e,n){const i=e||1,o=Math.floor(t.height*i),a=Math.floor(t.width*i);t.height=o/i,t.width=a/i;const s=t.canvas;return s.style&&(n||!s.style.height&&!s.style.width)&&(s.style.height=`${t.height}px`,s.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==i||s.height!==o||s.width!==a)&&(t.currentDevicePixelRatio=i,s.height=o,s.width=a,t.ctx.setTransform(i,0,0,i,0,0),!0)}const He=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 $e(t,e){const n=function(t,e){return Fe(t).getPropertyValue(e)}(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Ue(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}}function Ye(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:"middle"===i?n<.5?t.y:e.y:"after"===i?n<1?t.y:e.y:n>0?e.y:t.y}}function Xe(t,e,n,i){const o={x:t.cp2x,y:t.cp2y},a={x:e.cp1x,y:e.cp1y},s=Ue(t,o,n),r=Ue(o,a,n),l=Ue(a,e,n),c=Ue(s,r,n),d=Ue(r,l,n);return Ue(c,d,n)}const qe=new Map;function Ze(t,e,n){return function(t,e){e=e||{};const n=t+JSON.stringify(e);let i=qe.get(n);return i||(i=new Intl.NumberFormat(t,e),qe.set(n,i)),i}(e,n).format(t)}function Ke(t,e,n){return t?function(t,e){return{x:n=>t+t+e-n,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,n):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ge(t){return"angle"===t?{between:Q,compare:K,normalize:G}:{between:(t,e,n)=>t>=Math.min(e,n)&&t<=Math.max(n,e),compare:(t,e)=>t-e,normalize:t=>t}}function Qe({start:t,end:e,count:n,loop:i,style:o}){return{start:t%n,end:e%n,loop:i&&(e-t+1)%n==0,style:o}}function Je(t,e,n){if(!n)return[t];const{property:i,start:o,end:a}=n,s=e.length,{compare:r,between:l,normalize:c}=Ge(i),{start:d,end:h,loop:u,style:f}=function(t,e,n){const{property:i,start:o,end:a}=n,{between:s,normalize:r}=Ge(i),l=e.length;let c,d,{start:h,end:u,loop:f}=t;if(f){for(h+=l,u+=l,c=0,d=l;c<d&&s(r(e[h%l][i]),o,a);++c)h--,u--;h%=l,u%=l}return u<h&&(u+=l),{start:h,end:u,loop:f,style:t.style}}(t,e,n),g=[];let p,m,b,x=!1,y=null;for(let t=d,n=d;t<=h;++t)m=e[t%s],m.skip||(p=c(m[i]),p!==b&&(x=l(p,o,a),null===y&&(x||l(o,b,p)&&0!==r(o,b))&&(y=0===r(p,o)?t:n),null!==y&&(!x||0===r(a,p)||l(a,b,p))&&(g.push(Qe({start:y,end:t,loop:u,count:s,style:f})),y=null),n=t,b=p));return null!==y&&g.push(Qe({start:y,end:h,loop:u,count:s,style:f})),g}function tn(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function en(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var nn=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,i){const o=e.listeners[i],a=e.duration;o.forEach((i=>i({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(n-e.start,a)})))}_refresh(){const t=this;t._request||(t._running=!0,t._request=r.call(window,(()=>{t._update(),t._request=null,t._running&&t._refresh()})))}_update(t=Date.now()){const e=this;let n=0;e._charts.forEach(((i,o)=>{if(!i.running||!i.items.length)return;const a=i.items;let s,r=a.length-1,l=!1;for(;r>=0;--r)s=a[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),l=!0):(a[r]=a[a.length-1],a.pop());l&&(o.draw(),e._notify(o,i,t,"progress")),a.length||(i.running=!1,e._notify(o,i,t,"complete"),i.initial=!1),n+=a.length})),e._lastDate=t,0===n&&(e._running=!1)}_getAnims(t){const e=this._charts;let n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}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 n=e.items;let i=n.length-1;for(;i>=0;--i)n[i].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};const on="transparent",an={boolean:(t,e,n)=>n>.5?e:t,color(t,e,n){const i=Lt(t||on),o=i.valid&&Lt(e||on);return o&&o.valid?o.mix(i,n).hexString():e},number:(t,e,n)=>t+(e-t)*n};class sn{constructor(t,e,n,i){const o=e[n];i=le([t.to,i,o,t.from]);const a=le([t.from,o,i]);this._active=!0,this._fn=t.fn||an[t.type||typeof a],this._easing=it[t.easing]||it.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=n,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(t,e,n){const i=this;if(i._active){i._notify(!1);const o=i._target[i._prop],a=n-i._start,s=i._duration-a;i._start=n,i._duration=Math.floor(Math.max(s,t.duration)),i._total+=a,i._loop=!!t.loop,i._to=le([t.to,e,o,t.from]),i._from=le([t.from,o,e])}}cancel(){const t=this;t._active&&(t.tick(Date.now()),t._active=!1,t._notify(!1))}tick(t){const e=this,n=t-e._start,i=e._duration,o=e._prop,a=e._from,s=e._loop,r=e._to;let l;if(e._active=a!==r&&(s||n<i),!e._active)return e._target[o]=r,void e._notify(!0);n<0?e._target[o]=a:(l=n/i%2,l=s&&l>1?2-l:l,l=e._easing(Math.min(1,Math.max(0,l))),e._target[o]=e._fn(a,r,l))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,n)=>{t.push({res:e,rej:n})}))}_notify(t){const e=t?"res":"rej",n=this._promises||[];for(let t=0;t<n.length;t++)n[t][e]()}}jt.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 rn=Object.keys(jt.animation);jt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),jt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),jt.describe("animations",{_fallback:"animation"}),jt.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 ln{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!f(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const i=t[n];if(!f(i))return;const o={};for(const t of rn)o[t]=i[t];(u(i.properties)&&i.properties||[n]).forEach((t=>{t!==n&&e.has(t)||e.set(t,o)}))}))}_animateOptions(t,e){const n=e.options,i=function(t,e){if(!e)return;let n=t.options;if(n)return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n;t.options=e}(t,n);if(!i)return[];const o=this._createAnimations(i,n);return n.$shared&&function(t,e){const n=[],i=Object.keys(e);for(let e=0;e<i.length;e++){const o=t[i[e]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}(t.options.$animations,n).then((()=>{t.options=n}),(()=>{})),o}_createAnimations(t,e){const n=this._properties,i=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),s=Date.now();let r;for(r=a.length-1;r>=0;--r){const l=a[r];if("$"===l.charAt(0))continue;if("options"===l){i.push(...this._animateOptions(t,e));continue}const c=e[l];let d=o[l];const h=n.get(l);if(d){if(h&&d.active()){d.update(h,c,s);continue}d.cancel()}h&&h.duration?(o[l]=d=new sn(h,t,l,c),i.push(d)):t[l]=c}return i}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const n=this._createAnimations(t,e);return n.length?(nn.add(this._chart,n),!0):void 0}}function cn(t,e){const n=t&&t.options||{},i=n.reverse,o=void 0===n.min?e:0,a=void 0===n.max?e:0;return{start:i?a:o,end:i?o:a}}function dn(t,e){const n=[],i=t._getSortedDatasetMetas(e);let o,a;for(o=0,a=i.length;o<a;++o)n.push(i[o].index);return n}function hn(t,e,n,i){const o=t.keys,a="single"===i.mode;let s,r,l,c;if(null!==e){for(s=0,r=o.length;s<r;++s){if(l=+o[s],l===n){if(i.all)continue;break}c=t.values[l],g(c)&&(a||0===e||W(e)===W(c))&&(e+=c)}return e}}function un(t,e){const n=t&&t.options.stacked;return n||void 0===n&&void 0!==e.stack}function fn(t,e,n){const i=t[e]||(t[e]={});return i[n]||(i[n]={})}function gn(t,e,n){for(const i of e.getMatchingVisibleMetas("bar").reverse()){const e=t[i.index];if(n&&e>0||!n&&e<0)return i.index}return null}function pn(t,e){const{chart:n,_cachedMeta:i}=t,o=n._stacks||(n._stacks={}),{iScale:a,vScale:s,index:r}=i,l=a.axis,c=s.axis,d=function(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}(a,s,i),h=e.length;let u;for(let t=0;t<h;++t){const n=e[t],{[l]:i,[c]:a}=n;u=(n._stacks||(n._stacks={}))[c]=fn(o,d,i),u[r]=a,u._top=gn(u,s,!0),u._bottom=gn(u,s,!1)}}function mn(t,e){const n=t.scales;return Object.keys(n).filter((t=>n[t].axis===e)).shift()}function bn(t,e){const n=t.controller.index,i=t.vScale&&t.vScale.axis;if(i){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[i]||void 0===e[i][n])return;delete e[i][n]}}}const xn=t=>"reset"===t||"none"===t,yn=(t,e)=>e?t:Object.assign({},t);class _n{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,e=t._cachedMeta;t.configure(),t.linkScales(),e._stacked=un(e.vScale,e),t.addElements()}updateIndex(t){this.index!==t&&bn(this._cachedMeta),this.index=t}linkScales(){const t=this,e=t.chart,n=t._cachedMeta,i=t.getDataset(),o=(t,e,n,i)=>"x"===t?e:"r"===t?i:n,a=n.xAxisID=m(i.xAxisID,mn(e,"x")),s=n.yAxisID=m(i.yAxisID,mn(e,"y")),r=n.rAxisID=m(i.rAxisID,mn(e,"r")),l=n.indexAxis,c=n.iAxisID=o(l,a,s,r),d=n.vAxisID=o(l,s,a,r);n.xScale=t.getScaleForId(a),n.yScale=t.getScaleForId(s),n.rScale=t.getScaleForId(r),n.iScale=t.getScaleForId(c),n.vScale=t.getScaleForId(d)}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&&fe(this._data,this),t._stacked&&bn(t)}_dataCheck(){const t=this,e=t.getDataset(),n=e.data||(e.data=[]),i=t._data;if(f(n))t._data=function(t){const e=Object.keys(t),n=new Array(e.length);let i,o,a;for(i=0,o=e.length;i<o;++i)a=e[i],n[i]={x:a,y:t[a]};return n}(n);else if(i!==n){if(i){fe(i,t);const e=t._cachedMeta;bn(e),e._parsed=[]}n&&Object.isExtensible(n)&&(a=t,(o=n)._chartjs?o._chartjs.listeners.push(a):(Object.defineProperty(o,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[a]}}),ue.forEach((t=>{const e="_onData"+O(t),n=o[t];Object.defineProperty(o,t,{configurable:!0,enumerable:!1,value(...t){const i=n.apply(this,t);return o._chartjs.listeners.forEach((n=>{"function"==typeof n[e]&&n[e](...t)})),i}})})))),t._syncList=[],t._data=n}var o,a}addElements(){const t=this,e=t._cachedMeta;t._dataCheck(),t.datasetElementType&&(e.dataset=new t.datasetElementType)}buildOrUpdateElements(t){const e=this,n=e._cachedMeta,i=e.getDataset();let o=!1;e._dataCheck();const a=n._stacked;n._stacked=un(n.vScale,n),n.stack!==i.stack&&(o=!0,bn(n),n.stack=i.stack),e._resyncElements(t),(o||a!==n._stacked)&&pn(e,n._parsed)}configure(){const t=this,e=t.chart.config,n=e.datasetScopeKeys(t._type),i=e.getOptionScopes(t.getDataset(),n,!0);t.options=e.createResolver(i,t.getContext()),t._parsing=t.options.parsing}parse(t,e){const n=this,{_cachedMeta:i,_data:o}=n,{iScale:a,_stacked:s}=i,r=a.axis;let l,c,d,h=0===t&&e===o.length||i._sorted,g=t>0&&i._parsed[t-1];if(!1===n._parsing)i._parsed=o,i._sorted=!0,d=o;else{d=u(o[t])?n.parseArrayData(i,o,t,e):f(o[t])?n.parseObjectData(i,o,t,e):n.parsePrimitiveData(i,o,t,e);const a=()=>null===c[r]||g&&c[r]<g[r];for(l=0;l<e;++l)i._parsed[l+t]=c=d[l],h&&(a()&&(h=!1),g=c);i._sorted=h}s&&pn(n,d)}parsePrimitiveData(t,e,n,i){const{iScale:o,vScale:a}=t,s=o.axis,r=a.axis,l=o.getLabels(),c=o===a,d=new Array(i);let h,u,f;for(h=0,u=i;h<u;++h)f=h+n,d[h]={[s]:c||o.parse(l[f],f),[r]:a.parse(e[f],f)};return d}parseArrayData(t,e,n,i){const{xScale:o,yScale:a}=t,s=new Array(i);let r,l,c,d;for(r=0,l=i;r<l;++r)c=r+n,d=e[c],s[r]={x:o.parse(d[0],c),y:a.parse(d[1],c)};return s}parseObjectData(t,e,n,i){const{xScale:o,yScale:a}=t,{xAxisKey:s="x",yAxisKey:r="y"}=this._parsing,l=new Array(i);let c,d,h,u;for(c=0,d=i;c<d;++c)h=c+n,u=e[h],l[c]={x:o.parse(P(u,s),h),y:a.parse(P(u,r),h)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){const i=this.chart,o=this._cachedMeta,a=e[t.axis];return hn({keys:dn(i,!0),values:e._stacks[t.axis]},a,o.index,{mode:n})}updateRangeFromParsed(t,e,n,i){const o=n[e.axis];let a=null===o?NaN:o;const s=i&&n._stacks[e.axis];i&&s&&(i.values=s,t.min=Math.min(t.min,a),t.max=Math.max(t.max,a),a=hn(i,o,this._cachedMeta.index,{all:!0})),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const n=this,i=n._cachedMeta,o=i._parsed,a=i._sorted&&t===i.iScale,s=o.length,r=n._getOtherScale(t),l=e&&i._stacked&&{keys:dn(n.chart,!0),values:null},c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=function(t){const{min:e,max:n,minDefined:i,maxDefined:o}=t.getUserBounds();return{min:i?e:Number.NEGATIVE_INFINITY,max:o?n:Number.POSITIVE_INFINITY}}(r);let u,f,p,m;function b(){return p=o[u],f=p[t.axis],m=p[r.axis],!g(f)||d>m||h<m}for(u=0;u<s&&(b()||(n.updateRangeFromParsed(c,t,p,l),!a));++u);if(a)for(u=s-1;u>=0;--u)if(!b()){n.updateRangeFromParsed(c,t,p,l);break}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let i,o,a;for(i=0,o=e.length;i<o;++i)a=e[i][t.axis],g(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,n=e.iScale,i=e.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(t){const e=this,n=e._cachedMeta;e.configure(),e._cachedDataOpts={},e.update(t||"default"),n._clip=function(t){let e,n,i,o;return f(t)?(e=t.top,n=t.right,i=t.bottom,o=t.left):e=n=i=o=t,{top:e,right:n,bottom:i,left:o,disabled:!1===t}}(m(e.options.clip,function(t,e,n){if(!1===n)return!1;const i=cn(t,n),o=cn(e,n);return{top:o.end,right:i.end,bottom:o.start,left:i.start}}(n.xScale,n.yScale,e.getMaxOverflow())))}update(t){}draw(){const t=this,e=t._ctx,n=t.chart,i=t._cachedMeta,o=i.data||[],a=n.chartArea,s=[],r=t._drawStart||0,l=t._drawCount||o.length-r;let c;for(i.dataset&&i.dataset.draw(e,a,r,l),c=r;c<r+l;++c){const t=o[c];t.hidden||(t.active?s.push(t):t.draw(e,a))}for(c=0;c<s.length;++c)s[c].draw(e,a)}getStyle(t,e){const n=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){const i=this,o=i.getDataset();let a;if(t>=0&&t<i._cachedMeta.data.length){const e=i._cachedMeta.data[t];a=e.$context||(e.$context=function(t,e,n){return Object.assign(Object.create(t),{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}(i.getContext(),t,e)),a.parsed=i.getParsed(t),a.raw=o.data[t],a.index=a.dataIndex=t}else a=i.$context||(i.$context=function(t,e){return Object.assign(Object.create(t),{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(i.chart.getContext(),i.index)),a.dataset=o,a.index=a.datasetIndex=i.index;return a.active=!!e,a.mode=n,a}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){const i=this,o="active"===e,a=i._cachedDataOpts,s=t+"-"+e,r=a[s],l=i.enableOptionSharing&&A(n);if(r)return yn(r,l);const c=i.chart.config,d=c.datasetElementScopeKeys(i._type,t),h=o?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(i.getDataset(),d),f=Object.keys(jt.elements[t]),g=c.resolveNamedOptions(u,f,(()=>i.getContext(n,o)),h);return g.$shared&&(g.$shared=l,a[s]=Object.freeze(yn(g,l))),g}_resolveAnimations(t,e,n){const i=this,o=i.chart,a=i._cachedDataOpts,s=`animation-${e}`,r=a[s];if(r)return r;let l;if(!1!==o.options.animation){const o=i.chart.config,a=o.datasetAnimationScopeKeys(i._type,e),s=o.getOptionScopes(i.getDataset(),a);l=o.createResolver(s,i.getContext(t,n,e))}const c=new ln(o,l&&l.animations);return l&&l._cacheable&&(a[s]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||xn(t)||this.chart._animationsDisabled}updateElement(t,e,n,i){xn(i)?Object.assign(t,n):this._resolveAnimations(e,i).update(t,n)}updateSharedOptions(t,e,n){t&&!xn(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,i){t.active=i;const o=this.getStyle(e,i);this._resolveAnimations(e,n,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"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,n=e._data,i=e._cachedMeta.data;for(const[t,n,i]of e._syncList)e[t](n,i);e._syncList=[];const o=i.length,a=n.length,s=Math.min(a,o);s&&e.parse(0,s),a>o?e._insertElements(o,a-o,t):a<o&&e._removeElements(a,o-a)}_insertElements(t,e,n=!0){const i=this,o=i._cachedMeta,a=o.data,s=t+e;let r;const l=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(l(a),r=t;r<s;++r)a[r]=new i.dataElementType;i._parsing&&l(o._parsed),i.parse(t,e),n&&i.updateElements(a,t,e,"reset")}updateElements(t,e,n,i){}_removeElements(t,e){const n=this._cachedMeta;if(this._parsing){const i=n._parsed.splice(t,e);n._stacked&&bn(n,i)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,n,i]=t;this[e](n,i)}}_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){this._sync(["_removeElements",t,e]),this._sync(["_insertElements",t,arguments.length-2])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function vn(t){const e=function(t){if(!t._cache.$bar){const e=t.getMatchingVisibleMetas("bar");let n=[];for(let i=0,o=e.length;i<o;i++)n=n.concat(e[i].controller.getAllParsedValues(t));t._cache.$bar=ge(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(t);let n,i,o,a,s=t._length;const r=()=>{32767!==o&&-32768!==o&&(A(a)&&(s=Math.min(s,Math.abs(o-a)||s)),a=o)};for(n=0,i=e.length;n<i;++n)o=t.getPixelForValue(e[n]),r();for(a=void 0,n=0,i=t.ticks.length;n<i;++n)o=t.getPixelForTick(n),r();return s}function wn(t,e,n,i){return u(t)?function(t,e,n,i){const o=n.parse(t[0],i),a=n.parse(t[1],i),s=Math.min(o,a),r=Math.max(o,a);let l=s,c=r;Math.abs(s)>Math.abs(r)&&(l=r,c=s),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:a,min:s,max:r}}(t,e,n,i):e[n.axis]=n.parse(t,i),e}function Mn(t,e,n,i){const o=t.iScale,a=t.vScale,s=o.getLabels(),r=o===a,l=[];let c,d,h,u;for(c=n,d=n+i;c<d;++c)u=e[c],h={},h[o.axis]=r||o.parse(s[c],c),l.push(wn(u,h,a,c));return l}function kn(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Sn(t,e,n,i){let o=e.borderSkipped;const a={};if(!o)return void(t.borderSkipped=a);const{start:s,end:r,reverse:l,top:c,bottom:d}=function(t){let e,n,i,o,a;return t.horizontal?(e=t.base>t.x,n="left",i="right"):(e=t.base<t.y,n="bottom",i="top"),e?(o="end",a="start"):(o="start",a="end"),{start:n,end:i,reverse:e,top:o,bottom:a}}(t);"middle"===o&&n&&(t.enableBorderRadius=!0,(n._top||0)===i?o=c:(n._bottom||0)===i?o=d:(a[Cn(d,s,r,l)]=!0,o=c)),a[Cn(o,s,r,l)]=!0,t.borderSkipped=a}function Cn(t,e,n,i){var o,a,s;return i?(s=n,t=Dn(t=(o=t)===(a=e)?s:o===s?a:o,n,e)):t=Dn(t,e,n),t}function Dn(t,e,n){return"start"===t?e:"end"===t?n:t}_n.defaults={},_n.prototype.datasetElementType=null,_n.prototype.dataElementType=null;class Pn extends _n{parsePrimitiveData(t,e,n,i){return Mn(t,e,n,i)}parseArrayData(t,e,n,i){return Mn(t,e,n,i)}parseObjectData(t,e,n,i){const{iScale:o,vScale:a}=t,{xAxisKey:s="x",yAxisKey:r="y"}=this._parsing,l="x"===o.axis?s:r,c="x"===a.axis?s:r,d=[];let h,u,f,g;for(h=n,u=n+i;h<u;++h)g=e[h],f={},f[o.axis]=o.parse(P(g,l),h),d.push(wn(P(g,c),f,a,h));return d}updateRangeFromParsed(t,e,n,i){super.updateRangeFromParsed(t,e,n,i);const o=n._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:n,vScale:i}=e,o=this.getParsed(t),a=o._custom,s=kn(a)?"["+a.start+", "+a.end+"]":""+i.getLabelForValue(o[i.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:s}}initialize(){const t=this;t.enableOptionSharing=!0,super.initialize(),t._cachedMeta.stack=t.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,i){const o=this,a="reset"===i,{index:s,_cachedMeta:{vScale:r}}=o,l=r.getBasePixel(),c=r.isHorizontal(),d=o._getRuler(),u=o.resolveDataElementOptions(e,i),f=o.getSharedOptions(u),g=o.includeOptions(i,f);o.updateSharedOptions(f,i,u);for(let u=e;u<e+n;u++){const e=o.getParsed(u),n=a||h(e[r.axis])?{base:l,head:l}:o._calculateBarValuePixels(u),p=o._calculateBarIndexPixels(u,d),m=(e._stacks||{})[r.axis],b={horizontal:c,base:n.base,enableBorderRadius:!m||kn(e._custom)||s===m._top||s===m._bottom,x:c?n.head:p.center,y:c?p.center:n.head,height:c?p.size:Math.abs(n.size),width:c?Math.abs(n.size):p.size};g&&(b.options=f||o.resolveDataElementOptions(u,t[u].active?"active":i)),Sn(b,b.options||t[u].options,m,s),o.updateElement(t[u],u,b,i)}}_getStacks(t,e){const n=this._cachedMeta.iScale,i=n.getMatchingVisibleMetas(this._type),o=n.options.stacked,a=i.length,s=[];let r,l;for(r=0;r<a;++r)if(l=i[r],l.controller.options.grouped){if(void 0!==e){const t=l.controller.getParsed(e)[l.controller._cachedMeta.vScale.axis];if(h(t)||isNaN(t))continue}if((!1===o||-1===s.indexOf(l.stack)||void 0===o&&void 0===l.stack)&&s.push(l.stack),l.index===t)break}return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const i=this._getStacks(t,n),o=void 0!==e?i.indexOf(e):-1;return-1===o?i.length-1:o}_getRuler(){const t=this,e=t.options,n=t._cachedMeta,i=n.iScale,o=[];let a,s;for(a=0,s=n.data.length;a<s;++a)o.push(i.getPixelForValue(t.getParsed(a)[i.axis],a));const r=e.barThickness;return{min:r||vn(i),pixels:o,start:i._startPixel,end:i._endPixel,stackCount:t._getStackCount(),scale:i,grouped:e.grouped,ratio:r?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(t){const e=this,{_cachedMeta:{vScale:n,_stacked:i},options:{base:o,minBarLength:a}}=e,s=o||0,r=e.getParsed(t),l=r._custom,c=kn(l);let d,u,f=r[n.axis],g=0,p=i?e.applyStack(n,r,i):f;p!==f&&(g=p-f,p=f),c&&(f=l.barStart,p=l.barEnd-l.barStart,0!==f&&W(f)!==W(l.barEnd)&&(g=0),g+=f);const m=h(o)||c?g:o;let b=n.getPixelForValue(m);if(d=e.chart.getDataVisibility(t)?n.getPixelForValue(g+p):b,u=d-b,Math.abs(u)<a&&(u=function(t,e,n){return 0!==t?W(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}(u,n,s)*a,f===s&&(b-=u/2),d=b+u),b===n.getPixelForValue(s)){const t=W(u)*n.getLineWidthForValue(s)/2;b+=t,u-=t}return{size:u,base:b,head:d,center:d+u/2}}_calculateBarIndexPixels(t,e){const n=this,i=e.scale,o=n.options,a=o.skipNull,s=m(o.maxBarThickness,1/0);let r,l;if(e.grouped){const i=a?n._getStackCount(t):e.stackCount,c="flex"===o.barThickness?function(t,e,n,i){const o=e.pixels,a=o[t];let s=t>0?o[t-1]:null,r=t<o.length-1?o[t+1]:null;const l=n.categoryPercentage;null===s&&(s=a-(null===r?e.end-e.start:r-a)),null===r&&(r=a+a-s);const c=a-(a-Math.min(s,r))/2*l;return{chunk:Math.abs(r-s)/2*l/i,ratio:n.barPercentage,start:c}}(t,e,o,i):function(t,e,n,i){const o=n.barThickness;let a,s;return h(o)?(a=e.min*n.categoryPercentage,s=n.barPercentage):(a=o*i,s=1),{chunk:a/i,ratio:s,start:e.pixels[t]-a/2}}(t,e,o,i),d=n._getStackIndex(n.index,n._cachedMeta.stack,a?t:void 0);r=c.start+c.chunk*d+c.chunk/2,l=Math.min(s,c.chunk*c.ratio)}else r=i.getPixelForValue(n.getParsed(t)[i.axis],t),l=Math.min(s,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this,e=t._cachedMeta,n=e.vScale,i=e.data,o=i.length;let a=0;for(;a<o;++a)null!==t.getParsed(a)[n.axis]&&i[a].draw(t._ctx)}}Pn.id="bar",Pn.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},Pn.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class On extends _n{initialize(){this.enableOptionSharing=!0,super.initialize()}parseObjectData(t,e,n,i){const{xScale:o,yScale:a}=t,{xAxisKey:s="x",yAxisKey:r="y"}=this._parsing,l=[];let c,d,h;for(c=n,d=n+i;c<d;++c)h=e[c],l.push({x:o.parse(P(h,s),c),y:a.parse(P(h,r),c),_custom:h&&h.r&&+h.r});return l}getMaxOverflow(){const{data:t,_parsed:e}=this._cachedMeta;let n=0;for(let i=t.length-1;i>=0;--i)n=Math.max(n,t[i].size()/2,e[i]._custom);return n>0&&n}getLabelAndValue(t){const e=this._cachedMeta,{xScale:n,yScale:i}=e,o=this.getParsed(t),a=n.getLabelForValue(o.x),s=i.getLabelForValue(o.y),r=o._custom;return{label:e.label,value:"("+a+", "+s+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,i){const o=this,a="reset"===i,{iScale:s,vScale:r}=o._cachedMeta,l=o.resolveDataElementOptions(e,i),c=o.getSharedOptions(l),d=o.includeOptions(i,c),h=s.axis,u=r.axis;for(let l=e;l<e+n;l++){const e=t[l],n=!a&&o.getParsed(l),c={},f=c[h]=a?s.getPixelForDecimal(.5):s.getPixelForValue(n[h]),g=c[u]=a?r.getBasePixel():r.getPixelForValue(n[u]);c.skip=isNaN(f)||isNaN(g),d&&(c.options=o.resolveDataElementOptions(l,e.active?"active":i),a&&(c.options.radius=0)),o.updateElement(e,l,c,i)}o.updateSharedOptions(c,i,l)}resolveDataElementOptions(t,e){const n=this.getParsed(t);let i=super.resolveDataElementOptions(t,e);i.$shared&&(i=Object.assign({},i,{$shared:!1}));const o=i.radius;return"active"!==e&&(i.radius=0),i.radius+=m(n&&n._custom,o),i}}On.id="bubble",On.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},On.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class An extends _n{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 n=this.getDataset().data,i=this._cachedMeta;let o,a;for(o=t,a=t+e;o<a;++o)i._parsed[o]=+n[o]}_getRotation(){return Y(this.options.rotation-90)}_getCircumference(){return Y(this.options.circumference)}_getRotationExtents(){let t=R,e=-R;const n=this;for(let i=0;i<n.chart.data.datasets.length;++i)if(n.chart.isDatasetVisible(i)){const o=n.chart.getDatasetMeta(i).controller,a=o._getRotation(),s=o._getCircumference();t=Math.min(t,a),e=Math.max(e,a+s)}return{rotation:t,circumference:e-t}}update(t){const e=this,n=e.chart,{chartArea:i}=n,o=e._cachedMeta,a=o.data,s=e.getMaxBorderWidth()+e.getMaxOffset(a)+e.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),l=Math.min((d=r,"string"==typeof(c=e.options.cutout)&&c.endsWith("%")?parseFloat(c)/100:c/d),1);var c,d;const h=e._getRingWeight(e.index),{circumference:u,rotation:f}=e._getRotationExtents(),{ratioX:g,ratioY:p,offsetX:m,offsetY:x}=function(t,e,n){let i=1,o=1,a=0,s=0;if(e<R){const r=t,l=r+e,c=Math.cos(r),d=Math.sin(r),h=Math.cos(l),u=Math.sin(l),f=(t,e,i)=>Q(t,r,l,!0)?1:Math.max(e,e*n,i,i*n),g=(t,e,i)=>Q(t,r,l,!0)?-1:Math.min(e,e*n,i,i*n),p=f(0,c,h),m=f(F,d,u),b=g(E,c,h),x=g(E+F,d,u);i=(p-b)/2,o=(m-x)/2,a=-(p+b)/2,s=-(m+x)/2}return{ratioX:i,ratioY:o,offsetX:a,offsetY:s}}(f,u,l),y=(i.width-s)/g,_=(i.height-s)/p,v=Math.max(Math.min(y,_)/2,0),w=b(e.options.radius,v),M=(w-Math.max(w*l,0))/e._getVisibleDatasetWeightTotal();e.offsetX=m*w,e.offsetY=x*w,o.total=e.calculateTotal(),e.outerRadius=w-M*e._getRingWeightOffset(e.index),e.innerRadius=Math.max(e.outerRadius-M*h,0),e.updateElements(a,0,a.length,t)}_circumference(t,e){const n=this,i=n.options,o=n._cachedMeta,a=n._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===o._parsed[t]||o.data[t].hidden?0:n.calculateCircumference(o._parsed[t]*a/R)}updateElements(t,e,n,i){const o=this,a="reset"===i,s=o.chart,r=s.chartArea,l=s.options.animation,c=(r.left+r.right)/2,d=(r.top+r.bottom)/2,h=a&&l.animateScale,u=h?0:o.innerRadius,f=h?0:o.outerRadius,g=o.resolveDataElementOptions(e,i),p=o.getSharedOptions(g),m=o.includeOptions(i,p);let b,x=o._getRotation();for(b=0;b<e;++b)x+=o._circumference(b,a);for(b=e;b<e+n;++b){const e=o._circumference(b,a),n=t[b],s={x:c+o.offsetX,y:d+o.offsetY,startAngle:x,endAngle:x+e,circumference:e,outerRadius:f,innerRadius:u};m&&(s.options=p||o.resolveDataElementOptions(b,n.active?"active":i)),x+=e,o.updateElement(n,b,s,i)}o.updateSharedOptions(p,i,g)}calculateTotal(){const t=this._cachedMeta,e=t.data;let n,i=0;for(n=0;n<e.length;n++){const o=t._parsed[n];null===o||isNaN(o)||!this.chart.getDataVisibility(n)||e[n].hidden||(i+=Math.abs(o))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?R*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,i=n.data.labels||[],o=Ze(e._parsed[t],n.options.locale);return{label:i[t]||"",value:o}}getMaxBorderWidth(t){const e=this;let n=0;const i=e.chart;let o,a,s,r,l;if(!t)for(o=0,a=i.data.datasets.length;o<a;++o)if(i.isDatasetVisible(o)){s=i.getDatasetMeta(o),t=s.data,r=s.controller,r!==e&&r.configure();break}if(!t)return 0;for(o=0,a=t.length;o<a;++o)l=r.resolveDataElementOptions(o),"inner"!==l.borderAlign&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let e=0;for(let n=0,i=t.length;n<i;++n){const t=this.resolveDataElementOptions(n);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(m(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}An.id="doughnut",An.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"},An.descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t},An.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n}}=t.legend.options;return e.labels.map(((e,i)=>{const o=t.getDatasetMeta(0).controller.getStyle(i);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(i),index:i}}))}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const n=": "+t.formattedValue;return u(e)?(e=e.slice(),e[0]+=n):e+=n,e}}}}};class Tn extends _n{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this,n=e._cachedMeta,{dataset:i,data:o=[],_dataset:a}=n,s=e.chart._animationsDisabled;let{start:r,count:l}=function(t,e,n){const i=e.length;let o=0,a=i;if(t._sorted){const{iScale:s,_parsed:r}=t,l=s.axis,{min:c,max:d,minDefined:h,maxDefined:u}=s.getUserBounds();h&&(o=J(Math.min(de(r,s.axis,c).lo,n?i:de(e,l,s.getPixelForValue(c)).lo),0,i-1)),a=u?J(Math.max(de(r,s.axis,d).hi+1,n?0:de(e,l,s.getPixelForValue(d)).hi+1),o,i)-o:i-o}return{start:o,count:a}}(n,o,s);e._drawStart=r,e._drawCount=l,function(t){const{xScale:e,yScale:n,_scaleRanges:i}=t,o={xmin:e.min,xmax:e.max,ymin:n.min,ymax:n.max};if(!i)return t._scaleRanges=o,!0;const a=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,o),a}(n)&&(r=0,l=o.length),i._datasetIndex=e.index,i._decimated=!!a._decimated,i.points=o;const c=e.resolveDatasetElementOptions(t);e.options.showLine||(c.borderWidth=0),c.segment=e.options.segment,e.updateElement(i,void 0,{animated:!s,options:c},t),e.updateElements(o,r,l,t)}updateElements(t,e,n,i){const o=this,a="reset"===i,{iScale:s,vScale:r,_stacked:l}=o._cachedMeta,c=o.resolveDataElementOptions(e,i),d=o.getSharedOptions(c),u=o.includeOptions(i,d),f=s.axis,g=r.axis,p=o.options.spanGaps,m=H(p)?p:Number.POSITIVE_INFINITY,b=o.chart._animationsDisabled||a||"none"===i;let x=e>0&&o.getParsed(e-1);for(let c=e;c<e+n;++c){const e=t[c],n=o.getParsed(c),p=b?e:{},y=h(n[g]),_=p[f]=s.getPixelForValue(n[f],c),v=p[g]=a||y?r.getBasePixel():r.getPixelForValue(l?o.applyStack(r,n,l):n[g],c);p.skip=isNaN(_)||isNaN(v)||y,p.stop=c>0&&n[f]-x[f]>m,p.parsed=n,u&&(p.options=d||o.resolveDataElementOptions(c,e.active?"active":i)),b||o.updateElement(e,c,p,i),x=n}o.updateSharedOptions(d,i,c)}getMaxOverflow(){const t=this,e=t._cachedMeta,n=e.dataset,i=n.options&&n.options.borderWidth||0,o=e.data||[];if(!o.length)return i;const a=o[0].size(t.resolveDataElementOptions(0)),s=o[o.length-1].size(t.resolveDataElementOptions(o.length-1));return Math.max(i,a,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Tn.id="line",Tn.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Tn.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class En extends _n{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart,i=n.data.labels||[],o=Ze(e._parsed[t].r,n.options.locale);return{label:i[t]||"",value:o}}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this,e=t.chart,n=e.chartArea,i=e.options,o=Math.min(n.right-n.left,n.bottom-n.top),a=Math.max(o/2,0),s=(a-Math.max(i.cutoutPercentage?a/100*i.cutoutPercentage:1,0))/e.getVisibleDatasetCount();t.outerRadius=a-s*t.index,t.innerRadius=t.outerRadius-s}updateElements(t,e,n,i){const o=this,a="reset"===i,s=o.chart,r=o.getDataset(),l=s.options.animation,c=o._cachedMeta.rScale,d=c.xCenter,h=c.yCenter,u=c.getIndexAngle(0)-.5*E;let f,g=u;const p=360/o.countVisibleElements();for(f=0;f<e;++f)g+=o._computeAngle(f,i,p);for(f=e;f<e+n;f++){const e=t[f];let n=g,m=g+o._computeAngle(f,i,p),b=s.getDataVisibility(f)?c.getDistanceFromCenterForValue(r.data[f]):0;g=m,a&&(l.animateScale&&(b=0),l.animateRotate&&(n=m=u));const x={x:d,y:h,innerRadius:0,outerRadius:b,startAngle:n,endAngle:m,options:o.resolveDataElementOptions(f,e.active?"active":i)};o.updateElement(e,f,x,i)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let n=0;return e.data.forEach(((e,i)=>{!isNaN(t.data[i])&&this.chart.getDataVisibility(i)&&n++})),n}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?Y(this.resolveDataElementOptions(t,e).angle||n):0}}En.id="polarArea",En.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},En.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n}}=t.legend.options;return e.labels.map(((e,i)=>{const o=t.getDatasetMeta(0).controller.getStyle(i);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(i),index:i}}))}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.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 Rn extends An{}Rn.id="pie",Rn.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Ln extends _n{getLabelAndValue(t){const e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}update(t){const e=this,n=e._cachedMeta,i=n.dataset,o=n.data||[],a=n.iScale.getLabels();if(i.points=o,"resize"!==t){const n=e.resolveDatasetElementOptions(t);e.options.showLine||(n.borderWidth=0);const s={_loop:!0,_fullLoop:a.length===o.length,options:n};e.updateElement(i,void 0,s,t)}e.updateElements(o,0,o.length,t)}updateElements(t,e,n,i){const o=this,a=o.getDataset(),s=o._cachedMeta.rScale,r="reset"===i;for(let l=e;l<e+n;l++){const e=t[l],n=o.resolveDataElementOptions(l,e.active?"active":i),c=s.getPointPositionForValue(l,a.data[l]),d=r?s.xCenter:c.x,h=r?s.yCenter:c.y,u={x:d,y:h,angle:c.angle,skip:isNaN(d)||isNaN(h),options:n};o.updateElement(e,l,u,i)}}}Ln.id="radar",Ln.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},Ln.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class In extends Tn{}function zn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}In.id="scatter",In.defaults={showLine:!1,fill:!1},In.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};class Fn{constructor(t){this.options=t||{}}formats(){return zn()}parse(t,e){return zn()}format(t,e){return zn()}add(t,e,n){return zn()}diff(t,e,n){return zn()}startOf(t,e,n){return zn()}endOf(t,e){return zn()}}Fn.override=function(t){Object.assign(Fn.prototype,t)};var Vn={_date:Fn};function Bn(t,e){return"native"in t?{x:t.x,y:t.y}:je(t,e)}function jn(t,e,n,i){const{controller:o,data:a,_sorted:s}=t,r=o._cachedMeta.iScale;if(r&&e===r.axis&&s&&a.length){const t=r._reversePixels?he:de;if(!i)return t(a,e,n);if(o._sharedOptions){const i=a[0],o="function"==typeof i.getRange&&i.getRange(e);if(o){const i=t(a,e,n-o),s=t(a,e,n+o);return{lo:i.lo,hi:s.hi}}}}return{lo:0,hi:a.length-1}}function Wn(t,e,n,i,o){const a=t.getSortedVisibleDatasetMetas(),s=n[e];for(let t=0,n=a.length;t<n;++t){const{index:n,data:r}=a[t],{lo:l,hi:c}=jn(a[t],e,s,o);for(let t=l;t<=c;++t){const e=r[t];e.skip||i(e,n,t)}}}function Nn(t,e,n,i){const o=[];return Yt(e,t.chartArea,t._minPadding)?(Wn(t,n,e,(function(t,n,a){t.inRange(e.x,e.y,i)&&o.push({element:t,datasetIndex:n,index:a})}),!0),o):o}function Hn(t,e,n,i,o){const a=function(t){const e=-1!==t.indexOf("x"),n=-1!==t.indexOf("y");return function(t,i){const o=e?Math.abs(t.x-i.x):0,a=n?Math.abs(t.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}(n);let s=Number.POSITIVE_INFINITY,r=[];return Yt(e,t.chartArea,t._minPadding)?(Wn(t,n,e,(function(n,l,c){if(i&&!n.inRange(e.x,e.y,o))return;const d=n.getCenterPoint(o);if(!Yt(d,t.chartArea,t._minPadding)&&!n.inRange(e.x,e.y,o))return;const h=a(e,d);h<s?(r=[{element:n,datasetIndex:l,index:c}],s=h):h===s&&r.push({element:n,datasetIndex:l,index:c})})),r):r}function $n(t,e,n,i){const o=Bn(e,t),a=[],s=n.axis,r="x"===s?"inXRange":"inYRange";let l=!1;return function(t,e){const n=t.getSortedVisibleDatasetMetas();let i,o,a;for(let t=0,s=n.length;t<s;++t){({index:i,data:o}=n[t]);for(let t=0,n=o.length;t<n;++t)a=o[t],a.skip||e(a,i,t)}}(t,((t,e,n)=>{t[r](o[s],i)&&a.push({element:t,datasetIndex:e,index:n}),t.inRange(o.x,o.y,i)&&(l=!0)})),n.intersect&&!l?[]:a}var Un={modes:{index(t,e,n,i){const o=Bn(e,t),a=n.axis||"x",s=n.intersect?Nn(t,o,a,i):Hn(t,o,a,!1,i),r=[];return s.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=s[0].index,n=t.data[e];n&&!n.skip&&r.push({element:n,datasetIndex:t.index,index:e})})),r):[]},dataset(t,e,n,i){const o=Bn(e,t),a=n.axis||"xy";let s=n.intersect?Nn(t,o,a,i):Hn(t,o,a,!1,i);if(s.length>0){const e=s[0].datasetIndex,n=t.getDatasetMeta(e).data;s=[];for(let t=0;t<n.length;++t)s.push({element:n[t],datasetIndex:e,index:t})}return s},point:(t,e,n,i)=>Nn(t,Bn(e,t),n.axis||"xy",i),nearest:(t,e,n,i)=>Hn(t,Bn(e,t),n.axis||"xy",n.intersect,i),x:(t,e,n,i)=>(n.axis="x",$n(t,e,n,i)),y:(t,e,n,i)=>(n.axis="y",$n(t,e,n,i))}};const Yn=["left","top","right","bottom"];function Xn(t,e){return t.filter((t=>t.pos===e))}function qn(t,e){return t.filter((t=>-1===Yn.indexOf(t.pos)&&t.box.axis===e))}function Zn(t,e){return t.sort(((t,n)=>{const i=e?n:t,o=e?t:n;return i.weight===o.weight?i.index-o.index:i.weight-o.weight}))}function Kn(t,e,n,i){return Math.max(t[n],e[n])+Math.max(t[i],e[i])}function Gn(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 Qn(t,e,n,i){const{pos:o,box:a}=n,s=t.maxPadding;if(!f(o)){n.size&&(t[o]-=n.size);const e=i[n.stack]||{size:0,count:1};e.size=Math.max(e.size,n.horizontal?a.height:a.width),n.size=e.size/e.count,t[o]+=n.size}a.getPadding&&Gn(s,a.getPadding());const r=Math.max(0,e.outerWidth-Kn(s,t,"left","right")),l=Math.max(0,e.outerHeight-Kn(s,t,"top","bottom")),c=r!==t.w,d=l!==t.h;return t.w=r,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function Jn(t,e){const n=e.maxPadding;return function(t){const i={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{i[t]=Math.max(e[t],n[t])})),i}(t?["left","right"]:["top","bottom"])}function ti(t,e,n,i){const o=[];let a,s,r,l,c,d;for(a=0,s=t.length,c=0;a<s;++a){r=t[a],l=r.box,l.update(r.width||e.w,r.height||e.h,Jn(r.horizontal,e));const{same:s,other:h}=Qn(e,n,r,i);c|=s&&o.length,d=d||h,l.fullSize||o.push(r)}return c&&ti(o,e,n,i)||d}function ei(t,e,n,i,o){t.top=n,t.left=e,t.right=e+i,t.bottom=n+o,t.width=i,t.height=o}function ni(t,e,n,i){const o=n.padding;let{x:a,y:s}=e;for(const r of t){const t=r.box,l=i[r.stack]||{count:1,placed:0,weight:1},c=r.stackWeight/l.weight||1;if(r.horizontal){const i=e.w*c,a=l.size||t.height;A(l.start)&&(s=l.start),t.fullSize?ei(t,o.left,s,n.outerWidth-o.right-o.left,a):ei(t,e.left+l.placed,s,i,a),l.start=s,l.placed+=i,s=t.bottom}else{const i=e.h*c,s=l.size||t.width;A(l.start)&&(a=l.start),t.fullSize?ei(t,a,o.top,s,n.outerHeight-o.bottom-o.top):ei(t,a,e.top+l.placed,s,i),l.start=a,l.placed+=i,a=t.right}}e.x=a,e.y=s}jt.set("layout",{padding:{top:0,right:0,bottom:0,left:0}});var ii={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 n=t.boxes?t.boxes.indexOf(e):-1;-1!==n&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,i){if(!t)return;const o=se(t.options.layout.padding),a=Math.max(e-o.width,0),s=Math.max(n-o.height,0),r=function(t){const e=function(t){const e=[];let n,i,o,a,s,r;for(n=0,i=(t||[]).length;n<i;++n)o=t[n],({position:a,options:{stack:s,stackWeight:r=1}}=o),e.push({index:n,box:o,pos:a,horizontal:o.isHorizontal(),weight:o.weight,stack:s&&a+s,stackWeight:r});return e}(t),n=Zn(e.filter((t=>t.box.fullSize)),!0),i=Zn(Xn(e,"left"),!0),o=Zn(Xn(e,"right")),a=Zn(Xn(e,"top"),!0),s=Zn(Xn(e,"bottom")),r=qn(e,"x"),l=qn(e,"y");return{fullSize:n,leftAndTop:i.concat(a),rightAndBottom:o.concat(l).concat(s).concat(r),chartArea:Xn(e,"chartArea"),vertical:i.concat(o).concat(l),horizontal:a.concat(s).concat(r)}}(t.boxes),l=r.vertical,c=r.horizontal;y(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const d=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,h=Object.freeze({outerWidth:e,outerHeight:n,padding:o,availableWidth:a,availableHeight:s,vBoxMaxWidth:a/2/d,hBoxMaxHeight:s/2}),u=Object.assign({},o);Gn(u,se(i));const f=Object.assign({maxPadding:u,w:a,h:s,x:o.left,y:o.top},o),g=function(t,e){const n=function(t){const e={};for(const n of t){const{stack:t,pos:i,stackWeight:o}=n;if(!t||!Yn.includes(i))continue;const a=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return e}(t),{vBoxMaxWidth:i,hBoxMaxHeight:o}=e;let a,s,r;for(a=0,s=t.length;a<s;++a){r=t[a];const{fullSize:s}=r.box,l=n[r.stack],c=l&&r.stackWeight/l.weight;r.horizontal?(r.width=c?c*i:s&&e.availableWidth,r.height=o):(r.width=i,r.height=c?c*o:s&&e.availableHeight)}return n}(l.concat(c),h);ti(r.fullSize,f,h,g),ti(l,f,h,g),ti(c,f,h,g)&&ti(l,f,h,g),function(t){const e=t.maxPadding;function n(n){const i=Math.max(e[n]-t[n],0);return t[n]+=i,i}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}(f),ni(r.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,ni(r.rightAndBottom,f,h,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},y(r.chartArea,(e=>{const n=e.box;Object.assign(n,t.chartArea),n.update(f.w,f.h)}))}};class oi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,i){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,i?Math.floor(e/i):n)}}isAttached(t){return!0}}class ai extends oi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}}const si={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ri=t=>null===t||""===t,li=!!He&&{passive:!0};function ci(t,e,n){t.canvas.removeEventListener(e,n,li)}function di(t,e,n){const i=t.canvas,o=i&&Ie(i)||i,a=new MutationObserver((t=>{const e=Ie(o);t.forEach((t=>{for(let i=0;i<t.addedNodes.length;i++){const a=t.addedNodes[i];a!==o&&a!==e||n(t.target)}}))}));return a.observe(document,{childList:!0,subtree:!0}),a}function hi(t,e,n){const i=t.canvas,o=i&&Ie(i);if(!o)return;const a=new MutationObserver((t=>{t.forEach((t=>{for(let e=0;e<t.removedNodes.length;e++)if(t.removedNodes[e]===i){n();break}}))}));return a.observe(o,{childList:!0}),a}const ui=new Map;let fi=0;function gi(){const t=window.devicePixelRatio;t!==fi&&(fi=t,ui.forEach(((e,n)=>{n.currentDevicePixelRatio!==t&&e()})))}function pi(t,e,n){const i=t.canvas,o=i&&Ie(i);if(!o)return;const a=l(((t,e)=>{const i=o.clientWidth;n(t,e),i<o.clientWidth&&n()}),window),s=new ResizeObserver((t=>{const e=t[0],n=e.contentRect.width,i=e.contentRect.height;0===n&&0===i||a(n,i)}));return s.observe(o),function(t,e){ui.size||window.addEventListener("resize",gi),ui.set(t,e)}(t,a),s}function mi(t,e,n){n&&n.disconnect(),"resize"===e&&function(t){ui.delete(t),ui.size||window.removeEventListener("resize",gi)}(t)}function bi(t,e,n){const i=t.canvas,o=l((e=>{null!==t.ctx&&n(function(t,e){const n=si[t.type]||t.type,{x:i,y:o}=je(t,e);return{type:n,chart:e,native:t,x:void 0!==i?i: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,n){t.addEventListener(e,n,li)}(i,e,o),o}class xi extends oi{acquireContext(t,e){const n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(function(t,e){const n=t.style,i=t.getAttribute("height"),o=t.getAttribute("width");if(t.$chartjs={initial:{height:i,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",ri(o)){const e=$e(t,"width");void 0!==e&&(t.width=e)}if(ri(i))if(""===t.style.height)t.height=t.width/(e||2);else{const e=$e(t,"height");void 0!==e&&(t.height=e)}}(t,e),n):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const n=e.$chartjs.initial;["height","width"].forEach((t=>{const i=n[t];h(i)?e.removeAttribute(t):e.setAttribute(t,i)}));const i=n.style||{};return Object.keys(i).forEach((t=>{e.style[t]=i[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,n){this.removeEventListener(t,e);const i=t.$proxies||(t.$proxies={}),o={attach:di,detach:hi,resize:pi}[e]||bi;i[e]=o(t,e,n)}removeEventListener(t,e){const n=t.$proxies||(t.$proxies={}),i=n[e];i&&(({attach:mi,detach:mi,resize:mi}[e]||ci)(t,e,i),n[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,i){return function(t,e,n,i){const o=Fe(t),a=Be(o,"margin"),s=ze(o.maxWidth,t,"clientWidth")||I,r=ze(o.maxHeight,t,"clientHeight")||I,l=function(t,e,n){let i,o;if(void 0===e||void 0===n){const a=Ie(t);if(a){const t=a.getBoundingClientRect(),s=Fe(a),r=Be(s,"border","width"),l=Be(s,"padding");e=t.width-l.width-r.width,n=t.height-l.height-r.height,i=ze(s.maxWidth,a,"clientWidth"),o=ze(s.maxHeight,a,"clientHeight")}else e=t.clientWidth,n=t.clientHeight}return{width:e,height:n,maxWidth:i||I,maxHeight:o||I}}(t,e,n);let{width:c,height:d}=l;if("content-box"===o.boxSizing){const t=Be(o,"border","width"),e=Be(o,"padding");c-=e.width+t.width,d-=e.height+t.height}return c=Math.max(0,c-a.width),d=Math.max(0,i?Math.floor(c/i):d-a.height),c=We(Math.min(c,s,l.maxWidth)),d=We(Math.min(d,r,l.maxHeight)),c&&!d&&(d=We(c/2)),{width:c,height:d}}(t,e,n,i)}isAttached(t){const e=Ie(t);return!(!e||!e.isConnected)}}class yi{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:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return H(this.x)&&H(this.y)}getProps(t,e){const n=this,i=this.$animations;if(!e||!i)return n;const o={};return t.forEach((t=>{o[t]=i[t]&&i[t].active()?i[t]._to:n[t]})),o}}yi.defaults={},yi.defaultRoutes=void 0;const _i={values:t=>u(t)?t:""+t,numeric(t,e,n){if(0===t)return"0";const i=this.chart.options.locale;let o,a=t;if(n.length>1){const e=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),a=function(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}(t,n)}const s=j(Math.abs(a)),r=Math.max(Math.min(-1*Math.floor(s),20),0),l={notation:o,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ze(t,i,l)},logarithmic(t,e,n){if(0===t)return"0";const i=t/Math.pow(10,Math.floor(j(t)));return 1===i||2===i||5===i?_i.numeric.call(this,t,e,n):""}};var vi={formatters:_i};function wi(t,e,n,i,o){const a=m(i,0),s=Math.min(m(o,t.length),t.length);let r,l,c,d=0;for(n=Math.ceil(n),o&&(r=o-i,n=r/Math.floor(r/n)),c=a;c<0;)d++,c=Math.round(a+d*n);for(l=Math.max(a,0);l<s;l++)l===c&&(e.push(t[l]),d++,c=Math.round(a+d*n))}jt.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:vi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),jt.route("scale.ticks","color","","color"),jt.route("scale.grid","color","","borderColor"),jt.route("scale.grid","borderColor","","borderColor"),jt.route("scale.title","color","","color"),jt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),jt.describe("scales",{_fallback:"scale"}),jt.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Mi=(t,e,n)=>"top"===e||"left"===e?t[e]+n:t[e]-n;function ki(t,e){const n=[],i=t.length/e,o=t.length;let a=0;for(;a<o;a+=i)n.push(t[Math.floor(a)]);return n}function Si(t,e,n){const i=t.ticks.length,o=Math.min(e,i-1),a=t._startPixel,s=t._endPixel,r=1e-6;let l,c=t.getPixelForTick(o);if(!(n&&(l=1===i?Math.max(c-a,s-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<a-r||c>s+r)))return c}function Ci(t){return t.drawTicks?t.tickLength:0}function Di(t,e){if(!t.display)return 0;const n=re(t.font,e),i=se(t.padding);return(u(t.text)?t.text.length:1)*n.lineHeight+i.height}function Pi(t,e,n){let i=(t=>"start"===t?"left":"end"===t?"right":"center")(t);return(n&&"right"!==e||!n&&"right"===e)&&(i=(t=>"left"===t?"right":"right"===t?"left":t)(i)),i}class Oi extends yi{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){const e=this;e.options=t.setContext(e.getContext()),e.axis=t.axis,e._userMin=e.parse(t.min),e._userMax=e.parse(t.max),e._suggestedMin=e.parse(t.suggestedMin),e._suggestedMax=e.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:i}=this;return t=p(t,Number.POSITIVE_INFINITY),e=p(e,Number.NEGATIVE_INFINITY),n=p(n,Number.POSITIVE_INFINITY),i=p(i,Number.NEGATIVE_INFINITY),{min:p(t,n),max:p(e,i),minDefined:g(t),maxDefined:g(e)}}getMinMax(t){const e=this;let n,{min:i,max:o,minDefined:a,maxDefined:s}=e.getUserBounds();if(a&&s)return{min:i,max:o};const r=e.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)n=r[l].controller.getMinMax(e,t),a||(i=Math.min(i,n.min)),s||(o=Math.max(o,n.max));return{min:p(i,p(o,i)),max:p(o,p(i,o))}}getPadding(){const t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.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(){x(this.options.beforeUpdate,[this])}update(t,e,n){const i=this,o=i.options.ticks,a=o.sampleSize;i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),i.ticks=null,i._labelSizes=null,i._gridLineItems=null,i._labelItems=null,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i._maxLength=i.isHorizontal()?i.width+n.left+n.right:i.height+n.top+n.bottom,i._dataLimitsCached||(i.beforeDataLimits(),i.determineDataLimits(),i.afterDataLimits(),i._range=function(t,e){const{min:n,max:i}=t;return{min:n-Math.abs(b(e,n)),max:i+b(e,i)}}(i,i.options.grace),i._dataLimitsCached=!0),i.beforeBuildTicks(),i.ticks=i.buildTicks()||[],i.afterBuildTicks();const s=a<i.ticks.length;i._convertTicksToLabels(s?ki(i.ticks,a):i.ticks),i.configure(),i.beforeCalculateLabelRotation(),i.calculateLabelRotation(),i.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(i.ticks=function(t,e){const n=t.options.ticks,i=n.maxTicksLimit||function(t){const e=t.options.offset,n=t._tickSize(),i=t._length/n+(e?0:1),o=t._maxLength/n;return Math.floor(Math.min(i,o))}(t),o=n.major.enabled?function(t){const e=[];let n,i;for(n=0,i=t.length;n<i;n++)t[n].major&&e.push(n);return e}(e):[],a=o.length,s=o[0],r=o[a-1],l=[];if(a>i)return function(t,e,n,i){let o,a=0,s=n[0];for(i=Math.ceil(i),o=0;o<t.length;o++)o===s&&(e.push(t[o]),a++,s=n[a*i])}(e,l,o,a/i),l;const c=function(t,e,n){const i=function(t){const e=t.length;let n,i;if(e<2)return!1;for(i=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==i)return!1;return i}(t),o=e.length/n;if(!i)return Math.max(o,1);const a=function(t){const e=[],n=Math.sqrt(t);let i;for(i=1;i<n;i++)t%i==0&&(e.push(i),e.push(t/i));return n===(0|n)&&e.push(n),e.sort(((t,e)=>t-e)).pop(),e}(i);for(let t=0,e=a.length-1;t<e;t++){const e=a[t];if(e>o)return e}return Math.max(o,1)}(o,e,i);if(a>0){let t,n;const i=a>1?Math.round((r-s)/(a-1)):null;for(wi(e,l,c,h(i)?0:s-i,s),t=0,n=a-1;t<n;t++)wi(e,l,c,o[t],o[t+1]);return wi(e,l,c,r,h(i)?e.length:r+i),l}return wi(e,l,c),l}(i,i.ticks),i._labelSizes=null),s&&i._convertTicksToLabels(i.ticks),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate()}configure(){const t=this;let e,n,i=t.options.reverse;t.isHorizontal()?(e=t.left,n=t.right):(e=t.top,n=t.bottom,i=!i),t._startPixel=e,t._endPixel=n,t._reversePixels=i,t._length=n-e,t._alignToPixels=t.options.alignToPixels}afterUpdate(){x(this.options.afterUpdate,[this])}beforeSetDimensions(){x(this.options.beforeSetDimensions,[this])}setDimensions(){const t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0}afterSetDimensions(){x(this.options.afterSetDimensions,[this])}_callHooks(t){const e=this;e.chart.notifyPlugins(t,e.getContext()),x(e.options[t],[e])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){x(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this,n=e.options.ticks;let i,o,a;for(i=0,o=t.length;i<o;i++)a=t[i],a.label=x(n.callback,[a.value,i,t],e)}afterTickToLabelConversion(){x(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){x(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this,e=t.options,n=e.ticks,i=t.ticks.length,o=n.minRotation||0,a=n.maxRotation;let s,r,l,c=o;if(!t._isVisible()||!n.display||o>=a||i<=1||!t.isHorizontal())return void(t.labelRotation=o);const d=t._getLabelSizes(),h=d.widest.width,u=d.highest.height,f=J(t.chart.width-h,0,t.maxWidth);s=e.offset?t.maxWidth/i:f/(i-1),h+6>s&&(s=f/(i-(e.offset?.5:1)),r=t.maxHeight-Ci(e.grid)-n.padding-Di(e.title,t.chart.options.font),l=Math.sqrt(h*h+u*u),c=X(Math.min(Math.asin(J((d.highest.height+6)/s,-1,1)),Math.asin(J(r/l,-1,1))-Math.asin(J(u/l,-1,1)))),c=Math.max(o,Math.min(a,c))),t.labelRotation=c}afterCalculateLabelRotation(){x(this.options.afterCalculateLabelRotation,[this])}beforeFit(){x(this.options.beforeFit,[this])}fit(){const t=this,e={width:0,height:0},{chart:n,options:{ticks:i,title:o,grid:a}}=t,s=t._isVisible(),r=t.isHorizontal();if(s){const s=Di(o,n.options.font);if(r?(e.width=t.maxWidth,e.height=Ci(a)+s):(e.height=t.maxHeight,e.width=Ci(a)+s),i.display&&t.ticks.length){const{first:n,last:o,widest:a,highest:s}=t._getLabelSizes(),l=2*i.padding,c=Y(t.labelRotation),d=Math.cos(c),h=Math.sin(c);if(r){const n=i.mirror?0:h*a.width+d*s.height;e.height=Math.min(t.maxHeight,e.height+n+l)}else{const n=i.mirror?0:d*a.width+h*s.height;e.width=Math.min(t.maxWidth,e.width+n+l)}t._calculatePadding(n,o,h,d)}}t._handleMargins(),r?(t.width=t._length=n.width-t._margins.left-t._margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t._margins.top-t._margins.bottom)}_calculatePadding(t,e,n,i){const o=this,{ticks:{align:a,padding:s},position:r}=o.options,l=0!==o.labelRotation,c="top"!==r&&"x"===o.axis;if(o.isHorizontal()){const r=o.getPixelForTick(0)-o.left,d=o.right-o.getPixelForTick(o.ticks.length-1);let h=0,u=0;l?c?(h=i*t.width,u=n*e.height):(h=n*t.height,u=i*e.width):"start"===a?u=e.width:"end"===a?h=t.width:(h=t.width/2,u=e.width/2),o.paddingLeft=Math.max((h-r+s)*o.width/(o.width-r),0),o.paddingRight=Math.max((u-d+s)*o.width/(o.width-d),0)}else{let n=e.height/2,i=t.height/2;"start"===a?(n=0,i=t.height):"end"===a&&(n=e.height,i=0),o.paddingTop=n+s,o.paddingBottom=i+s}}_handleMargins(){const t=this;t._margins&&(t._margins.left=Math.max(t.paddingLeft,t._margins.left),t._margins.top=Math.max(t.paddingTop,t._margins.top),t._margins.right=Math.max(t.paddingRight,t._margins.right),t._margins.bottom=Math.max(t.paddingBottom,t._margins.bottom))}afterFit(){x(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){const e=this;let n,i;for(e.beforeTickToLabelConversion(),e.generateTickLabels(t),n=0,i=t.length;n<i;n++)h(t[n].label)&&(t.splice(n,1),i--,n--);e.afterTickToLabelConversion()}_getLabelSizes(){const t=this;let e=t._labelSizes;if(!e){const n=t.options.ticks.sampleSize;let i=t.ticks;n<i.length&&(i=ki(i,n)),t._labelSizes=e=t._computeLabelSizes(i,i.length)}return e}_computeLabelSizes(t,e){const{ctx:n,_longestTextCache:i}=this,o=[],a=[];let s,r,l,c,d,f,g,p,m,b,x,_=0,v=0;for(s=0;s<e;++s){if(c=t[s].label,d=this._resolveTickFontOptions(s),n.font=f=d.string,g=i[f]=i[f]||{data:{},gc:[]},p=d.lineHeight,m=b=0,h(c)||u(c)){if(u(c))for(r=0,l=c.length;r<l;++r)x=c[r],h(x)||u(x)||(m=Wt(n,g.data,g.gc,m,x),b+=p)}else m=Wt(n,g.data,g.gc,m,c),b=p;o.push(m),a.push(b),_=Math.max(m,_),v=Math.max(b,v)}!function(t,e){y(t,(t=>{const n=t.gc,i=n.length/2;let o;if(i>e){for(o=0;o<i;++o)delete t.data[n[o]];n.splice(0,i)}}))}(i,e);const w=o.indexOf(_),M=a.indexOf(v),k=t=>({width:o[t]||0,height:a[t]||0});return{first:k(0),last:k(e-1),widest:k(w),highest:k(M),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){const e=this;e._reversePixels&&(t=1-t);const n=e._startPixel+t*e._length;return J(e._alignToPixels?Ht(e.chart,n,0):n,-32768,32767)}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,n=e.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=function(t,e,n){return Object.assign(Object.create(t),{tick:n,index:e,type:"tick"})}(e.getContext(),t,i))}return e.$context||(e.$context=(i=e.chart.getContext(),o=e,Object.assign(Object.create(i),{scale:o,type:"scale"})));var i,o}_tickSize(){const t=this,e=t.options.ticks,n=Y(t.labelRotation),i=Math.abs(Math.cos(n)),o=Math.abs(Math.sin(n)),a=t._getLabelSizes(),s=e.autoSkipPadding||0,r=a?a.widest.width+s:0,l=a?a.highest.height+s:0;return t.isHorizontal()?l*i>r*o?r/i:l/o:l*o<r*i?l/i:r/o}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this,n=e.axis,i=e.chart,o=e.options,{grid:a,position:s}=o,r=a.offset,l=e.isHorizontal(),c=e.ticks.length+(r?1:0),d=Ci(a),h=[],u=a.setContext(e.getContext()),g=u.drawBorder?u.borderWidth:0,p=g/2,b=function(t){return Ht(i,t,g)};let x,y,_,v,w,M,k,S,C,D,P,O;if("top"===s)x=b(e.bottom),M=e.bottom-d,S=x-p,D=b(t.top)+p,O=t.bottom;else if("bottom"===s)x=b(e.top),D=t.top,O=b(t.bottom)-p,M=x+p,S=e.top+d;else if("left"===s)x=b(e.right),w=e.right-d,k=x-p,C=b(t.left)+p,P=t.right;else if("right"===s)x=b(e.left),C=t.left,P=b(t.right)-p,w=x+p,k=e.left+d;else if("x"===n){if("center"===s)x=b((t.top+t.bottom)/2+.5);else if(f(s)){const t=Object.keys(s)[0],n=s[t];x=b(e.chart.scales[t].getPixelForValue(n))}D=t.top,O=t.bottom,M=x+p,S=M+d}else if("y"===n){if("center"===s)x=b((t.left+t.right)/2);else if(f(s)){const t=Object.keys(s)[0],n=s[t];x=b(e.chart.scales[t].getPixelForValue(n))}w=x-p,k=w-d,C=t.left,P=t.right}const A=m(o.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/A));for(y=0;y<c;y+=T){const t=a.setContext(e.getContext(y)),n=t.lineWidth,o=t.color,s=a.borderDash||[],c=t.borderDashOffset,d=t.tickWidth,u=t.tickColor,f=t.tickBorderDash||[],g=t.tickBorderDashOffset;_=Si(e,y,r),void 0!==_&&(v=Ht(i,_,n),l?w=k=C=P=v:M=S=D=O=v,h.push({tx1:w,ty1:M,tx2:k,ty2:S,x1:C,y1:D,x2:P,y2:O,width:n,color:o,borderDash:s,borderDashOffset:c,tickWidth:d,tickColor:u,tickBorderDash:f,tickBorderDashOffset:g}))}return e._ticksLength=c,e._borderValue=x,h}_computeLabelItems(t){const e=this,n=e.axis,i=e.options,{position:o,ticks:a}=i,s=e.isHorizontal(),r=e.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=a,g=Ci(i.grid),p=g+d,m=h?-d:p,b=-Y(e.labelRotation),x=[];let y,_,v,w,M,k,S,C,D,P,O,A,T="middle";if("top"===o)k=e.bottom-m,S=e._getXAxisLabelAlignment();else if("bottom"===o)k=e.top+m,S=e._getXAxisLabelAlignment();else if("left"===o){const t=e._getYAxisLabelAlignment(g);S=t.textAlign,M=t.x}else if("right"===o){const t=e._getYAxisLabelAlignment(g);S=t.textAlign,M=t.x}else if("x"===n){if("center"===o)k=(t.top+t.bottom)/2+p;else if(f(o)){const t=Object.keys(o)[0],n=o[t];k=e.chart.scales[t].getPixelForValue(n)+p}S=e._getXAxisLabelAlignment()}else if("y"===n){if("center"===o)M=(t.left+t.right)/2-p;else if(f(o)){const t=Object.keys(o)[0],n=o[t];M=e.chart.scales[t].getPixelForValue(n)}S=e._getYAxisLabelAlignment(g).textAlign}"y"===n&&("start"===l?T="top":"end"===l&&(T="bottom"));const E=e._getLabelSizes();for(y=0,_=r.length;y<_;++y){v=r[y],w=v.label;const t=a.setContext(e.getContext(y));C=e.getPixelForTick(y)+a.labelOffset,D=e._resolveTickFontOptions(y),P=D.lineHeight,O=u(w)?w.length:1;const n=O/2,i=t.color,l=t.textStrokeColor,d=t.textStrokeWidth;let f;if(s?(M=C,A="top"===o?"near"===c||0!==b?-O*P+P/2:"center"===c?-E.highest.height/2-n*P+P:-E.highest.height+P/2:"near"===c||0!==b?P/2:"center"===c?E.highest.height/2-n*P:E.highest.height-O*P,h&&(A*=-1)):(k=C,A=(1-O)*P/2),t.showLabelBackdrop){const e=se(t.backdropPadding),n=E.heights[y],i=E.widths[y];let o=k+A-e.top,a=M-e.left;switch(T){case"middle":o-=n/2;break;case"bottom":o-=n}switch(S){case"center":a-=i/2;break;case"right":a-=i}f={left:a,top:o,width:i+e.width,height:n+e.height,color:t.backdropColor}}x.push({rotation:b,label:w,font:D,color:i,strokeColor:l,strokeWidth:d,textOffset:A,textAlign:S,textBaseline:T,translation:[M,k],backdrop:f})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Y(this.labelRotation))return"top"===t?"left":"right";let n="center";return"start"===e.align?n="left":"end"===e.align&&(n="right"),n}_getYAxisLabelAlignment(t){const e=this,{position:n,ticks:{crossAlign:i,mirror:o,padding:a}}=e.options,s=t+a,r=e._getLabelSizes().widest.width;let l,c;return"left"===n?o?(c=e.right+a,"near"===i?l="left":"center"===i?(l="center",c+=r/2):(l="right",c+=r)):(c=e.right-s,"near"===i?l="right":"center"===i?(l="center",c-=r/2):(l="left",c=e.left)):"right"===n?o?(c=e.left+a,"near"===i?l="right":"center"===i?(l="center",c-=r/2):(l="left",c-=r)):(c=e.left+s,"near"===i?l="left":"center"===i?(l="center",c+=r/2):(l="right",c=e.right)):l="right",{textAlign:l,x:c}}_computeLabelArea(){const t=this;if(t.options.ticks.mirror)return;const e=t.chart,n=t.options.position;return"left"===n||"right"===n?{top:0,left:t.left,bottom:e.height,right:t.right}:"top"===n||"bottom"===n?{top:t.top,left:0,bottom:t.bottom,right:e.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:n,top:i,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,i,o,a),t.restore())}getLineWidthForValue(t){const e=this,n=e.options.grid;if(!e._isVisible()||!n.display)return 0;const i=e.ticks.findIndex((e=>e.value===t));return i>=0?n.setContext(e.getContext(i)).lineWidth:0}drawGrid(t){const e=this,n=e.options.grid,i=e.ctx,o=e._gridLineItems||(e._gridLineItems=e._computeGridLineItems(t));let a,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(n.display)for(a=0,s=o.length;a<s;++a){const t=o[a];n.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),n.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 t=this,{chart:e,ctx:n,options:{grid:i}}=t,o=i.setContext(t.getContext()),a=i.drawBorder?o.borderWidth:0;if(!a)return;const s=i.setContext(t.getContext(0)).lineWidth,r=t._borderValue;let l,c,d,h;t.isHorizontal()?(l=Ht(e,t.left,a)-a/2,c=Ht(e,t.right,s)+s/2,d=h=r):(d=Ht(e,t.top,a)-a/2,h=Ht(e,t.bottom,s)+s/2,l=c=r),n.save(),n.lineWidth=o.borderWidth,n.strokeStyle=o.borderColor,n.beginPath(),n.moveTo(l,d),n.lineTo(c,h),n.stroke(),n.restore()}drawLabels(t){const e=this;if(!e.options.ticks.display)return;const n=e.ctx,i=e._computeLabelArea();i&&Xt(n,i);const o=e._labelItems||(e._labelItems=e._computeLabelItems(t));let a,s;for(a=0,s=o.length;a<s;++a){const t=o[a],e=t.font,i=t.label;t.backdrop&&(n.fillStyle=t.backdrop.color,n.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),Gt(n,i,0,t.textOffset,e,t)}i&&qt(n)}drawTitle(){const{ctx:t,options:{position:e,title:n,reverse:i}}=this;if(!n.display)return;const o=re(n.font),a=se(n.padding),s=n.align;let r=o.lineHeight/2;"bottom"===e||"center"===e||f(e)?(r+=a.bottom,u(n.text)&&(r+=o.lineHeight*(n.text.length-1))):r+=a.top;const{titleX:l,titleY:d,maxWidth:h,rotation:g}=function(t,e,n,i){const{top:o,left:a,bottom:s,right:r,chart:l}=t,{chartArea:d,scales:h}=l;let u,g,p,m=0;const b=s-o,x=r-a;if(t.isHorizontal()){if(g=c(i,a,r),f(n)){const t=Object.keys(n)[0],i=n[t];p=h[t].getPixelForValue(i)+b-e}else p="center"===n?(d.bottom+d.top)/2+b-e:Mi(t,n,e);u=r-a}else{if(f(n)){const t=Object.keys(n)[0],i=n[t];g=h[t].getPixelForValue(i)-x+e}else g="center"===n?(d.left+d.right)/2-x+e:Mi(t,n,e);p=c(i,s,o),m="left"===n?-F:F}return{titleX:g,titleY:p,maxWidth:u,rotation:m}}(this,r,e,s);Gt(t,n.text,0,0,o,{color:n.color,maxWidth:h,rotation:g,textAlign:Pi(s,e,i),textBaseline:"middle",translation:[l,d]})}draw(t){const e=this;e._isVisible()&&(e.drawBackground(),e.drawGrid(t),e.drawBorder(),e.drawTitle(),e.drawLabels(t))}_layers(){const t=this,e=t.options,n=e.ticks&&e.ticks.z||0,i=m(e.grid&&e.grid.z,-1);return t._isVisible()&&t.draw===Oi.prototype.draw?[{z:i,draw(e){t.drawBackground(),t.drawGrid(e),t.drawTitle()}},{z:i+1,draw(){t.drawBorder()}},{z:n,draw(e){t.drawLabels(e)}}]:[{z:n,draw(e){t.draw(e)}}]}getMatchingVisibleMetas(t){const e=this,n=e.chart.getSortedVisibleDatasetMetas(),i=e.axis+"AxisID",o=[];let a,s;for(a=0,s=n.length;a<s;++a){const s=n[a];s[i]!==e.id||t&&s.type!==t||o.push(s)}return o}_resolveTickFontOptions(t){return re(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this,e=t._resolveTickFontOptions(0).lineHeight;return(t.isHorizontal()?t.width:t.height)/e}}class Ai{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=this,n=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(n)&&(i=e.register(n));const o=e.items,a=t.id,s=e.scope+"."+a;if(!a)throw new Error("class does not have id: "+t);return a in o||(o[a]=t,function(t,e,n){const i=k(Object.create(null),[n?jt.get(n):{},jt.get(e),t.defaults]);jt.set(e,i),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((n=>{const i=n.split("."),o=i.pop(),a=[t].concat(i).join("."),s=e[n].split("."),r=s.pop(),l=s.join(".");jt.route(a,o,l,r)}))}(e,t.defaultRoutes),t.descriptors&&jt.describe(e,t.descriptors)}(t,s,i),e.override&&jt.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,n=t.id,i=this.scope;n in e&&delete e[n],i&&n in jt[i]&&(delete jt[i][n],this.override&&delete zt[n])}}var Ti=new class{constructor(){this.controllers=new Ai(_n,"datasets",!0),this.elements=new Ai(yi,"elements"),this.plugins=new Ai(Object,"plugins"),this.scales=new Ai(Oi,"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,n){const i=this;[...e].forEach((e=>{const o=n||i._getRegistryForType(e);n||o.isForType(e)||o===i.plugins&&e.id?i._exec(t,o,e):y(e,(e=>{const o=n||i._getRegistryForType(e);i._exec(t,o,e)}))}))}_exec(t,e,n){const i=O(t);x(n["before"+i],[],n),e[t](n),x(n["after"+i],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){const i=e.get(t);if(void 0===i)throw new Error('"'+t+'" is not a registered '+n+".");return i}};class Ei{constructor(){this._init=[]}notify(t,e,n,i){const o=this;"beforeInit"===e&&(o._init=o._createDescriptors(t,!0),o._notify(o._init,t,"install"));const a=i?o._descriptors(t).filter(i):o._descriptors(t),s=o._notify(a,t,e,n);return"destroy"===e&&(o._notify(a,t,"stop"),o._notify(o._init,t,"uninstall")),s}_notify(t,e,n,i){i=i||{};for(const o of t){const t=o.plugin;if(!1===x(t[n],[e,i,o.options],t)&&i.cancelable)return!1}return!0}invalidate(){h(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const n=t&&t.config,i=m(n.options&&n.options.plugins,{}),o=function(t){const e=[],n=Object.keys(Ti.plugins.items);for(let t=0;t<n.length;t++)e.push(Ti.getPlugin(n[t]));const i=t.plugins||[];for(let t=0;t<i.length;t++){const n=i[t];-1===e.indexOf(n)&&e.push(n)}return e}(n);return!1!==i||e?function(t,e,n,i){const o=[],a=t.getContext();for(let s=0;s<e.length;s++){const r=e[s],l=Ri(n[r.id],i);null!==l&&o.push({plugin:r,options:Li(t.config,r,l,a)})}return o}(t,o,i,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],n=this._cache,i=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(i(e,n),t,"stop"),this._notify(i(n,e),t,"start")}}function Ri(t,e){return e||!1!==t?!0===t?{}:t:null}function Li(t,e,n,i){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(n,o);return t.createResolver(a,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ii(t,e){const n=jt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function zi(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(n=e.position)||"bottom"===n?"x":"left"===n||"right"===n?"y":void 0)||t.charAt(0).toLowerCase();var n}function Fi(t){const e=t.options||(t.options={});e.plugins=m(e.plugins,{}),e.scales=function(t,e){const n=zt[t.type]||{scales:{}},i=e.scales||{},o=Ii(t.type,e),a=Object.create(null),s=Object.create(null);return Object.keys(i).forEach((t=>{const e=i[t],r=zi(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,o),c=n.scales||{};a[r]=a[r]||t,s[t]=S(Object.create(null),[{axis:r},e,c[r],c[l]])})),t.data.datasets.forEach((n=>{const o=n.type||t.type,r=n.indexAxis||Ii(o,e),l=(zt[o]||{}).scales||{};Object.keys(l).forEach((t=>{const e=function(t,e){let n=t;return"_index_"===t?n=e:"_value_"===t&&(n="x"===e?"y":"x"),n}(t,r),o=n[e+"AxisID"]||a[e]||e;s[o]=s[o]||Object.create(null),S(s[o],[{axis:e},i[o],l[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];S(e,[jt.scales[e.type],jt.scale])})),s}(t,e)}function Vi(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Bi=new Map,ji=new Set;function Wi(t,e){let n=Bi.get(t);return n||(n=e(),Bi.set(t,n),ji.add(n)),n}const Ni=(t,e,n)=>{const i=P(e,n);void 0!==i&&t.add(i)};class Hi{constructor(t){this._config=function(t){return(t=t||{}).data=Vi(t.data),Fi(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=Vi(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(),Fi(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Wi(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Wi(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Wi(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Wi(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const n=this._scopeCache;let i=n.get(t);return i&&!e||(i=new Map,n.set(t,i)),i}getOptionScopes(t,e,n){const{options:i,type:o}=this,a=this._cachedScopes(t,n),s=a.get(e);if(s)return s;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>Ni(r,t,e)))),e.forEach((t=>Ni(r,i,t))),e.forEach((t=>Ni(r,zt[o]||{},t))),e.forEach((t=>Ni(r,jt,t))),e.forEach((t=>Ni(r,Ft,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),ji.has(e)&&a.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,zt[e]||{},jt.datasets[e]||{},{type:e},jt,Ft]}resolveNamedOptions(t,e,n,i=[""]){const o={$shared:!0},{resolver:a,subPrefixes:s}=$i(this._resolverCache,t,i);let r=a;(function(t,e){const{isScriptable:n,isIndexable:i}=be(t);for(const o of e)if(n(o)&&T(t[o])||i(o)&&u(t[o]))return!0;return!1})(a,e)&&(o.$shared=!1,r=me(a,n=T(n)?n():n,this.createResolver(t,n,s)));for(const t of e)o[t]=r[t];return o}createResolver(t,e,n=[""],i){const{resolver:o}=$i(this._resolverCache,t,n);return f(e)?me(o,e,void 0,i):o}}function $i(t,e,n){let i=t.get(e);i||(i=new Map,t.set(e,i));const o=n.join();let a=i.get(o);return a||(a={resolver:pe(e,n),subPrefixes:n.filter((t=>!t.toLowerCase().includes("hover")))},i.set(o,a)),a}const Ui=["top","bottom","left","right","chartArea"];function Yi(t,e){return"top"===t||"bottom"===t||-1===Ui.indexOf(t)&&"x"===e}function Xi(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}function qi(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),x(n&&n.onComplete,[t],e)}function Zi(t){const e=t.chart,n=e.options.animation;x(n&&n.onProgress,[t],e)}function Ki(t){return Le()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Gi={},Qi=t=>{const e=Ki(t);return Object.values(Gi).filter((t=>t.canvas===e)).pop()};class Ji{constructor(t,e){const n=this,i=this.config=new Hi(e),o=Ki(t),a=Qi(o);if(a)throw new Error("Canvas is already in use. Chart with ID '"+a.id+"' must be destroyed before the canvas can be reused.");const s=i.createResolver(i.chartOptionScopes(),n.getContext());this.platform=new(i.platform||function(t){return!Le()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ai:xi}(o));const r=n.platform.acquireContext(o,s.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;this.id=d(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=s,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 Ei,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let n;return function(){return e?(clearTimeout(n),n=setTimeout(t,e)):t(),e}}((()=>this.update("resize")),s.resizeDelay||0),Gi[n.id]=n,r&&l?(nn.listen(n,"complete",qi),nn.listen(n,"progress",Zi),n._initialize(),n.attached&&n.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:i,_aspectRatio:o}=this;return h(t)?e&&o?o:i?n/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){const t=this;return t.notifyPlugins("beforeInit"),t.options.responsive?t.resize():Ne(t,t.options.devicePixelRatio),t.bindEvents(),t.notifyPlugins("afterInit"),t}clear(){return $t(this.canvas,this.ctx),this}stop(){return nn.stop(this),this}resize(t,e){nn.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this,i=n.options,o=n.canvas,a=i.maintainAspectRatio&&n.aspectRatio,s=n.platform.getMaximumSize(o,t,e,a),r=i.devicePixelRatio||n.platform.getDevicePixelRatio();n.width=s.width,n.height=s.height,n._aspectRatio=n.aspectRatio,Ne(n,r,!0)&&(n.notifyPlugins("resize",{size:s}),x(i.onResize,[n,s],n),n.attached&&n._doResize()&&n.render())}ensureScalesHaveIDs(){y(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this,e=t.options,n=e.scales,i=t.scales,o=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let a=[];n&&(a=a.concat(Object.keys(n).map((t=>{const e=n[t],i=zi(t,e),o="r"===i,a="x"===i;return{options:e,dposition:o?"chartArea":a?"bottom":"left",dtype:o?"radialLinear":a?"category":"linear"}})))),y(a,(n=>{const a=n.options,s=a.id,r=zi(s,a),l=m(a.type,n.dtype);void 0!==a.position&&Yi(a.position,r)===Yi(n.dposition)||(a.position=n.dposition),o[s]=!0;let c=null;s in i&&i[s].type===l?c=i[s]:(c=new(Ti.getScale(l))({id:s,type:l,ctx:t.ctx,chart:t}),i[c.id]=c),c.init(a,e)})),y(o,((t,e)=>{t||delete i[e]})),y(i,(e=>{ii.configure(t,e,e.options),ii.addBox(t,e)}))}_updateMetasets(){const t=this,e=t._metasets,n=t.data.datasets.length,i=e.length;if(e.sort(((t,e)=>t.index-e.index)),i>n){for(let e=n;e<i;++e)t._destroyDatasetMeta(e);e.splice(n,i-n)}t._sortedMetasets=e.slice(0).sort(Xi("order","index"))}_removeUnreferencedMetasets(){const t=this,{_metasets:e,data:{datasets:n}}=t;e.length>n.length&&delete t._stacks,e.forEach(((e,i)=>{0===n.filter((t=>t===e._dataset)).length&&t._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=this,e=[],n=t.data.datasets;let i,o;for(t._removeUnreferencedMetasets(),i=0,o=n.length;i<o;i++){const o=n[i];let a=t.getDatasetMeta(i);const s=o.type||t.config.type;if(a.type&&a.type!==s&&(t._destroyDatasetMeta(i),a=t.getDatasetMeta(i)),a.type=s,a.indexAxis=o.indexAxis||Ii(s,t.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=t.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const n=Ti.getController(s),{datasetElementType:o,dataElementType:r}=jt.datasets[s];Object.assign(n.prototype,{dataElementType:Ti.getElement(r),datasetElementType:o&&Ti.getElement(o)}),a.controller=new n(t,i),e.push(a.controller)}}return t._updateMetasets(),e}_resetElements(){const t=this;y(t.data.datasets,((e,n)=>{t.getDatasetMeta(n).controller.reset()}),t)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this,n=e.config;n.update(),e._options=n.createResolver(n.chartOptionScopes(),e.getContext()),y(e.scales,(t=>{ii.removeBox(e,t)}));const i=e._animationsDisabled=!e.options.animation;if(e.ensureScalesHaveIDs(),e.buildOrUpdateScales(),((t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0})(new Set(Object.keys(e._listeners)),new Set(e.options.events))&&!!this._responsiveListeners===e.options.responsive||(e.unbindEvents(),e.bindEvents()),e._plugins.invalidate(),!1===e.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=e.buildOrUpdateControllers();e.notifyPlugins("beforeElementsUpdate");let a=0;for(let t=0,n=e.data.datasets.length;t<n;t++){const{controller:n}=e.getDatasetMeta(t),s=!i&&-1===o.indexOf(n);n.buildOrUpdateElements(s),a=Math.max(+n.getMaxOverflow(),a)}e._minPadding=a,e._updateLayout(a),i||y(o,(t=>{t.reset()})),e._updateDatasets(t),e.notifyPlugins("afterUpdate",{mode:t}),e._layers.sort(Xi("z","_idx")),e._lastEvent&&e._eventHandler(e._lastEvent,!0),e.render()}_updateLayout(t){const e=this;if(!1===e.notifyPlugins("beforeLayout",{cancelable:!0}))return;ii.update(e,e.width,e.height,t);const n=e.chartArea,i=n.width<=0||n.height<=0;e._layers=[],y(e.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),e._layers.push(...t._layers()))}),e),e._layers.forEach(((t,e)=>{t._idx=e})),e.notifyPlugins("afterLayout")}_updateDatasets(t){const e=this,n="function"==typeof t;if(!1!==e.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let i=0,o=e.data.datasets.length;i<o;++i)e._updateDataset(i,n?t({datasetIndex:i}):t);e.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const n=this,i=n.getDatasetMeta(t),o={meta:i,index:t,mode:e,cancelable:!0};!1!==n.notifyPlugins("beforeDatasetUpdate",o)&&(i.controller._update(e),o.cancelable=!1,n.notifyPlugins("afterDatasetUpdate",o))}render(){const t=this;!1!==t.notifyPlugins("beforeRender",{cancelable:!0})&&(nn.has(t)?t.attached&&!nn.running(t)&&nn.start(t):(t.draw(),qi({chart:t})))}draw(){const t=this;let e;if(t._resizeBeforeDraw){const{width:e,height:n}=t._resizeBeforeDraw;t._resize(e,n),t._resizeBeforeDraw=null}if(t.clear(),t.width<=0||t.height<=0)return;if(!1===t.notifyPlugins("beforeDraw",{cancelable:!0}))return;const n=t._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(t.chartArea);for(t._drawDatasets();e<n.length;++e)n[e].draw(t.chartArea);t.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,n=[];let i,o;for(i=0,o=e.length;i<o;++i){const o=e[i];t&&!o.visible||n.push(o)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){const t=this;if(!1===t.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=t.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)t._drawDataset(e[n]);t.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this,n=e.ctx,i=t._clip,o=!i.disabled,a=e.chartArea,s={meta:t,index:t.index,cancelable:!0};!1!==e.notifyPlugins("beforeDatasetDraw",s)&&(o&&Xt(n,{left:!1===i.left?0:a.left-i.left,right:!1===i.right?e.width:a.right+i.right,top:!1===i.top?0:a.top-i.top,bottom:!1===i.bottom?e.height:a.bottom+i.bottom}),t.controller.draw(),o&&qt(n),s.cancelable=!1,e.notifyPlugins("afterDatasetDraw",s))}getElementsAtEventForMode(t,e,n,i){const o=Un.modes[e];return"function"==typeof o?o(this,t,n,i):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let i=n.filter((t=>t&&t._dataset===e)).pop();return i||(i={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},n.push(i)),i}getContext(){return this.$context||(this.$context={chart:this,type:"chart"})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return"boolean"==typeof n.hidden?!n.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,n){const i=this,o=n?"show":"hide",a=i.getDatasetMeta(t),s=a.controller._resolveAnimations(void 0,o);A(e)?(a.data[e].hidden=!n,i.update()):(i.setDatasetVisibility(t,n),s.update(a,{visible:n}),i.update((e=>e.datasetIndex===t?o:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this,n=e._metasets&&e._metasets[t];n&&n.controller&&(n.controller._destroy(),delete e._metasets[t])}destroy(){const t=this,{canvas:e,ctx:n}=t;let i,o;for(t.stop(),nn.remove(t),i=0,o=t.data.datasets.length;i<o;++i)t._destroyDatasetMeta(i);t.config.clearCache(),e&&(t.unbindEvents(),$t(e,n),t.platform.releaseContext(n),t.canvas=null,t.ctx=null),t.notifyPlugins("destroy"),delete Gi[t.id]}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this,e=t._listeners,n=t.platform,i=function(e,n,i){e.offsetX=n,e.offsetY=i,t._eventHandler(e)};y(t.options.events,(o=>((i,o)=>{n.addEventListener(t,i,o),e[i]=o})(o,i)))}bindResponsiveEvents(){const t=this;t._responsiveListeners||(t._responsiveListeners={});const e=t._responsiveListeners,n=t.platform,i=(i,o)=>{n.addEventListener(t,i,o),e[i]=o},o=(i,o)=>{e[i]&&(n.removeEventListener(t,i,o),delete e[i])},a=(e,n)=>{t.canvas&&t.resize(e,n)};let s;const r=()=>{o("attach",r),t.attached=!0,t.resize(),i("resize",a),i("detach",s)};s=()=>{t.attached=!1,o("resize",a),i("attach",r)},n.isAttached(t.canvas)?r():s()}unbindEvents(){const t=this;y(t._listeners,((e,n)=>{t.platform.removeEventListener(t,n,e)})),t._listeners={},y(t._responsiveListeners,((e,n)=>{t.platform.removeEventListener(t,n,e)})),t._responsiveListeners=void 0}updateHoverStyle(t,e,n){const i=n?"set":"remove";let o,a,s,r;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),s=0,r=t.length;s<r;++s){a=t[s];const e=a&&this.getDatasetMeta(a.datasetIndex).controller;e&&e[i+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this,n=e._active||[],i=t.map((({datasetIndex:t,index:n})=>{const i=e.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[n],index:n}}));!_(i,n)&&(e._active=i,e._updateHoverStyles(i,n))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}_updateHoverStyles(t,e,n){const i=this,o=i.options.hover,a=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=a(e,t),r=n?t:a(t,e);s.length&&i.updateHoverStyle(s,o.mode,!1),r.length&&o.mode&&i.updateHoverStyle(r,o.mode,!0)}_eventHandler(t,e){const n=this,i={event:t,replay:e,cancelable:!0},o=e=>(e.options.events||this.options.events).includes(t.type);if(!1===n.notifyPlugins("beforeEvent",i,o))return;const a=n._handleEvent(t,e);return i.cancelable=!1,n.notifyPlugins("afterEvent",i,o),(a||i.changed)&&n.render(),n}_handleEvent(t,e){const n=this,{_active:i=[],options:o}=n,a=o.hover,s=e;let r=[],l=!1,c=null;return"mouseout"!==t.type&&(r=n.getElementsAtEventForMode(t,a.mode,a,s),c="click"===t.type?n._lastEvent:t),n._lastEvent=null,Yt(t,n.chartArea,n._minPadding)&&(x(o.onHover,[t,r,n],n),"mouseup"!==t.type&&"click"!==t.type&&"contextmenu"!==t.type||x(o.onClick,[t,r,n],n)),l=!_(r,i),(l||e)&&(n._active=r,n._updateHoverStyles(r,i,e)),n._lastEvent=c,l}}const to=()=>y(Ji.instances,(t=>t._plugins.invalidate())),eo=!0;function no(t,e,n){const{startAngle:i,pixelMargin:o,x:a,y:s,outerRadius:r,innerRadius:l}=e;let c=o/r;t.beginPath(),t.arc(a,s,r,i-c,n+c),l>o?(c=o/l,t.arc(a,s,l,n+c,i-c,!0)):t.arc(a,s,o,n+F,i-F),t.closePath(),t.clip()}function io(t,e,n,i){return{x:n+t*Math.cos(e),y:i+t*Math.sin(e)}}function oo(t,e,n,i,o){const{x:a,y:s,startAngle:r,pixelMargin:l,innerRadius:c}=e,d=Math.max(e.outerRadius+i+n-l,0),h=c>0?c+i+n+l:0;let u=0;const f=o-r;if(i){const t=((c>0?c-i:0)+(d>0?d-i:0))/2;u=(f-(0!==t?f*t/(t+i):f))/2}const g=(f-Math.max(.001,f*d-n/E)/d)/2,p=r+g+u,m=o-g-u,{outerStart:b,outerEnd:x,innerStart:y,innerEnd:_}=function(t,e,n,i){const o=ie(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),a=(n-e)/2,s=Math.min(a,i*e/2),r=t=>{const e=(n-Math.min(a,t))*i/2;return J(t,0,Math.min(a,e))};return{outerStart:r(o.outerStart),outerEnd:r(o.outerEnd),innerStart:J(o.innerStart,0,s),innerEnd:J(o.innerEnd,0,s)}}(e,h,d,m-p),v=d-b,w=d-x,M=p+b/v,k=m-x/w,S=h+y,C=h+_,D=p+y/S,P=m-_/C;if(t.beginPath(),t.arc(a,s,d,M,k),x>0){const e=io(w,k,a,s);t.arc(e.x,e.y,x,k,m+F)}const O=io(C,m,a,s);if(t.lineTo(O.x,O.y),_>0){const e=io(C,P,a,s);t.arc(e.x,e.y,_,m+F,P+Math.PI)}if(t.arc(a,s,h,m-_/h,p+y/h,!0),y>0){const e=io(S,D,a,s);t.arc(e.x,e.y,y,D+Math.PI,p-F)}const A=io(v,p,a,s);if(t.lineTo(A.x,A.y),b>0){const e=io(v,M,a,s);t.arc(e.x,e.y,b,p-F,M)}t.closePath()}Object.defineProperties(Ji,{defaults:{enumerable:eo,value:jt},instances:{enumerable:eo,value:Gi},overrides:{enumerable:eo,value:zt},registry:{enumerable:eo,value:Ti},version:{enumerable:eo,value:"3.5.1"},getChart:{enumerable:eo,value:Qi},register:{enumerable:eo,value:(...t)=>{Ti.add(...t),to()}},unregister:{enumerable:eo,value:(...t)=>{Ti.remove(...t),to()}}});class ao extends yi{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,n){const i=this.getProps(["x","y"],n),{angle:o,distance:a}=function(t,e){const n=e.x-t.x,i=e.y-t.y,o=Math.sqrt(n*n+i*i);let a=Math.atan2(i,n);return a<-.5*E&&(a+=R),{angle:a,distance:o}}(i,{x:t,y:e}),{startAngle:s,endAngle:r,innerRadius:l,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),h=this.options.spacing/2;return(d>=R||Q(o,s,r))&&a>=l+h&&a<=c+h}getCenterPoint(t){const{x:e,y:n,startAngle:i,endAngle:o,innerRadius:a,outerRadius:s}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:l}=this.options,c=(i+o)/2,d=(a+s+l+r)/2;return{x:e+Math.cos(c)*d,y:n+Math.sin(c)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const e=this,{options:n,circumference:i}=e,o=(n.offset||0)/2,a=(n.spacing||0)/2;if(e.pixelMargin="inner"===n.borderAlign?.33:0,e.fullCircles=i>R?Math.floor(i/R):0,0===i||e.innerRadius<0||e.outerRadius<0)return;t.save();let s=0;if(o){s=o/2;const n=(e.startAngle+e.endAngle)/2;t.translate(Math.cos(n)*s,Math.sin(n)*s),e.circumference>=E&&(s=o)}t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor;const r=function(t,e,n,i){const{fullCircles:o,startAngle:a,circumference:s}=e;let r=e.endAngle;if(o){oo(t,e,n,i,a+R);for(let e=0;e<o;++e)t.fill();isNaN(s)||(r=a+s%R,s%R==0&&(r+=R))}return oo(t,e,n,i,r),t.fill(),r}(t,e,s,a);(function(t,e,n,i,o){const{options:a}=e,s="inner"===a.borderAlign;a.borderWidth&&(s?(t.lineWidth=2*a.borderWidth,t.lineJoin="round"):(t.lineWidth=a.borderWidth,t.lineJoin="bevel"),e.fullCircles&&function(t,e,n){const{x:i,y:o,startAngle:a,pixelMargin:s,fullCircles:r}=e,l=Math.max(e.outerRadius-s,0),c=e.innerRadius+s;let d;for(n&&no(t,e,a+R),t.beginPath(),t.arc(i,o,c,a+R,a,!0),d=0;d<r;++d)t.stroke();for(t.beginPath(),t.arc(i,o,l,a,a+R),d=0;d<r;++d)t.stroke()}(t,e,s),s&&no(t,e,o),oo(t,e,n,i,o),t.stroke())})(t,e,s,a,r),t.restore()}}function so(t,e,n=e){t.lineCap=m(n.borderCapStyle,e.borderCapStyle),t.setLineDash(m(n.borderDash,e.borderDash)),t.lineDashOffset=m(n.borderDashOffset,e.borderDashOffset),t.lineJoin=m(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=m(n.borderWidth,e.borderWidth),t.strokeStyle=m(n.borderColor,e.borderColor)}function ro(t,e,n){t.lineTo(n.x,n.y)}function lo(t,e,n={}){const i=t.length,{start:o=0,end:a=i-1}=n,{start:s,end:r}=e,l=Math.max(o,s),c=Math.min(a,r),d=o<s&&a<s||o>r&&a>r;return{count:i,start:l,loop:e.loop,ilen:c<l&&!d?i+c-l:c-l}}function co(t,e,n,i){const{points:o,options:a}=e,{count:s,start:r,loop:l,ilen:c}=lo(o,n,i),d=function(t){return t.stepped?Zt:t.tension||"monotone"===t.cubicInterpolationMode?Kt:ro}(a);let h,u,f,{move:g=!0,reverse:p}=i||{};for(h=0;h<=c;++h)u=o[(r+(p?c-h:h))%s],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):d(t,f,u,p,a.stepped),f=u);return l&&(u=o[(r+(p?c:0))%s],d(t,f,u,p,a.stepped)),!!l}function ho(t,e,n,i){const o=e.points,{count:a,start:s,ilen:r}=lo(o,n,i),{move:l=!0,reverse:c}=i||{};let d,h,u,f,g,p,m=0,b=0;const x=t=>(s+(c?r-t:t))%a,y=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(h=o[x(0)],t.moveTo(h.x,h.y)),d=0;d<=r;++d){if(h=o[x(d)],h.skip)continue;const e=h.x,n=h.y,i=0|e;i===u?(n<f?f=n:n>g&&(g=n),m=(b*m+e)/++b):(y(),t.lineTo(e,n),u=i,b=0,f=g=n),p=n}y()}function uo(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||n?co:ho}ao.id="arc",ao.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},ao.defaultRoutes={backgroundColor:"backgroundColor"};const fo="function"==typeof Path2D;class go extends yi{constructor(t){super(),this.animated=!0,this.options=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 n=this,i=n.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!n._pointsUpdated){const o=i.spanGaps?n._loop:n._fullLoop;Re(n._points,i,t,o,e),n._pointsUpdated=!0}}set points(t){const e=this;e._points=t,delete e._segments,delete e._path,e._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const n=t.points,i=t.options.spanGaps,o=n.length;if(!o)return[];const a=!!t._loop,{start:s,end:r}=function(t,e,n,i){let o=0,a=e-1;if(n&&!i)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,n&&(a+=o);a>o&&t[a%e].skip;)a--;return a%=e,{start:o,end:a}}(n,o,a,i);return function(t,e,n,i){return i&&i.setContext&&n?function(t,e,n,i){const o=tn(t.options),a=n.length,s=[];let r=e[0].start,l=r;for(const c of e){let e,d=o,h=n[r%a];for(l=r+1;l<=c.end;l++){const o=n[l%a];e=tn(i.setContext({type:"segment",p0:h,p1:o,p0DataIndex:(l-1)%a,p1DataIndex:l%a,datasetIndex:t._datasetIndex})),en(e,d)&&(s.push({start:r,end:l-1,loop:c.loop,style:d}),d=e,r=l-1),h=o,d=e}r<l-1&&(s.push({start:r,end:l-1,loop:c.loop,style:e}),r=l-1)}return s}(t,e,n,i):e}(t,!0===i?[{start:s,end:r,loop:a}]:function(t,e,n,i){const o=t.length,a=[];let s,r=e,l=t[e];for(s=e+1;s<=n;++s){const n=t[s%o];n.skip||n.stop?l.skip||(i=!1,a.push({start:e%o,end:(s-1)%o,loop:i}),e=r=n.stop?s:null):(r=s,l.skip&&(e=s)),l=n}return null!==r&&a.push({start:e%o,end:r%o,loop:i}),a}(n,s,r<s?r+o:r,!!t._fullLoop&&0===s&&r===o-1),n,e)}(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,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){const n=this,i=n.options,o=t[e],a=n.points,s=function(t,e){const n=[],i=t.segments;for(let o=0;o<i.length;o++){const a=Je(i[o],t.points,e);a.length&&n.push(...a)}return n}(n,{property:e,start:o,end:o});if(!s.length)return;const r=[],l=function(t){return t.stepped?Ye:t.tension||"monotone"===t.cubicInterpolationMode?Xe:Ue}(i);let c,d;for(c=0,d=s.length;c<d;++c){const{start:n,end:d}=s[c],h=a[n],u=a[d];if(h===u){r.push(h);continue}const f=l(h,u,Math.abs((o-h[e])/(u[e]-h[e])),i.stepped);f[e]=t[e],r.push(f)}return 1===r.length?r[0]:r}pathSegment(t,e,n){return uo(this)(t,this,e,n)}path(t,e,n){const i=this,o=i.segments,a=uo(i);let s=i._loop;e=e||0,n=n||i.points.length-e;for(const r of o)s&=a(t,i,r,{start:e,end:e+n-1});return!!s}draw(t,e,n,i){const o=this,a=o.options||{};(o.points||[]).length&&a.borderWidth&&(t.save(),function(t,e,n,i){fo&&1===e.segments.length?function(t,e,n,i){let o=e._path;o||(o=e._path=new Path2D,e.path(o,n,i)&&o.closePath()),so(t,e.options),t.stroke(o)}(t,e,n,i):function(t,e,n,i){const{segments:o,options:a}=e,s=uo(e);for(const r of o)so(t,a,r.style),t.beginPath(),s(t,e,r,{start:n,end:n+i-1})&&t.closePath(),t.stroke()}(t,e,n,i)}(t,o,n,i),t.restore(),o.animated&&(o._pointsUpdated=!1,o._path=void 0))}}function po(t,e,n,i){const o=t.options,{[n]:a}=t.getProps([n],i);return Math.abs(e-a)<o.radius+o.hitRadius}go.id="line",go.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},go.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},go.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class mo extends yi{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,n){const i=this.options,{x:o,y:a}=this.getProps(["x","y"],n);return Math.pow(t-o,2)+Math.pow(e-a,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(t,e){return po(this,t,"x",e)}inYRange(t,e){return po(this,t,"y",e)}getCenterPoint(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}size(t){let e=(t=t||this.options||{}).radius||0;return e=Math.max(e,e&&t.hoverRadius||0),2*(e+(e&&t.borderWidth||0))}draw(t,e){const n=this,i=n.options;n.skip||i.radius<.1||!Yt(n,e,n.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Ut(t,i,n.x,n.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function bo(t,e){const{x:n,y:i,base:o,width:a,height:s}=t.getProps(["x","y","base","width","height"],e);let r,l,c,d,h;return t.horizontal?(h=s/2,r=Math.min(n,o),l=Math.max(n,o),c=i-h,d=i+h):(h=a/2,r=n-h,l=n+h,c=Math.min(i,o),d=Math.max(i,o)),{left:r,top:c,right:l,bottom:d}}function xo(t,e,n,i){return t?0:J(e,n,i)}function yo(t,e,n,i){const o=null===e,a=null===n,s=t&&!(o&&a)&&bo(t,i);return s&&(o||e>=s.left&&e<=s.right)&&(a||n>=s.top&&n<=s.bottom)}function _o(t,e){t.rect(e.x,e.y,e.w,e.h)}function vo(t,e,n={}){const i=t.x!==n.x?-e:0,o=t.y!==n.y?-e:0,a=(t.x+t.w!==n.x+n.w?e:0)-i,s=(t.y+t.h!==n.y+n.h?e:0)-o;return{x:t.x+i,y:t.y+o,w:t.w+a,h:t.h+s,radius:t.radius}}mo.id="point",mo.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},mo.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class wo extends yi{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this.options,{inner:n,outer:i}=function(t){const e=bo(t),n=e.right-e.left,i=e.bottom-e.top,o=function(t,e,n){const i=t.options.borderWidth,o=t.borderSkipped,a=oe(i);return{t:xo(o.top,a.top,0,n),r:xo(o.right,a.right,0,e),b:xo(o.bottom,a.bottom,0,n),l:xo(o.left,a.left,0,e)}}(t,n/2,i/2),a=function(t,e,n){const{enableBorderRadius:i}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,a=ae(o),s=Math.min(e,n),r=t.borderSkipped,l=i||f(o);return{topLeft:xo(!l||r.top||r.left,a.topLeft,0,s),topRight:xo(!l||r.top||r.right,a.topRight,0,s),bottomLeft:xo(!l||r.bottom||r.left,a.bottomLeft,0,s),bottomRight:xo(!l||r.bottom||r.right,a.bottomRight,0,s)}}(t,n/2,i/2);return{outer:{x:e.left,y:e.top,w:n,h:i,radius:a},inner:{x:e.left+o.l,y:e.top+o.t,w:n-o.l-o.r,h:i-o.t-o.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,a.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(o.b,o.r))}}}}(this),o=(a=i.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Jt:_o;var a;t.save(),i.w===n.w&&i.h===n.h||(t.beginPath(),o(t,vo(i,.33,n)),t.clip(),o(t,vo(n,-.33,i)),t.fillStyle=e.borderColor,t.fill("evenodd")),t.beginPath(),o(t,vo(n,.33,i)),t.fillStyle=e.backgroundColor,t.fill(),t.restore()}inRange(t,e,n){return yo(this,t,e,n)}inXRange(t,e){return yo(this,t,null,e)}inYRange(t,e){return yo(this,null,t,e)}getCenterPoint(t){const{x:e,y:n,base:i,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+i)/2:e,y:o?n:(n+i)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}wo.id="bar",wo.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,enableBorderRadius:!0,pointStyle:void 0},wo.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},new WeakMap;const Mo={average(t){if(!t.length)return!1;let e,n,i=0,o=0,a=0;for(e=0,n=t.length;e<n;++e){const n=t[e].element;if(n&&n.hasValue()){const t=n.tooltipPosition();i+=t.x,o+=t.y,++a}}return{x:i/a,y:o/a}},nearest(t,e){if(!t.length)return!1;let n,i,o,a=e.x,s=e.y,r=Number.POSITIVE_INFINITY;for(n=0,i=t.length;n<i;++n){const i=t[n].element;if(i&&i.hasValue()){const t=Z(e,i.getCenterPoint());t<r&&(r=t,o=i)}}if(o){const t=o.tooltipPosition();a=t.x,s=t.y}return{x:a,y:s}}};function ko(t,e){return e&&(u(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function So(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Co(t,e){const{element:n,datasetIndex:i,index:o}=e,a=t.getDatasetMeta(i).controller,{label:s,value:r}=a.getLabelAndValue(o);return{chart:t,label:s,parsed:a.getParsed(o),raw:t.data.datasets[i].data[o],formattedValue:r,dataset:a.getDataset(),dataIndex:o,datasetIndex:i,element:n}}function Do(t,e){const n=t._chart.ctx,{body:i,footer:o,title:a}=t,{boxWidth:s,boxHeight:r}=e,l=re(e.bodyFont),c=re(e.titleFont),d=re(e.footerFont),h=a.length,u=o.length,f=i.length,g=se(e.padding);let p=g.height,m=0,b=i.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);b+=t.beforeBody.length+t.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),b&&(p+=f*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-f)*l.lineHeight+(b-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*d.lineHeight+(u-1)*e.footerSpacing);let x=0;const _=function(t){m=Math.max(m,n.measureText(t).width+x)};return n.save(),n.font=c.string,y(t.title,_),n.font=l.string,y(t.beforeBody.concat(t.afterBody),_),x=e.displayColors?s+2:0,y(i,(t=>{y(t.before,_),y(t.lines,_),y(t.after,_)})),x=0,n.font=d.string,y(t.footer,_),n.restore(),m+=g.width,{width:m,height:p}}function Po(t,e,n,i){const{x:o,width:a}=n,{width:s,chartArea:{left:r,right:l}}=t;let c="center";return"center"===i?c=o<=(r+l)/2?"left":"right":o<=a/2?c="left":o>=s-a/2&&(c="right"),function(t,e,n,i){const{x:o,width:a}=i,s=n.caretSize+n.caretPadding;return"left"===t&&o+a+s>e.width||"right"===t&&o-a-s<0||void 0}(c,t,e,n)&&(c="center"),c}function Oo(t,e,n){const i=e.yAlign||function(t,e){const{y:n,height:i}=e;return n<i/2?"top":n>t.height-i/2?"bottom":"center"}(t,n);return{xAlign:e.xAlign||Po(t,e,n,i),yAlign:i}}function Ao(t,e,n,i){const{caretSize:o,caretPadding:a,cornerRadius:s}=t,{xAlign:r,yAlign:l}=n,c=o+a,d=s+a;let h=function(t,e){let{x:n,width:i}=t;return"right"===e?n-=i:"center"===e&&(n-=i/2),n}(e,r);const u=function(t,e,n){let{y:i,height:o}=t;return"top"===e?i+=n:i-="bottom"===e?o+n:o/2,i}(e,l,c);return"center"===l?"left"===r?h+=c:"right"===r&&(h-=c):"left"===r?h-=d:"right"===r&&(h+=d),{x:J(h,0,i.width-e.width),y:J(u,0,i.height-e.height)}}function To(t,e,n){const i=se(n.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function Eo(t){return ko([],So(t))}function Ro(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}(class extends yi{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,e=t._cachedAnimations;if(e)return e;const n=t._chart,i=t.options.setContext(t.getContext()),o=i.enabled&&n.options.animation&&i.animations,a=new ln(t._chart,o);return o._cacheable&&(t._cachedAnimations=Object.freeze(a)),a}getContext(){const t=this;return t.$context||(t.$context=(e=t._chart.getContext(),n=t,i=t._tooltipItems,Object.assign(Object.create(e),{tooltip:n,tooltipItems:i,type:"tooltip"})));var e,n,i}getTitle(t,e){const n=this,{callbacks:i}=e,o=i.beforeTitle.apply(n,[t]),a=i.title.apply(n,[t]),s=i.afterTitle.apply(n,[t]);let r=[];return r=ko(r,So(o)),r=ko(r,So(a)),r=ko(r,So(s)),r}getBeforeBody(t,e){return Eo(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const n=this,{callbacks:i}=e,o=[];return y(t,(t=>{const e={before:[],lines:[],after:[]},a=Ro(i,t);ko(e.before,So(a.beforeLabel.call(n,t))),ko(e.lines,a.label.call(n,t)),ko(e.after,So(a.afterLabel.call(n,t))),o.push(e)})),o}getAfterBody(t,e){return Eo(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const n=this,{callbacks:i}=e,o=i.beforeFooter.apply(n,[t]),a=i.footer.apply(n,[t]),s=i.afterFooter.apply(n,[t]);let r=[];return r=ko(r,So(o)),r=ko(r,So(a)),r=ko(r,So(s)),r}_createItems(t){const e=this,n=e._active,i=e._chart.data,o=[],a=[],s=[];let r,l,c=[];for(r=0,l=n.length;r<l;++r)c.push(Co(e._chart,n[r]));return t.filter&&(c=c.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(c=c.sort(((e,n)=>t.itemSort(e,n,i)))),y(c,(n=>{const i=Ro(t.callbacks,n);o.push(i.labelColor.call(e,n)),a.push(i.labelPointStyle.call(e,n)),s.push(i.labelTextColor.call(e,n))})),e.labelColors=o,e.labelPointStyles=a,e.labelTextColors=s,e.dataPoints=c,c}update(t,e){const n=this,i=n.options.setContext(n.getContext()),o=n._active;let a,s=[];if(o.length){const t=Mo[i.position].call(n,o,n._eventPosition);s=n._createItems(i),n.title=n.getTitle(s,i),n.beforeBody=n.getBeforeBody(s,i),n.body=n.getBody(s,i),n.afterBody=n.getAfterBody(s,i),n.footer=n.getFooter(s,i);const e=n._size=Do(n,i),r=Object.assign({},t,e),l=Oo(n._chart,i,r),c=Ao(i,r,l,n._chart);n.xAlign=l.xAlign,n.yAlign=l.yAlign,a={opacity:1,x:c.x,y:c.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==n.opacity&&(a={opacity:0});n._tooltipItems=s,n.$context=void 0,a&&n._resolveAnimations().update(n,a),t&&i.external&&i.external.call(n,{chart:n._chart,tooltip:n,replay:e})}drawCaret(t,e,n,i){const o=this.getCaretPosition(t,n,i);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){const{xAlign:i,yAlign:o}=this,{cornerRadius:a,caretSize:s}=n,{x:r,y:l}=t,{width:c,height:d}=e;let h,u,f,g,p,m;return"center"===o?(p=l+d/2,"left"===i?(h=r,u=h-s,g=p+s,m=p-s):(h=r+c,u=h+s,g=p-s,m=p+s),f=h):(u="left"===i?r+a+s:"right"===i?r+c-a-s:this.caretX,"top"===o?(g=l,p=g-s,h=u-s,f=u+s):(g=l+d,p=g+s,h=u+s,f=u-s),m=g),{x1:h,x2:u,x3:f,y1:g,y2:p,y3:m}}drawTitle(t,e,n){const i=this,o=i.title,a=o.length;let s,r,l;if(a){const c=Ke(n.rtl,i.x,i.width);for(t.x=To(i,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",s=re(n.titleFont),r=n.titleSpacing,e.fillStyle=n.titleColor,e.font=s.string,l=0;l<a;++l)e.fillText(o[l],c.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,l+1===a&&(t.y+=n.titleMarginBottom-r)}}_drawColorBox(t,e,n,i,o){const a=this,s=a.labelColors[n],r=a.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,d=re(o.bodyFont),h=To(a,"left",o),u=i.x(h),f=l<d.lineHeight?(d.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const e={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},n=i.leftForLtr(u,c)+c/2,a=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ut(t,e,n,a),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,Ut(t,e,n,a)}else{t.lineWidth=s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=i.leftForLtr(u,c),n=i.leftForLtr(i.xPlus(u,1),c-2),a=ae(s.borderRadius);Object.values(a).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Jt(t,{x:e,y:g,w:c,h:l,radius:a}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Jt(t,{x:n,y:g+1,w:c-2,h:l-2,radius:a}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,g,c,l),t.strokeRect(e,g,c,l),t.fillStyle=s.backgroundColor,t.fillRect(n,g+1,c-2,l-2))}t.fillStyle=a.labelTextColors[n]}drawBody(t,e,n){const i=this,{body:o}=i,{bodySpacing:a,bodyAlign:s,displayColors:r,boxHeight:l,boxWidth:c}=n,d=re(n.bodyFont);let h=d.lineHeight,u=0;const f=Ke(n.rtl,i.x,i.width),g=function(n){e.fillText(n,f.x(t.x+u),t.y+h/2),t.y+=h+a},p=f.textAlign(s);let m,b,x,_,v,w,M;for(e.textAlign=s,e.textBaseline="middle",e.font=d.string,t.x=To(i,p,n),e.fillStyle=n.bodyColor,y(i.beforeBody,g),u=r&&"right"!==p?"center"===s?c/2+1:c+2:0,_=0,w=o.length;_<w;++_){for(m=o[_],b=i.labelTextColors[_],e.fillStyle=b,y(m.before,g),x=m.lines,r&&x.length&&(i._drawColorBox(e,t,_,f,n),h=Math.max(d.lineHeight,l)),v=0,M=x.length;v<M;++v)g(x[v]),h=d.lineHeight;y(m.after,g)}u=0,h=d.lineHeight,y(i.afterBody,g),t.y-=a}drawFooter(t,e,n){const i=this,o=i.footer,a=o.length;let s,r;if(a){const l=Ke(n.rtl,i.x,i.width);for(t.x=To(i,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",s=re(n.footerFont),e.fillStyle=n.footerColor,e.font=s.string,r=0;r<a;++r)e.fillText(o[r],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+n.footerSpacing}}drawBackground(t,e,n,i){const{xAlign:o,yAlign:a}=this,{x:s,y:r}=t,{width:l,height:c}=n,d=i.cornerRadius;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,e.lineWidth=i.borderWidth,e.beginPath(),e.moveTo(s+d,r),"top"===a&&this.drawCaret(t,e,n,i),e.lineTo(s+l-d,r),e.quadraticCurveTo(s+l,r,s+l,r+d),"center"===a&&"right"===o&&this.drawCaret(t,e,n,i),e.lineTo(s+l,r+c-d),e.quadraticCurveTo(s+l,r+c,s+l-d,r+c),"bottom"===a&&this.drawCaret(t,e,n,i),e.lineTo(s+d,r+c),e.quadraticCurveTo(s,r+c,s,r+c-d),"center"===a&&"left"===o&&this.drawCaret(t,e,n,i),e.lineTo(s,r+d),e.quadraticCurveTo(s,r,s+d,r),e.closePath(),e.fill(),i.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this,n=e._chart,i=e.$animations,o=i&&i.x,a=i&&i.y;if(o||a){const i=Mo[t.position].call(e,e._active,e._eventPosition);if(!i)return;const s=e._size=Do(e,t),r=Object.assign({},i,e._size),l=Oo(n,t,r),c=Ao(t,r,l,n);o._to===c.x&&a._to===c.y||(e.xAlign=l.xAlign,e.yAlign=l.yAlign,e.width=s.width,e.height=s.height,e.caretX=i.x,e.caretY=i.y,e._resolveAnimations().update(e,c))}}draw(t){const e=this,n=e.options.setContext(e.getContext());let i=e.opacity;if(!i)return;e._updateAnimationTarget(n);const o={width:e.width,height:e.height},a={x:e.x,y:e.y};i=Math.abs(i)<.001?0:i;const s=se(n.padding),r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;n.enabled&&r&&(t.save(),t.globalAlpha=i,e.drawBackground(a,t,o,n),function(t,e){let n,i;"ltr"!==e&&"rtl"!==e||(n=t.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=i)}(t,n.textDirection),a.y+=s.top,e.drawTitle(a,t,n),e.drawBody(a,t,n),e.drawFooter(a,t,n),function(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this,i=n._active,o=t.map((({datasetIndex:t,index:e})=>{const i=n._chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),a=!_(i,o),s=n._positionChanged(o,e);(a||s)&&(n._active=o,n._eventPosition=e,n.update(!0))}handleEvent(t,e){const n=this,i=n.options,o=n._active||[];let a=!1,s=[];"mouseout"!==t.type&&(s=n._chart.getElementsAtEventForMode(t,i.mode,i,e),i.reverse&&s.reverse());const r=n._positionChanged(s,t);return a=e||!_(s,o)||r,a&&(n._active=s,(i.enabled||i.external)&&(n._eventPosition={x:t.x,y:t.y},n.update(!0,e))),a}_positionChanged(t,e){const{caretX:n,caretY:i,options:o}=this,a=Mo[o.position].call(this,t,e);return!1!==a&&(n!==a.x||i!==a.y)}}).positioners=Mo;class Lo extends Oi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0}parse(t,e){if(h(t))return null;const n=this.getLabels();return((t,e)=>null===t?null:J(Math.round(t),0,e))(e=isFinite(e)&&n[e]===t?e:function(t,e,n){const i=t.indexOf(e);return-1===i?((t,e,n)=>"string"==typeof e?t.push(e)-1:isNaN(e)?null:n)(t,e,n):i!==t.lastIndexOf(e)?n:i}(n,t,m(e,t)),n.length-1)}determineDataLimits(){const t=this,{minDefined:e,maxDefined:n}=t.getUserBounds();let{min:i,max:o}=t.getMinMax(!0);"ticks"===t.options.bounds&&(e||(i=0),n||(o=t.getLabels().length-1)),t.min=i,t.max=o}buildTicks(){const t=this,e=t.min,n=t.max,i=t.options.offset,o=[];let a=t.getLabels();a=0===e&&n===a.length-1?a:a.slice(e,n+1),t._valueRange=Math.max(a.length-(i?0:1),1),t._startValue=t.min-(i?.5:0);for(let t=e;t<=n;t++)o.push({value:t});return o}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){const t=this;super.configure(),t.isHorizontal()||(t._reversePixels=!t._reversePixels)}getPixelForValue(t){const e=this;return"number"!=typeof t&&(t=e.parse(t)),null===t?NaN:e.getPixelForDecimal((t-e._startValue)/e._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){const e=this;return Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange)}getBasePixel(){return this.bottom}}function Io(t,e,{horizontal:n,minRotation:i}){const o=Y(i),a=(n?Math.sin(o):Math.cos(o))||.001,s=.75*e*(""+t).length;return Math.min(e/a,s)}Lo.id="category",Lo.defaults={ticks:{callback:Lo.prototype.getLabelForValue}};class zo extends Oi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return h(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const t=this,{beginAtZero:e}=t.options,{minDefined:n,maxDefined:i}=t.getUserBounds();let{min:o,max:a}=t;const s=t=>o=n?o:t,r=t=>a=i?a:t;if(e){const t=W(o),e=W(a);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(o===a){let t=1;(a>=Number.MAX_SAFE_INTEGER||o<=Number.MIN_SAFE_INTEGER)&&(t=Math.abs(.05*a)),r(a+t),e||s(o-t)}t.min=o,t.max=a}getTickLimit(){const t=this,e=t.options.ticks;let n,{maxTicksLimit:i,stepSize:o}=e;return o?n=Math.ceil(t.max/o)-Math.floor(t.min/o)+1:(n=t.computeTickLimit(),i=i||11),i&&(n=Math.min(i,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this,e=t.options,n=e.ticks;let i=t.getTickLimit();i=Math.max(2,i);const o=function(t,e){const n=[],{bounds:i,step:o,min:a,max:s,precision:r,count:l,maxTicks:c,maxDigits:d,includeBounds:u}=t,f=o||1,g=c-1,{min:p,max:m}=e,b=!h(a),x=!h(s),y=!h(l),_=(m-p)/(d+1);let v,w,M,k,S=N((m-p)/g/f)*f;if(S<1e-14&&!b&&!x)return[{value:p},{value:m}];k=Math.ceil(m/S)-Math.floor(p/S),k>g&&(S=N(k*S/g/f)*f),h(r)||(v=Math.pow(10,r),S=Math.ceil(S*v)/v),"ticks"===i?(w=Math.floor(p/S)*S,M=Math.ceil(m/S)*S):(w=p,M=m),b&&x&&o&&function(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}((s-a)/o,S/1e3)?(k=Math.round(Math.min((s-a)/S,c)),S=(s-a)/k,w=a,M=s):y?(w=b?a:w,M=x?s:M,k=l-1,S=(M-w)/k):(k=(M-w)/S,k=$(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const C=Math.max(q(S),q(w));v=Math.pow(10,h(r)?C:r),w=Math.round(w*v)/v,M=Math.round(M*v)/v;let D=0;for(b&&(u&&w!==a?(n.push({value:a}),w<a&&D++,$(Math.round((w+D*S)*v)/v,a,Io(a,_,t))&&D++):w<a&&D++);D<k;++D)n.push({value:Math.round((w+D*S)*v)/v});return x&&u&&M!==s?$(n[n.length-1].value,s,Io(s,_,t))?n[n.length-1].value=s:n.push({value:s}):x&&M!==s||n.push({value:M}),n}({maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:t._maxDigits(),horizontal:t.isHorizontal(),minRotation:n.minRotation||0,includeBounds:!1!==n.includeBounds},t._range||t);return"ticks"===e.bounds&&U(o,t,"value"),e.reverse?(o.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),o}configure(){const t=this,e=t.ticks;let n=t.min,i=t.max;if(super.configure(),t.options.offset&&e.length){const t=(i-n)/Math.max(e.length-1,1)/2;n-=t,i+=t}t._startValue=n,t._endValue=i,t._valueRange=i-n}getLabelForValue(t){return Ze(t,this.chart.options.locale)}}class Fo extends zo{determineDataLimits(){const t=this,{min:e,max:n}=t.getMinMax(!0);t.min=g(e)?e:0,t.max=g(n)?n:1,t.handleTickRangeOptions()}computeTickLimit(){const t=this,e=t.isHorizontal(),n=e?t.width:t.height,i=Y(t.options.ticks.minRotation),o=(e?Math.sin(i):Math.cos(i))||.001,a=t._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,a.lineHeight/o))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function Vo(t){return 1==t/Math.pow(10,Math.floor(j(t)))}Fo.id="linear",Fo.defaults={ticks:{callback:vi.formatters.numeric}};class Bo extends Oi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const n=zo.prototype.parse.apply(this,[t,e]);if(0!==n)return g(n)&&n>0?n:null;this._zero=!0}determineDataLimits(){const t=this,{min:e,max:n}=t.getMinMax(!0);t.min=g(e)?Math.max(0,e):null,t.max=g(n)?Math.max(0,n):null,t.options.beginAtZero&&(t._zero=!0),t.handleTickRangeOptions()}handleTickRangeOptions(){const t=this,{minDefined:e,maxDefined:n}=t.getUserBounds();let i=t.min,o=t.max;const a=t=>i=e?i:t,s=t=>o=n?o:t,r=(t,e)=>Math.pow(10,Math.floor(j(t))+e);i===o&&(i<=0?(a(1),s(10)):(a(r(i,-1)),s(r(o,1)))),i<=0&&a(r(o,-1)),o<=0&&s(r(i,1)),t._zero&&t.min!==t._suggestedMin&&i===r(t.min,0)&&a(r(i,-1)),t.min=i,t.max=o}buildTicks(){const t=this,e=t.options,n=function(t,e){const n=Math.floor(j(e.max)),i=Math.ceil(e.max/Math.pow(10,n)),o=[];let a=p(t.min,Math.pow(10,Math.floor(j(e.min)))),s=Math.floor(j(a)),r=Math.floor(a/Math.pow(10,s)),l=s<0?Math.pow(10,Math.abs(s)):1;do{o.push({value:a,major:Vo(a)}),++r,10===r&&(r=1,++s,l=s>=0?1:l),a=Math.round(r*Math.pow(10,s)*l)/l}while(s<n||s===n&&r<i);const c=p(t.max,a);return o.push({value:c,major:Vo(a)}),o}({min:t._userMin,max:t._userMax},t);return"ticks"===e.bounds&&U(n,t,"value"),e.reverse?(n.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),n}getLabelForValue(t){return void 0===t?"0":Ze(t,this.chart.options.locale)}configure(){const t=this,e=t.min;super.configure(),t._startValue=j(e),t._valueRange=j(t.max)-j(e)}getPixelForValue(t){const e=this;return void 0!==t&&0!==t||(t=e.min),null===t||isNaN(t)?NaN:e.getPixelForDecimal(t===e.min?0:(j(t)-e._startValue)/e._valueRange)}getValueForPixel(t){const e=this,n=e.getDecimalForPixel(t);return Math.pow(10,e._startValue+n*e._valueRange)}}function jo(t){const e=t.ticks;if(e.display&&t.display){const t=se(e.backdropPadding);return m(e.font&&e.font.size,jt.font.size)+t.height}return 0}function Wo(t,e,n,i,o){return t===i||t===o?{start:e-n/2,end:e+n/2}:t<i||t>o?{start:e-n,end:e}:{start:e,end:e+n}}function No(t){return 0===t||180===t?"center":t<180?"left":"right"}function Ho(t,e,n){return 90===n||270===n?t-=e/2:(n>270||n<90)&&(t-=e),t}function $o(t,e,n,i){const{ctx:o}=t;if(n)o.arc(t.xCenter,t.yCenter,e,0,R);else{let n=t.getPointPosition(0,e);o.moveTo(n.x,n.y);for(let a=1;a<i;a++)n=t.getPointPosition(a,e),o.lineTo(n.x,n.y)}}function Uo(t){return H(t)?t:0}Bo.id="logarithmic",Bo.defaults={ticks:{callback:vi.formatters.logarithmic,major:{enabled:!0}}};class Yo extends zo{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=jo(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2}determineDataLimits(){const t=this,{min:e,max:n}=t.getMinMax(!1);t.min=g(e)&&!isNaN(e)?e:0,t.max=g(n)&&!isNaN(n)?n:0,t.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/jo(this.options))}generateTickLabels(t){const e=this;zo.prototype.generateTickLabels.call(e,t),e._pointLabels=e.getLabels().map(((t,n)=>{const i=x(e.options.pointLabels.callback,[t,n],e);return i||0===i?i:""}))}fit(){const t=this,e=t.options;e.display&&e.pointLabels.display?function(t){const e={l:0,r:t.width,t:0,b:t.height-t.paddingTop},n={},i=[],o=[],a=t.getLabels().length;for(let c=0;c<a;c++){const a=t.options.pointLabels.setContext(t.getPointLabelContext(c));o[c]=a.padding;const d=t.getPointPosition(c,t.drawingArea+o[c]),h=re(a.font),f=(s=t.ctx,r=h,l=u(l=t._pointLabels[c])?l:[l],{w:Nt(s,r.string,l),h:l.length*r.lineHeight});i[c]=f;const g=t.getIndexAngle(c),p=X(g),m=Wo(p,d.x,f.w,0,180),b=Wo(p,d.y,f.h,90,270);m.start<e.l&&(e.l=m.start,n.l=g),m.end>e.r&&(e.r=m.end,n.r=g),b.start<e.t&&(e.t=b.start,n.t=g),b.end>e.b&&(e.b=b.end,n.b=g)}var s,r,l;t._setReductions(t.drawingArea,e,n),t._pointLabelItems=function(t,e,n){const i=[],o=t.getLabels().length,a=t.options,s=jo(a),r=t.getDistanceFromCenterForValue(a.ticks.reverse?t.min:t.max);for(let a=0;a<o;a++){const o=0===a?s/2:0,h=t.getPointPosition(a,r+o+n[a]),u=X(t.getIndexAngle(a)),f=e[a],g=Ho(h.y,f.h,u),p=No(u),m=(l=h.x,c=f.w,"right"===(d=p)?l-=c:"center"===d&&(l-=c/2),l);i.push({x:h.x,y:g,textAlign:p,left:m,top:g,right:m+f.w,bottom:g+f.h})}var l,c,d;return i}(t,i,o)}(t):t.setCenterPoint(0,0,0,0)}_setReductions(t,e,n){const i=this;let o=e.l/Math.sin(n.l),a=Math.max(e.r-i.width,0)/Math.sin(n.r),s=-e.t/Math.cos(n.t),r=-Math.max(e.b-(i.height-i.paddingTop),0)/Math.cos(n.b);o=Uo(o),a=Uo(a),s=Uo(s),r=Uo(r),i.drawingArea=Math.max(t/2,Math.min(Math.floor(t-(o+a)/2),Math.floor(t-(s+r)/2))),i.setCenterPoint(o,a,s,r)}setCenterPoint(t,e,n,i){const o=this,a=o.width-e-o.drawingArea,s=t+o.drawingArea,r=n+o.drawingArea,l=o.height-o.paddingTop-i-o.drawingArea;o.xCenter=Math.floor((s+a)/2+o.left),o.yCenter=Math.floor((r+l)/2+o.top+o.paddingTop)}getIndexAngle(t){return G(t*(R/this.getLabels().length)+Y(this.options.startAngle||0))}getDistanceFromCenterForValue(t){const e=this;if(h(t))return NaN;const n=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*n:(t-e.min)*n}getValueForDistanceFromCenter(t){if(h(t))return NaN;const e=this,n=t/(e.drawingArea/(e.max-e.min));return e.options.reverse?e.max-n:e.min+n}getPointLabelContext(t){const e=this,n=e._pointLabels||[];if(t>=0&&t<n.length){const i=n[t];return function(t,e,n){return Object.assign(Object.create(t),{label:n,index:e,type:"pointLabel"})}(e.getContext(),t,i)}}getPointPosition(t,e){const n=this,i=n.getIndexAngle(t)-F;return{x:Math.cos(i)*e+n.xCenter,y:Math.sin(i)*e+n.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:n,right:i,bottom:o}=this._pointLabelItems[t];return{left:e,top:n,right:i,bottom:o}}drawBackground(){const t=this,{backgroundColor:e,grid:{circular:n}}=t.options;if(e){const i=t.ctx;i.save(),i.beginPath(),$o(t,t.getDistanceFromCenterForValue(t._endValue),n,t.getLabels().length),i.closePath(),i.fillStyle=e,i.fill(),i.restore()}}drawGrid(){const t=this,e=t.ctx,n=t.options,{angleLines:i,grid:o}=n,a=t.getLabels().length;let s,r,l;if(n.pointLabels.display&&function(t,e){const{ctx:n,options:{pointLabels:i}}=t;for(let o=e-1;o>=0;o--){const e=i.setContext(t.getPointLabelContext(o)),a=re(e.font),{x:s,y:r,textAlign:l,left:c,top:d,right:u,bottom:f}=t._pointLabelItems[o],{backdropColor:g}=e;if(!h(g)){const t=se(e.backdropPadding);n.fillStyle=g,n.fillRect(c-t.left,d-t.top,u-c+t.width,f-d+t.height)}Gt(n,t._pointLabels[o],s,r+a.lineHeight/2,a,{color:e.color,textAlign:l,textBaseline:"middle"})}}(t,a),o.display&&t.ticks.forEach(((e,n)=>{if(0!==n){r=t.getDistanceFromCenterForValue(e.value);const i=o.setContext(t.getContext(n-1));!function(t,e,n,i){const o=t.ctx,a=e.circular,{color:s,lineWidth:r}=e;!a&&!i||!s||!r||n<0||(o.save(),o.strokeStyle=s,o.lineWidth=r,o.setLineDash(e.borderDash),o.lineDashOffset=e.borderDashOffset,o.beginPath(),$o(t,n,a,i),o.closePath(),o.stroke(),o.restore())}(t,i,r,a)}})),i.display){for(e.save(),s=t.getLabels().length-1;s>=0;s--){const o=i.setContext(t.getPointLabelContext(s)),{color:a,lineWidth:c}=o;c&&a&&(e.lineWidth=c,e.strokeStyle=a,e.setLineDash(o.borderDash),e.lineDashOffset=o.borderDashOffset,r=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),l=t.getPointPosition(s,r),e.beginPath(),e.moveTo(t.xCenter,t.yCenter),e.lineTo(l.x,l.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const t=this,e=t.ctx,n=t.options,i=n.ticks;if(!i.display)return;const o=t.getIndexAngle(0);let a,s;e.save(),e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",t.ticks.forEach(((o,r)=>{if(0===r&&!n.reverse)return;const l=i.setContext(t.getContext(r)),c=re(l.font);if(a=t.getDistanceFromCenterForValue(t.ticks[r].value),l.showLabelBackdrop){e.font=c.string,s=e.measureText(o.label).width,e.fillStyle=l.backdropColor;const t=se(l.backdropPadding);e.fillRect(-s/2-t.left,-a-c.size/2-t.top,s+t.width,c.size+t.height)}Gt(e,o.label,0,-a,c,{color:l.color})})),e.restore()}drawTitle(){}}Yo.id="radialLinear",Yo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:vi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5}},Yo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},Yo.descriptors={angleLines:{_fallback:"grid"}};const Xo={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}},qo=Object.keys(Xo);function Zo(t,e){return t-e}function Ko(t,e){if(h(e))return null;const n=t._adapter,{parser:i,round:o,isoWeekday:a}=t._parseOpts;let s=e;return"function"==typeof i&&(s=i(s)),g(s)||(s="string"==typeof i?n.parse(s,i):n.parse(s)),null===s?null:(o&&(s="week"!==o||!H(a)&&!0!==a?n.startOf(s,o):n.startOf(s,"isoWeek",a)),+s)}function Go(t,e,n,i){const o=qo.length;for(let a=qo.indexOf(t);a<o-1;++a){const t=Xo[qo[a]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((n-e)/(o*t.size))<=i)return qo[a]}return qo[o-1]}function Qo(t,e,n){if(n){if(n.length){const{lo:i,hi:o}=ce(n,e);t[n[i]>=e?n[i]:n[o]]=!0}}else t[e]=!0}function Jo(t,e,n){const i=[],o={},a=e.length;let s,r;for(s=0;s<a;++s)r=e[s],o[r]=s,i.push({value:r,major:!1});return 0!==a&&n?function(t,e,n,i){const o=t._adapter,a=+o.startOf(e[0].value,i),s=e[e.length-1].value;let r,l;for(r=a;r<=s;r=+o.add(r,1,i))l=n[r],l>=0&&(e[l].major=!0);return e}(t,i,o,n):i}class ta extends Oi{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 n=t.time||(t.time={}),i=this._adapter=new Vn._date(t.adapters.date);S(n.displayFormats,i.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Ko(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this,e=t.options,n=t._adapter,i=e.time.unit||"day";let{min:o,max:a,minDefined:s,maxDefined:r}=t.getUserBounds();function l(t){s||isNaN(t.min)||(o=Math.min(o,t.min)),r||isNaN(t.max)||(a=Math.max(a,t.max))}s&&r||(l(t._getLabelBounds()),"ticks"===e.bounds&&"labels"===e.ticks.source||l(t.getMinMax(!1))),o=g(o)&&!isNaN(o)?o:+n.startOf(Date.now(),i),a=g(a)&&!isNaN(a)?a:+n.endOf(Date.now(),i)+1,t.min=Math.min(o,a-1),t.max=Math.max(o+1,a)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){const t=this,e=t.options,n=e.time,i=e.ticks,o="labels"===i.source?t.getLabelTimestamps():t._generate();"ticks"===e.bounds&&o.length&&(t.min=t._userMin||o[0],t.max=t._userMax||o[o.length-1]);const a=t.min,s=function(t,e,n){let i=0,o=t.length;for(;i<o&&t[i]<e;)i++;for(;o>i&&t[o-1]>n;)o--;return i>0||o<t.length?t.slice(i,o):t}(o,a,t.max);return t._unit=n.unit||(i.autoSkip?Go(n.minUnit,t.min,t.max,t._getLabelCapacity(a)):function(t,e,n,i,o){for(let a=qo.length-1;a>=qo.indexOf(n);a--){const n=qo[a];if(Xo[n].common&&t._adapter.diff(o,i,n)>=e-1)return n}return qo[n?qo.indexOf(n):0]}(t,s.length,n.minUnit,t.min,t.max)),t._majorUnit=i.major.enabled&&"year"!==t._unit?function(t){for(let e=qo.indexOf(t)+1,n=qo.length;e<n;++e)if(Xo[qo[e]].common)return qo[e]}(t._unit):void 0,t.initOffsets(o),e.reverse&&s.reverse(),Jo(t,s,t._majorUnit)}initOffsets(t){const e=this;let n,i,o=0,a=0;e.options.offset&&t.length&&(n=e.getDecimalForValue(t[0]),o=1===t.length?1-n:(e.getDecimalForValue(t[1])-n)/2,i=e.getDecimalForValue(t[t.length-1]),a=1===t.length?i:(i-e.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;o=J(o,0,s),a=J(a,0,s),e._offsets={start:o,end:a,factor:1/(o+1+a)}}_generate(){const t=this,e=t._adapter,n=t.min,i=t.max,o=t.options,a=o.time,s=a.unit||Go(a.minUnit,n,i,t._getLabelCapacity(n)),r=m(a.stepSize,1),l="week"===s&&a.isoWeekday,c=H(l)||!0===l,d={};let h,u,f=n;if(c&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,c?"day":s),e.diff(i,n,s)>1e5*r)throw new Error(n+" and "+i+" are too far apart with stepSize of "+r+" "+s);const g="data"===o.ticks.source&&t.getDataTimestamps();for(h=f,u=0;h<i;h=+e.add(h,r,s),u++)Qo(d,h,g);return h!==i&&"ticks"!==o.bounds&&1!==u||Qo(d,h,g),Object.keys(d).sort(((t,e)=>t-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}_tickFormatFunction(t,e,n,i){const o=this,a=o.options,s=a.time.displayFormats,r=o._unit,l=o._majorUnit,c=r&&s[r],d=l&&s[l],h=n[e],u=l&&d&&h&&h.major,f=o._adapter.format(t,i||(u?d:c)),g=a.ticks.callback;return g?x(g,[f,e,n],o):f}generateTickLabels(t){let e,n,i;for(e=0,n=t.length;e<n;++e)i=t[e],i.label=this._tickFormatFunction(i.value,e,t)}getDecimalForValue(t){const e=this;return null===t?NaN:(t-e.min)/(e.max-e.min)}getPixelForValue(t){const e=this,n=e._offsets,i=e.getDecimalForValue(t);return e.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const e=this,n=e._offsets,i=e.getDecimalForPixel(t)/n.factor-n.end;return e.min+i*(e.max-e.min)}_getLabelSize(t){const e=this,n=e.options.ticks,i=e.ctx.measureText(t).width,o=Y(e.isHorizontal()?n.maxRotation:n.minRotation),a=Math.cos(o),s=Math.sin(o),r=e._resolveTickFontOptions(0).size;return{w:i*a+r*s,h:i*s+r*a}}_getLabelCapacity(t){const e=this,n=e.options.time,i=n.displayFormats,o=i[n.unit]||i.millisecond,a=e._tickFormatFunction(t,0,Jo(e,[t],e._majorUnit),o),s=e._getLabelSize(a),r=Math.floor(e.isHorizontal()?e.width/s.w:e.height/s.h)-1;return r>0?r:1}getDataTimestamps(){const t=this;let e,n,i=t._cache.data||[];if(i.length)return i;const o=t.getMatchingVisibleMetas();if(t._normalized&&o.length)return t._cache.data=o[0].controller.getAllParsedValues(t);for(e=0,n=o.length;e<n;++e)i=i.concat(o[e].controller.getAllParsedValues(t));return t._cache.data=t.normalize(i)}getLabelTimestamps(){const t=this,e=t._cache.labels||[];let n,i;if(e.length)return e;const o=t.getLabels();for(n=0,i=o.length;n<i;++n)e.push(Ko(t,o[n]));return t._cache.labels=t._normalized?e:t.normalize(e)}normalize(t){return ge(t.sort(Zo))}}function ea(t,e,n){let i,o,a,s,r=0,l=t.length-1;n?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=de(t,"pos",e)),({pos:i,time:a}=t[r]),({pos:o,time:s}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=de(t,"time",e)),({time:i,pos:a}=t[r]),({time:o,pos:s}=t[l]));const c=o-i;return c?a+(s-a)*(e-i)/c:a}ta.id="time",ta.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class na extends ta{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this,e=t._getTimestampsForTable(),n=t._table=t.buildLookupTable(e);t._minPos=ea(n,t.min),t._tableRange=ea(n,t.max)-t._minPos,super.initOffsets(e)}buildLookupTable(t){const{min:e,max:n}=this,i=[],o=[];let a,s,r,l,c;for(a=0,s=t.length;a<s;++a)l=t[a],l>=e&&l<=n&&i.push(l);if(i.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(a=0,s=i.length;a<s;++a)c=i[a+1],r=i[a-1],l=i[a],Math.round((c+r)/2)!==l&&o.push({time:l,pos:a/(s-1)});return o}_getTimestampsForTable(){const t=this;let e=t._cache.all||[];if(e.length)return e;const n=t.getDataTimestamps(),i=t.getLabelTimestamps();return e=n.length&&i.length?t.normalize(n.concat(i)):n.length?n:i,e=t._cache.all=e,e}getDecimalForValue(t){return(ea(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this,n=e._offsets,i=e.getDecimalForPixel(t)/n.factor-n.end;return ea(e._table,i*e._tableRange+e._minPos,!0)}}na.id="timeseries",na.defaults=ta.defaults,Ji.defaults.color="#b0b0b0";var ia={y:{display:!0,ticks:{suggestedMin:0},gridLines:{color:"#606060",zeroLineColor:"#606060"}}},oa="#e7c9e5",aa="#64a6bd",sa="#404040";function ra(t,e){var n=-1,i=Date.now(),o={label:"texture count",data:[{x:0,y:0}],borderColor:oa,borderWidth:1.5,pointRadius:1},a={label:"geometry count",data:[{x:0,y:0}],borderColor:aa,borderWidth:1.5,pointRadius:1},s=["0s"],r=new Ji(t,{type:"line",data:{labels:s,datasets:[o,a]},options:{animation:{duration:10},scales:ia}});this.update=function(t){var l=Math.floor((Date.now()-i)/1e3),c="".concat(l,"s");n>0&&s[n]==c?s.push(""):(s.push(c),n=s.length-1),s.length>60&&(s.shift(),n--);var d=e.info.memory;o.data.push({x:l,y:d.textures}),a.data.push({x:l,y:d.geometries}),o.data.length>60&&(o.data.shift(),a.data.shift()),t&&r.update()},this.resize=function(){r.resize()}}Ji.register(Tn,go,mo,Fo,Lo,wo,Pn);var la=n(15671),ca=n(43144),da=n(79340),ha=n(82963),ua=n(61120);const fa=function(t){(0,da.Z)(a,t);var e,n,o=(e=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,i=(0,ua.Z)(e);if(n){var o=(0,ua.Z)(this).constructor;t=Reflect.construct(i,arguments,o)}else t=i.apply(this,arguments);return(0,ha.Z)(this,t)});function a(t,e,n){var s;return(0,la.Z)(this,a),n=n||new i.Color(Math.random(),Math.random(),Math.random()),(s=o.call(this,t.box3D,n.getHex())).obb=t,s.material.linewidth=2,s.frustumCulled=!1,s.matrixAutoUpdate=!1,s.rotationAutoUpdate=!1,s.updateMatrixWorld(!0),s}return(0,ca.Z)(a,[{key:"removeChildren",value:function(){this.material.dispose(),this.geometry.dispose()}},{key:"updateMatrixWorld",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.obb.box3D.isEmpty()||(this.quaternion.copy(this.obb.quaternion),this.obb.box3D.getCenter(this.position).applyQuaternion(this.quaternion).add(this.obb.position),this.obb.box3D.getSize(this.scale),this.scale.multiplyScalar(.5),this.updateMatrix(),i.Object3D.prototype.updateMatrixWorld.call(this,t))}}]),a}(i.Box3Helper);function ga(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return pa(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pa(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function pa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function ma(t,e,n){var r=this;n||((n=document.createElement("div")).id="chart-div",n.style.cssText="z-index: 10; position: absolute; bottom: 0; left: 0; width: 100vw; height: 30%; background-color: ".concat(sa,"; display: none"),document.body.appendChild(n)),this.chartDivContainer=n;var l=this.createChartContainer("three-info").getContext("2d");this.charts=[],this.charts.push(new ra(l,t.mainLoop.gfxEngine.renderer));var c,d,h,u,f=this.charts,g=t.tileLayer,p=new o.Z(t.referenceCrs,0,0,0),m=new o.Z("EPSG:4326",0,0,0),b=e.addFolder("Debug Tools"),x={displayCharts:!1,eventsDebug:!1,debugCameraWindow:!1,freeze:!1},y=function(){c=Date.now()},_=function(){var t,e,i=Date.now()-c;t=i,e="none"!=n.style.display,f.forEach((function(n){return n.update(e,t)}))};b.add(x,"displayCharts").name("Display charts").onChange((function(e){e?(t.addFrameRequester(a.Ao.UPDATE_START,y),t.addFrameRequester(a.Ao.UPDATE_END,_),n.style.display="flex"):(t.removeFrameRequester(a.Ao.UPDATE_START,y),t.removeFrameRequester(a.Ao.UPDATE_END,_),n.style.display="none"),r.updateChartDivSize(),t.notifyChange()})),b.add(x,"debugCameraWindow").name("debug Camera").onChange((function(e){e?t.addFrameRequester(a.Ao.AFTER_RENDER,z):t.removeFrameRequester(a.Ao.AFTER_RENDER,z),t.notifyChange()})),b.add(x,"freeze").name("freeze update").onChange((function(e){g.frozen=e,t.notifyChange()}));var v=t.controls;p.crs=t.referenceCrs;var w=new i.Vector3,M=v&&v.getCameraTargetPosition?v.getCameraTargetPosition:function(){return t.camera.camera3D.position},k=function(e){t.getPickingPositionFromDepth(t.eventToViewCoords(e),w)?(p.setFromVector3(w).as("EPSG:4326",m),x.latitude="".concat(m.y.toFixed(6)),x.longitude="".concat(m.x.toFixed(6))):(x.latitude="---------",x.longitude="---------"),d.updateDisplay(),h.updateDisplay()};b.add(x,"eventsDebug").name("Debug event").onChange((function(e){e?((u=b.addFolder("Events")).open(),p.setFromVector3(M()).as("EPSG:4326",m),x.latitude="".concat(m.y.toFixed(6)),x.longitude="".concat(m.x.toFixed(6)),d=u.add(x,"latitude"),h=u.add(x,"longitude"),t.domElement.addEventListener("mousemove",k)):(t.domElement.removeEventListener("mousemove",k),b.removeFolder("Events"))}));var S=new i.CameraHelper(t.camera.camera3D),C=t.camera.camera3D.clone();C.fov*=1.5,C.updateProjectionMatrix();var D=t.mainLoop.gfxEngine,P=D.renderer,O=1e11,A=t.getLayerById("atmosphere");A&&(O=A.fog.distance),S.visible=!1,t.scene.add(S);var T=new s.Z,E=new fa(T,"",new i.Color(aa));function R(t){t.material&&O&&(t.material.fogDistance=O)}E.visible=!1,t.scene.add(T),t.scene.add(E);var L=new i.Color,I=new i.Vector3;function z(){if(x.debugCameraWindow&&C){var e={x:.25*D.width,y:.25*D.height};C.aspect=e.x/e.y;var i=t.camera.camera3D,a=new o.Z(t.referenceCrs,i.position).as(g.extent.crs),s=t.tileLayer.info.displayed.extent;T.setFromExtent(s),E.visible=!0,E.updateMatrixWorld(!0);var r=1.5*a.z;if(a.z=r,a.as(t.referenceCrs).toVector3(C.position),i.worldToLocal(C.position),C.position.z+=r,i.localToWorld(C.position),I.copy(t.camera.camera3D.position),i.worldToLocal(I),I.z-=1.5*r,i.localToWorld(I),C.lookAt(I),S.update(),C.updateProjectionMatrix(),A){A.object3d.visible=!1,O=1e11;var l,c=ga(g.level0Nodes);try{for(c.s();!(l=c.n()).done;)l.value.traverseVisible(R)}catch(t){c.e(t)}finally{c.f()}}var d=x.displayCharts?Math.round(parseFloat(n.style.height.replace("%",""))*D.height/100)+3:0;if(S.visible=!0,S.updateMatrixWorld(!0),P.getClearColor(L),P.setViewport(D.width-e.x,d,e.x,e.y),P.setScissor(D.width-e.x,d,e.x,e.y),P.setScissorTest(!0),P.setClearColor(sa),P.clear(),P.render(t.scene,C),P.setScissorTest(!1),P.setClearColor(L),P.setViewport(0,0,D.width,D.height),S.visible=!1,E.visible=!1,A&&(A.object3d.visible=!0),A){O=A.fog.distance;var h,u=ga(g.level0Nodes);try{for(u.s();!(h=u.n()).done;)h.value.traverseVisible(R)}catch(t){u.e(t)}finally{u.f()}}}}}ma.prototype.createChartContainer=function(t){var e=document.createElement("div");e.style.cssText="background-color: ".concat(sa,"; flex: auto;"),this.chartDivContainer.appendChild(e);var n=document.createElement("canvas");return n.height="20rem",n.id=t,e.appendChild(n),n},ma.prototype.updateChartDivSize=function(){var t,e=0,n=ga(this.chartDivContainer.getElementsByTagName("div"));try{for(n.s();!(t=n.n()).done;)"none"!==t.value.style.display&&e++}catch(t){n.e(t)}finally{n.f()}var i,o=Math.floor(100/e),a=ga(this.chartDivContainer.getElementsByTagName("div"));try{for(a.s();!(i=a.n()).done;){var s=i.value;"none"!==s.style.display&&(s.style.width="".concat(o,"%"))}}catch(t){a.e(t)}finally{a.f()}this.charts.forEach((function(t){t.resize(),t.update()}))};const ba=ma;var xa=n(42175);function ya(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}const _a={initTools:function(t,e,n){var i=function(){return t.notifyChange(e,!0)};e.debugUI=n.addFolder("".concat(e.id)),e.debugUI.add(e,"visible").name("Visible").onChange(i),e.debugUI.add(e,"sseThreshold").name("SSE threshold").onChange(i),e.debugUI.add(e,"octreeDepthLimit",-1,20).name("Depth limit").onChange(i),e.debugUI.add(e,"pointBudget",1,15e6).name("Max point count").onChange(i),e.debugUI.add(e.object3d.position,"z",-50,50).name("Z translation").onChange((function(){e.object3d.updateMatrixWorld(),t.notifyChange(e)})),e.dbgStickyNode="",e.dbgDisplaySticky=!1,e.dbgDisplayChildren=!0,e.dbgDisplayParents=!0;var o=e.debugUI.addFolder("Styling");null!=e.material.mode&&(o.add(e.material,"mode",xa.IK).name("Display mode").onChange(i),o.add(e,"maxIntensityRange",0,1).name("Intensity max").onChange(i)),o.add(e,"opacity",0,1).name("Layer Opacity").onChange(i),o.add(e,"pointSize",0,15).name("Point Size").onChange(i),null!=e.material.picking&&o.add(e.material,"picking").name("Display picking id").onChange(i);var a=e.debugUI.addFolder("Debug");a.add(e.bboxes,"visible").name("Display Bounding Boxes").onChange(i),a.add(e,"dbgStickyNode").name("Sticky node name").onChange(i),a.add(e,"dbgDisplaySticky").name("Display sticky node").onChange(i),a.add(e,"dbgDisplayChildren").name("Display children of sticky node").onChange(i),a.add(e,"dbgDisplayParents").name("Display parents of sticky node").onChange(i),t.addFrameRequester("before_layer_update",(function(){if(e.dbgStickyNode.length){e.displayedCount=0;var t,n=e.dbgStickyNode.split(","),i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ya(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ya(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}(e.group.children);try{var o=function(){var i=t.value;i.visible=n.some((function(t){return n=t,o=i.owner.name,e.dbgDisplaySticky&&n===o||e.dbgDisplayParents&&n.startsWith(o)||e.dbgDisplayChildren&&o.startsWith(n);var n,o})),i.boxHelper&&(i.boxHelper.visible=i.visible),i.visible&&(e.displayedCount+=i.geometry.attributes.position.count)};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}))}};var va=n(36194),wa=n(52767),Ma=n(25727),ka=n(88070);function Sa(t,e){var n=0,i=Date.now(),o={label:"Update 1st level",data:[{x:0,y:0}],borderColor:oa,borderWidth:1.5,pointRadius:1},a={label:"Update duration (ms)",data:[{x:0,y:0}],borderColor:aa,borderWidth:1.5,pointRadius:1},s=["0s"],r=new Ji(t,{type:"line",data:{labels:s,datasets:[o,a]},options:{animation:{duration:10},scales:ia}});this.update=function(t,l){var c=Math.floor((Date.now()-i)/1e3),d="".concat(c,"s");n>0&&s[n]==d?s.push(""):(s.push(d),n=s.length-1),s.length>60&&(s.shift(),n--),o.data.push({x:0,y:e._latestUpdateStartingLevel}),a.data.push({x:0,y:l}),o.data.length>60&&(o.data.shift(),a.data.shift()),t&&r.update()},this.resize=function(){r.resize()}}function Ca(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function Da(t,e){var n=[],i=[],o=[],a=new Ji(t,{type:"bar",data:{labels:n,datasets:[{label:"Visible node per level",data:i,backgroundColor:oa},{label:"Diplayed node per level",data:o,backgroundColor:aa}]},options:{scales:ia}});this.update=function(t){var s={};for(var r in function t(n,i){if(n&&n.visible&&(n.level>=0&&n.layer===e&&(i[n.level]?i[n.level][0]+=1:i[n.level]=[1,0],n.material.visible&&(i[n.level][1]+=1)),n.children)){var o,a=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ca(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ca(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}(n.children);try{for(a.s();!(o=a.n()).done;)t(o.value,i)}catch(t){a.e(t)}finally{a.f()}}}(e.object3d,s),n.length=0,i.length=0,s)({}).hasOwnProperty.call(s,r)&&(n[r]="".concat(r),i[r]=s[r][0],o[r]=s[r][1]);t&&a.update()},this.resize=function(){a.resize()}}function Pa(t,e,n){t.defineLayerProperty(e,n,(function(){(t.parent?t.parent.object3d:t.object3d).traverse((function(n){n.layer==t&&n.material?n.material[e]=t[e]:n.content&&n.content.layer==t&&n.content.traverse((function(n){n.material&&(n.material[e]=t[e])}))}))}))}const Oa={addWireFrameCheckbox:function(t,e,n){t.add(n,"wireframe").name("Wireframe").onChange((function(){return e.notifyChange(n)}))},addMaterialSize:function(t,e,n,i,o){Pa(n,"size",1),t.add(n,"size",i,o).name("Size").onChange((function(){return e.notifyChange(n)}))},addMaterialLineWidth:function(t,e,n,i,o){Pa(n,"linewidth",1),t.add(n,"linewidth",i,o).name("Line Width").onChange((function(){return e.notifyChange(n)}))},createGeometryDebugUI:function(t,e,n){var i=t.addFolder("Layer ".concat(n.id));return i.add(n,"visible").name("Visible").onChange((function(){return e.notifyChange(n)})),i.add(n,"opacity",0,1).name("Opacity").onChange((function(){return e.notifyChange(n)})),i}};function Aa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ta(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ta(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function Ta(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function Ea(t,e,n,i){e.traverse((function(t){t.material&&t.layer===n&&i(t.material)})),t.notifyChange()}var Ra;function La(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ra&&(Ra.material.overlayAlpha=0,Ra.material.showOutline=t.tileLayer.showOutline,t.notifyChange(Ra));var i=t.tileLayer.pickObjectsAt(t,e);return(Ra=i.length?i[0].object:void 0)&&(n&&console.info(Ra),Ra.material.overlayAlpha=.5,Ra.material.showOutline=!0,t.notifyChange(Ra)),Ra}function Ia(t,e,n,o){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e.isDebugMode||s){o=o||new ba(e,t),n=n||e.tileLayer;var r=Oa.createGeometryDebugUI(t,e,n),l="".concat(n.id,"-nb-objects"),c=o.createChartContainer(l),d="".concat(n.id,"-nb-visible"),h=o.createChartContainer(d);o.charts.push(new Sa(c.getContext("2d"),n)),o.charts.push(new Da(h.getContext("2d"),n)),n.showOutline=!1,n.wireframe=!1;var u={objectChart:!0,visibilityChart:!0,sseHelper:!1};r.add(n,"showOutline").name("Show tiles").onChange((function(t){n.showOutline=t,Ea(e,n.object3d,n,(function(e){e.showOutline=t}))})),r.add(n,"wireframe").name("Wireframe").onChange((function(){e.notifyChange(n)})),r.add(u,"objectChart").name("Object chart").onChange((function(t){document.getElementById(l).parentNode.style.display=t?"block":"none",o.updateChartDivSize(),o.charts.forEach((function(t){return t.update()}))})),r.add(u,"visibilityChart").name("Visibility chart").onChange((function(t){document.getElementById(d).parentNode.style.display=t?"block":"none",o.updateChartDivSize(),o.charts.forEach((function(t){return t.update()}))}));var f="".concat(n.id,"_obb_debug"),g="".concat(n.id,"_sb_debug"),p=new i.SphereGeometry(1,16,16),m=new Ma.Z(f,new i.Object3D,{update:S,visible:!1,cacheLifeTime:1/0,source:!1});wa.Z.prototype.addLayer.call(e,m,n).then((function(t){r.add(t,"visible").name("Bounding boxes").onChange((function(){e.notifyChange(t)}))}));var b=new Ma.Z(g,new i.Object3D,{update:S,visible:!1,cacheLifeTime:1/0,source:!1});wa.Z.prototype.addLayer.call(e,b,n).then((function(t){r.add(t,"visible").name("Bounding Spheres").onChange((function(){e.notifyChange(t)}))}));var x=document.getElementById("viewerDiv"),y=document.createElement("span");y.className="circleBase",x.appendChild(y);var _,v=new i.Vector3,w=function(){va.ZP.update(),e.notifyChange()},M=function(){va.ZP.removeAll(),e._frameRequesters[a.Ao.BEFORE_RENDER].includes(w)&&e.removeFrameRequester(a.Ao.BEFORE_RENDER,w)};r.add(u,"sseHelper").name("Sse helper").onChange((function(t){t?window.addEventListener("mousemove",C,!1):(y.style.display="none",M(),window.removeEventListener("mousemove",C))}));var k=null;window.addEventListener("mousedown",(function(t){83==k&&La(e,t)})),window.addEventListener("keydown",(function(t){k=t.which})),window.addEventListener("keyup",(function(){k=null}))}function S(t,e,n){var o=t.camera.camera3D.layers.test({mask:1<<e.threejsLayer});if(n.parent&&o){var a=n.children.filter((function(t){return t.layer&&t.layer.id==e.id}))[0];if(n.material&&n.material.visible){if(!a){var s=t.view.getLayerById(e.id).threejsLayer;if(e.id==f)(a=new fa(n.obb)).children[0]&&a.children[0].layers.set(s);else if(e.id==g){var r=new i.Color(Math.random(),Math.random(),Math.random()),l=new i.MeshBasicMaterial({color:r.getHex(),wireframe:!0});(a=new i.Mesh(p,l)).position.copy(n.boundingSphere.center),a.scale.multiplyScalar(n.boundingSphere.radius)}a.layers.set(s),a.layer=e,n.add(a),a.updateMatrixWorld(!0);var c=n.material.addEventListener("hidden",(function(){n.material.removeEventListener(c);for(var t=n.children.length;t--;){var e=n.children[t];if(e.layer===g){if(e.dispose)e.dispose();else if(Array.isArray(e.material)){var i,o=Aa(e.material);try{for(o.s();!(i=o.n()).done;)i.value.dispose()}catch(t){o.e(t)}finally{o.f()}}else e.material.dispose();n.children.splice(t,1)}}}))}e.id==g&&(a.position.copy(n.boundingSphere.center),a.scale.set(1,1,1).multiplyScalar(n.boundingSphere.radius)),a.updateMatrixWorld(!0),a.visible=!0}else a&&(a.visible=!1)}else ka.Z.removeChildrenAndCleanupRecursively(e,n)}function C(t){var n=La(e,t,!1);if(n){y.style.display="table-cell",v.copy(n.boundingSphere.center).applyMatrix4(n.matrixWorld);var i=v.project(e.camera.camera3D),o=e.normalizedToViewCoords(i),s=n.screenSize;if(_!=n){var r=Number(y.style.width.replace("px",""));_=n,M(),new va.ZP.Tween({size:r}).to({size:s},500).easing(va.ZP.Easing.Sinusoidal.In).easing(va.ZP.Easing.Exponential.Out).onUpdate((function(t){y.style["line-height"]="".concat(t.size,"px"),y.style.width="".concat(t.size,"px"),y.style.height="".concat(t.size,"px"),y.innerHTML="".concat(Math.floor(t.size)," px"),y.style.left="".concat(o.x-.5*t.size,"px"),y.style.top="".concat(o.y-.5*t.size,"px")})).onComplete(M).start(),e.addFrameRequester(a.Ao.BEFORE_RENDER,w)}}else y.style.display="none"}}var za=new i.Mesh;function Fa(t,e,n){var o=Oa.createGeometryDebugUI(t,e,n),a=new i.Group;e.scene.add(a),Oa.addWireFrameCheckbox(o,e,n);var s="".concat(n.id,"_obb_debug"),r=new Ma.Z(s,new i.Object3D,{update:function(t,e,o){if(t.camera.camera3D.layers.test({mask:1<<e.threejsLayer})){var s=o.userData.metadata,r=o.userData.obb;if(o.visible&&s.boundingVolume){if(!r){if(s.boundingVolume.region)r=new fa(s.boundingVolume.region,"id:".concat(o.id)),a.add(r),r.updateMatrixWorld(!0);else if(s.boundingVolume.box)za.geometry.boundingBox=s.boundingVolume.box,(r=new i.BoxHelper(za)).material.linewidth=2;else if(s.boundingVolume.sphere){var l=new i.SphereGeometry(s.boundingVolume.sphere.radius,32,32),c=new i.MeshBasicMaterial({wireframe:!0});(r=new i.Mesh(l,c)).position.copy(s.boundingVolume.sphere.center)}if(r){r.layer=e;var d=e.threejsLayer;r.layers.set(d),r.children.length&&r.children[0].layers.set(d),o.userData.obb=r,r.updateMatrixWorld()}if(r&&!s.boundingVolume.region){var h=n.tileset.asset.gltfUpAxis;void 0===h||"Y"===h?r.rotation.x=.5*-Math.PI:"X"===h&&(r.rotation.z=.5*-Math.PI),o.parent.add(r),r.updateMatrix(),r.updateMatrixWorld(!0)}}r&&(r.visible=!0,"function"==typeof r.setMaterialVisibility&&r.setMaterialVisibility(!0))}else r&&(r.visible=!1,"function"==typeof r.setMaterialVisibility&&r.setMaterialVisibility(!1))}},visible:!1,cacheLifeTime:1/0,source:!1});wa.Z.prototype.addLayer.call(e,r,n).then((function(t){o.add(t,"visible").name("Bounding boxes").onChange((function(){e.notifyChange(e.camera.camera3D)}))})),o.add(n,"sseThreshold",0,100).name("sseThreshold").onChange((function(){e.notifyChange(e.camera.camera3D)}))}}},t=>(85003,t(t.s=85003))])}));
|
|
2
|
+
"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("debug",[],e):"object"==typeof exports?exports.debug=e():t.debug=e()}(self,(function(){return(self.webpackChunk_name_=self.webpackChunk_name_||[]).push([[711],{75807:(t,e,i)=>{i.r(e),i.d(e,{Debug:()=>ko,GeometryDebug:()=>zo,PotreeDebug:()=>Do,create3dTilesDebugUI:()=>$o,createTileDebugUI:()=>No});var s=i(2212),n=i(60145),o=i(49469),a=i(44996);const r="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function h(t,e,i){const s=i||(t=>Array.prototype.slice.call(t));let n=!1,o=[];return function(...i){o=s(i),n||(n=!0,r.call(window,(()=>{n=!1,t.apply(e,o)})))}}const l=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,c=function(){let t=0;return function(){return t++}}();function d(t){return null==t}function u(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 f(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const g=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function p(t,e){return g(t)?t:e}function m(t,e){return void 0===t?e:t}const b=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function x(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function y(t,e,i,s){let n,o,a;if(u(t))if(o=t.length,s)for(n=o-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<o;n++)e.call(i,t[n],n);else if(f(t))for(a=Object.keys(t),o=a.length,n=0;n<o;n++)e.call(i,t[a[n]],a[n])}function _(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function v(t){if(u(t))return t.map(v);if(f(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=v(t[i[n]]);return e}return t}function w(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function M(t,e,i,s){if(!w(t))return;const n=e[t],o=i[t];f(n)&&f(o)?k(n,o,s):e[t]=v(o)}function k(t,e,i){const s=u(e)?e:[e],n=s.length;if(!f(t))return t;const o=(i=i||{}).merger||M;for(let a=0;a<n;++a){if(!f(e=s[a]))continue;const n=Object.keys(e);for(let s=0,a=n.length;s<a;++s)o(n[s],t,e,i)}return t}function C(t,e){return k(t,e,{merger:S})}function S(t,e,i){if(!w(t))return;const s=e[t],n=i[t];f(s)&&f(n)?C(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=v(n))}function D(t,e){const i=t.indexOf(".",e);return-1===i?t.length:i}function P(t,e){if(""===e)return t;let i=0,s=D(e,i);for(;t&&s>i;)t=t[e.substr(i,s-i)],i=s+1,s=D(e,i);return t}function O(t){return t.charAt(0).toUpperCase()+t.slice(1)}const A=t=>void 0!==t,T=t=>"function"==typeof t,L=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},E=Math.PI,R=2*E,I=R+E,z=Number.POSITIVE_INFINITY,F=E/180,V=E/2,B=E/4,j=2*E/3,W=Math.log10,N=Math.sign;function H(t){const e=Math.round(t);t=U(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(W(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function $(t){return!isNaN(parseFloat(t))&&isFinite(t)}function U(t,e,i){return Math.abs(t-e)<i}function Y(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function X(t){return t*(E/180)}function q(t){return t*(180/E)}function Z(t){if(!g(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function G(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+I)%R-E}function Q(t){return(t%R+R)%R}function J(t,e,i,s){const n=Q(t),o=Q(e),a=Q(i),r=Q(o-n),h=Q(a-n),l=Q(n-o),c=Q(n-a);return n===o||n===a||s&&o===a||r>h&&l<c}function tt(t,e,i){return Math.max(e,Math.min(i,t))}function et(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}const it=t=>0===t||1===t,st=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*R/i),nt=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*R/i)+1,ot={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*V),easeOutSine:t=>Math.sin(t*V),easeInOutSine:t=>-.5*(Math.cos(E*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=>it(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=>it(t)?t:st(t,.075,.3),easeOutElastic:t=>it(t)?t:nt(t,.075,.3),easeInOutElastic(t){const e=.1125;return it(t)?t:t<.5?.5*st(2*t,e,.45):.5+.5*nt(2*t-1,e,.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-ot.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*ot.easeInBounce(2*t):.5*ot.easeOutBounce(2*t-1)+.5},at={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},rt="0123456789ABCDEF",ht=t=>rt[15&t],lt=t=>rt[(240&t)>>4]+rt[15&t],ct=t=>(240&t)>>4==(15&t);function dt(t){return t+.5|0}const ut=(t,e,i)=>Math.max(Math.min(t,i),e);function ft(t){return ut(dt(2.55*t),0,255)}function gt(t){return ut(dt(255*t),0,255)}function pt(t){return ut(dt(t/2.55)/100,0,1)}function mt(t){return ut(dt(100*t),0,100)}const bt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,xt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function yt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function _t(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function vt(t,e,i){const s=yt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function wt(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,h,l;return n!==o&&(l=n-o,h=a>.5?l/(2-n-o):l/(n+o),r=n===e?(i-s)/l+(i<s?6:0):n===i?(s-e)/l+2:(e-i)/l+4,r=60*r+.5),[0|r,h||0,a]}function Mt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(gt)}function kt(t,e,i){return Mt(yt,t,e,i)}function Ct(t){return(t%360+360)%360}const St={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"},Dt={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 Pt;function Ot(t,e,i){if(t){let s=wt(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=kt(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function At(t,e){return t?Object.assign(e||{},t):t}function Tt(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=gt(t[3]))):(e=At(t,{r:0,g:0,b:0,a:1})).a=gt(e.a),e}function Lt(t){return"r"===t.charAt(0)?function(t){const e=bt.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=255&(e[8]?ft(t):255*t)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?ft(i):i),s=255&(e[4]?ft(s):s),n=255&(e[6]?ft(n):n),{r:i,g:s,b:n,a:o}}}(t):function(t){const e=xt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?ft(+e[5]):gt(+e[5]));const n=Ct(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Mt(vt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return Mt(_t,t,e,i)}(n,o,a):kt(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}(t)}class Et{constructor(t){if(t instanceof Et)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=Tt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*at[s[1]],g:255&17*at[s[2]],b:255&17*at[s[3]],a:5===o?17*at[s[4]]:255}:7!==o&&9!==o||(n={r:at[s[1]]<<4|at[s[2]],g:at[s[3]]<<4|at[s[4]],b:at[s[5]]<<4|at[s[6]],a:9===o?at[s[7]]<<4|at[s[8]]:255})),i=n||function(t){Pt||(Pt=function(){const t={},e=Object.keys(Dt),i=Object.keys(St);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,St[o]);o=parseInt(Dt[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),Pt.transparent=[0,0,0,0]);const e=Pt[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||Lt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=At(this._rgb);return t&&(t.a=pt(t.a)),t}set rgb(t){this._rgb=Tt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${pt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?(t=this._rgb,e=function(t){return ct(t.r)&&ct(t.g)&&ct(t.b)&&ct(t.a)}(t)?ht:lt,t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t):this._rgb;var t,e}hslString(){return this._valid?function(t){if(!t)return;const e=wt(t),i=e[0],s=mt(e[1]),n=mt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${pt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):this._rgb}mix(t,e){const i=this;if(t){const s=i.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,h=s.a-n.a,l=((r*h==-1?r:(r+h)/(1+r*h))+1)/2;o=1-l,s.r=255&l*s.r+o*n.r+.5,s.g=255&l*s.g+o*n.g+.5,s.b=255&l*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,i.rgb=s}return i}clone(){return new Et(this.rgb)}alpha(t){return this._rgb.a=gt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=dt(.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 Ot(this._rgb,2,t),this}darken(t){return Ot(this._rgb,2,-t),this}saturate(t){return Ot(this._rgb,1,t),this}desaturate(t){return Ot(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=wt(t);i[0]=Ct(i[0]+e),i=kt(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Rt(t){return new Et(t)}const It=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function zt(t){return It(t)?t:Rt(t)}function Ft(t){return It(t)?t:Rt(t).saturate(.5).darken(.1).hexString()}const Vt=Object.create(null),Bt=Object.create(null);function jt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function Wt(t,e,i){return"string"==typeof e?k(jt(t,e),i):k(jt(t,""),e)}var Nt=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)=>Ft(e.backgroundColor),this.hoverBorderColor=(t,e)=>Ft(e.borderColor),this.hoverColor=(t,e)=>Ft(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 Wt(this,t,e)}get(t){return jt(this,t)}describe(t,e){return Wt(Bt,t,e)}override(t,e){return Wt(Vt,t,e)}route(t,e,i,s){const n=jt(this,t),o=jt(this,i),a="_"+e;Object.defineProperties(n,{[a]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[s];return f(t)?Object.assign({},e,t):m(t,e)},set(t){this[a]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Ht(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function $t(t,e,i,s){let n=(s=s||{}).data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(n=s.data={},o=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let a=0;const r=i.length;let h,l,c,d,f;for(h=0;h<r;h++)if(d=i[h],null!=d&&!0!==u(d))a=Ht(t,n,o,a,d);else if(u(d))for(l=0,c=d.length;l<c;l++)f=d[l],null==f||u(f)||(a=Ht(t,n,o,a,f));t.restore();const g=o.length/2;if(g>i.length){for(h=0;h<g;h++)delete n[o[h]];o.splice(0,g)}return a}function Ut(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function Yt(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Xt(t,e,i,s){let n,o,a,r,h;const l=e.pointStyle,c=e.rotation,d=e.radius;let u=(c||0)*F;if(l&&"object"==typeof l&&(n=l.toString(),"[object HTMLImageElement]"===n||"[object HTMLCanvasElement]"===n))return t.save(),t.translate(i,s),t.rotate(u),t.drawImage(l,-l.width/2,-l.height/2,l.width,l.height),void t.restore();if(!(isNaN(d)||d<=0)){switch(t.beginPath(),l){default:t.arc(i,s,d,0,R),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,s-Math.cos(u)*d),u+=j,t.lineTo(i+Math.sin(u)*d,s-Math.cos(u)*d),u+=j,t.lineTo(i+Math.sin(u)*d,s-Math.cos(u)*d),t.closePath();break;case"rectRounded":h=.516*d,r=d-h,o=Math.cos(u+B)*r,a=Math.sin(u+B)*r,t.arc(i-o,s-a,h,u-E,u-V),t.arc(i+a,s-o,h,u-V,u),t.arc(i+o,s+a,h,u,u+V),t.arc(i-a,s+o,h,u+V,u+E),t.closePath();break;case"rect":if(!c){r=Math.SQRT1_2*d,t.rect(i-r,s-r,2*r,2*r);break}u+=B;case"rectRot":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+a,s-o),t.lineTo(i+o,s+a),t.lineTo(i-a,s+o),t.closePath();break;case"crossRot":u+=B;case"cross":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a),t.moveTo(i+a,s-o),t.lineTo(i-a,s+o);break;case"star":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a),t.moveTo(i+a,s-o),t.lineTo(i-a,s+o),u+=B,o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a),t.moveTo(i+a,s-o),t.lineTo(i-a,s+o);break;case"line":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(u)*d,s+Math.sin(u)*d)}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 Zt(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Gt(t){t.restore()}function Kt(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Qt(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function Jt(t,e,i,s,n,o={}){const a=u(e)?e:[e],r=o.strokeWidth>0&&""!==o.strokeColor;let h,l;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),d(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,o),h=0;h<a.length;++h)l=a[h],r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),d(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(l,i,s,o.maxWidth)),t.fillText(l,i,s,o.maxWidth),te(t,i,s,l,o),s+=n.lineHeight;t.restore()}function te(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,h=i-o.actualBoundingBoxAscent,l=i+o.actualBoundingBoxDescent,c=n.strikethrough?(h+l)/2:l;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function ee(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,-V,E,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,E,V,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,V,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-V,!0),t.lineTo(i+a.topLeft,s)}const ie=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),se=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function ne(t,e){const i=(""+t).match(ie);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}function oe(t,e){const i={},s=f(e),n=s?Object.keys(e):e,o=f(t)?s?i=>m(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=+o(t)||0;return i}function ae(t){return oe(t,{top:"y",right:"x",bottom:"y",left:"x"})}function re(t){return oe(t,["topLeft","topRight","bottomLeft","bottomRight"])}function he(t){const e=ae(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function le(t,e){t=t||{},e=e||Nt.font;let i=m(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=m(t.style,e.style);s&&!(""+s).match(se)&&(console.warn('Invalid font style specified: "'+s+'"'),s="");const n={family:m(t.family,e.family),lineHeight:ne(m(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:m(t.weight,e.weight),string:""};return n.string=function(t){return!t||d(t.size)||d(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n}function ce(t,e,i,s){let n,o,a,r=!0;for(n=0,o=t.length;n<o;++n)if(a=t[n],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),r=!1),void 0!==i&&u(a)&&(a=a[i%a.length],r=!1),void 0!==a))return s&&!r&&(s.cacheable=!1),a}function de(t,e){return Object.assign(Object.create(t),e)}function ue(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const fe=(t,e,i)=>ue(t,i,(s=>t[s][e]<i)),ge=(t,e,i)=>ue(t,i,(s=>t[s][e]>=i)),pe=["push","pop","shift","splice","unshift"];function me(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(pe.forEach((e=>{delete t[e]})),delete t._chartjs)}function be(t){const e=new Set;let i,s;for(i=0,s=t.length;i<s;++i)e.add(t[i]);return e.size===s?t:Array.from(e)}function xe(t,e=[""],i=t,s,n=(()=>t[0])){A(s)||(s=Oe("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:n,override:n=>xe([n,...t],e,i,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Me(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=Oe(ve(o,t),i),A(n))return we(t,n)?De(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Ae(t).includes(e),ownKeys:t=>Ae(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function ye(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:_e(t,s),setContext:e=>ye(t,e,i,s),override:n=>ye(t.override(n),e,i,s)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Me(t,e,(()=>function(t,e,i){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=t;let r=s[e];return T(r)&&a.isScriptable(e)&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);return r.add(t),e=e(o,a||s),r.delete(t),we(t,e)&&(e=De(n._scopes,n,t,e)),e}(e,r,t,i)),u(r)&&r.length&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=i;if(A(o.index)&&s(t))e=e[o.index%e.length];else if(f(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const h of i){const i=De(s,n,t,h);e.push(ye(i,o,a&&a[t],r))}}return e}(e,r,t,a.isIndexable)),we(e,r)&&(r=ye(r,n,o&&o[e],a)),r}(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,s)=>(t[i]=s,delete e[i],!0)})}function _e(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:T(i)?i:()=>i,isIndexable:T(s)?s:()=>s}}const ve=(t,e)=>t?t+O(e):e,we=(t,e)=>f(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Me(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function ke(t,e,i){return T(t)?t(e,i):t}const Ce=(t,e)=>!0===t?e:"string"==typeof t?P(e,t):void 0;function Se(t,e,i,s){for(const n of e){const e=Ce(i,n);if(e){t.add(e);const n=ke(e._fallback,i,e);if(A(n)&&n!==i&&n!==s)return n}else if(!1===e&&A(s)&&i!==s)return null}return!1}function De(t,e,i,s){const n=e._rootScopes,o=ke(e._fallback,i,s),a=[...t,...n],r=new Set;r.add(s);let h=Pe(r,a,i,o||i);return null!==h&&(!A(o)||o===i||(h=Pe(r,a,o,h),null!==h))&&xe(Array.from(r),[""],n,o,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];return u(n)&&f(i)?i:n}(e,i,s)))}function Pe(t,e,i,s){for(;i;)i=Se(t,e,i,s);return i}function Oe(t,e){for(const i of e){if(!i)continue;const e=i[t];if(A(e))return e}}function Ae(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 Te=Number.EPSILON||1e-14,Le=(t,e)=>e<t.length&&!t[e].skip&&t[e],Ee=t=>"x"===t?"y":"x";function Re(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=G(o,n),h=G(a,o);let l=r/(r+h),c=h/(r+h);l=isNaN(l)?0:l,c=isNaN(c)?0:c;const d=s*l,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function Ie(t,e,i){return Math.max(Math.min(t,i),e)}function ze(t,e,i,s,n){let o,a,r,h;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){const i=Ee(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,h,l=Le(t,0);for(a=0;a<s;++a)if(r=h,h=l,l=Le(t,a+1),h){if(l){const t=l[e]-h[e];n[a]=0!==t?(l[i]-h[i])/t:0}o[a]=r?l?N(n[a-1])!==N(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,i){const s=t.length;let n,o,a,r,h,l=Le(t,0);for(let c=0;c<s-1;++c)h=l,l=Le(t,c+1),h&&l&&(U(e[c],0,Te)?i[c]=i[c+1]=0:(n=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=n*a*e[c],i[c+1]=o*a*e[c])))}(t,n,o),function(t,e,i="x"){const s=Ee(i),n=t.length;let o,a,r,h=Le(t,0);for(let l=0;l<n;++l){if(a=r,r=h,h=Le(t,l+1),!r)continue;const n=r[i],c=r[s];a&&(o=(n-a[i])/3,r[`cp1${i}`]=n-o,r[`cp1${s}`]=c-o*e[l]),h&&(o=(h[i]-n)/3,r[`cp2${i}`]=n+o,r[`cp2${s}`]=c+o*e[l])}}(t,o,e)}(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],h=Re(i,r,t[Math.min(o+1,a-(s?0:1))%a],e.tension),r.cp1x=h.previous.x,r.cp1y=h.previous.y,r.cp2x=h.next.x,r.cp2y=h.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,n,o,a,r=qt(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&qt(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=Ie(n.cp1x,e.left,e.right),n.cp1y=Ie(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=Ie(n.cp2x,e.left,e.right),n.cp2y=Ie(n.cp2y,e.top,e.bottom)))}(t,i)}function Fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Ve(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Be(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const je=t=>window.getComputedStyle(t,null),We=["top","right","bottom","left"];function Ne(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=We[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function He(t,e){const{canvas:i,currentDevicePixelRatio:s}=e,n=je(i),o="border-box"===n.boxSizing,a=Ne(n,"padding"),r=Ne(n,"border","width"),{x:h,y:l,box:c}=function(t,e){const i=t.native||t,s=i.touches,n=s&&s.length?s[0]:i,{offsetX:o,offsetY:a}=n;let r,h,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(o,a,i.target))r=o,h=a;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,h=n.clientY-t.top,l=!0}return{x:r,y:h,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((h-d)/f*i.width/s),y:Math.round((l-u)/g*i.height/s)}}const $e=t=>Math.round(10*t)/10;function Ue(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=n/s,t.width=o/s;const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const Ye=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 Xe(t,e){const i=function(t,e){return je(t).getPropertyValue(e)}(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function qe(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Ze(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function Ge(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=qe(t,n,i),r=qe(n,o,i),h=qe(o,e,i),l=qe(a,r,i),c=qe(r,h,i);return qe(l,c,i)}const Ke=new Map;function Qe(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=Ke.get(i);return s||(s=new Intl.NumberFormat(t,e),Ke.set(i,s)),s}(e,i).format(t)}function Je(t,e,i){return t?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}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function ti(t){return"angle"===t?{between:J,compare:K,normalize:Q}:{between:et,compare:(t,e)=>t-e,normalize:t=>t}}function ei({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function ii(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:h,normalize:l}=ti(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=ti(s),h=e.length;let l,c,{start:d,end:u,loop:f}=t;if(f){for(d+=h,u+=h,l=0,c=h;l<c&&a(r(e[d%h][s]),n,o);++l)d--,u--;d%=h,u%=h}return u<d&&(u+=h),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,b,x=!1,y=null;for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=l(m[s]),p!==b&&(x=h(p,n,o),null===y&&(x||h(n,b,p)&&0!==r(n,b))&&(y=0===r(p,n)?t:i),null!==y&&(!x||0===r(o,p)||h(o,b,p))&&(g.push(ei({start:y,end:t,loop:u,count:a,style:f})),y=null),i=t,b=p));return null!==y&&g.push(ei({start:y,end:d,loop:u,count:a,style:f})),g}function si(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function ni(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var oi=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=r.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.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 s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};const ai="transparent",ri={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=zt(t||ai),n=s.valid&&zt(e||ai);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class hi{constructor(t,e,i,s){const n=e[i];s=ce([t.to,s,n,t.from]);const o=ce([t.from,n,s]);this._active=!0,this._fn=t.fn||ri[t.type||typeof o],this._easing=ot[t.easing]||ot.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=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=ce([t.to,e,s,t.from]),this._from=ce([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<i),!this._active)return this._target[s]=a,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}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]()}}Nt.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 li=Object.keys(Nt.animation);Nt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),Nt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),Nt.describe("animations",{_fallback:"animation"}),Nt.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 ci{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!f(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const s=t[i];if(!f(s))return;const n={};for(const t of li)n[t]=s[t];(u(s.properties)&&s.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,n)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(i)return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i;t.options=e}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const h=o[r];if("$"===h.charAt(0))continue;if("options"===h){s.push(...this._animateOptions(t,e));continue}const l=e[h];let c=n[h];const d=i.get(h);if(c){if(d&&c.active()){c.update(d,l,a);continue}c.cancel()}d&&d.duration?(n[h]=c=new hi(d,t,h,l),s.push(c)):t[h]=l}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(oi.add(this._chart,i),!0):void 0}}function di(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function ui(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function fi(t,e,i,s={}){const n=t.keys,o="single"===s.mode;let a,r,h,l;if(null!==e){for(a=0,r=n.length;a<r;++a){if(h=+n[a],h===i){if(s.all)continue;break}l=t.values[h],g(l)&&(o||0===e||N(e)===N(l))&&(e+=l)}return e}}function gi(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function pi(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function mi(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function bi(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,h=o.axis,l=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[h]:o,[l]:d}=i;u=(i._stacks||(i._stacks={}))[l]=pi(n,c,o),u[r]=d,u._top=mi(u,a,!0,s.type),u._bottom=mi(u,a,!1,s.type)}}function xi(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function yi(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const _i=t=>"reset"===t||"none"===t,vi=(t,e)=>e?t:Object.assign({},t);class wi{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=gi(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&yi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=m(i.xAxisID,xi(t,"x")),o=e.yAxisID=m(i.yAxisID,xi(t,"y")),a=e.rAxisID=m(i.rAxisID,xi(t,"r")),r=e.indexAxis,h=e.iAxisID=s(r,n,o,a),l=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(l)}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&&me(this._data,this),t._stacked&&yi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(f(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s],i[s]={x:o,y:t[o]};return i}(e);else if(i!==e){if(i){me(i,this);const t=this._cachedMeta;yi(t),t._parsed=[]}e&&Object.isExtensible(e)&&(this,(s=e)._chartjs?s._chartjs.listeners.push(this):(Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),pe.forEach((t=>{const e="_onData"+O(t),i=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...t){const n=i.apply(this,t);return s._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),n}})})))),this._syncList=[],this._data=e}var s}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=gi(e.vScale,e),e.stack!==i.stack&&(s=!0,yi(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&bi(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:s}=this,{iScale:n,_stacked:o}=i,a=n.axis;let r,h,l,c=0===t&&e===s.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,l=s;else{l=u(s[t])?this.parseArrayData(i,s,t,e):f(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const n=()=>null===h[a]||d&&h[a]<d[a];for(r=0;r<e;++r)i._parsed[r+t]=h=l[r],c&&(n()&&(c=!1),d=h);i._sorted=c}o&&bi(this,l)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,h=n.getLabels(),l=n===o,c=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,c[d]={[a]:l||n.parse(h[f],f),[r]:o.parse(e[f],f)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,h,l,c;for(r=0,h=s;r<h;++r)l=r+i,c=e[l],a[r]={x:n.parse(c[0],l),y:o.parse(c[1],l)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,h=new Array(s);let l,c,d,u;for(l=0,c=s;l<c;++l)d=l+i,u=e[d],h[l]={x:n.parse(P(u,a),d),y:o.parse(P(u,r),d)};return h}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return fi({keys:ui(s,!0),values:e._stacks[t.axis]},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=null===n?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=fi(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,a=this._getOtherScale(t),r=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:ui(i,!0),values:null})(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:l,max:c}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(a);let d,u;function f(){u=s[d];const e=u[a.axis];return!g(u[t.axis])||l>e||c<e}for(d=0;d<o&&(f()||(this.updateRangeFromParsed(h,t,u,r),!n));++d);if(n)for(d=o-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(h,t,u,r);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s][t.axis],g(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return f(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(m(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=di(t,i),n=di(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a;let h;for(i.dataset&&i.dataset.draw(t,n,a,r),h=a;h<a+r;++h){const e=s[h];e.hidden||(e.active?o.push(e):e.draw(t,n))}for(h=0;h<o.length;++h)o[h].draw(t,n)}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 s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return de(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return de(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}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 s="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&A(i);if(a)return vi(a,r);const h=this.chart.config,l=h.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=h.getOptionScopes(this.getDataset(),l),u=Object.keys(Nt.elements[t]),f=h.resolveNamedOptions(d,u,(()=>this.getContext(i,s)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(vi(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const h=new ci(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||_i(t)||this.chart._animationsDisabled}updateElement(t,e,i,s){_i(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!_i(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}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 s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&yi(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}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])}}function Mi(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=be(s.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const h=()=>{32767!==o&&-32768!==o&&(A(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;s<n;++s)o=e.getPixelForValue(i[s]),h();for(a=void 0,s=0,n=e.ticks.length;s<n;++s)o=e.getPixelForTick(s),h();return r}function ki(t,e,i,s){return u(t)?function(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let h=a,l=r;Math.abs(a)>Math.abs(r)&&(h=r,l=a),e[i.axis]=l,e._custom={barStart:h,barEnd:l,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Ci(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,h=[];let l,c,d,u;for(l=i,c=i+s;l<c;++l)u=e[l],d={},d[n.axis]=r||n.parse(a[l],l),h.push(ki(u,d,o,l));return h}function Si(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Di(t,e,i,s){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);const{start:a,end:r,reverse:h,top:l,bottom:c}=function(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=l:(i._bottom||0)===s?n=c:(o[Pi(c,a,r,h)]=!0,n=l)),o[Pi(n,a,r,h)]=!0,t.borderSkipped=o}function Pi(t,e,i,s){var n,o,a;return s?(a=i,t=Oi(t=(n=t)===(o=e)?a:n===a?o:n,i,e)):t=Oi(t,e,i),t}function Oi(t,e,i){return"start"===t?e:"end"===t?i:t}function Ai(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}wi.defaults={},wi.prototype.datasetElementType=null,wi.prototype.dataElementType=null;class Ti extends wi{parsePrimitiveData(t,e,i,s){return Ci(t,e,i,s)}parseArrayData(t,e,i,s){return Ci(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,h="x"===n.axis?a:r,l="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(P(g,h),d),c.push(ki(P(g,l),f,o,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),o=n._custom,a=Si(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:a}}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,s){const n="reset"===s,{index:o,_cachedMeta:{vScale:a}}=this,r=a.getBasePixel(),h=a.isHorizontal(),l=this._getRuler(),c=this.resolveDataElementOptions(e,s),u=this.getSharedOptions(c),f=this.includeOptions(s,u);this.updateSharedOptions(u,s,c);for(let c=e;c<e+i;c++){const e=this.getParsed(c),i=n||d(e[a.axis])?{base:r,head:r}:this._calculateBarValuePixels(c),g=this._calculateBarIndexPixels(c,l),p=(e._stacks||{})[a.axis],m={horizontal:h,base:i.base,enableBorderRadius:!p||Si(e._custom)||o===p._top||o===p._bottom,x:h?i.head:g.center,y:h?g.center:i.head,height:h?g.size:Math.abs(i.size),width:h?Math.abs(i.size):g.size};f&&(m.options=u||this.resolveDataElementOptions(c,t[c].active?"active":s));const b=m.options||t[c].options;Di(m,b,p,o),Ai(m,b,l.ratio),this.updateElement(t[c],c,m,s)}}_getStacks(t,e){const i=this._cachedMeta.iScale,s=i.getMatchingVisibleMetas(this._type),n=i.options.stacked,o=s.length,a=[];let r,h;for(r=0;r<o;++r)if(h=s[r],h.controller.options.grouped){if(void 0!==e){const t=h.controller.getParsed(e)[h.controller._cachedMeta.vScale.axis];if(d(t)||isNaN(t))continue}if((!1===n||-1===a.indexOf(h.stack)||void 0===n&&void 0===h.stack)&&a.push(h.stack),h.index===t)break}return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||Mi(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i},options:{base:s,minBarLength:n}}=this,o=s||0,a=this.getParsed(t),r=a._custom,h=Si(r);let l,c,u=a[e.axis],f=0,g=i?this.applyStack(e,a,i):u;g!==u&&(f=g-u,g=u),h&&(u=r.barStart,g=r.barEnd-r.barStart,0!==u&&N(u)!==N(r.barEnd)&&(f=0),f+=u);const p=d(s)||h?f:s;let m=e.getPixelForValue(p);if(l=this.chart.getDataVisibility(t)?e.getPixelForValue(f+g):m,c=l-m,Math.abs(c)<n&&(c=function(t,e,i){return 0!==t?N(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(c,e,o)*n,u===o&&(m-=c/2),l=m+c),m===e.getPixelForValue(o)){const t=N(c)*e.getLineWidthForValue(o)/2;m+=t,c-=t}return{size:c,base:m,head:l,center:l+c/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,o=m(s.maxBarThickness,1/0);let a,r;if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,h="flex"===s.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const h=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const l=o-(o-Math.min(a,r))/2*h;return{chunk:Math.abs(r-a)/2*h/s,ratio:i.barPercentage,start:l}}(t,e,s,i):function(t,e,i,s){const n=i.barThickness;let o,a;return d(n)?(o=e.min*i.categoryPercentage,a=i.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:e.pixels[t]-o/2}}(t,e,s,i),l=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0);a=h.start+h.chunk*l+h.chunk/2,r=Math.min(o,h.chunk*h.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(o,e.min*e.ratio);return{base:a-r/2,head:a+r/2,center:a,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null!==this.getParsed(n)[e.axis]&&i[n].draw(this._ctx)}}Ti.id="bar",Ti.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},Ti.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class Li extends wi{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=m(s[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=m(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return n}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:s}=e,n=this.getParsed(t),o=i.getLabelForValue(n.x),a=s.getLabelForValue(n.y),r=n._custom;return{label:e.label,value:"("+o+", "+a+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,r=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(r),l=this.includeOptions(s,h),c=o.axis,d=a.axis;for(let r=e;r<e+i;r++){const e=t[r],i=!n&&this.getParsed(r),h={},u=h[c]=n?o.getPixelForDecimal(.5):o.getPixelForValue(i[c]),f=h[d]=n?a.getBasePixel():a.getPixelForValue(i[d]);h.skip=isNaN(u)||isNaN(f),l&&(h.options=this.resolveDataElementOptions(r,e.active?"active":s),n&&(h.options.radius=0)),this.updateElement(e,r,h,s)}this.updateSharedOptions(h,s,r)}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=m(i&&i._custom,n),s}}Li.id="bubble",Li.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},Li.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class Ei extends wi{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,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,o,a=t=>+i[t];if(f(i[t])){const{key:t="value"}=this._parsing;a=e=>+P(i[e],t)}for(n=t,o=t+e;n<o;++n)s._parsed[n]=a(n)}}_getRotation(){return X(this.options.rotation-90)}_getCircumference(){return X(this.options.circumference)}_getRotationExtents(){let t=R,e=-R;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),r=Math.min((l=a,"string"==typeof(h=this.options.cutout)&&h.endsWith("%")?parseFloat(h)/100:h/l),1);var h,l;const c=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=function(t,e,i){let s=1,n=1,o=0,a=0;if(e<R){const r=t,h=r+e,l=Math.cos(r),c=Math.sin(r),d=Math.cos(h),u=Math.sin(h),f=(t,e,s)=>J(t,r,h,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>J(t,r,h,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,l,d),m=f(V,c,u),b=g(E,l,d),x=g(E+V,c,u);s=(p-b)/2,n=(m-x)/2,o=-(p+b)/2,a=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),x=(i.width-o)/f,y=(i.height-o)/g,_=Math.max(Math.min(x,y)/2,0),v=b(this.options.radius,_),w=(v-Math.max(v*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*v,this.offsetY=m*v,s.total=this.calculateTotal(),this.outerRadius=v-w*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-w*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/R)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,h=(a.left+a.right)/2,l=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,f=this.resolveDataElementOptions(e,s),g=this.getSharedOptions(f),p=this.includeOptions(s,g);let m,b=this._getRotation();for(m=0;m<e;++m)b+=this._circumference(m,n);for(m=e;m<e+i;++m){const e=this._circumference(m,n),i=t[m],o={x:h+this.offsetX,y:l+this.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:u,innerRadius:d};p&&(o.options=g||this.resolveDataElementOptions(m,i.active?"active":s)),b+=e,this.updateElement(i,m,o,s)}this.updateSharedOptions(g,s,f)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?R*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=Qe(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++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(m(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Ei.id="doughnut",Ei.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"},Ei.descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t},Ei.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,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}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 u(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class Ri extends wi{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=function(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,_parsed:r}=t,h=a.axis,{min:l,max:c,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(n=tt(Math.min(fe(r,a.axis,l).lo,i?s:fe(e,h,a.getPixelForValue(l)).lo),0,s-1)),o=u?tt(Math.max(fe(r,a.axis,c).hi+1,i?0:fe(e,h,a.getPixelForValue(c)).hi+1),n,s)-n:s-n}return{start:n,count:o}}(e,s,o);this._drawStart=a,this._drawCount=r,function(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:h},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a,_stacked:r,_dataset:h}=this._cachedMeta,l=this.resolveDataElementOptions(e,s),c=this.getSharedOptions(l),u=this.includeOptions(s,c),f=o.axis,g=a.axis,{spanGaps:p,segment:m}=this.options,b=$(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||n||"none"===s;let y=e>0&&this.getParsed(e-1);for(let l=e;l<e+i;++l){const e=t[l],i=this.getParsed(l),p=x?e:{},_=d(i[g]),v=p[f]=o.getPixelForValue(i[f],l),w=p[g]=n||_?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,i,r):i[g],l);p.skip=isNaN(v)||isNaN(w)||_,p.stop=l>0&&i[f]-y[f]>b,m&&(p.parsed=i,p.raw=h.data[l]),u&&(p.options=c||this.resolveDataElementOptions(l,e.active?"active":s)),x||this.updateElement(e,l,p,s),y=i}this.updateSharedOptions(c,s,l)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Ri.id="line",Ri.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Ri.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Ii extends wi{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=Qe(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}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,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=this.getDataset(),r=o.options.animation,h=this._cachedMeta.rScale,l=h.xCenter,c=h.yCenter,d=h.getIndexAngle(0)-.5*E;let u,f=d;const g=360/this.countVisibleElements();for(u=0;u<e;++u)f+=this._computeAngle(u,s,g);for(u=e;u<e+i;u++){const e=t[u];let i=f,p=f+this._computeAngle(u,s,g),m=o.getDataVisibility(u)?h.getDistanceFromCenterForValue(a.data[u]):0;f=p,n&&(r.animateScale&&(m=0),r.animateRotate&&(i=p=d));const b={x:l,y:c,innerRadius:0,outerRadius:m,startAngle:i,endAngle:p,options:this.resolveDataElementOptions(u,e.active?"active":s)};this.updateElement(e,u,b,s)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let i=0;return e.data.forEach(((e,s)=>{!isNaN(t.data[s])&&this.chart.getDataVisibility(s)&&i++})),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?X(this.resolveDataElementOptions(t,e).angle||i):0}}Ii.id="polarArea",Ii.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Ii.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,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}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 zi extends Ei{}zi.id="pie",zi.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Fi extends wi{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,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this.getDataset(),o=this._cachedMeta.rScale,a="reset"===s;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":s),h=o.getPointPositionForValue(r,n.data[r]),l=a?o.xCenter:h.x,c=a?o.yCenter:h.y,d={x:l,y:c,angle:h.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,d,s)}}}Fi.id="radar",Fi.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},Fi.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class Vi extends Ri{}function Bi(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}Vi.id="scatter",Vi.defaults={showLine:!1,fill:!1},Vi.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};class ji{constructor(t){this.options=t||{}}formats(){return Bi()}parse(t,e){return Bi()}format(t,e){return Bi()}add(t,e,i){return Bi()}diff(t,e,i){return Bi()}startOf(t,e,i){return Bi()}endOf(t,e){return Bi()}}ji.override=function(t){Object.assign(ji.prototype,t)};var Wi={_date:ji};function Ni(t,e){return"native"in t?{x:t.x,y:t.y}:He(t,e)}function Hi(t,e,i,s){const{controller:n,data:o,_sorted:a}=t,r=n._cachedMeta.iScale;if(r&&e===r.axis&&a&&o.length){const t=r._reversePixels?ge:fe;if(!s)return t(o,e,i);if(n._sharedOptions){const s=o[0],n="function"==typeof s.getRange&&s.getRange(e);if(n){const s=t(o,e,i-n),a=t(o,e,i+n);return{lo:s.lo,hi:a.hi}}}}return{lo:0,hi:o.length-1}}function $i(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:r}=o[t],{lo:h,hi:l}=Hi(o[t],e,a,n);for(let t=h;t<=l;++t){const e=r[t];e.skip||s(e,i,t)}}}function Ui(t,e,i,s){const n=[];return qt(e,t.chartArea,t._minPadding)?($i(t,i,e,(function(t,i,o){t.inRange(e.x,e.y,s)&&n.push({element:t,datasetIndex:i,index:o})}),!0),n):n}function Yi(t,e,i,s,n){const o=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,o=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(i);let a=Number.POSITIVE_INFINITY,r=[];return qt(e,t.chartArea,t._minPadding)?($i(t,i,e,(function(i,h,l){if(s&&!i.inRange(e.x,e.y,n))return;const c=i.getCenterPoint(n);if(!qt(c,t.chartArea,t._minPadding)&&!i.inRange(e.x,e.y,n))return;const d=o(e,c);d<a?(r=[{element:i,datasetIndex:h,index:l}],a=d):d===a&&r.push({element:i,datasetIndex:h,index:l})})),r):r}function Xi(t,e,i,s){const n=Ni(e,t),o=[],a=i.axis,r="x"===a?"inXRange":"inYRange";let h=!1;return function(t,e){const i=t.getSortedVisibleDatasetMetas();let s,n,o;for(let t=0,a=i.length;t<a;++t){({index:s,data:n}=i[t]);for(let t=0,i=n.length;t<i;++t)o=n[t],o.skip||e(o,s,t)}}(t,((t,e,i)=>{t[r](n[a],s)&&o.push({element:t,datasetIndex:e,index:i}),t.inRange(n.x,n.y,s)&&(h=!0)})),i.intersect&&!h?[]:o}var qi={modes:{index(t,e,i,s){const n=Ni(e,t),o=i.axis||"x",a=i.intersect?Ui(t,n,o,s):Yi(t,n,o,!1,s),r=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&r.push({element:i,datasetIndex:t.index,index:e})})),r):[]},dataset(t,e,i,s){const n=Ni(e,t),o=i.axis||"xy";let a=i.intersect?Ui(t,n,o,s):Yi(t,n,o,!1,s);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,s)=>Ui(t,Ni(e,t),i.axis||"xy",s),nearest:(t,e,i,s)=>Yi(t,Ni(e,t),i.axis||"xy",i.intersect,s),x:(t,e,i,s)=>Xi(t,e,{axis:"x",intersect:i.intersect},s),y:(t,e,i,s)=>Xi(t,e,{axis:"y",intersect:i.intersect},s)}};const Zi=["left","top","right","bottom"];function Gi(t,e){return t.filter((t=>t.pos===e))}function Ki(t,e){return t.filter((t=>-1===Zi.indexOf(t.pos)&&t.box.axis===e))}function Qi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Ji(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function ts(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 es(t,e,i,s){const{pos:n,box:o}=i,a=t.maxPadding;if(!f(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?o.height:o.width),i.size=e.size/e.count,t[n]+=i.size}o.getPadding&&ts(a,o.getPadding());const r=Math.max(0,e.outerWidth-Ji(a,t,"left","right")),h=Math.max(0,e.outerHeight-Ji(a,t,"top","bottom")),l=r!==t.w,c=h!==t.h;return t.w=r,t.h=h,i.horizontal?{same:l,other:c}:{same:c,other:l}}function is(t,e){const i=e.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}(t?["left","right"]:["top","bottom"])}function ss(t,e,i,s){const n=[];let o,a,r,h,l,c;for(o=0,a=t.length,l=0;o<a;++o){r=t[o],h=r.box,h.update(r.width||e.w,r.height||e.h,is(r.horizontal,e));const{same:a,other:d}=es(e,i,r,s);l|=a&&n.length,c=c||d,h.fullSize||n.push(r)}return l&&ss(n,e,i,s)||c}function ns(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function os(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,h=s[r.stack]||{count:1,placed:0,weight:1},l=r.stackWeight/h.weight||1;if(r.horizontal){const s=e.w*l,o=h.size||t.height;A(h.start)&&(a=h.start),t.fullSize?ns(t,n.left,a,i.outerWidth-n.right-n.left,o):ns(t,e.left+h.placed,a,s,o),h.start=a,h.placed+=s,a=t.bottom}else{const s=e.h*l,a=h.size||t.width;A(h.start)&&(o=h.start),t.fullSize?ns(t,o,n.top,a,i.outerHeight-n.bottom-n.top):ns(t,o,e.top+h.placed,a,s),h.start=o,h.placed+=s,o=t.right}}e.x=o,e.y=a}Nt.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var as={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,s){if(!t)return;const n=he(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=Qi(e.filter((t=>t.box.fullSize)),!0),s=Qi(Gi(e,"left"),!0),n=Qi(Gi(e,"right")),o=Qi(Gi(e,"top"),!0),a=Qi(Gi(e,"bottom")),r=Ki(e,"x"),h=Ki(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(h).concat(a).concat(r),chartArea:Gi(e,"chartArea"),vertical:s.concat(n).concat(h),horizontal:o.concat(a).concat(r)}}(t.boxes),h=r.vertical,l=r.horizontal;y(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=h.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},n);ts(u,he(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Zi.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,h=i[r.stack],l=h&&r.stackWeight/h.weight;r.horizontal?(r.width=l?l*s:a&&e.availableWidth,r.height=n):(r.width=s,r.height=l?l*n:a&&e.availableHeight)}return i}(h.concat(l),d);ss(r.fullSize,f,d,g),ss(h,f,d,g),ss(l,f,d,g)&&ss(h,f,d,g),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(f),os(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,os(r.rightAndBottom,f,d,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},y(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};class rs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class hs extends rs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ls={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},cs=t=>null===t||""===t,ds=!!Ye&&{passive:!0};function us(t,e,i){t.canvas.removeEventListener(e,i,ds)}function fs(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function gs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||fs(i.addedNodes,s),e=e&&!fs(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function ps(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||fs(i.removedNodes,s),e=e&&!fs(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const ms=new Map;let bs=0;function xs(){const t=window.devicePixelRatio;t!==bs&&(bs=t,ms.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ys(t,e,i){const s=t.canvas,n=s&&Ve(s);if(!n)return;const o=h(((t,e)=>{const s=n.clientWidth;i(t,e),s<n.clientWidth&&i()}),window),a=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return a.observe(n),function(t,e){ms.size||window.addEventListener("resize",xs),ms.set(t,e)}(t,o),a}function _s(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){ms.delete(t),ms.size||window.removeEventListener("resize",xs)}(t)}function vs(t,e,i){const s=t.canvas,n=h((e=>{null!==t.ctx&&i(function(t,e){const i=ls[t.type]||t.type,{x:s,y:n}=He(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,ds)}(s,e,n),n}class ws extends rs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",cs(n)){const e=Xe(t,"width");void 0!==e&&(t.width=e)}if(cs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Xe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const i=e.$chartjs.initial;["height","width"].forEach((t=>{const s=i[t];d(s)?e.removeAttribute(t):e.setAttribute(t,s)}));const s=i.style||{};return Object.keys(s).forEach((t=>{e.style[t]=s[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:gs,detach:ps,resize:ys}[e]||vs;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:_s,detach:_s,resize:_s}[e]||us)(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return function(t,e,i,s){const n=je(t),o=Ne(n,"margin"),a=Be(n.maxWidth,t,"clientWidth")||z,r=Be(n.maxHeight,t,"clientHeight")||z,h=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=Ve(t);if(o){const t=o.getBoundingClientRect(),a=je(o),r=Ne(a,"border","width"),h=Ne(a,"padding");e=t.width-h.width-r.width,i=t.height-h.height-r.height,s=Be(a.maxWidth,o,"clientWidth"),n=Be(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||z,maxHeight:n||z}}(t,e,i);let{width:l,height:c}=h;if("content-box"===n.boxSizing){const t=Ne(n,"border","width"),e=Ne(n,"padding");l-=e.width+t.width,c-=e.height+t.height}return l=Math.max(0,l-o.width),c=Math.max(0,s?Math.floor(l/s):c-o.height),l=$e(Math.min(l,a,h.maxWidth)),c=$e(Math.min(c,r,h.maxHeight)),l&&!c&&(c=$e(l/2)),{width:l,height:c}}(t,e,i,s)}isAttached(t){const e=Ve(t);return!(!e||!e.isConnected)}}class Ms{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 $(this.x)&&$(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}Ms.defaults={},Ms.defaultRoutes=void 0;const ks={values:t=>u(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=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)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}(t,i)}const a=W(Math.abs(o)),r=Math.max(Math.min(-1*Math.floor(a),20),0),h={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(h,this.options.ticks.format),Qe(t,s,h)},logarithmic(t,e,i){if(0===t)return"0";const s=t/Math.pow(10,Math.floor(W(t)));return 1===s||2===s||5===s?ks.numeric.call(this,t,e,i):""}};var Cs={formatters:ks};function Ss(t,e,i,s,n){const o=m(s,0),a=Math.min(m(n,t.length),t.length);let r,h,l,c=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),l=o;l<0;)c++,l=Math.round(o+c*i);for(h=Math.max(o,0);h<a;h++)h===l&&(e.push(t[h]),c++,l=Math.round(o+c*i))}Nt.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:Cs.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),Nt.route("scale.ticks","color","","color"),Nt.route("scale.grid","color","","borderColor"),Nt.route("scale.grid","borderColor","","borderColor"),Nt.route("scale.title","color","","color"),Nt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),Nt.describe("scales",{_fallback:"scale"}),Nt.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Ds=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Ps(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function Os(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let h,l=t.getPixelForTick(n);if(!(i&&(h=1===s?Math.max(l-o,a-l):0===e?(t.getPixelForTick(1)-l)/2:(l-t.getPixelForTick(n-1))/2,l+=n<e?h:-h,l<o-r||l>a+r)))return l}function As(t){return t.drawTicks?t.tickLength:0}function Ts(t,e){if(!t.display)return 0;const i=le(t.font,e),s=he(t.padding);return(u(t.text)?t.text.length:1)*i.lineHeight+s.height}function Ls(t,e,i){let s=(t=>"start"===t?"left":"end"===t?"right":"center")(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class Es extends Ms{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:s}=this;return t=p(t,Number.POSITIVE_INFINITY),e=p(e,Number.NEGATIVE_INFINITY),i=p(i,Number.POSITIVE_INFINITY),s=p(s,Number.NEGATIVE_INFINITY),{min:p(t,i),max:p(e,s),minDefined:g(t),maxDefined:g(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,h=a.length;r<h;++r)e=a[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),o||(s=Math.max(s,e.max));return i=o&&i>s?s:i,s=n&&i>s?i:s,{min:p(i,p(s,i)),max:p(s,p(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){x(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.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=function(t,e,i){const{min:s,max:n}=t,o=b(e,(n-s)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?Ps(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=function(t,e){const i=t.options.ticks,s=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),n=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],o=n.length,a=n[0],r=n[o-1],h=[];if(o>s)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=i[o*s])}(e,h,n,o/s),h;const l=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const o=function(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(s);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)return e}return Math.max(n,1)}(n,e,s);if(o>0){let t,i;const s=o>1?Math.round((r-a)/(o-1)):null;for(Ss(e,h,l,d(s)?0:a-s,a),t=0,i=o-1;t<i;t++)Ss(e,h,l,n[t],n[t+1]);return Ss(e,h,l,r,d(s)?e.length:r+s),h}return Ss(e,h,l),h}(this,this.ticks),this._labelSizes=null),r&&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(){x(this.options.afterUpdate,[this])}beforeSetDimensions(){x(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(){x(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),x(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){x(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=x(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){x(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){x(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=this.ticks.length,s=e.minRotation||0,n=e.maxRotation;let o,a,r,h=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const l=this._getLabelSizes(),c=l.widest.width,d=l.highest.height,u=tt(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-As(t.grid)-e.padding-Ts(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),h=q(Math.min(Math.asin(tt((l.highest.height+6)/o,-1,1)),Math.asin(tt(a/r,-1,1))-Math.asin(tt(d/r,-1,1)))),h=Math.max(s,Math.min(n,h))),this.labelRotation=h}afterCalculateLabelRotation(){x(this.options.afterCalculateLabelRotation,[this])}beforeFit(){x(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Ts(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=As(n)+o):(t.height=this.maxHeight,t.width=As(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,h=X(this.labelRotation),l=Math.cos(h),c=Math.sin(h);if(a){const e=i.mirror?0:c*n.width+l*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:l*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,l)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,h="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?h?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-l+o)*this.width/(this.width-l),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_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(){x(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++)d(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=Ps(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:s}=this,n=[],o=[];let a,r,h,l,c,f,g,p,m,b,x,_=0,v=0;for(a=0;a<e;++a){if(l=t[a].label,c=this._resolveTickFontOptions(a),i.font=f=c.string,g=s[f]=s[f]||{data:{},gc:[]},p=c.lineHeight,m=b=0,d(l)||u(l)){if(u(l))for(r=0,h=l.length;r<h;++r)x=l[r],d(x)||u(x)||(m=Ht(i,g.data,g.gc,m,x),b+=p)}else m=Ht(i,g.data,g.gc,m,l),b=p;n.push(m),o.push(b),_=Math.max(m,_),v=Math.max(b,v)}!function(t,e){y(t,(t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}}))}(s,e);const w=n.indexOf(_),M=o.indexOf(v),k=t=>({width:n[t]||0,height:o[t]||0});return{first:k(0),last:k(e-1),widest:k(w),highest:k(M),widths:n,heights:o}}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 tt(this._alignToPixels?Ut(this.chart,e,0):e,-32768,32767)}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 de(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=de(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=X(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*i>a*s?a/i:r/s:r*s<a*i?r/i:a/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:o}=s,a=n.offset,r=this.isHorizontal(),h=this.ticks.length+(a?1:0),l=As(n),c=[],d=n.setContext(this.getContext()),u=d.drawBorder?d.borderWidth:0,g=u/2,p=function(t){return Ut(i,t,u)};let b,x,y,_,v,w,M,k,C,S,D,P;if("top"===o)b=p(this.bottom),w=this.bottom-l,k=b-g,S=p(t.top)+g,P=t.bottom;else if("bottom"===o)b=p(this.top),S=t.top,P=p(t.bottom)-g,w=b+g,k=this.top+l;else if("left"===o)b=p(this.right),v=this.right-l,M=b-g,C=p(t.left)+g,D=t.right;else if("right"===o)b=p(this.left),C=t.left,D=p(t.right)-g,v=b+g,M=this.left+l;else if("x"===e){if("center"===o)b=p((t.top+t.bottom)/2+.5);else if(f(o)){const t=Object.keys(o)[0],e=o[t];b=p(this.chart.scales[t].getPixelForValue(e))}S=t.top,P=t.bottom,w=b+g,k=w+l}else if("y"===e){if("center"===o)b=p((t.left+t.right)/2);else if(f(o)){const t=Object.keys(o)[0],e=o[t];b=p(this.chart.scales[t].getPixelForValue(e))}v=b-g,M=v-l,C=t.left,D=t.right}const O=m(s.ticks.maxTicksLimit,h),A=Math.max(1,Math.ceil(h/O));for(x=0;x<h;x+=A){const t=n.setContext(this.getContext(x)),e=t.lineWidth,s=t.color,o=n.borderDash||[],h=t.borderDashOffset,l=t.tickWidth,d=t.tickColor,u=t.tickBorderDash||[],f=t.tickBorderDashOffset;y=Os(this,x,a),void 0!==y&&(_=Ut(i,y,e),r?v=M=C=D=_:w=k=S=P=_,c.push({tx1:v,ty1:w,tx2:M,ty2:k,x1:C,y1:S,x2:D,y2:P,width:e,color:s,borderDash:o,borderDashOffset:h,tickWidth:l,tickColor:d,tickBorderDash:u,tickBorderDashOffset:f}))}return this._ticksLength=h,this._borderValue=b,c}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:n}=i,o=this.isHorizontal(),a=this.ticks,{align:r,crossAlign:h,padding:l,mirror:c}=n,d=As(i.grid),g=d+l,p=c?-l:g,m=-X(this.labelRotation),b=[];let x,y,_,v,w,M,k,C,S,D,P,O,A="middle";if("top"===s)M=this.bottom-p,k=this._getXAxisLabelAlignment();else if("bottom"===s)M=this.top+p,k=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(d);k=t.textAlign,w=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(d);k=t.textAlign,w=t.x}else if("x"===e){if("center"===s)M=(t.top+t.bottom)/2+g;else if(f(s)){const t=Object.keys(s)[0],e=s[t];M=this.chart.scales[t].getPixelForValue(e)+g}k=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)w=(t.left+t.right)/2-g;else if(f(s)){const t=Object.keys(s)[0],e=s[t];w=this.chart.scales[t].getPixelForValue(e)}k=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?A="top":"end"===r&&(A="bottom"));const T=this._getLabelSizes();for(x=0,y=a.length;x<y;++x){_=a[x],v=_.label;const t=n.setContext(this.getContext(x));C=this.getPixelForTick(x)+n.labelOffset,S=this._resolveTickFontOptions(x),D=S.lineHeight,P=u(v)?v.length:1;const e=P/2,i=t.color,r=t.textStrokeColor,l=t.textStrokeWidth;let d;if(o?(w=C,O="top"===s?"near"===h||0!==m?-P*D+D/2:"center"===h?-T.highest.height/2-e*D+D:-T.highest.height+D/2:"near"===h||0!==m?D/2:"center"===h?T.highest.height/2-e*D:T.highest.height-P*D,c&&(O*=-1)):(M=C,O=(1-P)*D/2),t.showLabelBackdrop){const e=he(t.backdropPadding),i=T.heights[x],s=T.widths[x];let n=M+O-e.top,o=w-e.left;switch(A){case"middle":n-=i/2;break;case"bottom":n-=i}switch(k){case"center":o-=s/2;break;case"right":o-=s}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}b.push({rotation:m,label:v,font:S,color:i,strokeColor:r,strokeWidth:l,textOffset:O,textAlign:k,textBaseline:A,translation:[w,M],backdrop:d})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-X(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:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,h;return"left"===e?s?(h=this.right+n,"near"===i?r="left":"center"===i?(r="center",h+=a/2):(r="right",h+=a)):(h=this.right-o,"near"===i?r="right":"center"===i?(r="center",h-=a/2):(r="left",h=this.left)):"right"===e?s?(h=this.left+n,"near"===i?r="right":"center"===i?(r="center",h-=a/2):(r="left",h-=a)):(h=this.left+o,"near"===i?r="left":"center"===i?(r="center",h+=a/2):(r="right",h=this.right)):r="right",{textAlign:r,x:h}}_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:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),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));return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n<o;++n){const t=s[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({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,s=i.setContext(this.getContext()),n=i.drawBorder?s.borderWidth:0;if(!n)return;const o=i.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let r,h,l,c;this.isHorizontal()?(r=Ut(t,this.left,n)-n/2,h=Ut(t,this.right,o)+o/2,l=c=a):(l=Ut(t,this.top,n)-n/2,c=Ut(t,this.bottom,o)+o/2,r=h=a),e.save(),e.lineWidth=s.borderWidth,e.strokeStyle=s.borderColor,e.beginPath(),e.moveTo(r,l),e.lineTo(h,c),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Zt(e,i);const s=this._labelItems||(this._labelItems=this._computeLabelItems(t));let n,o;for(n=0,o=s.length;n<o;++n){const t=s[n],i=t.font,o=t.label;t.backdrop&&(e.fillStyle=t.backdrop.color,e.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),Jt(e,o,0,t.textOffset,i,t)}i&&Gt(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const n=le(i.font),o=he(i.padding),a=i.align;let r=n.lineHeight/2;"bottom"===e||"center"===e||f(e)?(r+=o.bottom,u(i.text)&&(r+=n.lineHeight*(i.text.length-1))):r+=o.top;const{titleX:h,titleY:c,maxWidth:d,rotation:g}=function(t,e,i,s){const{top:n,left:o,bottom:a,right:r,chart:h}=t,{chartArea:c,scales:d}=h;let u,g,p,m=0;const b=a-n,x=r-o;if(t.isHorizontal()){if(g=l(s,o,r),f(i)){const t=Object.keys(i)[0],s=i[t];p=d[t].getPixelForValue(s)+b-e}else p="center"===i?(c.bottom+c.top)/2+b-e:Ds(t,i,e);u=r-o}else{if(f(i)){const t=Object.keys(i)[0],s=i[t];g=d[t].getPixelForValue(s)-x+e}else g="center"===i?(c.left+c.right)/2-x+e:Ds(t,i,e);p=l(s,a,n),m="left"===i?-V:V}return{titleX:g,titleY:p,maxWidth:u,rotation:m}}(this,r,e,a);Jt(t,i.text,0,0,n,{color:i.color,maxWidth:d,rotation:g,textAlign:Ls(a,e,s),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=m(t.grid&&t.grid.z,-1);return this._isVisible()&&this.draw===Es.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",s=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||s.push(o)}return s}_resolveTickFontOptions(t){return le(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Rs{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 s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=k(Object.create(null),[i?Nt.get(i):{},Nt.get(e),t.defaults]);Nt.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),h=a.join(".");Nt.route(o,n,h,r)}))}(e,t.defaultRoutes),t.descriptors&&Nt.describe(e,t.descriptors)}(t,o,i),this.override&&Nt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in Nt[s]&&(delete Nt[s][i],this.override&&delete Vt[i])}}var Is=new class{constructor(){this.controllers=new Rs(wi,"datasets",!0),this.elements=new Rs(Ms,"elements"),this.plugins=new Rs(Object,"plugins"),this.scales=new Rs(Es,"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 s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):y(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=O(t);x(i["before"+s],[],i),e[t](i),x(i["after"+s],[],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 s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}};class zs{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return"destroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===x(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){d(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,s=m(i.options&&i.options.plugins,{}),n=function(t){const e=[],i=Object.keys(Is.plugins.items);for(let t=0;t<i.length;t++)e.push(Is.getPlugin(i[t]));const s=t.plugins||[];for(let t=0;t<s.length;t++){const i=s[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==s||e?function(t,e,i,s){const n=[],o=t.getContext();for(let a=0;a<e.length;a++){const r=e[a],h=Fs(i[r.id],s);null!==h&&n.push({plugin:r,options:Vs(t.config,r,h,o)})}return n}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Fs(t,e){return e||!1!==t?!0===t?{}:t:null}function Vs(t,e,i,s){const n=t.pluginScopeKeys(e),o=t.getOptionScopes(i,n);return t.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Bs(t,e){const i=Nt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function js(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 Ws(t){const e=t.options||(t.options={});e.plugins=m(e.plugins,{}),e.scales=function(t,e){const i=Vt[t.type]||{scales:{}},s=e.scales||{},n=Bs(t.type,e),o=Object.create(null),a=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!f(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 r=js(t,e),h=function(t,e){return t===e?"_index_":"_value_"}(r,n),l=i.scales||{};o[r]=o[r]||t,a[t]=C(Object.create(null),[{axis:r},e,l[r],l[h]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,r=i.indexAxis||Bs(n,e),h=(Vt[n]||{}).scales||{};Object.keys(h).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),n=i[e+"AxisID"]||o[e]||e;a[n]=a[n]||Object.create(null),C(a[n],[{axis:e},s[n],h[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];C(e,[Nt.scales[e.type],Nt.scale])})),a}(t,e)}function Ns(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Hs=new Map,$s=new Set;function Us(t,e){let i=Hs.get(t);return i||(i=e(),Hs.set(t,i),$s.add(i)),i}const Ys=(t,e,i)=>{const s=P(e,i);void 0!==s&&t.add(s)};class Xs{constructor(t){this._config=function(t){return(t=t||{}).data=Ns(t.data),Ws(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=Ns(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(),Ws(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Us(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Us(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Us(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Us(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>Ys(r,t,e)))),e.forEach((t=>Ys(r,s,t))),e.forEach((t=>Ys(r,Vt[n]||{},t))),e.forEach((t=>Ys(r,Nt,t))),e.forEach((t=>Ys(r,Bt,t)))}));const h=Array.from(r);return 0===h.length&&h.push(Object.create(null)),$s.has(e)&&o.set(e,h),h}chartOptionScopes(){const{options:t,type:e}=this;return[t,Vt[e]||{},Nt.datasets[e]||{},{type:e},Nt,Bt]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:o,subPrefixes:a}=qs(this._resolverCache,t,s);let r=o;(function(t,e){const{isScriptable:i,isIndexable:s}=_e(t);for(const n of e){const e=i(n),o=s(n),a=(o||e)&&t[n];if(e&&(T(a)||Zs(a))||o&&u(a))return!0}return!1})(o,e)&&(n.$shared=!1,r=ye(o,i=T(i)?i():i,this.createResolver(t,i,a)));for(const t of e)n[t]=r[t];return n}createResolver(t,e,i=[""],s){const{resolver:n}=qs(this._resolverCache,t,i);return f(e)?ye(n,e,void 0,s):n}}function qs(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);return o||(o={resolver:xe(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)),o}const Zs=t=>f(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||T(t[i])),!1),Gs=["top","bottom","left","right","chartArea"];function Ks(t,e){return"top"===t||"bottom"===t||-1===Gs.indexOf(t)&&"x"===e}function Qs(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Js(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),x(i&&i.onComplete,[t],e)}function tn(t){const e=t.chart,i=e.options.animation;x(i&&i.onProgress,[t],e)}function en(t){return Fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const sn={},nn=t=>{const e=en(t);return Object.values(sn).filter((t=>t.canvas===e)).pop()};function on(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class an{constructor(t,e){const i=this.config=new Xs(e),s=en(t),n=nn(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?hs:ws}(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),r=a&&a.canvas,h=r&&r.height,l=r&&r.width;this.id=c(),this.ctx=a,this.canvas=r,this.width=l,this.height=h,this._options=o,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 zs,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}((t=>this.update(t)),o.resizeDelay||0),this._dataChanges=[],sn[this.id]=this,a&&r?(oi.listen(this,"complete",Js),oi.listen(this,"progress",tn),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:s,_aspectRatio:n}=this;return d(t)?e&&n?n:s?i/s: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():Ue(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Yt(this.canvas,this.ctx),this}stop(){return oi.stop(this),this}resize(t,e){oi.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Ue(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),x(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){y(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=js(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),y(n,(e=>{const n=e.options,o=n.id,a=js(o,n),r=m(n.type,e.dtype);void 0!==n.position&&Ks(n.position,a)===Ks(e.dposition)||(n.position=e.dposition),s[o]=!0;let h=null;o in i&&i[o].type===r?h=i[o]:(h=new(Is.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[h.id]=h),h.init(n,t)})),y(s,((t,e)=>{t||delete i[e]})),y(i,(t=>{as.configure(this,t,t.options),as.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(Qs("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,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const o=s.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=o,n.indexAxis=s.indexAxis||Bs(o,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=Is.getController(o),{datasetElementType:s,dataElementType:a}=Nt.datasets[o];Object.assign(e.prototype,{dataElementType:Is.getElement(a),datasetElementType:s&&Is.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){y(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()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||y(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Qs("z","_idx")),this._lastEvent&&this._eventHandler(this._lastEvent,!0),this.render()}_updateScales(){y(this.scales,(t=>{as.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);L(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e)on(t,s,"_removeElements"===i?-n:n)}_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(",")))),s=i(0);for(let t=1;t<e;t++)if(!L(s,i(t)))return;return Array.from(s).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;as.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],y(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,T(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(oi.has(this)?this.attached&&!oi.running(this)&&oi.start(this):(this.draw(),Js({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 s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}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,s=!i.disabled,n=this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&Zt(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&Gt(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}getElementsAtEventForMode(t,e,i,s){const n=qi.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={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(s)),s}getContext(){return this.$context||(this.$context=de(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 s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);A(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s: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(),oi.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(),Yt(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete sn[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,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};y(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){y(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},y(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[s+"HoverStyle"](o.element,o.datasetIndex,o.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}}));!_(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 s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e){const{_active:i=[],options:s}=this,n=s.hover,o=e;let a=[],r=!1,h=null;return"mouseout"!==t.type&&(a=this.getElementsAtEventForMode(t,n.mode,n,o),h="click"===t.type?this._lastEvent:t),this._lastEvent=null,qt(t,this.chartArea,this._minPadding)&&(x(s.onHover,[t,a,this],this),"mouseup"!==t.type&&"click"!==t.type&&"contextmenu"!==t.type||x(s.onClick,[t,a,this],this)),r=!_(a,i),(r||e)&&(this._active=a,this._updateHoverStyles(a,i,e)),this._lastEvent=h,r}}const rn=()=>y(an.instances,(t=>t._plugins.invalidate())),hn=!0;function ln(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:h}=e;let l=n/r;t.beginPath(),t.arc(o,a,r,s-l,i+l),h>n?(l=n/h,t.arc(o,a,h,i+l,s-l,!0)):t.arc(o,a,n,i+V,s-V),t.closePath(),t.clip()}function cn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function dn(t,e,i,s,n){const{x:o,y:a,startAngle:r,pixelMargin:h,innerRadius:l}=e,c=Math.max(e.outerRadius+s+i-h,0),d=l>0?l+s+i+h:0;let u=0;const f=n-r;if(s){const t=((l>0?l-s:0)+(c>0?c-s:0))/2;u=(f-(0!==t?f*t/(t+s):f))/2}const g=(f-Math.max(.001,f*c-i/E)/c)/2,p=r+g+u,m=n-g-u,{outerStart:b,outerEnd:x,innerStart:y,innerEnd:_}=function(t,e,i,s){const n=oe(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return tt(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:tt(n.innerStart,0,a),innerEnd:tt(n.innerEnd,0,a)}}(e,d,c,m-p),v=c-b,w=c-x,M=p+b/v,k=m-x/w,C=d+y,S=d+_,D=p+y/C,P=m-_/S;if(t.beginPath(),t.arc(o,a,c,M,k),x>0){const e=cn(w,k,o,a);t.arc(e.x,e.y,x,k,m+V)}const O=cn(S,m,o,a);if(t.lineTo(O.x,O.y),_>0){const e=cn(S,P,o,a);t.arc(e.x,e.y,_,m+V,P+Math.PI)}if(t.arc(o,a,d,m-_/d,p+y/d,!0),y>0){const e=cn(C,D,o,a);t.arc(e.x,e.y,y,D+Math.PI,p-V)}const A=cn(v,p,o,a);if(t.lineTo(A.x,A.y),b>0){const e=cn(v,M,o,a);t.arc(e.x,e.y,b,p-V,M)}t.closePath()}Object.defineProperties(an,{defaults:{enumerable:hn,value:Nt},instances:{enumerable:hn,value:sn},overrides:{enumerable:hn,value:Vt},registry:{enumerable:hn,value:Is},version:{enumerable:hn,value:"3.6.2"},getChart:{enumerable:hn,value:nn},register:{enumerable:hn,value:(...t)=>{Is.add(...t),rn()}},unregister:{enumerable:hn,value:(...t)=>{Is.remove(...t),rn()}}});class un extends Ms{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 s=this.getProps(["x","y"],i),{angle:n,distance:o}=function(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*E&&(o+=R),{angle:o,distance:n}}(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:h,outerRadius:l,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=this.options.spacing/2,u=m(c,r-a)>=R||J(n,a,r),f=et(o,h+d,l+d);return u&&f}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:h}=this.options,l=(s+n)/2,c=(o+a+h+r)/2;return{x:e+Math.cos(l)*c,y:i+Math.sin(l)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,n=(e.spacing||0)/2;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>R?Math.floor(i/R):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=0;if(s){o=s/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*o,Math.sin(e)*o),this.circumference>=E&&(o=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const a=function(t,e,i,s){const{fullCircles:n,startAngle:o,circumference:a}=e;let r=e.endAngle;if(n){dn(t,e,i,s,o+R);for(let e=0;e<n;++e)t.fill();isNaN(a)||(r=o+a%R,a%R==0&&(r+=R))}return dn(t,e,i,s,r),t.fill(),r}(t,this,o,n);(function(t,e,i,s,n){const{options:o}=e,a="inner"===o.borderAlign;o.borderWidth&&(a?(t.lineWidth=2*o.borderWidth,t.lineJoin="round"):(t.lineWidth=o.borderWidth,t.lineJoin="bevel"),e.fullCircles&&function(t,e,i){const{x:s,y:n,startAngle:o,pixelMargin:a,fullCircles:r}=e,h=Math.max(e.outerRadius-a,0),l=e.innerRadius+a;let c;for(i&&ln(t,e,o+R),t.beginPath(),t.arc(s,n,l,o+R,o,!0),c=0;c<r;++c)t.stroke();for(t.beginPath(),t.arc(s,n,h,o,o+R),c=0;c<r;++c)t.stroke()}(t,e,a),a&&ln(t,e,n),dn(t,e,i,s,n),t.stroke())})(t,this,o,n,a),t.restore()}}function fn(t,e,i=e){t.lineCap=m(i.borderCapStyle,e.borderCapStyle),t.setLineDash(m(i.borderDash,e.borderDash)),t.lineDashOffset=m(i.borderDashOffset,e.borderDashOffset),t.lineJoin=m(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=m(i.borderWidth,e.borderWidth),t.strokeStyle=m(i.borderColor,e.borderColor)}function gn(t,e,i){t.lineTo(i.x,i.y)}function pn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,h=Math.max(n,a),l=Math.min(o,r),c=n<a&&o<a||n>r&&o>r;return{count:s,start:h,loop:e.loop,ilen:l<h&&!c?s+l-h:l-h}}function mn(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:h,ilen:l}=pn(n,i,s),c=function(t){return t.stepped?Kt:t.tension||"monotone"===t.cubicInterpolationMode?Qt:gn}(o);let d,u,f,{move:g=!0,reverse:p}=s||{};for(d=0;d<=l;++d)u=n[(r+(p?l-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,f,u,p,o.stepped),f=u);return h&&(u=n[(r+(p?l:0))%a],c(t,f,u,p,o.stepped)),!!h}function bn(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=pn(n,i,s),{move:h=!0,reverse:l}=s||{};let c,d,u,f,g,p,m=0,b=0;const x=t=>(a+(l?r-t:t))%o,y=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(h&&(d=n[x(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[x(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<f?f=i:i>g&&(g=i),m=(b*m+e)/++b):(y(),t.lineTo(e,i),u=s,b=0,f=g=i),p=i}y()}function xn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?mn:bn}un.id="arc",un.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},un.defaultRoutes={backgroundColor:"backgroundColor"};const yn="function"==typeof Path2D;class _n extends Ms{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 s=i.spanGaps?this._loop:this._fullLoop;ze(this._points,i,t,s,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=function(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);return function(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=si(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,h=i.length,l=[];let c=o,d=e[0].start,u=d;function f(t,e,s,n){const o=r?-1:1;if(t!==e){for(t+=h;i[t%h].skip;)t-=o;for(;i[e%h].skip;)e+=o;t%h!=e%h&&(l.push({start:t%h,end:e%h,loop:s,style:n}),c=n,d=e%h)}}for(const t of e){d=r?d:t.start;let e,o=i[d%h];for(u=d+1;u<=t.end;u++){const r=i[u%h];e=si(s.setContext(de(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%h,p1DataIndex:u%h,datasetIndex:a}))),ni(e,c)&&f(d,u-1,t.loop,c),o=r,c=e}d<u-1&&f(d,u-1,t.loop,c)}return l}(t,e,i,s):e}(t,!0===s?[{start:a,end:r,loop:o}]:function(t,e,i,s){const n=t.length,o=[];let a,r=e,h=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?h.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,h.skip&&(e=a)),h=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),i,e)}(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,s=t[e],n=this.points,o=function(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const o=ii(s[n],t.points,e);o.length&&i.push(...o)}return i}(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?Ze:t.tension||"monotone"===t.cubicInterpolationMode?Ge:qe}(i);let h,l;for(h=0,l=o.length;h<l;++h){const{start:l,end:c}=o[h],d=n[l],u=n[c];if(d===u){a.push(d);continue}const f=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return xn(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=xn(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),function(t,e,i,s){yn&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),fn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=xn(e);for(const r of n)fn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function vn(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}_n.id="line",_n.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},_n.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},_n.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class wn extends Ms{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 s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return vn(this,t,"x",e)}inYRange(t,e){return vn(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 e=Math.max(e,e&&t.hoverRadius||0),2*(e+(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,Xt(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Mn(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,h,l,c,d;return t.horizontal?(d=a/2,r=Math.min(i,n),h=Math.max(i,n),l=s-d,c=s+d):(d=o/2,r=i-d,h=i+d,l=Math.min(s,n),c=Math.max(s,n)),{left:r,top:l,right:h,bottom:c}}function kn(t,e,i,s){return t?0:tt(e,i,s)}function Cn(t,e,i,s){const n=null===e,o=null===i,a=t&&!(n&&o)&&Mn(t,s);return a&&(n||et(e,a.left,a.right))&&(o||et(i,a.top,a.bottom))}function Sn(t,e){t.rect(e.x,e.y,e.w,e.h)}function Dn(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}wn.id="point",wn.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},wn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class Pn extends Ms{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:s}}=this,{inner:n,outer:o}=function(t){const e=Mn(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=ae(s);return{t:kn(n.top,o.top,0,i),r:kn(n.right,o.right,0,e),b:kn(n.bottom,o.bottom,0,i),l:kn(n.left,o.left,0,e)}}(t,i/2,s/2),o=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,o=re(n),a=Math.min(e,i),r=t.borderSkipped,h=s||f(n);return{topLeft:kn(!h||r.top||r.left,o.topLeft,0,a),topRight:kn(!h||r.top||r.right,o.topRight,0,a),bottomLeft:kn(!h||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:kn(!h||r.bottom||r.right,o.bottomRight,0,a)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:o},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?ee:Sn;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,Dn(o,e,n)),t.clip(),a(t,Dn(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,Dn(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Cn(this,t,e,i)}inXRange(t,e){return Cn(this,t,null,e)}inYRange(t,e){return Cn(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}Pn.id="bar",Pn.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0},Pn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},new WeakMap;const On={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s+=t.x,n+=t.y,++o}}return{x:s/o,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=G(e,s.getCenterPoint());t<r&&(r=t,n=s)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function An(t,e){return e&&(u(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Tn(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Ln(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function En(t,e){const i=t._chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,h=le(e.bodyFont),l=le(e.titleFont),c=le(e.footerFont),d=o.length,u=n.length,f=s.length,g=he(e.padding);let p=g.height,m=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);b+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*l.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b&&(p+=f*(e.displayColors?Math.max(r,h.lineHeight):h.lineHeight)+(b-f)*h.lineHeight+(b-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let x=0;const _=function(t){m=Math.max(m,i.measureText(t).width+x)};return i.save(),i.font=l.string,y(t.title,_),i.font=h.string,y(t.beforeBody.concat(t.afterBody),_),x=e.displayColors?a+2+e.boxPadding:0,y(s,(t=>{y(t.before,_),y(t.lines,_),y(t.after,_)})),x=0,i.font=c.string,y(t.footer,_),i.restore(),m+=g.width,{width:m,height:p}}function Rn(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:h}}=t;let l="center";return"center"===s?l=n<=(r+h)/2?"left":"right":n<=o/2?l="left":n>=a-o/2&&(l="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(l,t,e,i)&&(l="center"),l}function In(t,e,i){const s=e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:e.xAlign||Rn(t,e,i,s),yAlign:s}}function zn(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:h}=i,l=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=re(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,h,l);return"center"===h?"left"===r?g+=l:"right"===r&&(g-=l):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:tt(g,0,s.width-e.width),y:tt(p,0,s.height-e.height)}}function Fn(t,e,i){const s=he(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Vn(t){return An([],Tn(t))}function Bn(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}(class extends Ms{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()),s=i.enabled&&e.options.animation&&i.animations,n=new ci(this._chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(this,de(this._chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"})))}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=An(a,Tn(s)),a=An(a,Tn(n)),a=An(a,Tn(o)),a}getBeforeBody(t,e){return Vn(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return y(t,(t=>{const e={before:[],lines:[],after:[]},n=Bn(i,t);An(e.before,Tn(n.beforeLabel.call(this,t))),An(e.lines,n.label.call(this,t)),An(e.after,Tn(n.afterLabel.call(this,t))),s.push(e)})),s}getAfterBody(t,e){return Vn(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=An(a,Tn(s)),a=An(a,Tn(n)),a=An(a,Tn(o)),a}_createItems(t){const e=this._active,i=this._chart.data,s=[],n=[],o=[];let a,r,h=[];for(a=0,r=e.length;a<r;++a)h.push(Ln(this._chart,e[a]));return t.filter&&(h=h.filter(((e,s,n)=>t.filter(e,s,n,i)))),t.itemSort&&(h=h.sort(((e,s)=>t.itemSort(e,s,i)))),y(h,(e=>{const i=Bn(t.callbacks,e);s.push(i.labelColor.call(this,e)),n.push(i.labelPointStyle.call(this,e)),o.push(i.labelTextColor.call(this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=h,h}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=On[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=En(this,i),a=Object.assign({},t,e),r=In(this._chart,i,a),h=zn(i,a,r,this._chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:h.x,y:h.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this._chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:h,bottomLeft:l,bottomRight:c}=re(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,b,x,y,_;return"center"===n?(y=u+g/2,"left"===s?(p=d,m=p-o,x=y+o,_=y-o):(p=d+f,m=p+o,x=y-o,_=y+o),b=p):(m="left"===s?d+Math.max(r,l)+o:"right"===s?d+f-Math.max(h,c)-o:this.caretX,"top"===n?(x=u,y=x-o,p=m-o,b=m+o):(x=u+g,y=x+o,p=m+o,b=m-o),_=x),{x1:p,x2:m,x3:b,y1:x,y2:y,y3:_}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const h=Je(i.rtl,this.x,this.width);for(t.x=Fn(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",o=le(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(s[r],h.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:r,boxWidth:h,boxPadding:l}=n,c=le(n.bodyFont),d=Fn(this,"left",n),u=s.x(d),f=r<c.lineHeight?(c.lineHeight-r)/2:0,g=e.y+f;if(n.usePointStyle){const e={radius:Math.min(h,r)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},i=s.leftForLtr(u,h)+h/2,l=g+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Xt(t,e,i,l),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,Xt(t,e,i,l)}else{t.lineWidth=o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const e=s.leftForLtr(u,h-l),i=s.leftForLtr(s.xPlus(u,1),h-l-2),a=re(o.borderRadius);Object.values(a).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,ee(t,{x:e,y:g,w:h,h:r,radius:a}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),ee(t,{x:i,y:g+1,w:h-2,h:r-2,radius:a}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,h,r),t.strokeRect(e,g,h,r),t.fillStyle=o.backgroundColor,t.fillRect(i,g+1,h-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:h,boxPadding:l}=i,c=le(i.bodyFont);let d=c.lineHeight,u=0;const f=Je(i.rtl,this.x,this.width),g=function(i){e.fillText(i,f.x(t.x+u),t.y+d/2),t.y+=d+n},p=f.textAlign(o);let m,b,x,_,v,w,M;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Fn(this,p,i),e.fillStyle=i.bodyColor,y(this.beforeBody,g),u=a&&"right"!==p?"center"===o?h/2+l:h+2+l:0,_=0,w=s.length;_<w;++_){for(m=s[_],b=this.labelTextColors[_],e.fillStyle=b,y(m.before,g),x=m.lines,a&&x.length&&(this._drawColorBox(e,t,_,f,i),d=Math.max(c.lineHeight,r)),v=0,M=x.length;v<M;++v)g(x[v]),d=c.lineHeight;y(m.after,g)}u=0,d=c.lineHeight,y(this.afterBody,g),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=Je(i.rtl,this.x,this.width);for(t.x=Fn(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=le(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:h,height:l}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=re(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+c,r),"top"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+h-d,r),e.quadraticCurveTo(a+h,r,a+h,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(a+h,r+l-f),e.quadraticCurveTo(a+h,r+l,a+h-f,r+l),"bottom"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+l),e.quadraticCurveTo(a,r+l,a,r+l-u),"center"===o&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(a,r+c),e.quadraticCurveTo(a,r,a+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this._chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=On[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=En(this,t),a=Object.assign({},i,this._size),r=In(e,t,a),h=zn(t,a,r,e);s._to===h.x&&n._to===h.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,h))}}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=he(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),function(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),function(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=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}})),n=!_(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this.update(!0))}handleEvent(t,e){const i=this.options,s=this._active||[];let n=!1,o=[];"mouseout"!==t.type&&(o=this._chart.getElementsAtEventForMode(t,i.mode,i,e),i.reverse&&o.reverse());const a=this._positionChanged(o,t);return n=e||!_(o,s)||a,n&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),n}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=On[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}).positioners=On;class jn extends Es{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:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(d(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:tt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:function(t,e,i,s){const n=t.indexOf(e);return-1===n?((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s):n!==t.lastIndexOf(e)?i:n}(i,t,m(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}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 Wn(t,e,{horizontal:i,minRotation:s}){const n=X(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}jn.id="category",jn.defaults={ticks:{callback:jn.prototype.getLabelForValue}};class Nn extends Es{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 d(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,a=t=>n=i?n:t;if(t){const t=N(s),e=N(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=1;(n>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*n)),a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} 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();i=Math.max(2,i);const s=function(t,e){const i=[],{bounds:s,step:n,min:o,max:a,precision:r,count:h,maxTicks:l,maxDigits:c,includeBounds:u}=t,f=n||1,g=l-1,{min:p,max:m}=e,b=!d(o),x=!d(a),y=!d(h),_=(m-p)/(c+1);let v,w,M,k,C=H((m-p)/g/f)*f;if(C<1e-14&&!b&&!x)return[{value:p},{value:m}];k=Math.ceil(m/C)-Math.floor(p/C),k>g&&(C=H(k*C/g/f)*f),d(r)||(v=Math.pow(10,r),C=Math.ceil(C*v)/v),"ticks"===s?(w=Math.floor(p/C)*C,M=Math.ceil(m/C)*C):(w=p,M=m),b&&x&&n&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((a-o)/n,C/1e3)?(k=Math.round(Math.min((a-o)/C,l)),C=(a-o)/k,w=o,M=a):y?(w=b?o:w,M=x?a:M,k=h-1,C=(M-w)/k):(k=(M-w)/C,k=U(k,Math.round(k),C/1e3)?Math.round(k):Math.ceil(k));const S=Math.max(Z(C),Z(w));v=Math.pow(10,d(r)?S:r),w=Math.round(w*v)/v,M=Math.round(M*v)/v;let D=0;for(b&&(u&&w!==o?(i.push({value:o}),w<o&&D++,U(Math.round((w+D*C)*v)/v,o,Wn(o,_,t))&&D++):w<o&&D++);D<k;++D)i.push({value:Math.round((w+D*C)*v)/v});return x&&u&&M!==a?i.length&&U(i[i.length-1].value,a,Wn(a,_,t))?i[i.length-1].value=a:i.push({value:a}):x&&M!==a||i.push({value:M}),i}({maxTicks: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&&Y(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Qe(t,this.chart.options.locale,this.options.ticks.format)}}class Hn extends Nn{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=g(t)?t:0,this.max=g(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=X(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function $n(t){return 1==t/Math.pow(10,Math.floor(W(t)))}Hn.id="linear",Hn.defaults={ticks:{callback:Cs.formatters.numeric}};class Un extends Es{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Nn.prototype.parse.apply(this,[t,e]);if(0!==i)return g(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=g(t)?Math.max(0,t):null,this.max=g(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,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t,a=(t,e)=>Math.pow(10,Math.floor(W(t))+e);i===s&&(i<=0?(n(1),o(10)):(n(a(i,-1)),o(a(s,1)))),i<=0&&n(a(s,-1)),s<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&n(a(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(W(e.max)),s=Math.ceil(e.max/Math.pow(10,i)),n=[];let o=p(t.min,Math.pow(10,Math.floor(W(e.min)))),a=Math.floor(W(o)),r=Math.floor(o/Math.pow(10,a)),h=a<0?Math.pow(10,Math.abs(a)):1;do{n.push({value:o,major:$n(o)}),++r,10===r&&(r=1,++a,h=a>=0?1:h),o=Math.round(r*Math.pow(10,a)*h)/h}while(a<i||a===i&&r<s);const l=p(t.max,o);return n.push({value:l,major:$n(o)}),n}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Y(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":Qe(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=W(t),this._valueRange=W(this.max)-W(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(W(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Yn(t){const e=t.ticks;if(e.display&&t.display){const t=he(e.backdropPadding);return m(e.font&&e.font.size,Nt.font.size)+t.height}return 0}function Xn(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function qn(t){return 0===t||180===t?"center":t<180?"left":"right"}function Zn(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function Gn(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,R);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o<s;o++)i=t.getPointPosition(o,e),n.lineTo(i.x,i.y)}}function Kn(t){return $(t)?t:0}Un.id="logarithmic",Un.defaults={ticks:{callback:Cs.formatters.logarithmic,major:{enabled:!0}}};class Qn extends Nn{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=Yn(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=g(t)&&!isNaN(t)?t:0,this.max=g(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Yn(this.options))}generateTickLabels(t){Nn.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=x(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}))}fit(){const t=this.options;t.display&&t.pointLabels.display?function(t){const e={l:0,r:t.width,t:0,b:t.height-t.paddingTop},i={},s=[],n=[],o=t.getLabels().length;for(let l=0;l<o;l++){const o=t.options.pointLabels.setContext(t.getPointLabelContext(l));n[l]=o.padding;const c=t.getPointPosition(l,t.drawingArea+n[l]),d=le(o.font),f=(a=t.ctx,r=d,h=u(h=t._pointLabels[l])?h:[h],{w:$t(a,r.string,h),h:h.length*r.lineHeight});s[l]=f;const g=t.getIndexAngle(l),p=q(g),m=Xn(p,c.x,f.w,0,180),b=Xn(p,c.y,f.h,90,270);m.start<e.l&&(e.l=m.start,i.l=g),m.end>e.r&&(e.r=m.end,i.r=g),b.start<e.t&&(e.t=b.start,i.t=g),b.end>e.b&&(e.b=b.end,i.b=g)}var a,r,h;t._setReductions(t.drawingArea,e,i),t._pointLabelItems=function(t,e,i){const s=[],n=t.getLabels().length,o=t.options,a=Yn(o),r=t.getDistanceFromCenterForValue(o.ticks.reverse?t.min:t.max);for(let o=0;o<n;o++){const n=0===o?a/2:0,d=t.getPointPosition(o,r+n+i[o]),u=q(t.getIndexAngle(o)),f=e[o],g=Zn(d.y,f.h,u),p=qn(u),m=(h=d.x,l=f.w,"right"===(c=p)?h-=l:"center"===c&&(h-=l/2),h);s.push({x:d.x,y:g,textAlign:p,left:m,top:g,right:m+f.w,bottom:g+f.h})}var h,l,c;return s}(t,s,n)}(this):this.setCenterPoint(0,0,0,0)}_setReductions(t,e,i){let s=e.l/Math.sin(i.l),n=Math.max(e.r-this.width,0)/Math.sin(i.r),o=-e.t/Math.cos(i.t),a=-Math.max(e.b-(this.height-this.paddingTop),0)/Math.cos(i.b);s=Kn(s),n=Kn(n),o=Kn(o),a=Kn(a),this.drawingArea=Math.max(t/2,Math.min(Math.floor(t-(s+n)/2),Math.floor(t-(o+a)/2))),this.setCenterPoint(s,n,o,a)}setCenterPoint(t,e,i,s){const n=this.width-e-this.drawingArea,o=t+this.drawingArea,a=i+this.drawingArea,r=this.height-this.paddingTop-s-this.drawingArea;this.xCenter=Math.floor((o+n)/2+this.left),this.yCenter=Math.floor((a+r)/2+this.top+this.paddingTop)}getIndexAngle(t){return Q(t*(R/this.getLabels().length)+X(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(d(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(d(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 de(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e){const i=this.getIndexAngle(t)-V;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:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Gn(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:s}=e,n=this.getLabels().length;let o,a,r;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=s.setContext(t.getPointLabelContext(n)),o=le(e.font),{x:a,y:r,textAlign:h,left:l,top:c,right:u,bottom:f}=t._pointLabelItems[n],{backdropColor:g}=e;if(!d(g)){const t=he(e.backdropPadding);i.fillStyle=g,i.fillRect(l-t.left,c-t.top,u-l+t.width,f-c+t.height)}Jt(i,t._pointLabels[n],a,r+o.lineHeight/2,o,{color:e.color,textAlign:h,textBaseline:"middle"})}}(this,n),s.display&&this.ticks.forEach(((t,e)=>{0!==e&&(a=this.getDistanceFromCenterForValue(t.value),function(t,e,i,s){const n=t.ctx,o=e.circular,{color:a,lineWidth:r}=e;!o&&!s||!a||!r||i<0||(n.save(),n.strokeStyle=a,n.lineWidth=r,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),Gn(t,i,o,s),n.closePath(),n.stroke(),n.restore())}(this,s.setContext(this.getContext(e-1)),a,n))})),i.display){for(t.save(),o=this.getLabels().length-1;o>=0;o--){const s=i.setContext(this.getPointLabelContext(o)),{color:n,lineWidth:h}=s;h&&n&&(t.lineWidth=h,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),r=this.getPointPosition(o,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(r.x,r.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&!e.reverse)return;const r=i.setContext(this.getContext(a)),h=le(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=h.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=he(r.backdropPadding);t.fillRect(-o/2-e.left,-n-h.size/2-e.top,o+e.width,h.size+e.height)}Jt(t,s.label,0,-n,h,{color:r.color})})),t.restore()}drawTitle(){}}Qn.id="radialLinear",Qn.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Cs.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5}},Qn.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},Qn.descriptors={angleLines:{_fallback:"grid"}};const Jn={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}},to=Object.keys(Jn);function eo(t,e){return t-e}function io(t,e){if(d(e))return null;const i=t._adapter,{parser:s,round:n,isoWeekday:o}=t._parseOpts;let a=e;return"function"==typeof s&&(a=s(a)),g(a)||(a="string"==typeof s?i.parse(a,s):i.parse(a)),null===a?null:(n&&(a="week"!==n||!$(o)&&!0!==o?i.startOf(a,n):i.startOf(a,"isoWeek",o)),+a)}function so(t,e,i,s){const n=to.length;for(let o=to.indexOf(t);o<n-1;++o){const t=Jn[to[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return to[o]}return to[n-1]}function no(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=ue(i,e);t[i[s]>=e?i[s]:i[n]]=!0}}else t[e]=!0}function oo(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return 0!==o&&i?function(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,h;for(r=o;r<=a;r=+n.add(r,1,s))h=i[r],h>=0&&(e[h].major=!0);return e}(t,s,n,i):s}class ao extends Es{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={}),s=this._adapter=new Wi._date(t.adapters.date);C(i.displayFormats,s.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:io(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:s,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();function r(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}o&&a||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),s=g(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=g(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_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,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=function(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}(s,n,this.max);return this._unit=e.unit||(i.autoSkip?so(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=to.length-1;o>=to.indexOf(i);o--){const i=to[o];if(Jn[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return to[i?to.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=to.indexOf(t)+1,i=to.length;e<i;++e)if(Jn[to[e]].common)return to[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),oo(this,o,this._majorUnit)}initOffsets(t){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=tt(s,0,o),n=tt(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||so(n.minUnit,e,i,this._getLabelCapacity(e)),a=m(n.stepSize,1),r="week"===o&&n.isoWeekday,h=$(r)||!0===r,l={};let c,d,u=e;if(h&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,h?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const f="data"===s.ticks.source&&this.getDataTimestamps();for(c=u,d=0;c<i;c=+t.add(c,a,o),d++)no(l,c,f);return c!==i&&"ticks"!==s.bounds&&1!==d||no(l,c,f),Object.keys(l).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,s){const n=this.options,o=n.time.displayFormats,a=this._unit,r=this._majorUnit,h=a&&o[a],l=r&&o[r],c=i[e],d=r&&l&&c&&c.major,u=this._adapter.format(t,s||(d?l:h)),f=n.ticks.callback;return f?x(f,[u,e,i],this):u}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.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,s=X(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,oo(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[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 s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(io(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return be(t.sort(eo))}}function ro(t,e,i){let s,n,o,a,r=0,h=t.length-1;i?(e>=t[r].pos&&e<=t[h].pos&&({lo:r,hi:h}=fe(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[h])):(e>=t[r].time&&e<=t[h].time&&({lo:r,hi:h}=fe(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[h]));const l=n-s;return l?o+(a-o)*(e-s)/l:o}ao.id="time",ao.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class ho extends ao{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=ro(e,this.min),this._tableRange=ro(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,h,l;for(o=0,a=t.length;o<a;++o)h=t[o],h>=e&&h<=i&&s.push(h);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)l=s[o+1],r=s[o-1],h=s[o],Math.round((l+r)/2)!==h&&n.push({time:h,pos:o/(a-1)});return n}_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,t}getDecimalForValue(t){return(ro(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return ro(this._table,i*this._tableRange+this._minPos,!0)}}ho.id="timeseries",ho.defaults=ao.defaults,an.defaults.color="#b0b0b0";var lo={y:{display:!0,ticks:{suggestedMin:0},gridLines:{color:"#606060",zeroLineColor:"#606060"}}},co="#e7c9e5",uo="#64a6bd",fo="#404040";function go(t,e){var i=-1,s=Date.now(),n={label:"texture count",data:[{x:0,y:0}],borderColor:co,borderWidth:1.5,pointRadius:1},o={label:"geometry count",data:[{x:0,y:0}],borderColor:uo,borderWidth:1.5,pointRadius:1},a=["0s"],r=new an(t,{type:"line",data:{labels:a,datasets:[n,o]},options:{animation:{duration:10},scales:lo}});this.update=function(t){var h=Math.floor((Date.now()-s)/1e3),l="".concat(h,"s");i>0&&a[i]==l?a.push(""):(a.push(l),i=a.length-1),a.length>60&&(a.shift(),i--);var c=e.info.memory;n.data.push({x:h,y:c.textures}),o.data.push({x:h,y:c.geometries}),n.data.length>60&&(n.data.shift(),o.data.shift()),t&&r.update()},this.resize=function(){r.resize()}}an.register(Ri,_n,wn,Hn,jn,Pn,Ti);var po=i(15671),mo=i(43144),bo=i(79340),xo=i(82963),yo=i(61120);const _o=function(t){(0,bo.Z)(o,t);var e,i,n=(e=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,s=(0,yo.Z)(e);if(i){var n=(0,yo.Z)(this).constructor;t=Reflect.construct(s,arguments,n)}else t=s.apply(this,arguments);return(0,xo.Z)(this,t)});function o(t,e,i){var a;return(0,po.Z)(this,o),i=i||new s.Color(Math.random(),Math.random(),Math.random()),(a=n.call(this,t.box3D,i.getHex())).obb=t,a.material.linewidth=2,a.frustumCulled=!1,a.matrixAutoUpdate=!1,a.rotationAutoUpdate=!1,a.updateMatrixWorld(!0),a}return(0,mo.Z)(o,[{key:"removeChildren",value:function(){this.material.dispose(),this.geometry.dispose()}},{key:"updateMatrixWorld",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.obb.box3D.isEmpty()||(this.quaternion.copy(this.obb.quaternion),this.obb.box3D.getCenter(this.position).applyQuaternion(this.quaternion).add(this.obb.position),this.obb.box3D.getSize(this.scale),this.scale.multiplyScalar(.5),this.updateMatrix(),s.Object3D.prototype.updateMatrixWorld.call(this,t))}}]),o}(s.Box3Helper);function vo(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return wo(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?wo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var s=0,n=function(){};return{s:n,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){r=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(r)throw o}}}}function wo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}function Mo(t,e,i){var r=this;i||((i=document.createElement("div")).id="chart-div",i.style.cssText="z-index: 10; position: absolute; bottom: 0; left: 0; width: 100vw; height: 30%; background-color: ".concat(fo,"; display: none"),document.body.appendChild(i)),this.chartDivContainer=i;var h=this.createChartContainer("three-info").getContext("2d");this.charts=[],this.charts.push(new go(h,t.mainLoop.gfxEngine.renderer));var l,c,d,u,f=this.charts,g=t.tileLayer,p=new n.Z(t.referenceCrs,0,0,0),m=new n.Z("EPSG:4326",0,0,0),b=e.addFolder("Debug Tools"),x={displayCharts:!1,eventsDebug:!1,debugCameraWindow:!1,freeze:!1},y=function(){l=Date.now()},_=function(){var t,e,s=Date.now()-l;t=s,e="none"!=i.style.display,f.forEach((function(i){return i.update(e,t)}))};b.add(x,"displayCharts").name("Display charts").onChange((function(e){e?(t.addFrameRequester(o.Ao.UPDATE_START,y),t.addFrameRequester(o.Ao.UPDATE_END,_),i.style.display="flex"):(t.removeFrameRequester(o.Ao.UPDATE_START,y),t.removeFrameRequester(o.Ao.UPDATE_END,_),i.style.display="none"),r.updateChartDivSize(),t.notifyChange()})),b.add(x,"debugCameraWindow").name("debug Camera").onChange((function(e){e?t.addFrameRequester(o.Ao.AFTER_RENDER,z):t.removeFrameRequester(o.Ao.AFTER_RENDER,z),t.notifyChange()})),b.add(x,"freeze").name("freeze update").onChange((function(e){g.frozen=e,t.notifyChange()}));var v=t.controls;p.crs=t.referenceCrs;var w=new s.Vector3,M=v&&v.getCameraTargetPosition?v.getCameraTargetPosition:function(){return t.camera.camera3D.position},k=function(e){t.getPickingPositionFromDepth(t.eventToViewCoords(e),w)?(p.setFromVector3(w).as("EPSG:4326",m),x.latitude="".concat(m.y.toFixed(6)),x.longitude="".concat(m.x.toFixed(6))):(x.latitude="---------",x.longitude="---------"),c.updateDisplay(),d.updateDisplay()};b.add(x,"eventsDebug").name("Debug event").onChange((function(e){e?((u=b.addFolder("Events")).open(),p.setFromVector3(M()).as("EPSG:4326",m),x.latitude="".concat(m.y.toFixed(6)),x.longitude="".concat(m.x.toFixed(6)),c=u.add(x,"latitude"),d=u.add(x,"longitude"),t.domElement.addEventListener("mousemove",k)):(t.domElement.removeEventListener("mousemove",k),b.removeFolder("Events"))}));var C=new s.CameraHelper(t.camera.camera3D),S=t.camera.camera3D.clone();S.fov*=1.5,S.updateProjectionMatrix();var D=t.mainLoop.gfxEngine,P=D.renderer,O=1e11,A=t.getLayerById("atmosphere");A&&(O=A.fog.distance),C.visible=!1,t.scene.add(C);var T=new a.Z,L=new _o(T,"",new s.Color(uo));function E(t){t.material&&O&&(t.material.fogDistance=O)}L.visible=!1,t.scene.add(T),t.scene.add(L);var R=new s.Color,I=new s.Vector3;function z(){if(x.debugCameraWindow&&S){var e={x:.25*D.width,y:.25*D.height};S.aspect=e.x/e.y;var s=t.camera.camera3D,o=new n.Z(t.referenceCrs,s.position).as(g.extent.crs),a=t.tileLayer.info.displayed.extent;T.setFromExtent(a),L.visible=!0,L.updateMatrixWorld(!0);var r=1.5*o.z;if(o.z=r,o.as(t.referenceCrs).toVector3(S.position),s.worldToLocal(S.position),S.position.z+=r,s.localToWorld(S.position),I.copy(t.camera.camera3D.position),s.worldToLocal(I),I.z-=1.5*r,s.localToWorld(I),S.lookAt(I),C.update(),S.updateProjectionMatrix(),A){A.object3d.visible=!1,O=1e11;var h,l=vo(g.level0Nodes);try{for(l.s();!(h=l.n()).done;)h.value.traverseVisible(E)}catch(t){l.e(t)}finally{l.f()}}var c=x.displayCharts?Math.round(parseFloat(i.style.height.replace("%",""))*D.height/100)+3:0;if(C.visible=!0,C.updateMatrixWorld(!0),P.getClearColor(R),P.setViewport(D.width-e.x,c,e.x,e.y),P.setScissor(D.width-e.x,c,e.x,e.y),P.setScissorTest(!0),P.setClearColor(fo),P.clear(),P.render(t.scene,S),P.setScissorTest(!1),P.setClearColor(R),P.setViewport(0,0,D.width,D.height),C.visible=!1,L.visible=!1,A&&(A.object3d.visible=!0),A){O=A.fog.distance;var d,u=vo(g.level0Nodes);try{for(u.s();!(d=u.n()).done;)d.value.traverseVisible(E)}catch(t){u.e(t)}finally{u.f()}}}}}Mo.prototype.createChartContainer=function(t){var e=document.createElement("div");e.style.cssText="background-color: ".concat(fo,"; flex: auto;"),this.chartDivContainer.appendChild(e);var i=document.createElement("canvas");return i.height="20rem",i.id=t,e.appendChild(i),i},Mo.prototype.updateChartDivSize=function(){var t,e=0,i=vo(this.chartDivContainer.getElementsByTagName("div"));try{for(i.s();!(t=i.n()).done;)"none"!==t.value.style.display&&e++}catch(t){i.e(t)}finally{i.f()}var s,n=Math.floor(100/e),o=vo(this.chartDivContainer.getElementsByTagName("div"));try{for(o.s();!(s=o.n()).done;){var a=s.value;"none"!==a.style.display&&(a.style.width="".concat(n,"%"))}}catch(t){o.e(t)}finally{o.f()}this.charts.forEach((function(t){t.resize(),t.update()}))};const ko=Mo;var Co=i(32204);function So(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}const Do={initTools:function(t,e,i){var s=function(){return t.notifyChange(e,!0)};e.debugUI=i.addFolder("".concat(e.id)),e.debugUI.add(e,"visible").name("Visible").onChange(s),e.debugUI.add(e,"sseThreshold").name("SSE threshold").onChange(s),e.debugUI.add(e,"octreeDepthLimit",-1,20).name("Depth limit").onChange(s),e.debugUI.add(e,"pointBudget",1,15e6).name("Max point count").onChange(s),e.debugUI.add(e.object3d.position,"z",-50,50).name("Z translation").onChange((function(){e.object3d.updateMatrixWorld(),t.notifyChange(e)})),e.dbgStickyNode="",e.dbgDisplaySticky=!1,e.dbgDisplayChildren=!0,e.dbgDisplayParents=!0;var n=e.debugUI.addFolder("Styling");null!=e.material.mode&&(n.add(e.material,"mode",Co.IK).name("Display mode").onChange(s),n.add(e,"maxIntensityRange",0,1).name("Intensity max").onChange(s)),n.add(e,"opacity",0,1).name("Layer Opacity").onChange(s),n.add(e,"pointSize",0,15).name("Point Size").onChange(s),null!=e.material.picking&&n.add(e.material,"picking").name("Display picking id").onChange(s);var o=e.debugUI.addFolder("Debug");o.add(e.bboxes,"visible").name("Display Bounding Boxes").onChange(s),o.add(e,"dbgStickyNode").name("Sticky node name").onChange(s),o.add(e,"dbgDisplaySticky").name("Display sticky node").onChange(s),o.add(e,"dbgDisplayChildren").name("Display children of sticky node").onChange(s),o.add(e,"dbgDisplayParents").name("Display parents of sticky node").onChange(s),t.addFrameRequester("before_layer_update",(function(){if(e.dbgStickyNode.length){e.displayedCount=0;var t,i=e.dbgStickyNode.split(","),s=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return So(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?So(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var s=0,n=function(){};return{s:n,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){r=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(r)throw o}}}}(e.group.children);try{var n=function(){var s=t.value;s.visible=i.some((function(t){return i=t,n=s.owner.name,e.dbgDisplaySticky&&i===n||e.dbgDisplayParents&&i.startsWith(n)||e.dbgDisplayChildren&&n.startsWith(i);var i,n})),s.boxHelper&&(s.boxHelper.visible=s.visible),s.visible&&(e.displayedCount+=s.geometry.attributes.position.count)};for(s.s();!(t=s.n()).done;)n()}catch(t){s.e(t)}finally{s.f()}}}))}};var Po=i(36194),Oo=i(95769),Ao=i(20193),To=i(1857);function Lo(t,e){var i=0,s=Date.now(),n={label:"Update 1st level",data:[{x:0,y:0}],borderColor:co,borderWidth:1.5,pointRadius:1},o={label:"Update duration (ms)",data:[{x:0,y:0}],borderColor:uo,borderWidth:1.5,pointRadius:1},a=["0s"],r=new an(t,{type:"line",data:{labels:a,datasets:[n,o]},options:{animation:{duration:10},scales:lo}});this.update=function(t,h){var l=Math.floor((Date.now()-s)/1e3),c="".concat(l,"s");i>0&&a[i]==c?a.push(""):(a.push(c),i=a.length-1),a.length>60&&(a.shift(),i--),n.data.push({x:0,y:e._latestUpdateStartingLevel}),o.data.push({x:0,y:h}),n.data.length>60&&(n.data.shift(),o.data.shift()),t&&r.update()},this.resize=function(){r.resize()}}function Eo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}function Ro(t,e){var i=[],s=[],n=[],o=new an(t,{type:"bar",data:{labels:i,datasets:[{label:"Visible node per level",data:s,backgroundColor:co},{label:"Diplayed node per level",data:n,backgroundColor:uo}]},options:{scales:lo}});this.update=function(t){var a={};for(var r in function t(i,s){if(i&&i.visible&&(i.level>=0&&i.layer===e&&(s[i.level]?s[i.level][0]+=1:s[i.level]=[1,0],i.material.visible&&(s[i.level][1]+=1)),i.children)){var n,o=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Eo(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Eo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var s=0,n=function(){};return{s:n,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){r=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(r)throw o}}}}(i.children);try{for(o.s();!(n=o.n()).done;)t(n.value,s)}catch(t){o.e(t)}finally{o.f()}}}(e.object3d,a),i.length=0,s.length=0,a)({}).hasOwnProperty.call(a,r)&&(i[r]="".concat(r),s[r]=a[r][0],n[r]=a[r][1]);t&&o.update()},this.resize=function(){o.resize()}}function Io(t,e,i){t.defineLayerProperty(e,i,(function(){(t.parent?t.parent.object3d:t.object3d).traverse((function(i){i.layer==t&&i.material?i.material[e]=t[e]:i.content&&i.content.layer==t&&i.content.traverse((function(i){i.material&&(i.material[e]=t[e])}))}))}))}const zo={addWireFrameCheckbox:function(t,e,i){t.add(i,"wireframe").name("Wireframe").onChange((function(){return e.notifyChange(i)}))},addMaterialSize:function(t,e,i,s,n){Io(i,"size",1),t.add(i,"size",s,n).name("Size").onChange((function(){return e.notifyChange(i)}))},addMaterialLineWidth:function(t,e,i,s,n){Io(i,"linewidth",1),t.add(i,"linewidth",s,n).name("Line Width").onChange((function(){return e.notifyChange(i)}))},createGeometryDebugUI:function(t,e,i){var s=t.addFolder("Layer ".concat(i.id));return s.add(i,"visible").name("Visible").onChange((function(){return e.notifyChange(i)})),s.add(i,"opacity",0,1).name("Opacity").onChange((function(){return e.notifyChange(i)})),s}};function Fo(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Vo(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Vo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var s=0,n=function(){};return{s:n,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){r=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(r)throw o}}}}function Vo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=new Array(e);i<e;i++)s[i]=t[i];return s}function Bo(t,e,i,s){e.traverse((function(t){t.material&&t.layer===i&&s(t.material)})),t.notifyChange()}var jo;function Wo(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];jo&&(jo.material.overlayAlpha=0,jo.material.showOutline=t.tileLayer.showOutline,t.notifyChange(jo));var s=t.tileLayer.pickObjectsAt(t,e);return(jo=s.length?s[0].object:void 0)&&(i&&console.info(jo),jo.material.overlayAlpha=.5,jo.material.showOutline=!0,t.notifyChange(jo)),jo}function No(t,e,i,n){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e.isDebugMode||a){n=n||new ko(e,t),i=i||e.tileLayer;var r=zo.createGeometryDebugUI(t,e,i),h="".concat(i.id,"-nb-objects"),l=n.createChartContainer(h),c="".concat(i.id,"-nb-visible"),d=n.createChartContainer(c);n.charts.push(new Lo(l.getContext("2d"),i)),n.charts.push(new Ro(d.getContext("2d"),i)),i.showOutline=!1,i.wireframe=!1;var u={objectChart:!0,visibilityChart:!0,sseHelper:!1};r.add(i,"showOutline").name("Show tiles").onChange((function(t){i.showOutline=t,Bo(e,i.object3d,i,(function(e){e.showOutline=t}))})),r.add(i,"wireframe").name("Wireframe").onChange((function(){e.notifyChange(i)})),r.add(u,"objectChart").name("Object chart").onChange((function(t){document.getElementById(h).parentNode.style.display=t?"block":"none",n.updateChartDivSize(),n.charts.forEach((function(t){return t.update()}))})),r.add(u,"visibilityChart").name("Visibility chart").onChange((function(t){document.getElementById(c).parentNode.style.display=t?"block":"none",n.updateChartDivSize(),n.charts.forEach((function(t){return t.update()}))}));var f="".concat(i.id,"_obb_debug"),g="".concat(i.id,"_sb_debug"),p=new s.SphereGeometry(1,16,16),m=new Ao.Z(f,new s.Object3D,{update:C,visible:!1,cacheLifeTime:1/0,source:!1});Oo.Z.prototype.addLayer.call(e,m,i).then((function(t){r.add(t,"visible").name("Bounding boxes").onChange((function(){e.notifyChange(t)}))}));var b=new Ao.Z(g,new s.Object3D,{update:C,visible:!1,cacheLifeTime:1/0,source:!1});Oo.Z.prototype.addLayer.call(e,b,i).then((function(t){r.add(t,"visible").name("Bounding Spheres").onChange((function(){e.notifyChange(t)}))}));var x=document.getElementById("viewerDiv"),y=document.createElement("span");y.className="circleBase",x.appendChild(y);var _,v=new s.Vector3,w=function(){Po.ZP.update(),e.notifyChange()},M=function(){Po.ZP.removeAll(),e._frameRequesters[o.Ao.BEFORE_RENDER].includes(w)&&e.removeFrameRequester(o.Ao.BEFORE_RENDER,w)};r.add(u,"sseHelper").name("Sse helper").onChange((function(t){t?window.addEventListener("mousemove",S,!1):(y.style.display="none",M(),window.removeEventListener("mousemove",S))}));var k=null;window.addEventListener("mousedown",(function(t){83==k&&Wo(e,t)})),window.addEventListener("keydown",(function(t){k=t.which})),window.addEventListener("keyup",(function(){k=null}))}function C(t,e,i){var n=t.camera.camera3D.layers.test({mask:1<<e.threejsLayer});if(i.parent&&n){var o=i.children.filter((function(t){return t.layer&&t.layer.id==e.id}))[0];if(i.material&&i.material.visible){if(!o){var a=t.view.getLayerById(e.id).threejsLayer;if(e.id==f)(o=new _o(i.obb)).children[0]&&o.children[0].layers.set(a);else if(e.id==g){var r=new s.Color(Math.random(),Math.random(),Math.random()),h=new s.MeshBasicMaterial({color:r.getHex(),wireframe:!0});(o=new s.Mesh(p,h)).position.copy(i.boundingSphere.center),o.scale.multiplyScalar(i.boundingSphere.radius)}o.layers.set(a),o.layer=e,i.add(o),o.updateMatrixWorld(!0);var l=i.material.addEventListener("hidden",(function(){i.material.removeEventListener(l);for(var t=i.children.length;t--;){var e=i.children[t];if(e.layer===g){if(e.dispose)e.dispose();else if(Array.isArray(e.material)){var s,n=Fo(e.material);try{for(n.s();!(s=n.n()).done;)s.value.dispose()}catch(t){n.e(t)}finally{n.f()}}else e.material.dispose();i.children.splice(t,1)}}}))}e.id==g&&(o.position.copy(i.boundingSphere.center),o.scale.set(1,1,1).multiplyScalar(i.boundingSphere.radius)),o.updateMatrixWorld(!0),o.visible=!0}else o&&(o.visible=!1)}else To.Z.removeChildrenAndCleanupRecursively(e,i)}function S(t){var i=Wo(e,t,!1);if(i){y.style.display="table-cell",v.copy(i.boundingSphere.center).applyMatrix4(i.matrixWorld);var s=v.project(e.camera.camera3D),n=e.normalizedToViewCoords(s),a=i.screenSize;if(_!=i){var r=Number(y.style.width.replace("px",""));_=i,M(),new Po.ZP.Tween({size:r}).to({size:a},500).easing(Po.ZP.Easing.Sinusoidal.In).easing(Po.ZP.Easing.Exponential.Out).onUpdate((function(t){y.style["line-height"]="".concat(t.size,"px"),y.style.width="".concat(t.size,"px"),y.style.height="".concat(t.size,"px"),y.innerHTML="".concat(Math.floor(t.size)," px"),y.style.left="".concat(n.x-.5*t.size,"px"),y.style.top="".concat(n.y-.5*t.size,"px")})).onComplete(M).start(),e.addFrameRequester(o.Ao.BEFORE_RENDER,w)}}else y.style.display="none"}}var Ho=new s.Mesh;function $o(t,e,i){var n=zo.createGeometryDebugUI(t,e,i),o=new s.Group;e.scene.add(o),zo.addWireFrameCheckbox(n,e,i);var a="".concat(i.id,"_obb_debug"),r=new Ao.Z(a,new s.Object3D,{update:function(t,e,n){if(t.camera.camera3D.layers.test({mask:1<<e.threejsLayer})){var a=n.userData.metadata,r=n.userData.obb;if(n.visible&&a.boundingVolume){if(!r){if(a.boundingVolume.region)r=new _o(a.boundingVolume.region,"id:".concat(n.id)),o.add(r),r.updateMatrixWorld(!0);else if(a.boundingVolume.box)Ho.geometry.boundingBox=a.boundingVolume.box,(r=new s.BoxHelper(Ho)).material.linewidth=2;else if(a.boundingVolume.sphere){var h=new s.SphereGeometry(a.boundingVolume.sphere.radius,32,32),l=new s.MeshBasicMaterial({wireframe:!0});(r=new s.Mesh(h,l)).position.copy(a.boundingVolume.sphere.center)}if(r){r.layer=e;var c=e.threejsLayer;r.layers.set(c),r.children.length&&r.children[0].layers.set(c),n.userData.obb=r,r.updateMatrixWorld()}if(r&&!a.boundingVolume.region){var d=i.tileset.asset.gltfUpAxis;void 0===d||"Y"===d?r.rotation.x=.5*-Math.PI:"X"===d&&(r.rotation.z=.5*-Math.PI),n.parent.add(r),r.updateMatrix(),r.updateMatrixWorld(!0)}}r&&(r.visible=!0,"function"==typeof r.setMaterialVisibility&&r.setMaterialVisibility(!0))}else r&&(r.visible=!1,"function"==typeof r.setMaterialVisibility&&r.setMaterialVisibility(!1))}},visible:!1,cacheLifeTime:1/0,source:!1});Oo.Z.prototype.addLayer.call(e,r,i).then((function(t){n.add(t,"visible").name("Bounding boxes").onChange((function(){e.notifyChange(e.camera.camera3D)}))})),n.add(i,"sseThreshold",0,100).name("sseThreshold").onChange((function(){e.notifyChange(e.camera.camera3D)}))}}},t=>(75807,t(t.s=75807))])}));
|
|
3
3
|
//# sourceMappingURL=debug.js.map
|