itowns 2.45.1-next.0 → 2.45.1-next.1

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.
Files changed (185) hide show
  1. package/dist/455.js +2 -0
  2. package/dist/455.js.map +1 -0
  3. package/dist/debug.js +3 -0
  4. package/dist/debug.js.LICENSE.txt +13 -0
  5. package/dist/debug.js.map +1 -0
  6. package/dist/itowns.js +3 -0
  7. package/dist/itowns.js.LICENSE.txt +5 -0
  8. package/dist/itowns.js.map +1 -0
  9. package/dist/itowns_lasparser.js +2 -0
  10. package/dist/itowns_lasparser.js.map +1 -0
  11. package/dist/itowns_lasworker.js +2 -0
  12. package/dist/itowns_lasworker.js.map +1 -0
  13. package/dist/itowns_potree2worker.js +2 -0
  14. package/dist/itowns_potree2worker.js.map +1 -0
  15. package/dist/itowns_widgets.js +2 -0
  16. package/dist/itowns_widgets.js.map +1 -0
  17. package/lib/Controls/FirstPersonControls.js +308 -0
  18. package/lib/Controls/FlyControls.js +175 -0
  19. package/lib/Controls/GlobeControls.js +1178 -0
  20. package/lib/Controls/PlanarControls.js +1025 -0
  21. package/lib/Controls/StateControl.js +432 -0
  22. package/lib/Controls/StreetControls.js +392 -0
  23. package/lib/Converter/Feature2Mesh.js +612 -0
  24. package/lib/Converter/Feature2Texture.js +174 -0
  25. package/lib/Converter/convertToTile.js +70 -0
  26. package/lib/Converter/textureConverter.js +43 -0
  27. package/lib/Core/3DTiles/C3DTBatchTable.js +131 -0
  28. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +96 -0
  29. package/lib/Core/3DTiles/C3DTBoundingVolume.js +156 -0
  30. package/lib/Core/3DTiles/C3DTExtensions.js +97 -0
  31. package/lib/Core/3DTiles/C3DTFeature.js +110 -0
  32. package/lib/Core/3DTiles/C3DTilesEnums.js +20 -0
  33. package/lib/Core/3DTiles/C3DTileset.js +99 -0
  34. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +100 -0
  35. package/lib/Core/AnimationPlayer.js +142 -0
  36. package/lib/Core/CopcNode.js +174 -0
  37. package/lib/Core/Deprecated/Undeprecator.js +74 -0
  38. package/lib/Core/EntwinePointTileNode.js +126 -0
  39. package/lib/Core/Feature.js +488 -0
  40. package/lib/Core/Geographic/GeoidGrid.js +108 -0
  41. package/lib/Core/Label.js +222 -0
  42. package/lib/Core/MainLoop.js +209 -0
  43. package/lib/Core/Picking.js +255 -0
  44. package/lib/Core/PointCloudNode.js +42 -0
  45. package/lib/Core/Potree2Node.js +206 -0
  46. package/lib/Core/Potree2PointAttributes.js +139 -0
  47. package/lib/Core/PotreeNode.js +101 -0
  48. package/lib/Core/Prefab/Globe/Atmosphere.js +293 -0
  49. package/lib/Core/Prefab/Globe/GlobeLayer.js +152 -0
  50. package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +110 -0
  51. package/lib/Core/Prefab/Globe/SkyShader.js +78 -0
  52. package/lib/Core/Prefab/GlobeView.js +155 -0
  53. package/lib/Core/Prefab/Planar/PlanarLayer.js +59 -0
  54. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +71 -0
  55. package/lib/Core/Prefab/PlanarView.js +62 -0
  56. package/lib/Core/Prefab/TileBuilder.js +82 -0
  57. package/lib/Core/Prefab/computeBufferTileGeometry.js +248 -0
  58. package/lib/Core/Scheduler/Cache.js +17 -0
  59. package/lib/Core/Scheduler/CancelledCommandException.js +15 -0
  60. package/lib/Core/Scheduler/Scheduler.js +294 -0
  61. package/lib/Core/Style.js +660 -0
  62. package/lib/Core/StyleOptions.js +486 -0
  63. package/lib/Core/System/Capabilities.js +63 -0
  64. package/lib/Core/Tile/Tile.js +205 -0
  65. package/lib/Core/Tile/TileGrid.js +49 -0
  66. package/lib/Core/TileGeometry.js +124 -0
  67. package/lib/Core/TileMesh.js +108 -0
  68. package/lib/Core/View.js +1115 -0
  69. package/lib/Layer/C3DTilesLayer.js +459 -0
  70. package/lib/Layer/ColorLayer.js +154 -0
  71. package/lib/Layer/CopcLayer.js +63 -0
  72. package/lib/Layer/ElevationLayer.js +139 -0
  73. package/lib/Layer/EntwinePointTileLayer.js +71 -0
  74. package/lib/Layer/FeatureGeometryLayer.js +77 -0
  75. package/lib/Layer/GeoidLayer.js +80 -0
  76. package/lib/Layer/GeometryLayer.js +233 -0
  77. package/lib/Layer/InfoLayer.js +64 -0
  78. package/lib/Layer/LabelLayer.js +469 -0
  79. package/lib/Layer/Layer.js +335 -0
  80. package/lib/Layer/LayerUpdateState.js +89 -0
  81. package/lib/Layer/LayerUpdateStrategy.js +80 -0
  82. package/lib/Layer/OGC3DTilesLayer.js +543 -0
  83. package/lib/Layer/OrientedImageLayer.js +227 -0
  84. package/lib/Layer/PointCloudLayer.js +405 -0
  85. package/lib/Layer/Potree2Layer.js +171 -0
  86. package/lib/Layer/PotreeLayer.js +72 -0
  87. package/lib/Layer/RasterLayer.js +37 -0
  88. package/lib/Layer/ReferencingLayerProperties.js +62 -0
  89. package/lib/Layer/TiledGeometryLayer.js +459 -0
  90. package/lib/Loader/LASLoader.js +193 -0
  91. package/lib/Loader/Potree2BrotliLoader.js +261 -0
  92. package/lib/Loader/Potree2Loader.js +207 -0
  93. package/lib/Main.js +113 -0
  94. package/lib/MainBundle.js +4 -0
  95. package/lib/Parser/B3dmParser.js +174 -0
  96. package/lib/Parser/CameraCalibrationParser.js +94 -0
  97. package/lib/Parser/GDFParser.js +72 -0
  98. package/lib/Parser/GTXParser.js +75 -0
  99. package/lib/Parser/GeoJsonParser.js +212 -0
  100. package/lib/Parser/GpxParser.js +25 -0
  101. package/lib/Parser/ISGParser.js +71 -0
  102. package/lib/Parser/KMLParser.js +25 -0
  103. package/lib/Parser/LASParser.js +137 -0
  104. package/lib/Parser/MapBoxUrlParser.js +83 -0
  105. package/lib/Parser/PntsParser.js +131 -0
  106. package/lib/Parser/Potree2BinParser.js +92 -0
  107. package/lib/Parser/PotreeBinParser.js +106 -0
  108. package/lib/Parser/PotreeCinParser.js +29 -0
  109. package/lib/Parser/ShapefileParser.js +78 -0
  110. package/lib/Parser/VectorTileParser.js +215 -0
  111. package/lib/Parser/XbilParser.js +120 -0
  112. package/lib/Parser/deprecated/LegacyGLTFLoader.js +1386 -0
  113. package/lib/Parser/iGLTFLoader.js +168 -0
  114. package/lib/Process/3dTilesProcessing.js +304 -0
  115. package/lib/Process/FeatureProcessing.js +76 -0
  116. package/lib/Process/LayeredMaterialNodeProcessing.js +229 -0
  117. package/lib/Process/ObjectRemovalHelper.js +97 -0
  118. package/lib/Process/handlerNodeError.js +23 -0
  119. package/lib/Provider/3dTilesProvider.js +149 -0
  120. package/lib/Provider/DataSourceProvider.js +24 -0
  121. package/lib/Provider/Fetcher.js +233 -0
  122. package/lib/Provider/PointCloudProvider.js +45 -0
  123. package/lib/Provider/TileProvider.js +16 -0
  124. package/lib/Provider/URLBuilder.js +116 -0
  125. package/lib/Renderer/Camera.js +281 -0
  126. package/lib/Renderer/Color.js +56 -0
  127. package/lib/Renderer/ColorLayersOrdering.js +115 -0
  128. package/lib/Renderer/CommonMaterial.js +31 -0
  129. package/lib/Renderer/Label2DRenderer.js +192 -0
  130. package/lib/Renderer/LayeredMaterial.js +243 -0
  131. package/lib/Renderer/OBB.js +150 -0
  132. package/lib/Renderer/OrientedImageCamera.js +118 -0
  133. package/lib/Renderer/OrientedImageMaterial.js +167 -0
  134. package/lib/Renderer/PointsMaterial.js +485 -0
  135. package/lib/Renderer/RasterTile.js +243 -0
  136. package/lib/Renderer/RenderMode.js +31 -0
  137. package/lib/Renderer/Shader/ShaderChunk.js +160 -0
  138. package/lib/Renderer/Shader/ShaderUtils.js +47 -0
  139. package/lib/Renderer/SphereHelper.js +17 -0
  140. package/lib/Renderer/WebXR.js +51 -0
  141. package/lib/Renderer/c3DEngine.js +214 -0
  142. package/lib/Source/C3DTilesGoogleSource.js +74 -0
  143. package/lib/Source/C3DTilesIonSource.js +54 -0
  144. package/lib/Source/C3DTilesSource.js +30 -0
  145. package/lib/Source/CopcSource.js +126 -0
  146. package/lib/Source/EntwinePointTileSource.js +72 -0
  147. package/lib/Source/FileSource.js +188 -0
  148. package/lib/Source/OGC3DTilesGoogleSource.js +29 -0
  149. package/lib/Source/OGC3DTilesIonSource.js +34 -0
  150. package/lib/Source/OGC3DTilesSource.js +21 -0
  151. package/lib/Source/OrientedImageSource.js +59 -0
  152. package/lib/Source/Potree2Source.js +167 -0
  153. package/lib/Source/PotreeSource.js +82 -0
  154. package/lib/Source/Source.js +202 -0
  155. package/lib/Source/TMSSource.js +144 -0
  156. package/lib/Source/VectorTilesSource.js +182 -0
  157. package/lib/Source/WFSSource.js +170 -0
  158. package/lib/Source/WMSSource.js +167 -0
  159. package/lib/Source/WMTSSource.js +92 -0
  160. package/lib/ThreeExtended/capabilities/WebGL.js +69 -0
  161. package/lib/ThreeExtended/libs/ktx-parse.module.js +506 -0
  162. package/lib/ThreeExtended/libs/zstddec.module.js +29 -0
  163. package/lib/ThreeExtended/loaders/DDSLoader.js +200 -0
  164. package/lib/ThreeExtended/loaders/DRACOLoader.js +400 -0
  165. package/lib/ThreeExtended/loaders/GLTFLoader.js +2879 -0
  166. package/lib/ThreeExtended/loaders/KTX2Loader.js +709 -0
  167. package/lib/ThreeExtended/math/ColorSpaces.js +59 -0
  168. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +846 -0
  169. package/lib/ThreeExtended/utils/WorkerPool.js +70 -0
  170. package/lib/Utils/CameraUtils.js +554 -0
  171. package/lib/Utils/DEMUtils.js +350 -0
  172. package/lib/Utils/FeaturesUtils.js +156 -0
  173. package/lib/Utils/Gradients.js +16 -0
  174. package/lib/Utils/ThreeUtils.js +115 -0
  175. package/lib/Utils/gui/C3DTilesStyle.js +218 -0
  176. package/lib/Utils/gui/Main.js +7 -0
  177. package/lib/Utils/gui/Minimap.js +152 -0
  178. package/lib/Utils/gui/Navigation.js +245 -0
  179. package/lib/Utils/gui/Scale.js +104 -0
  180. package/lib/Utils/gui/Searchbar.js +234 -0
  181. package/lib/Utils/gui/Widget.js +80 -0
  182. package/lib/Utils/placeObjectOnGround.js +136 -0
  183. package/lib/Worker/LASLoaderWorker.js +19 -0
  184. package/lib/Worker/Potree2Worker.js +21 -0
  185. package/package.json +2 -2
package/dist/debug.js ADDED
@@ -0,0 +1,3 @@
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,(()=>(self.webpackChunk=self.webpackChunk||[]).push([[40],{38171:(t,e,i)=>{i.r(e),i.d(e,{Debug:()=>Ms,GeometryDebug:()=>Is,GuiTools:()=>ma,PointCloudDebug:()=>Os,create3dTilesDebugUI:()=>Vs,createOGC3DTilesDebugUI:()=>ro,createTileDebugUI:()=>Fs});var n=i(39437),s=i(80353),o=i(30458);function a(t){return t+.5|0}const r=(t,e,i)=>Math.max(Math.min(t,i),e);function l(t){return r(a(2.55*t),0,255)}function h(t){return r(a(255*t),0,255)}function c(t){return r(a(t/2.55)/100,0,1)}function d(t){return r(a(100*t),0,100)}const u={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},p=[..."0123456789ABCDEF"],f=t=>p[15&t],g=t=>p[(240&t)>>4]+p[15&t],m=t=>(240&t)>>4==(15&t);const _=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function b(t,e,i){const n=e*Math.min(i,1-i),s=(e,s=(e+t/30)%12)=>i-n*Math.max(Math.min(s-3,9-s,1),-1);return[s(0),s(8),s(4)]}function y(t,e,i){const n=(n,s=(n+t/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[n(5),n(3),n(1)]}function x(t,e,i){const n=b(t,1,.5);let s;for(e+i>1&&(s=1/(e+i),e*=s,i*=s),s=0;s<3;s++)n[s]*=1-e-i,n[s]+=e;return n}function v(t){const e=t.r/255,i=t.g/255,n=t.b/255,s=Math.max(e,i,n),o=Math.min(e,i,n),a=(s+o)/2;let r,l,h;return s!==o&&(h=s-o,l=a>.5?h/(2-s-o):h/(s+o),r=function(t,e,i,n,s){return t===s?(e-i)/n+(e<i?6:0):e===s?(i-t)/n+2:(t-e)/n+4}(e,i,n,h,s),r=60*r+.5),[0|r,l||0,a]}function w(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(h)}function C(t,e,i){return w(b,t,e,i)}function k(t){return(t%360+360)%360}const M={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"},S={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let E;const A=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,D=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,O=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function L(t,e,i){if(t){let n=v(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=C(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function T(t,e){return t?Object.assign(e||{},t):t}function R(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=h(t[3]))):(e=T(t,{r:0,g:0,b:0,a:1})).a=h(e.a),e}function P(t){return"r"===t.charAt(0)?function(t){const e=A.exec(t);let i,n,s,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?l(t):r(255*t,0,255)}return i=+e[1],n=+e[3],s=+e[5],i=255&(e[2]?l(i):r(i,0,255)),n=255&(e[4]?l(n):r(n,0,255)),s=255&(e[6]?l(s):r(s,0,255)),{r:i,g:n,b:s,a:o}}}(t):function(t){const e=_.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?l(+e[5]):h(+e[5]));const s=k(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return w(x,t,e,i)}(s,o,a):"hsv"===e[1]?function(t,e,i){return w(y,t,e,i)}(s,o,a):C(s,o,a),{r:i[0],g:i[1],b:i[2],a:n}}(t)}class I{constructor(t){if(t instanceof I)return t;const e=typeof t;let i;var n,s,o;"object"===e?i=R(t):"string"===e&&(o=(n=t).length,"#"===n[0]&&(4===o||5===o?s={r:255&17*u[n[1]],g:255&17*u[n[2]],b:255&17*u[n[3]],a:5===o?17*u[n[4]]:255}:7!==o&&9!==o||(s={r:u[n[1]]<<4|u[n[2]],g:u[n[3]]<<4|u[n[4]],b:u[n[5]]<<4|u[n[6]],a:9===o?u[n[7]]<<4|u[n[8]]:255})),i=s||function(t){E||(E=function(){const t={},e=Object.keys(S),i=Object.keys(M);let n,s,o,a,r;for(n=0;n<e.length;n++){for(a=r=e[n],s=0;s<i.length;s++)o=i[s],r=r.replace(o,M[o]);o=parseInt(S[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),E.transparent=[0,0,0,0]);const e=E[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||P(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=T(this._rgb);return t&&(t.a=c(t.a)),t}set rgb(t){this._rgb=R(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${c(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?(t=this._rgb,e=(t=>m(t.r)&&m(t.g)&&m(t.b)&&m(t.a))(t)?f:g,t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0):void 0;var t,e}hslString(){return this._valid?function(t){if(!t)return;const e=v(t),i=e[0],n=d(e[1]),s=d(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${s}%, ${c(t.a)})`:`hsl(${i}, ${n}%, ${s}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let s;const o=e===s?.5:e,a=2*o-1,r=i.a-n.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;s=1-l,i.r=255&l*i.r+s*n.r+.5,i.g=255&l*i.g+s*n.g+.5,i.b=255&l*i.b+s*n.b+.5,i.a=o*i.a+(1-o)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=O(c(t.r)),s=O(c(t.g)),o=O(c(t.b));return{r:h(D(n+i*(O(c(e.r))-n))),g:h(D(s+i*(O(c(e.g))-s))),b:h(D(o+i*(O(c(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new I(this.rgb)}alpha(t){return this._rgb.a=h(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=a(.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 L(this._rgb,2,t),this}darken(t){return L(this._rgb,2,-t),this}saturate(t){return L(this._rgb,1,t),this}desaturate(t){return L(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=v(t);i[0]=k(i[0]+e),i=C(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}const z=(()=>{let t=0;return()=>t++})();function B(t){return null==t}function F(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function N(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function V(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function H(t,e){return V(t)?t:e}function j(t,e){return void 0===t?e:t}function U(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function G(t,e,i,n){let s,o,a;if(F(t))if(o=t.length,n)for(s=o-1;s>=0;s--)e.call(i,t[s],s);else for(s=0;s<o;s++)e.call(i,t[s],s);else if(N(t))for(a=Object.keys(t),o=a.length,s=0;s<o;s++)e.call(i,t[a[s]],a[s])}function W(t,e){let i,n,s,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(s=t[i],o=e[i],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function $(t){if(F(t))return t.map($);if(N(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let s=0;for(;s<n;++s)e[i[s]]=$(t[i[s]]);return e}return t}function Y(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function X(t,e,i,n){if(!Y(t))return;const s=e[t],o=i[t];N(s)&&N(o)?q(s,o,n):e[t]=$(o)}function q(t,e,i){const n=F(e)?e:[e],s=n.length;if(!N(t))return t;const o=(i=i||{}).merger||X;let a;for(let e=0;e<s;++e){if(a=n[e],!N(a))continue;const s=Object.keys(a);for(let e=0,n=s.length;e<n;++e)o(s[e],t,a,i)}return t}function K(t,e){return q(t,e,{merger:Q})}function Q(t,e,i){if(!Y(t))return;const n=e[t],s=i[t];N(n)&&N(s)?K(n,s):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=$(s))}const J={"":t=>t,x:t=>t.x,y:t=>t.y};function Z(t,e){const i=J[e]||(J[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function tt(t){return t.charAt(0).toUpperCase()+t.slice(1)}const et=t=>void 0!==t,it=t=>"function"==typeof t,nt=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},st=Math.PI,ot=2*st,at=ot+st,rt=Number.POSITIVE_INFINITY,lt=st/180,ht=st/2,ct=st/4,dt=2*st/3,ut=Math.log10,pt=Math.sign;function ft(t,e,i){return Math.abs(t-e)<i}function gt(t){const e=Math.round(t);t=ft(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(ut(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function mt(t){return!isNaN(parseFloat(t))&&isFinite(t)}function _t(t){return t*(st/180)}function bt(t){if(!V(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function yt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xt(t,e){return(t-e+at)%ot-st}function vt(t){return(t%ot+ot)%ot}function wt(t,e,i,n){const s=vt(t),o=vt(e),a=vt(i),r=vt(o-s),l=vt(a-s),h=vt(s-o),c=vt(s-a);return s===o||s===a||n&&o===a||r>l&&h<c}function Ct(t,e,i){return Math.max(e,Math.min(i,t))}function kt(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function Mt(t,e,i){i=i||(i=>t[i]<e);let n,s=t.length-1,o=0;for(;s-o>1;)n=o+s>>1,i(n)?o=n:s=n;return{lo:o,hi:s}}const St=(t,e,i,n)=>Mt(t,i,n?n=>{const s=t[n][e];return s<i||s===i&&t[n+1][e]===i}:n=>t[n][e]<i),Et=(t,e,i)=>Mt(t,i,(n=>t[n][e]>=i)),At=["push","pop","shift","splice","unshift"];function Dt(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,s=n.indexOf(e);-1!==s&&n.splice(s,1),n.length>0||(At.forEach((e=>{delete t[e]})),delete t._chartjs)}const Ot="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Lt(t,e){let i=[],n=!1;return function(...s){i=s,n||(n=!0,Ot.call(window,(()=>{n=!1,t.apply(e,i)})))}}const Tt=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;const Rt=t=>0===t||1===t,Pt=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*ot/i),It=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*ot/i)+1,zt={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*ht),easeOutSine:t=>Math.sin(t*ht),easeInOutSine:t=>-.5*(Math.cos(st*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=>Rt(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=>Rt(t)?t:Pt(t,.075,.3),easeOutElastic:t=>Rt(t)?t:It(t,.075,.3),easeInOutElastic(t){const e=.1125;return Rt(t)?t:t<.5?.5*Pt(2*t,e,.45):.5+.5*It(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-zt.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*zt.easeInBounce(2*t):.5*zt.easeOutBounce(2*t-1)+.5};function Bt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Ft(t){return Bt(t)?t:new I(t)}function Nt(t){return Bt(t)?t:new I(t).saturate(.5).darken(.1).hexString()}const Vt=["x","y","borderWidth","radius","tension"],Ht=["color","borderColor","backgroundColor"],jt=new Map;function Ut(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=jt.get(i);return n||(n=new Intl.NumberFormat(t,e),jt.set(i,n)),n}(e,i).format(t)}const Gt={values:t=>F(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let s,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)&&(s="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=ut(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ut(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(ut(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?Gt.numeric.call(this,t,e,i):""}};var Wt={formatters:Gt};const $t=Object.create(null),Yt=Object.create(null);function Xt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function qt(t,e,i){return"string"==typeof e?q(Xt(t,e),i):q(Xt(t,""),e)}class Kt{constructor(t,e){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)=>Nt(e.backgroundColor),this.hoverBorderColor=(t,e)=>Nt(e.borderColor),this.hoverColor=(t,e)=>Nt(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return qt(this,t,e)}get(t){return Xt(this,t)}describe(t,e){return qt(Yt,t,e)}override(t,e){return qt($t,t,e)}route(t,e,i,n){const s=Xt(this,t),o=Xt(this,i),a="_"+e;Object.defineProperties(s,{[a]:{value:s[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[n];return N(t)?Object.assign({},e,t):j(t,e)},set(t){this[a]=t}}})}apply(t){t.forEach((t=>t(this)))}}var Qt=new Kt({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:Ht},numbers:{type:"number",properties:Vt}}),t.describe("animations",{_fallback:"animation"}),t.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}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Wt.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function Jt(t,e,i,n,s){let o=e[s];return o||(o=e[s]=t.measureText(s).width,i.push(s)),o>n&&(n=o),n}function Zt(t,e,i){const n=t.currentDevicePixelRatio,s=0!==i?Math.max(i/2,.5):0;return Math.round((e-s)*n)/n+s}function te(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function ee(t,e,i,n){!function(t,e,i,n,s){let o,a,r,l,h,c,d,u;const p=e.pointStyle,f=e.rotation,g=e.radius;let m=(f||0)*lt;if(p&&"object"==typeof p&&(o=p.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,n),t.rotate(m),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(g)||g<=0)){switch(t.beginPath(),p){default:s?t.ellipse(i,n,s/2,g,0,0,ot):t.arc(i,n,g,0,ot),t.closePath();break;case"triangle":c=s?s/2:g,t.moveTo(i+Math.sin(m)*c,n-Math.cos(m)*g),m+=dt,t.lineTo(i+Math.sin(m)*c,n-Math.cos(m)*g),m+=dt,t.lineTo(i+Math.sin(m)*c,n-Math.cos(m)*g),t.closePath();break;case"rectRounded":h=.516*g,l=g-h,a=Math.cos(m+ct)*l,d=Math.cos(m+ct)*(s?s/2-h:l),r=Math.sin(m+ct)*l,u=Math.sin(m+ct)*(s?s/2-h:l),t.arc(i-d,n-r,h,m-st,m-ht),t.arc(i+u,n-a,h,m-ht,m),t.arc(i+d,n+r,h,m,m+ht),t.arc(i-u,n+a,h,m+ht,m+st),t.closePath();break;case"rect":if(!f){l=Math.SQRT1_2*g,c=s?s/2:l,t.rect(i-c,n-l,2*c,2*l);break}m+=ct;case"rectRot":d=Math.cos(m)*(s?s/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(s?s/2:g),t.moveTo(i-d,n-r),t.lineTo(i+u,n-a),t.lineTo(i+d,n+r),t.lineTo(i-u,n+a),t.closePath();break;case"crossRot":m+=ct;case"cross":d=Math.cos(m)*(s?s/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(s?s/2:g),t.moveTo(i-d,n-r),t.lineTo(i+d,n+r),t.moveTo(i+u,n-a),t.lineTo(i-u,n+a);break;case"star":d=Math.cos(m)*(s?s/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(s?s/2:g),t.moveTo(i-d,n-r),t.lineTo(i+d,n+r),t.moveTo(i+u,n-a),t.lineTo(i-u,n+a),m+=ct,d=Math.cos(m)*(s?s/2:g),a=Math.cos(m)*g,r=Math.sin(m)*g,u=Math.sin(m)*(s?s/2:g),t.moveTo(i-d,n-r),t.lineTo(i+d,n+r),t.moveTo(i+u,n-a),t.lineTo(i-u,n+a);break;case"line":a=s?s/2:Math.cos(m)*g,r=Math.sin(m)*g,t.moveTo(i-a,n-r),t.lineTo(i+a,n+r);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(m)*(s?s/2:g),n+Math.sin(m)*g);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}(t,e,i,n,null)}function ie(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 ne(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function se(t){t.restore()}function oe(t,e,i,n,s){if(!e)return t.lineTo(i.x,i.y);if("middle"===s){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===s!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function ae(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function re(t,e,i,n,s){if(s.strikethrough||s.underline){const o=t.measureText(n),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,h=i+o.actualBoundingBoxDescent,c=s.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=s.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function le(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function he(t,e,i,n,s,o={}){const a=F(e)?e:[e],r=o.strokeWidth>0&&""!==o.strokeColor;let l,h;for(t.save(),t.font=s.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),B(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),l=0;l<a.length;++l)h=a[l],o.backdrop&&le(t,o.backdrop),r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),B(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(h,i,n,o.maxWidth)),t.fillText(h,i,n,o.maxWidth),re(t,i,n,h,o),n+=Number(s.lineHeight);t.restore()}function ce(t,e){const{x:i,y:n,w:s,h:o,radius:a}=e;t.arc(i+a.topLeft,n+a.topLeft,a.topLeft,1.5*st,st,!0),t.lineTo(i,n+o-a.bottomLeft),t.arc(i+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,st,ht,!0),t.lineTo(i+s-a.bottomRight,n+o),t.arc(i+s-a.bottomRight,n+o-a.bottomRight,a.bottomRight,ht,0,!0),t.lineTo(i+s,n+a.topRight),t.arc(i+s-a.topRight,n+a.topRight,a.topRight,0,-ht,!0),t.lineTo(i+a.topLeft,n)}const de=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,ue=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function pe(t,e){const i=(""+t).match(de);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 fe(t,e){const i={},n=N(e),s=n?Object.keys(e):e,o=N(t)?n?i=>j(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of s)i[t]=+o(t)||0;return i}function ge(t){return fe(t,{top:"y",right:"x",bottom:"y",left:"x"})}function me(t){const e=ge(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function _e(t,e){t=t||{},e=e||Qt.font;let i=j(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=j(t.style,e.style);n&&!(""+n).match(ue)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:j(t.family,e.family),lineHeight:pe(j(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:j(t.weight,e.weight),string:""};return s.string=function(t){return!t||B(t.size)||B(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(s),s}function be(t,e,i,n){let s,o,a,r=!0;for(s=0,o=t.length;s<o;++s)if(a=t[s],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),r=!1),void 0!==i&&F(a)&&(a=a[i%a.length],r=!1),void 0!==a))return n&&!r&&(n.cacheable=!1),a}function ye(t,e){return Object.assign(Object.create(t),e)}function xe(t,e=[""],i,n,s=()=>t[0]){const o=i||t;void 0===n&&(n=Le("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:n,_getTarget:s,override:i=>xe([i,...t],e,o,n)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>Me(i,n,(()=>function(t,e,i,n){let s;for(const o of e)if(s=Le(Ce(o,t),i),void 0!==s)return ke(t,s)?De(i,n,t,s):s}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Te(t).includes(e),ownKeys:t=>Te(t),set(t,e,i){const n=t._storage||(t._storage=s());return t[e]=n[e]=i,delete t._keys,!0}})}function ve(t,e,i,n){const s={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:we(t,n),setContext:e=>ve(t,e,i,n),override:s=>ve(t.override(s),e,i,n)};return new Proxy(s,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Me(t,e,(()=>function(t,e,i){const{_proxy:n,_context:s,_subProxy:o,_descriptors:a}=t;let r=n[e];return it(r)&&a.isScriptable(e)&&(r=function(t,e,i,n){const{_proxy:s,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||n);return r.delete(t),ke(t,l)&&(l=De(s._scopes,s,t,l)),l}(e,r,t,i)),F(r)&&r.length&&(r=function(t,e,i,n){const{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=i;if(void 0!==o.index&&n(t))return e[o.index%e.length];if(N(e[0])){const i=e,n=s._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=De(n,s,t,l);e.push(ve(i,o,a&&a[t],r))}}return e}(e,r,t,a.isIndexable)),ke(e,r)&&(r=ve(r,s,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,n)=>(t[i]=n,delete e[i],!0)})}function we(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:s=e.allKeys}=t;return{allKeys:s,scriptable:i,indexable:n,isScriptable:it(i)?i:()=>i,isIndexable:it(n)?n:()=>n}}const Ce=(t,e)=>t?t+tt(e):e,ke=(t,e)=>N(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Me(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function Se(t,e,i){return it(t)?t(e,i):t}const Ee=(t,e)=>!0===t?e:"string"==typeof t?Z(e,t):void 0;function Ae(t,e,i,n,s){for(const o of e){const e=Ee(i,o);if(e){t.add(e);const o=Se(e._fallback,i,s);if(void 0!==o&&o!==i&&o!==n)return o}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function De(t,e,i,n){const s=e._rootScopes,o=Se(e._fallback,i,n),a=[...t,...s],r=new Set;r.add(n);let l=Oe(r,a,i,o||i,n);return null!==l&&(void 0===o||o===i||(l=Oe(r,a,o,l,n),null!==l))&&xe(Array.from(r),[""],s,o,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const s=n[e];return F(s)&&N(i)?i:s||{}}(e,i,n)))}function Oe(t,e,i,n,s){for(;i;)i=Ae(t,e,i,n,s);return i}function Le(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function Te(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 Re=Number.EPSILON||1e-14,Pe=(t,e)=>e<t.length&&!t[e].skip&&t[e],Ie=t=>"x"===t?"y":"x";function ze(t,e,i,n){const s=t.skip?e:t,o=e,a=i.skip?e:i,r=yt(o,s),l=yt(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=n*h,u=n*c;return{previous:{x:o.x-d*(a.x-s.x),y:o.y-d*(a.y-s.y)},next:{x:o.x+u*(a.x-s.x),y:o.y+u*(a.y-s.y)}}}function Be(t,e,i){return Math.max(Math.min(t,i),e)}function Fe(t,e,i,n,s){let o,a,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){const i=Ie(e),n=t.length,s=Array(n).fill(0),o=Array(n);let a,r,l,h=Pe(t,0);for(a=0;a<n;++a)if(r=l,l=h,h=Pe(t,a+1),l){if(h){const t=h[e]-l[e];s[a]=0!==t?(h[i]-l[i])/t:0}o[a]=r?h?pt(s[a-1])!==pt(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}!function(t,e,i){const n=t.length;let s,o,a,r,l,h=Pe(t,0);for(let c=0;c<n-1;++c)l=h,h=Pe(t,c+1),l&&h&&(ft(e[c],0,Re)?i[c]=i[c+1]=0:(s=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(s,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=s*a*e[c],i[c+1]=o*a*e[c])))}(t,s,o),function(t,e,i="x"){const n=Ie(i),s=t.length;let o,a,r,l=Pe(t,0);for(let h=0;h<s;++h){if(a=r,r=l,l=Pe(t,h+1),!r)continue;const s=r[i],c=r[n];a&&(o=(s-a[i])/3,r[`cp1${i}`]=s-o,r[`cp1${n}`]=c-o*e[h]),l&&(o=(l[i]-s)/3,r[`cp2${i}`]=s+o,r[`cp2${n}`]=c+o*e[h])}}(t,o,e)}(t,s);else{let i=n?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=ze(i,r,t[Math.min(o+1,a-(n?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,n,s,o,a,r=ie(t[0],e);for(i=0,n=t.length;i<n;++i)a=o,o=r,r=i<n-1&&ie(t[i+1],e),o&&(s=t[i],a&&(s.cp1x=Be(s.cp1x,e.left,e.right),s.cp1y=Be(s.cp1y,e.top,e.bottom)),r&&(s.cp2x=Be(s.cp2x,e.left,e.right),s.cp2y=Be(s.cp2y,e.top,e.bottom)))}(t,i)}function Ne(){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 He(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const je=t=>t.ownerDocument.defaultView.getComputedStyle(t,null),Ue=["top","right","bottom","left"];function Ge(t,e,i){const n={};i=i?"-"+i:"";for(let s=0;s<4;s++){const o=Ue[s];n[o]=parseFloat(t[e+"-"+o+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function We(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,s=je(i),o="border-box"===s.boxSizing,a=Ge(s,"padding"),r=Ge(s,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:s,offsetY:o}=n;let a,r,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(s,o,t.target))a=s,r=o;else{const t=e.getBoundingClientRect();a=n.clientX-t.left,r=n.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:p,height:f}=e;return o&&(p-=a.width+r.width,f-=a.height+r.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((h-u)/f*i.height/n)}}const $e=t=>Math.round(10*t)/10;function Ye(t,e,i){const n=e||1,s=Math.floor(t.height*n),o=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);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!==n||a.height!==s||a.width!==o)&&(t.currentDevicePixelRatio=n,a.height=s,a.width=o,t.ctx.setTransform(n,0,0,n,0,0),!0)}const Xe=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Ne()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function qe(t,e){const i=function(t,e){return je(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ke(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Qe(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function Je(t,e,i,n){const s={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=Ke(t,s,i),r=Ke(s,o,i),l=Ke(o,e,i),h=Ke(a,r,i),c=Ke(r,l,i);return Ke(h,c,i)}function Ze(t){return"angle"===t?{between:wt,compare:xt,normalize:vt}:{between:kt,compare:(t,e)=>t-e,normalize:t=>t}}function ti({start:t,end:e,count:i,loop:n,style:s}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:s}}function ei(t,e,i){if(!i)return[t];const{property:n,start:s,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Ze(n),{start:c,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:s,end:o}=i,{between:a,normalize:r}=Ze(n),l=e.length;let h,c,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,h=0,c=l;h<c&&a(r(e[d%l][n]),s,o);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),f=[];let g,m,_,b=!1,y=null;for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(g=h(m[n]),g!==_&&(b=l(g,s,o),null===y&&(b||l(s,_,g)&&0!==r(s,_))&&(y=0===r(g,s)?t:i),null!==y&&(!b||0===r(o,g)||l(o,_,g))&&(f.push(ti({start:y,end:t,loop:u,count:a,style:p})),y=null),i=t,_=g));return null!==y&&f.push(ti({start:y,end:d,loop:u,count:a,style:p})),f}function ii(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){if(!e)return!1;const i=[],n=function(t,e){return Bt(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}class si{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const s=e.listeners[n],o=e.duration;s.forEach((n=>n({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=Ot.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const s=i.items;let o,a=s.length-1,r=!1;for(;a>=0;--a)o=s[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(s[a]=s[s.length-1],s.pop());r&&(n.draw(),this._notify(n,i,t,"progress")),s.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=s.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var oi=new si;const ai="transparent",ri={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=Ft(t||ai),s=n.valid&&Ft(e||ai);return s&&s.valid?s.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class li{constructor(t,e,i,n){const s=e[i];n=be([t.to,n,s,t.from]);const o=be([t.from,s,n]);this._active=!0,this._fn=t.fn||ri[t.type||typeof o],this._easing=zt[t.easing]||zt.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=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],s=i-this._start,o=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=s,this._loop=!!t.loop,this._to=be([t.to,e,n,t.from]),this._from=be([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,s=this._from,o=this._loop,a=this._to;let r;if(this._active=s!==a&&(o||e<i),!this._active)return this._target[n]=a,void this._notify(!0);e<0?this._target[n]=s:(r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[n]=this._fn(s,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]()}}class hi{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!N(t))return;const e=Object.keys(Qt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const s=t[n];if(!N(s))return;const o={};for(const t of e)o[t]=s[t];(F(s.properties)&&s.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,o)}))}))}_animateOptions(t,e){const i=e.options,n=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(!n)return[];const s=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const s=t[n[e]];s&&s.active()&&i.push(s.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),s}_createAnimations(t,e){const i=this._properties,n=[],s=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const h=e[l];let c=s[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(s[l]=c=new li(d,t,l,h),n.push(c)):t[l]=h}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(oi.add(this._chart,i),!0):void 0}}function ci(t,e){const i=t&&t.options||{},n=i.reverse,s=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:n?o:s,end:n?s:o}}function di(t,e){const i=[],n=t._getSortedDatasetMetas(e);let s,o;for(s=0,o=n.length;s<o;++s)i.push(n[s].index);return i}function ui(t,e,i,n={}){const s=t.keys,o="single"===n.mode;let a,r,l,h;if(null!==e){for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===i){if(n.all)continue;break}h=t.values[l],V(h)&&(o||0===e||pt(e)===pt(h))&&(e+=h)}return e}}function pi(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function fi(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function gi(t,e,i,n){for(const s of e.getMatchingVisibleMetas(n).reverse()){const e=t[s.index];if(i&&e>0||!i&&e<0)return s.index}return null}function mi(t,e){const{chart:i,_cachedMeta:n}=t,s=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=n,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:o,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=fi(s,c,o),u[r]=d,u._top=gi(u,a,!0,n.type),u._bottom=gi(u,a,!1,n.type),(u._visualValues||(u._visualValues={}))[r]=d}}function _i(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function bi(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const yi=t=>"reset"===t||"none"===t,xi=(t,e)=>e?t:Object.assign({},t);class vi{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=pi(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&bi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,s=e.xAxisID=j(i.xAxisID,_i(t,"x")),o=e.yAxisID=j(i.yAxisID,_i(t,"y")),a=e.rAxisID=j(i.rAxisID,_i(t,"r")),r=e.indexAxis,l=e.iAxisID=n(r,s,o,a),h=e.vAxisID=n(r,o,s,a);e.xScale=this.getScaleForId(s),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Dt(this._data,this),t._stacked&&bi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(N(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,s="x"===i.axis?"x":"y",o="x"===n.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,h,c;for(l=0,h=a.length;l<h;++l)c=a[l],r[l]={[s]:c,[o]:t[c]};return r}(e,t)}else if(i!==e){if(i){Dt(i,this);const t=this._cachedMeta;bi(t),t._parsed=[]}e&&Object.isExtensible(e)&&((n=e)._chartjs?n._chartjs.listeners.push(this):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),At.forEach((t=>{const e="_onData"+tt(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const s=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),s}})})))),this._syncList=[],this._data=e}var n}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const s=e._stacked;e._stacked=pi(e.vScale,e),e.stack!==i.stack&&(n=!0,bi(e),e.stack=i.stack),this._resyncElements(t),(n||s!==e._stacked)&&mi(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:s,_stacked:o}=i,a=s.axis;let r,l,h,c=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,h=n;else{h=F(n[t])?this.parseArrayData(i,n,t,e):N(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const s=()=>null===l[a]||d&&l[a]<d[a];for(r=0;r<e;++r)i._parsed[r+t]=l=h[r],c&&(s()&&(c=!1),d=l);i._sorted=c}o&&mi(this,h)}parsePrimitiveData(t,e,i,n){const{iScale:s,vScale:o}=t,a=s.axis,r=o.axis,l=s.getLabels(),h=s===o,c=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,c[d]={[a]:h||s.parse(l[p],p),[r]:o.parse(e[p],p)};return c}parseArrayData(t,e,i,n){const{xScale:s,yScale:o}=t,a=new Array(n);let r,l,h,c;for(r=0,l=n;r<l;++r)h=r+i,c=e[h],a[r]={x:s.parse(c[0],h),y:o.parse(c[1],h)};return a}parseObjectData(t,e,i,n){const{xScale:s,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(n);let h,c,d,u;for(h=0,c=n;h<c;++h)d=h+i,u=e[d],l[h]={x:s.parse(Z(u,a),d),y:o.parse(Z(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,s=this._cachedMeta,o=e[t.axis];return ui({keys:di(n,!0),values:e._stacks[t.axis]._visualValues},o,s.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const s=i[e.axis];let o=null===s?NaN:s;const a=n&&i._stacks[e.axis];n&&a&&(n.values=a,o=ui(n,s,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,s=i._sorted&&t===i.iScale,o=n.length,a=this._getOtherScale(t),r=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:di(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(t){const{min:e,max:i,minDefined:n,maxDefined:s}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:s?i:Number.POSITIVE_INFINITY}}(a);let d,u;function p(){u=n[d];const e=u[a.axis];return!V(u[t.axis])||h>e||c<e}for(d=0;d<o&&(p()||(this.updateRangeFromParsed(l,t,u,r),!s));++d);if(s)for(d=o-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,s,o;for(n=0,s=e.length;n<s;++n)o=e[n][t.axis],V(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,s=this.getParsed(t);return{label:i?""+i.getLabelForValue(s[i.axis]):"",value:n?""+n.getLabelForValue(s[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,s;return N(t)?(e=t.top,i=t.right,n=t.bottom,s=t.left):e=i=n=s=t,{top:e,right:i,bottom:n,left:s,disabled:!1===t}}(j(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=ci(t,i),s=ci(e,i);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],s=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||n.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,s,a,r),h=a;h<a+r;++h){const e=n[h];e.hidden||(e.active&&l?o.push(e):e.draw(t,s))}for(h=0;h<o.length;++h)o[h].draw(t,s)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let s;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];s=e.$context||(e.$context=function(t,e,i){return ye(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),s.parsed=this.getParsed(t),s.raw=n.data[t],s.index=s.dataIndex=t}else s=this.$context||(this.$context=function(t,e){return ye(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),s.dataset=n,s.index=s.datasetIndex=this.index;return s.active=!!e,s.mode=i,s}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,s=this._cachedDataOpts,o=t+"-"+e,a=s[o],r=this.enableOptionSharing&&et(i);if(a)return xi(a,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(Qt.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),c);return p.$shared&&(p.$shared=r,s[o]=Object.freeze(xi(p,r))),p}_resolveAnimations(t,e,i){const n=this.chart,s=this._cachedDataOpts,o=`animation-${e}`,a=s[o];if(a)return a;let r;if(!1!==n.options.animation){const n=this.chart.config,s=n.datasetAnimationScopeKeys(this._type,e),o=n.getOptionScopes(this.getDataset(),s);r=n.createResolver(o,this.getContext(t,i,e))}const l=new hi(n,r&&r.animations);return r&&r._cacheable&&(s[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||yi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,s=this.getSharedOptions(i),o=this.includeOptions(e,s)||s!==n;return this.updateSharedOptions(s,e,i),{sharedOptions:s,includeOptions:o}}updateElement(t,e,i,n){yi(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!yi(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const s=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(s)||s})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,s=e.length,o=Math.min(s,n);o&&this.parse(0,o),s>n?this._insertElements(n,s-n,t):s<n&&this._removeElements(s,n-s)}_insertElements(t,e,i=!0){const n=this._cachedMeta,s=n.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(s),a=t;a<o;++a)s[a]=new this.dataElementType;this._parsing&&r(n._parsed),this.parse(t,e),i&&this.updateElements(s,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&bi(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function wi(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,s=i.length;e<s;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=function(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,s,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(et(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(n=0,s=i.length;n<s;++n)o=e.getPixelForValue(i[n]),l();for(a=void 0,n=0,s=e.ticks.length;n<s;++n)o=e.getPixelForTick(n),l();return r}function Ci(t,e,i,n){return F(t)?function(t,e,i,n){const s=i.parse(t[0],n),o=i.parse(t[1],n),a=Math.min(s,o),r=Math.max(s,o);let l=a,h=r;Math.abs(a)>Math.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:s,end:o,min:a,max:r}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function ki(t,e,i,n){const s=t.iScale,o=t.vScale,a=s.getLabels(),r=s===o,l=[];let h,c,d,u;for(h=i,c=i+n;h<c;++h)u=e[h],d={},d[s.axis]=r||s.parse(a[h],h),l.push(Ci(u,d,o,h));return l}function Mi(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Si(t,e,i,n){let s=e.borderSkipped;const o={};if(!s)return void(t.borderSkipped=o);if(!0===s)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,n,s,o;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(s="end",o="start"):(s="start",o="end"),{start:i,end:n,reverse:e,top:s,bottom:o}}(t);"middle"===s&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?s=h:(i._bottom||0)===n?s=c:(o[Ei(c,a,r,l)]=!0,s=h)),o[Ei(s,a,r,l)]=!0,t.borderSkipped=o}function Ei(t,e,i,n){var s,o,a;return n?(a=i,t=Ai(t=(s=t)===(o=e)?a:s===a?o:s,i,e)):t=Ai(t,e,i),t}function Ai(t,e,i){return"start"===t?e:"end"===t?i:t}function Di(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}function Oi(t,e,i,n){const{controller:s,data:o,_sorted:a}=t,r=s._cachedMeta.iScale;if(r&&e===r.axis&&"r"!==e&&a&&o.length){const t=r._reversePixels?Et:St;if(!n)return t(o,e,i);if(s._sharedOptions){const n=o[0],s="function"==typeof n.getRange&&n.getRange(e);if(s){const n=t(o,e,i-s),a=t(o,e,i+s);return{lo:n.lo,hi:a.hi}}}}return{lo:0,hi:o.length-1}}function Li(t,e,i,n,s){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:l,hi:h}=Oi(o[t],e,a,s);for(let t=l;t<=h;++t){const e=r[t];e.skip||n(e,i,t)}}}function Ti(t,e,i,n,s){const o=[];return s||t.isPointInArea(e)?(Li(t,i,e,(function(i,a,r){(s||ie(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&o.push({element:i,datasetIndex:a,index:r})}),!0),o):o}function Ri(t,e,i,n,s,o){return o||t.isPointInArea(e)?"r"!==i||n?function(t,e,i,n,s,o){let a=[];const r=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const s=e?Math.abs(t.x-n.x):0,o=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(o,2))}}(i);let l=Number.POSITIVE_INFINITY;return Li(t,i,e,(function(i,h,c){const d=i.inRange(e.x,e.y,s);if(n&&!d)return;const u=i.getCenterPoint(s);if(!o&&!t.isPointInArea(u)&&!d)return;const p=r(e,u);p<l?(a=[{element:i,datasetIndex:h,index:c}],l=p):p===l&&a.push({element:i,datasetIndex:h,index:c})})),a}(t,e,i,n,s,o):function(t,e,i,n){let s=[];return Li(t,i,e,(function(t,i,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],n),{angle:l}=function(t,e){const i=e.x-t.x,n=e.y-t.y,s=Math.sqrt(i*i+n*n);let o=Math.atan2(n,i);return o<-.5*st&&(o+=ot),{angle:o,distance:s}}(t,{x:e.x,y:e.y});wt(l,a,r)&&s.push({element:t,datasetIndex:i,index:o})})),s}(t,e,i,s):[]}function Pi(t,e,i,n,s){const o=[],a="x"===i?"inXRange":"inYRange";let r=!1;return Li(t,i,e,((t,n,l)=>{t[a]&&t[a](e[i],s)&&(o.push({element:t,datasetIndex:n,index:l}),r=r||t.inRange(e.x,e.y,s))})),n&&!r?[]:o}var Ii={evaluateInteractionItems:Li,modes:{index(t,e,i,n){const s=We(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Ti(t,s,o,n,a):Ri(t,s,o,!1,n,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const s=We(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Ti(t,s,o,n,a):Ri(t,s,o,!1,n,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,n)=>Ti(t,We(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const s=We(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Ri(t,s,o,i.intersect,n,a)},x:(t,e,i,n)=>Pi(t,We(e,t),"x",i.intersect,n),y:(t,e,i,n)=>Pi(t,We(e,t),"y",i.intersect,n)}};const zi=["left","top","right","bottom"];function Bi(t,e){return t.filter((t=>t.pos===e))}function Fi(t,e){return t.filter((t=>-1===zi.indexOf(t.pos)&&t.box.axis===e))}function Ni(t,e){return t.sort(((t,i)=>{const n=e?i:t,s=e?t:i;return n.weight===s.weight?n.index-s.index:n.weight-s.weight}))}function Vi(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Hi(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 ji(t,e,i,n){const{pos:s,box:o}=i,a=t.maxPadding;if(!N(s)){i.size&&(t[s]-=i.size);const e=n[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[s]+=i.size}o.getPadding&&Hi(a,o.getPadding());const r=Math.max(0,e.outerWidth-Vi(a,t,"left","right")),l=Math.max(0,e.outerHeight-Vi(a,t,"top","bottom")),h=r!==t.w,c=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function Ui(t,e){const i=e.maxPadding;return function(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}(t?["left","right"]:["top","bottom"])}function Gi(t,e,i,n){const s=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,Ui(r.horizontal,e));const{same:a,other:d}=ji(e,i,r,n);h|=a&&s.length,c=c||d,l.fullSize||s.push(r)}return h&&Gi(s,e,i,n)||c}function Wi(t,e,i,n,s){t.top=i,t.left=e,t.right=e+n,t.bottom=i+s,t.width=n,t.height=s}function $i(t,e,i,n){const s=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=n[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const n=e.w*h,o=l.size||t.height;et(l.start)&&(a=l.start),t.fullSize?Wi(t,s.left,a,i.outerWidth-s.right-s.left,o):Wi(t,e.left+l.placed,a,n,o),l.start=a,l.placed+=n,a=t.bottom}else{const n=e.h*h,a=l.size||t.width;et(l.start)&&(o=l.start),t.fullSize?Wi(t,o,s.top,a,i.outerHeight-s.bottom-s.top):Wi(t,o,e.top+l.placed,a,n),l.start=o,l.placed+=n,o=t.right}}e.x=o,e.y=a}var Yi={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const s=me(t.options.layout.padding),o=Math.max(e-s.width,0),a=Math.max(i-s.height,0),r=function(t){const e=function(t){const e=[];let i,n,s,o,a,r;for(i=0,n=(t||[]).length;i<n;++i)s=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=s),e.push({index:i,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=Ni(e.filter((t=>t.box.fullSize)),!0),n=Ni(Bi(e,"left"),!0),s=Ni(Bi(e,"right")),o=Ni(Bi(e,"top"),!0),a=Ni(Bi(e,"bottom")),r=Fi(e,"x"),l=Fi(e,"y");return{fullSize:i,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Bi(e,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;G(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},s);Hi(u,me(n));const p=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),f=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:s}=i;if(!t||!zi.includes(n))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=s}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:s}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*n:a&&e.availableWidth,r.height=s):(r.width=n,r.height=h?h*s:a&&e.availableHeight)}return i}(l.concat(h),d);Gi(r.fullSize,p,d,f),Gi(l,p,d,f),Gi(h,p,d,f)&&Gi(l,p,d,f),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),$i(r.leftAndTop,p,d,f),p.x+=p.w,p.y+=p.h,$i(r.rightAndBottom,p,d,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},G(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Xi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class qi extends Xi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ki="$chartjs",Qi={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ji=t=>null===t||""===t,Zi=!!Xe&&{passive:!0};function tn(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Zi)}function en(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function nn(t,e,i){const n=t.canvas,s=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||en(i.addedNodes,n),e=e&&!en(i.removedNodes,n);e&&i()}));return s.observe(document,{childList:!0,subtree:!0}),s}function sn(t,e,i){const n=t.canvas,s=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||en(i.removedNodes,n),e=e&&!en(i.addedNodes,n);e&&i()}));return s.observe(document,{childList:!0,subtree:!0}),s}const on=new Map;let an=0;function rn(){const t=window.devicePixelRatio;t!==an&&(an=t,on.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ln(t,e,i){const n=t.canvas,s=n&&Ve(n);if(!s)return;const o=Lt(((t,e)=>{const n=s.clientWidth;i(t,e),n<s.clientWidth&&i()}),window),a=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||o(i,n)}));return a.observe(s),function(t,e){on.size||window.addEventListener("resize",rn),on.set(t,e)}(t,o),a}function hn(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){on.delete(t),on.size||window.removeEventListener("resize",rn)}(t)}function cn(t,e,i){const n=t.canvas,s=Lt((e=>{null!==t.ctx&&i(function(t,e){const i=Qi[t.type]||t.type,{x:n,y:s}=We(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==s?s:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,Zi)}(n,e,s),s}class dn extends Xi{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),s=t.getAttribute("width");if(t[Ki]={initial:{height:n,width:s,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Ji(s)){const e=qe(t,"width");void 0!==e&&(t.width=e)}if(Ji(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=qe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Ki])return!1;const i=e[Ki].initial;["height","width"].forEach((t=>{const n=i[t];B(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[Ki],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),s={attach:nn,detach:sn,resize:ln}[e]||cn;n[e]=s(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];n&&(({attach:hn,detach:hn,resize:hn}[e]||tn)(t,e,n),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return function(t,e,i,n){const s=je(t),o=Ge(s,"margin"),a=He(s.maxWidth,t,"clientWidth")||rt,r=He(s.maxHeight,t,"clientHeight")||rt,l=function(t,e,i){let n,s;if(void 0===e||void 0===i){const o=t&&Ve(t);if(o){const t=o.getBoundingClientRect(),a=je(o),r=Ge(a,"border","width"),l=Ge(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,n=He(a.maxWidth,o,"clientWidth"),s=He(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||rt,maxHeight:s||rt}}(t,e,i);let{width:h,height:c}=l;if("content-box"===s.boxSizing){const t=Ge(s,"border","width"),e=Ge(s,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-o.width),c=Math.max(0,n?h/n:c-o.height),h=$e(Math.min(h,a,l.maxWidth)),c=$e(Math.min(c,r,l.maxHeight)),h&&!c&&(c=$e(h/2)),(void 0!==e||void 0!==i)&&n&&l.height&&c>l.height&&(c=l.height,h=$e(Math.floor(c*n))),{width:h,height:c}}(t,e,i,n)}isAttached(t){const e=t&&Ve(t);return!(!e||!e.isConnected)}}class un{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return mt(this.x)&&mt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}}function pn(t,e,i,n,s){const o=j(n,0),a=Math.min(j(s,t.length),t.length);let r,l,h,c=0;for(i=Math.ceil(i),s&&(r=s-n,i=r/Math.floor(r/i)),h=o;h<0;)c++,h=Math.round(o+c*i);for(l=Math.max(o,0);l<a;l++)l===h&&(e.push(t[l]),c++,h=Math.round(o+c*i))}const fn=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,gn=(t,e)=>Math.min(e||t,t);function mn(t,e){const i=[],n=t.length/e,s=t.length;let o=0;for(;o<s;o+=n)i.push(t[Math.floor(o)]);return i}function _n(t,e,i){const n=t.ticks.length,s=Math.min(e,n-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(s);if(!(i&&(l=1===n?Math.max(h-o,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(s-1))/2,h+=s<e?l:-l,h<o-r||h>a+r)))return h}function bn(t){return t.drawTicks?t.tickLength:0}function yn(t,e){if(!t.display)return 0;const i=_e(t.font,e),n=me(t.padding);return(F(t.text)?t.text.length:1)*i.lineHeight+n.height}function xn(t,e,i){let n=(t=>"start"===t?"left":"end"===t?"right":"center")(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class vn extends un{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=H(t,Number.POSITIVE_INFINITY),e=H(e,Number.NEGATIVE_INFINITY),i=H(i,Number.POSITIVE_INFINITY),n=H(n,Number.NEGATIVE_INFINITY),{min:H(t,i),max:H(e,n),minDefined:V(t),maxDefined:V(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:s,maxDefined:o}=this.getUserBounds();if(s&&o)return{min:i,max:n};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;r<l;++r)e=a[r].controller.getMinMax(this,t),s||(i=Math.min(i,e.min)),o||(n=Math.max(n,e.max));return i=o&&i>n?n:i,n=s&&i>n?i:n,{min:H(i,H(n,i)),max:H(n,H(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){U(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:s,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:n,max:s}=t,o=(l=(s-n)/2,"string"==typeof(r=e)&&r.endsWith("%")?parseFloat(r)/100*l:+r),a=(t,e)=>i&&0===t?0:t+e;var r,l;return{min:a(n,-Math.abs(o)),max:a(s,o)}}(this,s,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?mn(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,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),s=t._maxLength/i;return Math.floor(Math.min(n,s))}(t),s=Math.min(i.maxTicksLimit||n,n),o=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],a=o.length,r=o[0],l=o[a-1],h=[];if(a>s)return function(t,e,i,n){let s,o=0,a=i[0];for(n=Math.ceil(n),s=0;s<t.length;s++)s===a&&(e.push(t[s]),o++,a=i[o*n])}(e,h,o,a/s),h;const c=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),s=e.length/i;if(!n)return Math.max(s,1);const o=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>s)return e}return Math.max(s,1)}(o,e,s);if(a>0){let t,i;const n=a>1?Math.round((l-r)/(a-1)):null;for(pn(e,h,c,B(n)?0:r-n,r),t=0,i=a-1;t<i;t++)pn(e,h,c,o[t],o[t+1]);return pn(e,h,c,l,B(n)?e.length:l+n),h}return pn(e,h,c),h}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),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(){U(this.options.afterUpdate,[this])}beforeSetDimensions(){U(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(){U(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),U(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){U(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,s;for(i=0,n=t.length;i<n;i++)s=t[i],s.label=U(e.callback,[s.value,i,t],this)}afterTickToLabelConversion(){U(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){U(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=gn(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,s=e.maxRotation;let o,a,r,l=n;if(!this._isVisible()||!e.display||n>=s||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Ct(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-bn(t.grid)-e.padding-yn(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Math.min(Math.asin(Ct((h.highest.height+6)/o,-1,1)),Math.asin(Ct(a/r,-1,1))-Math.asin(Ct(d/r,-1,1)))*(180/st),l=Math.max(n,Math.min(s,l))),this.labelRotation=l}afterCalculateLabelRotation(){U(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){U(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=yn(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=bn(s)+o):(t.height=this.maxHeight,t.width=bn(s)+o),i.display&&this.ticks.length){const{first:e,last:n,widest:s,highest:o}=this._getLabelSizes(),r=2*i.padding,l=_t(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*s.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*s.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,n,c,h)}}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,n){const{ticks:{align:s,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=n*t.width,d=i*e.height):(c=i*t.height,d=n*e.width):"start"===s?d=e.width:"end"===s?c=t.width:"inner"!==s&&(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-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,n=t.height/2;"start"===s?(i=0,n=t.height):"end"===s&&(i=e.height,n=0),this.paddingTop=i+o,this.paddingBottom=n+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(){U(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++)B(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=mn(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:s}=this,o=[],a=[],r=Math.floor(e/gn(e,i));let l,h,c,d,u,p,f,g,m,_,b,y=0,x=0;for(l=0;l<e;l+=r){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,f=s[p]=s[p]||{data:{},gc:[]},g=u.lineHeight,m=_=0,B(d)||F(d)){if(F(d))for(h=0,c=d.length;h<c;++h)b=d[h],B(b)||F(b)||(m=Jt(n,f.data,f.gc,m,b),_+=g)}else m=Jt(n,f.data,f.gc,m,d),_=g;o.push(m),a.push(_),y=Math.max(m,y),x=Math.max(_,x)}!function(t,e){G(t,(t=>{const i=t.gc,n=i.length/2;let s;if(n>e){for(s=0;s<n;++s)delete t.data[i[s]];i.splice(0,n)}}))}(s,e);const v=o.indexOf(y),w=a.indexOf(x),C=t=>({width:o[t]||0,height:a[t]||0});return{first:C(0),last:C(e-1),widest:C(v),highest:C(w),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){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ct(this._alignToPixels?Zt(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 ye(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=ye(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=_t(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),s=this._getLabelSizes(),o=t.autoSkipPadding||0,a=s?s.widest.width+o:0,r=s?s.highest.height+o:0;return this.isHorizontal()?r*i>a*n?a/i:r/n:r*n<a*i?r/i:a/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:s,position:o,border:a}=n,r=s.offset,l=this.isHorizontal(),h=this.ticks.length+(r?1:0),c=bn(s),d=[],u=a.setContext(this.getContext()),p=u.display?u.width:0,f=p/2,g=function(t){return Zt(i,t,p)};let m,_,b,y,x,v,w,C,k,M,S,E;if("top"===o)m=g(this.bottom),v=this.bottom-c,C=m-f,M=g(t.top)+f,E=t.bottom;else if("bottom"===o)m=g(this.top),M=t.top,E=g(t.bottom)-f,v=m+f,C=this.top+c;else if("left"===o)m=g(this.right),x=this.right-c,w=m-f,k=g(t.left)+f,S=t.right;else if("right"===o)m=g(this.left),k=t.left,S=g(t.right)-f,x=m+f,w=this.left+c;else if("x"===e){if("center"===o)m=g((t.top+t.bottom)/2+.5);else if(N(o)){const t=Object.keys(o)[0],e=o[t];m=g(this.chart.scales[t].getPixelForValue(e))}M=t.top,E=t.bottom,v=m+f,C=v+c}else if("y"===e){if("center"===o)m=g((t.left+t.right)/2);else if(N(o)){const t=Object.keys(o)[0],e=o[t];m=g(this.chart.scales[t].getPixelForValue(e))}x=m-f,w=x-c,k=t.left,S=t.right}const A=j(n.ticks.maxTicksLimit,h),D=Math.max(1,Math.ceil(h/A));for(_=0;_<h;_+=D){const t=this.getContext(_),e=s.setContext(t),n=a.setContext(t),o=e.lineWidth,h=e.color,c=n.dash||[],u=n.dashOffset,p=e.tickWidth,f=e.tickColor,g=e.tickBorderDash||[],m=e.tickBorderDashOffset;b=_n(this,_,r),void 0!==b&&(y=Zt(i,b,o),l?x=w=k=S=y:v=C=M=E=y,d.push({tx1:x,ty1:v,tx2:w,ty2:C,x1:k,y1:M,x2:S,y2:E,width:o,color:h,borderDash:c,borderDashOffset:u,tickWidth:p,tickColor:f,tickBorderDash:g,tickBorderDashOffset:m}))}return this._ticksLength=h,this._borderValue=m,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:s}=i,o=this.isHorizontal(),a=this.ticks,{align:r,crossAlign:l,padding:h,mirror:c}=s,d=bn(i.grid),u=d+h,p=c?-h:u,f=-_t(this.labelRotation),g=[];let m,_,b,y,x,v,w,C,k,M,S,E,A="middle";if("top"===n)v=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)v=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("x"===e){if("center"===n)v=(t.top+t.bottom)/2+u;else if(N(n)){const t=Object.keys(n)[0],e=n[t];v=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)x=(t.left+t.right)/2-u;else if(N(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?A="top":"end"===r&&(A="bottom"));const D=this._getLabelSizes();for(m=0,_=a.length;m<_;++m){b=a[m],y=b.label;const t=s.setContext(this.getContext(m));C=this.getPixelForTick(m)+s.labelOffset,k=this._resolveTickFontOptions(m),M=k.lineHeight,S=F(y)?y.length:1;const e=S/2,i=t.color,r=t.textStrokeColor,h=t.textStrokeWidth;let d,u=w;if(o?(x=C,"inner"===w&&(u=m===_-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),E="top"===n?"near"===l||0!==f?-S*M+M/2:"center"===l?-D.highest.height/2-e*M+M:-D.highest.height+M/2:"near"===l||0!==f?M/2:"center"===l?D.highest.height/2-e*M:D.highest.height-S*M,c&&(E*=-1),0===f||t.showLabelBackdrop||(x+=M/2*Math.sin(f))):(v=C,E=(1-S)*M/2),t.showLabelBackdrop){const e=me(t.backdropPadding),i=D.heights[m],n=D.widths[m];let s=E-e.top,o=0-e.left;switch(A){case"middle":s-=i/2;break;case"bottom":s-=i}switch(w){case"center":o-=n/2;break;case"right":o-=n;break;case"inner":m===_-1?o-=n:m>0&&(o-=n/2)}d={left:o,top:s,width:n+e.width,height:i+e.height,color:t.backdropColor}}g.push({label:y,font:k,textOffset:E,options:{rotation:f,color:i,strokeColor:r,strokeWidth:h,textAlign:u,textBaseline:A,translation:[x,v],backdrop:d}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-_t(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:s}}=this.options,o=t+s,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?n?(l=this.right+s,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?n?(l=this.left+s,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:s,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,s,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,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let s,o;const a=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(s=0,o=n.length;s<o;++s){const t=n[s];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:{border:i,grid:n}}=this,s=i.setContext(this.getContext()),o=i.display?s.width:0;if(!o)return;const a=n.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=Zt(t,this.left,o)-o/2,h=Zt(t,this.right,a)+a/2,c=d=r):(c=Zt(t,this.top,o)-o/2,d=Zt(t,this.bottom,a)+a/2,l=h=r),e.save(),e.lineWidth=s.width,e.strokeStyle=s.color,e.beginPath(),e.moveTo(l,c),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&ne(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;he(e,t.label,0,t.textOffset,n,i)}i&&se(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const s=_e(i.font),o=me(i.padding),a=i.align;let r=s.lineHeight/2;"bottom"===e||"center"===e||N(e)?(r+=o.bottom,F(i.text)&&(r+=s.lineHeight*(i.text.length-1))):r+=o.top;const{titleX:l,titleY:h,maxWidth:c,rotation:d}=function(t,e,i,n){const{top:s,left:o,bottom:a,right:r,chart:l}=t,{chartArea:h,scales:c}=l;let d,u,p,f=0;const g=a-s,m=r-o;if(t.isHorizontal()){if(u=Tt(n,o,r),N(i)){const t=Object.keys(i)[0],n=i[t];p=c[t].getPixelForValue(n)+g-e}else p="center"===i?(h.bottom+h.top)/2+g-e:fn(t,i,e);d=r-o}else{if(N(i)){const t=Object.keys(i)[0],n=i[t];u=c[t].getPixelForValue(n)-m+e}else u="center"===i?(h.left+h.right)/2-m+e:fn(t,i,e);p=Tt(n,a,s),f="left"===i?-ht:ht}return{titleX:u,titleY:p,maxWidth:d,rotation:f}}(this,r,e,a);he(t,i.text,0,0,s,{color:i.color,maxWidth:c,rotation:d,textAlign:xn(a,e,n),textBaseline:"middle",translation:[l,h]})}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=j(t.grid&&t.grid.z,-1),n=j(t.border&&t.border.z,0);return this._isVisible()&&this.draw===vn.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let s,o;for(s=0,o=e.length;s<o;++s){const o=e[s];o[i]!==this.id||t&&o.type!==t||n.push(o)}return n}_resolveTickFontOptions(t){return _e(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class wn{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,s=t.id,o=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+t);return s in n||(n[s]=t,function(t,e,i){const n=q(Object.create(null),[i?Qt.get(i):{},Qt.get(e),t.defaults]);Qt.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),s=n.pop(),o=[t].concat(n).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");Qt.route(o,s,l,r)}))}(e,t.defaultRoutes),t.descriptors&&Qt.describe(e,t.descriptors)}(t,o,i),this.override&&Qt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in Qt[n]&&(delete Qt[n][i],this.override&&delete $t[i])}}class Cn{constructor(){this.controllers=new wn(vi,"datasets",!0),this.elements=new wn(un,"elements"),this.plugins=new wn(Object,"plugins"),this.scales=new wn(vn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):G(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=tt(t);U(i["before"+n],[],i),e[t](i),U(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var kn=new Cn;class Mn{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const s=n?this._descriptors(t).filter(n):this._descriptors(t),o=this._notify(s,t,e,i);return"afterDestroy"===e&&(this._notify(s,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,n){n=n||{};for(const s of t){const t=s.plugin;if(!1===U(t[i],[e,n,s.options],t)&&n.cancelable)return!1}return!0}invalidate(){B(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=j(i.options&&i.options.plugins,{}),s=function(t){const e={},i=[],n=Object.keys(kn.plugins.items);for(let t=0;t<n.length;t++)i.push(kn.getPlugin(n[t]));const s=t.plugins||[];for(let t=0;t<s.length;t++){const n=s[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,s){const o=[],a=t.getContext();for(const r of e){const e=r.id,l=Sn(n[e],s);null!==l&&o.push({plugin:r,options:En(t.config,{plugin:r,local:i[e]},l,a)})}return o}(t,s,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function Sn(t,e){return e||!1!==t?!0===t?{}:t:null}function En(t,{plugin:e,local:i},n,s){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(n,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function An(t,e){const i=Qt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Dn(t){if("x"===t||"y"===t||"r"===t)return t}function On(t,...e){if(Dn(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&Dn(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Ln(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Tn(t){const e=t.options||(t.options={});e.plugins=j(e.plugins,{}),e.scales=function(t,e){const i=$t[t.type]||{scales:{}},n=e.scales||{},s=An(t.type,e),o=Object.create(null);return Object.keys(n).forEach((e=>{const a=n[e];if(!N(a))return console.error(`Invalid scale configuration for scale: ${e}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const r=On(e,a,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return Ln(t,"x",i[0])||Ln(t,"y",i[0])}return{}}(e,t),Qt.scales[a.type]),l=function(t,e){return t===e?"_index_":"_value_"}(r,s),h=i.scales||{};o[e]=K(Object.create(null),[{axis:r},a,h[r],h[l]])})),t.data.datasets.forEach((i=>{const s=i.type||t.type,a=i.indexAxis||An(s,e),r=($t[s]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,a),s=i[e+"AxisID"]||e;o[s]=o[s]||Object.create(null),K(o[s],[{axis:e},n[s],r[t]])}))})),Object.keys(o).forEach((t=>{const e=o[t];K(e,[Qt.scales[e.type],Qt.scale])})),o}(t,e)}function Rn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Pn=new Map,In=new Set;function zn(t,e){let i=Pn.get(t);return i||(i=e(),Pn.set(t,i),In.add(i)),i}const Bn=(t,e,i)=>{const n=Z(e,i);void 0!==n&&t.add(n)};class Fn{constructor(t){this._config=function(t){return(t=t||{}).data=Rn(t.data),Tn(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=Rn(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(),Tn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return zn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return zn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return zn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return zn(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:s}=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=>Bn(r,t,e)))),e.forEach((t=>Bn(r,n,t))),e.forEach((t=>Bn(r,$t[s]||{},t))),e.forEach((t=>Bn(r,Qt,t))),e.forEach((t=>Bn(r,Yt,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),In.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,$t[e]||{},Qt.datasets[e]||{},{type:e},Qt,Yt]}resolveNamedOptions(t,e,i,n=[""]){const s={$shared:!0},{resolver:o,subPrefixes:a}=Nn(this._resolverCache,t,n);let r=o;(function(t,e){const{isScriptable:i,isIndexable:n}=we(t);for(const s of e){const e=i(s),o=n(s),a=(o||e)&&t[s];if(e&&(it(a)||Vn(a))||o&&F(a))return!0}return!1})(o,e)&&(s.$shared=!1,r=ve(o,i=it(i)?i():i,this.createResolver(t,i,a)));for(const t of e)s[t]=r[t];return s}createResolver(t,e,i=[""],n){const{resolver:s}=Nn(this._resolverCache,t,i);return N(e)?ve(s,e,void 0,n):s}}function Nn(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const s=i.join();let o=n.get(s);return o||(o={resolver:xe(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(s,o)),o}const Vn=t=>N(t)&&Object.getOwnPropertyNames(t).some((e=>it(t[e]))),Hn=["top","bottom","left","right","chartArea"];function jn(t,e){return"top"===t||"bottom"===t||-1===Hn.indexOf(t)&&"x"===e}function Un(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function Gn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),U(i&&i.onComplete,[t],e)}function Wn(t){const e=t.chart,i=e.options.animation;U(i&&i.onProgress,[t],e)}function $n(t){return Ne()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Yn={},Xn=t=>{const e=$n(t);return Object.values(Yn).filter((t=>t.canvas===e)).pop()};function qn(t,e,i){const n=Object.keys(t);for(const s of n){const n=+s;if(n>=e){const o=t[s];delete t[s],(i>0||n>e)&&(t[n+i]=o)}}}function Kn(t,e,i){return t.options.clip?t[i]:e[i]}class Qn{static defaults=Qt;static instances=Yn;static overrides=$t;static registry=kn;static version="4.4.4";static getChart=Xn;static register(...t){kn.add(...t),Jn()}static unregister(...t){kn.remove(...t),Jn()}constructor(t,e){const i=this.config=new Fn(e),n=$n(t),s=Xn(n);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Ne()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?qi:dn}(n)),this.platform.updateConfig(i);const a=this.platform.acquireContext(n,o.aspectRatio),r=a&&a.canvas,l=r&&r.height,h=r&&r.width;this.id=z(),this.ctx=a,this.canvas=r,this.width=h,this.height=l,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 Mn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),o.resizeDelay||0),this._dataChanges=[],Yn[this.id]=this,a&&r?(oi.listen(this,"complete",Gn),oi.listen(this,"progress",Wn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:s}=this;return B(t)?e&&s?s:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return kn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ye(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return te(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,n=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(n,t,e,s),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Ye(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),U(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){G(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let s=[];e&&(s=s.concat(Object.keys(e).map((t=>{const i=e[t],n=On(t,i),s="r"===n,o="x"===n;return{options:i,dposition:s?"chartArea":o?"bottom":"left",dtype:s?"radialLinear":o?"category":"linear"}})))),G(s,(e=>{const s=e.options,o=s.id,a=On(o,s),r=j(s.type,e.dtype);void 0!==s.position&&jn(s.position,a)===jn(e.dposition)||(s.position=e.dposition),n[o]=!0;let l=null;o in i&&i[o].type===r?l=i[o]:(l=new(kn.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[l.id]=l),l.init(s,t)})),G(n,((t,e)=>{t||delete i[e]})),G(i,(t=>{Yi.configure(this,t,t.options),Yi.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(Un("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let s=this.getDatasetMeta(i);const o=n.type||this.config.type;if(s.type&&s.type!==o&&(this._destroyDatasetMeta(i),s=this.getDatasetMeta(i)),s.type=o,s.indexAxis=n.indexAxis||An(o,this.options),s.order=n.order||0,s.index=i,s.label=""+n.label,s.visible=this.isDatasetVisible(i),s.controller)s.controller.updateIndex(i),s.controller.linkScales();else{const e=kn.getController(o),{datasetElementType:n,dataElementType:a}=Qt.datasets[o];Object.assign(e,{dataElementType:kn.getElement(a),datasetElementType:n&&kn.getElement(n)}),s.controller=new e(this,i),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){G(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const s=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=!n&&-1===s.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),n||G(s,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Un("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){G(this.scales,(t=>{Yi.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);nt(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:s}of e)qn(t,n,"_removeElements"===i?-s:s)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!nt(n,i(t)))return;return Array.from(n).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Yi.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],G(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,it(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(oi.has(this)?this.attached&&!oi.running(this)&&oi.start(this):(this.draw(),Gn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,s;for(n=0,s=e.length;n<s;++n){const s=e[n];t&&!s.visible||i.push(s)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,s=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:Kn(i,e,"left"),right:Kn(i,e,"right"),top:Kn(n,e,"top"),bottom:Kn(n,e,"bottom")}:e}(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(n&&ne(e,{left:!1===i.left?0:s.left-i.left,right:!1===i.right?this.width:s.right+i.right,top:!1===i.top?0:s.top-i.top,bottom:!1===i.bottom?this.height:s.bottom+i.bottom}),t.controller.draw(),n&&se(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return ie(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const s=Ii.modes[e];return"function"==typeof s?s(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=ye(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",s=this.getDatasetMeta(t),o=s.controller._resolveAnimations(void 0,n);et(e)?(s.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(s,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),oi.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),te(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Yn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};G(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},s=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",s),i("detach",o)};o=()=>{this.attached=!1,n("resize",s),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){G(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},G(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let s,o,a,r;for("dataset"===e&&(s=this.getDatasetMeta(t[0].datasetIndex),s.controller["_"+n+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[n+"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}}));!W(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,s=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=s(e,t),a=i?t:s(t,e);o.length&&this.updateHoverStyle(o,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const s=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(s||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:s}=this,o=e,a=this._getActiveElements(t,n,i,o),r=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,U(s.onHover,[t,a,this],this),r&&U(s.onClick,[t,a,this],this));const h=!W(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const s=this.options.hover;return this.getElementsAtEventForMode(t,s.mode,s,n)}}function Jn(){return G(Qn.instances,(t=>t._plugins.invalidate()))}function Zn(t,e,i=e){t.lineCap=j(i.borderCapStyle,e.borderCapStyle),t.setLineDash(j(i.borderDash,e.borderDash)),t.lineDashOffset=j(i.borderDashOffset,e.borderDashOffset),t.lineJoin=j(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=j(i.borderWidth,e.borderWidth),t.strokeStyle=j(i.borderColor,e.borderColor)}function ts(t,e,i){t.lineTo(i.x,i.y)}function es(t,e,i={}){const n=t.length,{start:s=0,end:o=n-1}=i,{start:a,end:r}=e,l=Math.max(s,a),h=Math.min(o,r),c=s<a&&o<a||s>r&&o>r;return{count:n,start:l,loop:e.loop,ilen:h<l&&!c?n+h-l:h-l}}function is(t,e,i,n){const{points:s,options:o}=e,{count:a,start:r,loop:l,ilen:h}=es(s,i,n),c=function(t){return t.stepped?oe:t.tension||"monotone"===t.cubicInterpolationMode?ae:ts}(o);let d,u,p,{move:f=!0,reverse:g}=n||{};for(d=0;d<=h;++d)u=s[(r+(g?h-d:d))%a],u.skip||(f?(t.moveTo(u.x,u.y),f=!1):c(t,p,u,g,o.stepped),p=u);return l&&(u=s[(r+(g?h:0))%a],c(t,p,u,g,o.stepped)),!!l}function ns(t,e,i,n){const s=e.points,{count:o,start:a,ilen:r}=es(s,i,n),{move:l=!0,reverse:h}=n||{};let c,d,u,p,f,g,m=0,_=0;const b=t=>(a+(h?r-t:t))%o,y=()=>{p!==f&&(t.lineTo(m,f),t.lineTo(m,p),t.lineTo(m,g))};for(l&&(d=s[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=s[b(c)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>f&&(f=i),m=(_*m+e)/++_):(y(),t.lineTo(e,i),u=n,_=0,p=f=i),g=i}y()}function ss(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?is:ns}const os="function"==typeof Path2D;function as(t,e,i,n){const s=t.options,{[i]:o}=t.getProps([i],n);return Math.abs(e-o)<s.radius+s.hitRadius}function rs(t,e){const{x:i,y:n,base:s,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=a/2,r=Math.min(i,s),l=Math.max(i,s),h=n-d,c=n+d):(d=o/2,r=i-d,l=i+d,h=Math.min(n,s),c=Math.max(n,s)),{left:r,top:h,right:l,bottom:c}}function ls(t,e,i,n){return t?0:Ct(e,i,n)}function hs(t){const e=rs(t),i=e.right-e.left,n=e.bottom-e.top,s=function(t,e,i){const n=t.options.borderWidth,s=t.borderSkipped,o=ge(n);return{t:ls(s.top,o.top,0,i),r:ls(s.right,o.right,0,e),b:ls(s.bottom,o.bottom,0,i),l:ls(s.left,o.left,0,e)}}(t,i/2,n/2),o=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),s=t.options.borderRadius,o=function(t){return fe(t,["topLeft","topRight","bottomLeft","bottomRight"])}(s),a=Math.min(e,i),r=t.borderSkipped,l=n||N(s);return{topLeft:ls(!l||r.top||r.left,o.topLeft,0,a),topRight:ls(!l||r.top||r.right,o.topRight,0,a),bottomLeft:ls(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:ls(!l||r.bottom||r.right,o.bottomRight,0,a)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:o},inner:{x:e.left+s.l,y:e.top+s.t,w:i-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function cs(t,e,i,n){const s=null===e,o=null===i,a=t&&!(s&&o)&&rs(t,n);return a&&(s||kt(e,a.left,a.right))&&(o||kt(i,a.top,a.bottom))}function ds(t,e){t.rect(e.x,e.y,e.w,e.h)}function us(t,e,i={}){const n=t.x!==i.x?-e:0,s=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-n,a=(t.y+t.h!==i.y+i.h?e:0)-s;return{x:t.x+n,y:t.y+s,w:t.w+o,h:t.h+a,radius:t.radius}}function ps(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}new WeakMap;function fs(t,e,{horizontal:i,minRotation:n}){const s=_t(n),o=(i?Math.sin(s):Math.cos(s))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class gs extends vn{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 B(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:n,max:s}=this;const o=t=>n=e?n:t,a=t=>s=i?s:t;if(t){const t=pt(n),e=pt(s);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(n===s){let e=0===s?1:Math.abs(.05*s);a(s+e),t||o(n-e)}this.min=n,this.max=s}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=function(t,e){const i=[],{bounds:n,step:s,min:o,max:a,precision:r,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=s||1,p=h-1,{min:f,max:g}=e,m=!B(o),_=!B(a),b=!B(l),y=(g-f)/(c+1);let x,v,w,C,k=gt((g-f)/p/u)*u;if(k<1e-14&&!m&&!_)return[{value:f},{value:g}];C=Math.ceil(g/k)-Math.floor(f/k),C>p&&(k=gt(C*k/p/u)*u),B(r)||(x=Math.pow(10,r),k=Math.ceil(k*x)/x),"ticks"===n?(v=Math.floor(f/k)*k,w=Math.ceil(g/k)*k):(v=f,w=g),m&&_&&s&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((a-o)/s,k/1e3)?(C=Math.round(Math.min((a-o)/k,h)),k=(a-o)/C,v=o,w=a):b?(v=m?o:v,w=_?a:w,C=l-1,k=(w-v)/C):(C=(w-v)/k,C=ft(C,Math.round(C),k/1e3)?Math.round(C):Math.ceil(C));const M=Math.max(bt(k),bt(v));x=Math.pow(10,B(r)?M:r),v=Math.round(v*x)/x,w=Math.round(w*x)/x;let S=0;for(m&&(d&&v!==o?(i.push({value:o}),v<o&&S++,ft(Math.round((v+S*k)*x)/x,o,fs(o,y,t))&&S++):v<o&&S++);S<C;++S){const t=Math.round((v+S*k)*x)/x;if(_&&t>a)break;i.push({value:t})}return _&&d&&w!==a?i.length&&ft(i[i.length-1].value,a,fs(a,y,t))?i[i.length-1].value=a:i.push({value:a}):_&&w!==a||i.push({value:w}),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&&function(t,e,i){let n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ut(t,this.chart.options.locale,this.options.ticks.format)}}class ms extends gs{static id="linear";static defaults={ticks:{callback:Wt.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=_t(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,s.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}Wt.formatters.logarithmic,Wt.formatters.numeric,Qn.defaults.color="#b0b0b0";const _s={y:{display:!0,ticks:{suggestedMin:0},gridLines:{color:"#606060",zeroLineColor:"#606060"}}},bs="#e7c9e5",ys="#64a6bd",xs="#404040";function vs(t,e){let i=-1;const n=Date.now(),s={label:"texture count",data:[{x:0,y:0}],borderColor:bs,borderWidth:1.5,pointRadius:1},o={label:"geometry count",data:[{x:0,y:0}],borderColor:ys,borderWidth:1.5,pointRadius:1},a=["0s"],r=new Qn(t,{type:"line",data:{labels:a,datasets:[s,o]},options:{animation:{duration:10},scales:_s}});this.update=t=>{const l=Math.floor((Date.now()-n)/1e3),h=`${l}s`;i>0&&a[i]==h?a.push(""):(a.push(h),i=a.length-1),a.length>60&&(a.shift(),i--);const c=e.info.memory;s.data.push({x:l,y:c.textures}),o.data.push({x:l,y:c.geometries}),s.data.length>60&&(s.data.shift(),o.data.shift()),t&&r.update()},this.resize=()=>{r.resize()}}Qn.register(class extends vi{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:s}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=function(t,e,i){const n=e.length;let s=0,o=n;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:h,max:c,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(s=Ct(Math.min(St(r,l,h).lo,i?n:St(e,l,a.getPixelForValue(h)).lo),0,n-1)),o=u?Ct(Math.max(St(r,a.axis,c,!0).hi+1,i?0:St(e,l,a.getPixelForValue(c),!0).hi+1),s,n)-s:n-s}return{start:s,count:o}}(e,n,o);this._drawStart=a,this._drawCount=r,function(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,s={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=s,!0;const o=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,s),o}(e)&&(a=0,r=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!s._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(n,a,r,t)}updateElements(t,e,i,n){const s="reset"===n,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:c}=this._getSharedOptions(e,n),d=o.axis,u=a.axis,{spanGaps:p,segment:f}=this.options,g=mt(p)?p:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||s||"none"===n,_=e+i,b=t.length;let y=e>0&&this.getParsed(e-1);for(let i=0;i<b;++i){const p=t[i],b=m?p:{};if(i<e||i>=_){b.skip=!0;continue}const x=this.getParsed(i),v=B(x[u]),w=b[d]=o.getPixelForValue(x[d],i),C=b[u]=s||v?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,x,r):x[u],i);b.skip=isNaN(w)||isNaN(C)||v,b.stop=i>0&&Math.abs(x[d]-y[d])>g,f&&(b.parsed=x,b.raw=l.data[i]),c&&(b.options=h||this.resolveDataElementOptions(i,p.active?"active":n)),m||this.updateElement(p,i,b,n),y=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const s=n[0].size(this.resolveDataElementOptions(0)),o=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,s,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},class extends un{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Fe(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,s=i.length;if(!s)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,n){let s=0,o=e-1;if(i&&!n)for(;s<e&&!t[s].skip;)s++;for(;s<e&&t[s].skip;)s++;for(s%=e,i&&(o+=s);o>s&&t[o%e].skip;)o--;return o%=e,{start:s,end:o}}(i,s,o,n);return function(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const s=t._chart.getContext(),o=ii(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,h=[];let c=o,d=e[0].start,u=d;function p(t,e,n,s){const o=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:n,style:s}),c=s,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=ii(n.setContext(ye(s,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),ni(e,c)&&p(d,u-1,t.loop,c),o=r,c=e}d<u-1&&p(d,u-1,t.loop,c)}return h}(t,e,i,n):e}(t,!0===n?[{start:a,end:r,loop:o}]:function(t,e,i,n){const s=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%s];i.skip||i.stop?l.skip||(n=!1,o.push({start:e%s,end:(a-1)%s,loop:n}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%s,end:r%s,loop:n}),o}(i,a,r<a?r+s:r,!!t._fullLoop&&0===a&&r===s-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,n=t[e],s=this.points,o=function(t,e){const i=[],n=t.segments;for(let s=0;s<n.length;s++){const o=ei(n[s],t.points,e);o.length&&i.push(...o)}return i}(this,{property:e,start:n,end:n});if(!o.length)return;const a=[],r=function(t){return t.stepped?Qe:t.tension||"monotone"===t.cubicInterpolationMode?Je:Ke}(i);let l,h;for(l=0,h=o.length;l<h;++l){const{start:h,end:c}=o[l],d=s[h],u=s[c];if(d===u){a.push(d);continue}const p=r(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],a.push(p)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return ss(this)(t,this,e,i)}path(t,e,i){const n=this.segments,s=ss(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of n)o&=s(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,n){const s=this.options||{};(this.points||[]).length&&s.borderWidth&&(t.save(),function(t,e,i,n){os&&!e.options.segment?function(t,e,i,n){let s=e._path;s||(s=e._path=new Path2D,e.path(s,i,n)&&s.closePath()),Zn(t,e.options),t.stroke(s)}(t,e,i,n):function(t,e,i,n){const{segments:s,options:o}=e,a=ss(e);for(const r of s)Zn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}},class extends un{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:s,y:o}=this.getProps(["x","y"],i);return Math.pow(t-s,2)+Math.pow(e-o,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return as(this,t,"x",e)}inYRange(t,e){return as(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||!ie(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ee(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}},ms,class extends vn{static id="category";static defaults={ticks:{callback:ps}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(B(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Ct(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:function(t,e,i,n){const s=t.indexOf(e);return-1===s?((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n):s!==t.lastIndexOf(e)?i:s}(i,t,j(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let s=this.getLabels();s=0===t&&e===s.length-1?s:s.slice(t,e+1),this._valueRange=Math.max(s.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return ps.call(this,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}},class extends un{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:s,outer:o}=hs(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?ce:ds;var r;t.save(),o.w===s.w&&o.h===s.h||(t.beginPath(),a(t,us(o,e,s)),t.clip(),a(t,us(s,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,us(s,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return cs(this,t,e,i)}inXRange(t,e){return cs(this,t,null,e)}inYRange(t,e){return cs(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:s}=this.getProps(["x","y","base","horizontal"],t);return{x:s?(e+n)/2:e,y:s?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},class extends vi{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,n){return ki(t,e,i,n)}parseArrayData(t,e,i,n){return ki(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:s,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===s.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,p,f;for(d=i,u=i+n;d<u;++d)f=e[d],p={},p[s.axis]=s.parse(Z(f,l),d),c.push(Ci(Z(f,h),p,o,d));return c}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const s=i._custom;s&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,s.min),t.max=Math.max(t.max,s.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,s=this.getParsed(t),o=s._custom,a=Mi(o)?"["+o.start+", "+o.end+"]":""+n.getLabelForValue(s[n.axis]);return{label:""+i.getLabelForValue(s[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,n){const s="reset"===n,{index:o,_cachedMeta:{vScale:a}}=this,r=a.getBasePixel(),l=a.isHorizontal(),h=this._getRuler(),{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=s||B(e[a.axis])?{base:r,head:r}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,h),f=(e._stacks||{})[a.axis],g={horizontal:l,base:i.base,enableBorderRadius:!f||Mi(e._custom)||o===f._top||o===f._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(g.options=c||this.resolveDataElementOptions(u,t[u].active?"active":n));const m=g.options||t[u].options;Si(g,m,f,o),Di(g,m,h.ratio),this.updateElement(t[u],u,g,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),s=i.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(e),r=a&&a[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===r)),n=e&&e[t.vScale.axis];if(B(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===s||-1===o.indexOf(i.stack)||void 0===s&&void 0===i.stack)&&o.push(i.stack),i.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),s=void 0!==e?n.indexOf(e):-1;return-1===s?n.length-1:s}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let s,o;for(s=0,o=e.data.length;s<o;++s)n.push(i.getPixelForValue(this.getParsed(s)[i.axis],s));const a=t.barThickness;return{min:a||wi(e),pixels:n,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,index:n},options:{base:s,minBarLength:o}}=this,a=s||0,r=this.getParsed(t),l=r._custom,h=Mi(l);let c,d,u=r[e.axis],p=0,f=i?this.applyStack(e,r,i):u;f!==u&&(p=f-u,f=u),h&&(u=l.barStart,f=l.barEnd-l.barStart,0!==u&&pt(u)!==pt(l.barEnd)&&(p=0),p+=u);const g=B(s)||h?p:s;let m=e.getPixelForValue(g);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(p+f):m,d=c-m,Math.abs(d)<o){d=function(t,e,i){return 0!==t?pt(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,a)*o,u===a&&(m-=d/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),l=Math.min(t,s),p=Math.max(t,s);m=Math.max(Math.min(m,p),l),c=m+d,i&&!h&&(r._stacks[e.axis]._visualValues[n]=e.getValueForPixel(c)-e.getValueForPixel(m))}if(m===e.getPixelForValue(a)){const t=pt(d)*e.getLineWidthForValue(a)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,s=n.skipNull,o=j(n.maxBarThickness,1/0);let a,r;if(e.grouped){const i=s?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const s=e.pixels,o=s[t];let a=t>0?s[t-1]:null,r=t<s.length-1?s[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/n,ratio:i.barPercentage,start:h}}(t,e,n,i):function(t,e,i,n){const s=i.barThickness;let o,a;return B(s)?(o=e.min*i.categoryPercentage,a=i.barPercentage):(o=s*n,a=1),{chunk:o/n,ratio:a,start:e.pixels[t]-o/2}}(t,e,n,i),h=this._getStackIndex(this.index,this._cachedMeta.stack,s?t:void 0);a=l.start+l.chunk*h+l.chunk/2,r=Math.min(o,l.chunk*l.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,n=i.length;let s=0;for(;s<n;++s)null===this.getParsed(s)[e.axis]||i[s].hidden||i[s].draw(this._ctx)}});class ws extends n.Box3Helper{constructor(t,e,i){i=i||new n.Color(Math.random(),Math.random(),Math.random()),super(t.box3D,i.getHex()),this.obb=t,this.material.linewidth=2,this.frustumCulled=!1,this.matrixAutoUpdate=!1,this.rotationAutoUpdate=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(){let 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(),n.Object3D.prototype.updateMatrixWorld.call(this,t))}}const Cs=ws;function ks(t,e,i){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: ${xs}; display: none`,document.body.appendChild(i)),this.chartDivContainer=i;const a=this.createChartContainer("three-info").getContext("2d");this.charts=[],this.charts.push(new vs(a,t.mainLoop.gfxEngine.renderer));const r=this.charts,l=t.tileLayer,h=new s.E$(t.referenceCrs,0,0,0),c=new s.E$("EPSG:4326",0,0,0),d=e.addFolder("Debug Tools"),u={displayCharts:!1,eventsDebug:!1,debugCameraWindow:!1,freeze:!1};let p;const f=()=>{p=Date.now()},g=()=>{!function(t){const e="none"!=i.style.display;r.forEach((i=>i.update(e,t)))}(Date.now()-p)};let m,_,b,y;d.add(u,"displayCharts").name("Display charts").onChange((e=>{e?(t.addFrameRequester(o.n7.UPDATE_START,f),t.addFrameRequester(o.n7.UPDATE_END,g),i.style.display="flex"):(t.removeFrameRequester(o.n7.UPDATE_START,f),t.removeFrameRequester(o.n7.UPDATE_END,g),i.style.display="none"),this.updateChartDivSize(),t.notifyChange()})),d.add(u,"debugCameraWindow").name("debug Camera").onChange((e=>{e?t.addFrameRequester(o.n7.AFTER_RENDER,I):t.removeFrameRequester(o.n7.AFTER_RENDER,I),t.notifyChange()})),d.add(u,"freeze").name("freeze update").onChange((e=>{l.frozen=e,t.notifyChange()}));const x=t.controls;h.crs=t.referenceCrs;const v=new n.Vector3,w=x&&x.getCameraTargetPosition?x.getCameraTargetPosition:()=>t.camera3D.position,C=e=>{t.getPickingPositionFromDepth(t.eventToViewCoords(e),v)?(h.setFromVector3(v).as("EPSG:4326",c),u.latitude=`${c.y.toFixed(6)}`,u.longitude=`${c.x.toFixed(6)}`,u.altitude=`${c.z.toFixed(2)}`):(u.latitude="---------",u.longitude="---------",u.altitude="---------"),m.updateDisplay(),_.updateDisplay(),b.updateDisplay()};d.add(u,"eventsDebug").name("Debug event").onChange((e=>{e?(y=d.addFolder("Events"),y.open(),h.setFromVector3(w()).as("EPSG:4326",c),u.latitude=`${c.y.toFixed(6)}`,u.longitude=`${c.x.toFixed(6)}`,u.altitude=`${c.z.toFixed(2)}`,m=y.add(u,"latitude"),_=y.add(u,"longitude"),b=y.add(u,"altitude"),t.domElement.addEventListener("mousemove",C)):(t.domElement.removeEventListener("mousemove",C),d.removeFolder("Events"))}));const k=new n.CameraHelper(t.camera3D),M=t.camera3D.clone();M.fov*=1.5,M.updateProjectionMatrix();const S=t.mainLoop.gfxEngine,E=S.renderer;let A=1e11;const D=t.getLayerById("atmosphere");D&&(A=D.fog.distance),k.visible=!1,t.scene.add(k);const O=new o.Wz,L=new Cs(O,"",new n.Color(ys));function T(t){t.material&&A&&(t.material.fogDistance=A)}L.visible=!1,t.scene.add(O),t.scene.add(L);const R=new n.Color,P=new n.Vector3;function I(){if(u.debugCameraWindow&&M){const e=.25,n={x:S.width*e,y:S.height*e};M.aspect=n.x/n.y;const o=t.camera3D,a=new s.E$(t.referenceCrs).setFromVector3(o.position).as(l.extent.crs),r=t.tileLayer.info.displayed.extent;O.setFromExtent(r),L.visible=!0,L.updateMatrixWorld(!0);const h=1.5*a.z;if(a.z=h,a.as(t.referenceCrs).toVector3(M.position),o.worldToLocal(M.position),M.position.z+=h,o.localToWorld(M.position),P.copy(t.camera3D.position),o.worldToLocal(P),P.z-=1.5*h,o.localToWorld(P),M.lookAt(P),k.update(),M.updateProjectionMatrix(),D){D.object3d.visible=!1,A=1e11;for(const t of l.level0Nodes)t.traverseVisible(T)}const c=u.displayCharts?Math.round(parseFloat(i.style.height.replace("%",""))*S.height/100)+3:0;if(k.visible=!0,k.updateMatrixWorld(!0),E.getClearColor(R),E.setViewport(S.width-n.x,c,n.x,n.y),E.setScissor(S.width-n.x,c,n.x,n.y),E.setScissorTest(!0),E.setClearColor(xs),E.clear(),E.render(t.scene,M),E.setScissorTest(!1),E.setClearColor(R),E.setViewport(0,0,S.width,S.height),k.visible=!1,L.visible=!1,D&&(D.object3d.visible=!0),D){A=D.fog.distance;for(const t of l.level0Nodes)t.traverseVisible(T)}}}}ks.prototype.createChartContainer=function(t){const e=document.createElement("div");e.style.cssText=`background-color: ${xs}; flex: auto;`,this.chartDivContainer.appendChild(e);const i=document.createElement("canvas");return i.height="20rem",i.id=t,e.appendChild(i),i},ks.prototype.updateChartDivSize=function(){let t=0;for(const e of this.chartDivContainer.getElementsByTagName("div"))"none"!==e.style.display&&t++;const e=Math.floor(100/t);for(const t of this.chartDivContainer.getElementsByTagName("div"))"none"!==t.style.display&&(t.style.width=`${e}%`);this.charts.forEach((t=>{t.resize(),t.update()}))};const Ms=ks;function Ss(t,e){let i=null;const n=t.__folders.Styling.__controllers;for(let t=0;t<n.length;t+=1){const s=n[t];if(s.property===e||s.name===e){i=s;break}}return i}function Es(t,e){const i=Ss(t,e);i&&(i.__li.style.display="none")}function As(t,e){const i=Ss(t,e);i&&(i.__li.style.display="")}function Ds(t,e,i){e=parseInt(e,10),[o.qW.INTENSITY,o.qW.ELEVATION,o.qW.SCAN_ANGLE].includes(e)?As(t,"gradient"):Es(t,"gradient"),o.qW.INTENSITY===e?(As(t,"minIntensityRange"),As(t,"maxIntensityRange")):(Es(t,"minIntensityRange"),Es(t,"maxIntensityRange")),o.qW.ELEVATION===e?(As(t,"minElevationRange"),As(t,"maxElevationRange")):(Es(t,"minElevationRange"),Es(t,"maxElevationRange")),o.qW.SCAN_ANGLE===e?(As(t,"minAngleRange"),As(t,"maxAngleRange")):(Es(t,"minAngleRange"),Es(t,"maxAngleRange")),(i=parseInt(i,10))===o.qU.VALUE?(Es(t,"minAttenuatedSize"),Es(t,"maxAttenuatedSize")):(As(t,"minAttenuatedSize"),As(t,"maxAttenuatedSize"))}const Os={initTools(t,e,i){e.debugUI=i.addFolder(`${e.id}`);const n=()=>{Ds(e.debugUI,e.material.mode,e.material.sizeMode),t.notifyChange(e,!0)};e.debugUI.add(e,"visible").name("Visible").onChange(n),e.debugUI.add(e,"sseThreshold").name("SSE threshold").onChange(n),e.debugUI.add(e,"octreeDepthLimit",-1,20).name("Depth limit").onChange(n),e.debugUI.add(e,"pointBudget",1,15e6).name("Max point count").onChange(n),e.debugUI.add(e.object3d.position,"z",-50,50).name("Z translation").onChange((()=>{e.object3d.updateMatrixWorld(),t.notifyChange(e)})),e.dbgStickyNode="",e.dbgDisplaySticky=!1,e.dbgDisplayChildren=!0,e.dbgDisplayParents=!0;const s=e.debugUI.addFolder("Styling");if(null!=e.material.mode){const t=Object.keys(o.qW),i=t.filter((t=>o.qW[t]===e.material.mode))[0];s.add({mode:i},"mode",t).name("Display mode").onChange((t=>{e.material.mode=o.qW[t],n()}));const a=Object.keys(e.material.gradients);s.add({gradient:a[0]},"gradient",a).name("gradient").onChange((t=>{e.material.gradient=e.material.gradients[t],n()})),s.add(e,"minIntensityRange",e.minIntensityRange,e.maxIntensityRange-1).name("Intensity min").onChange((t=>{t>=e.maxIntensityRange&&(e.maxIntensityRange=t+1,Ss(e.debugUI,"maxIntensityRange").updateDisplay()),n()})),s.add(e,"maxIntensityRange",e.minIntensityRange+1,e.maxIntensityRange).name("Intensity max").onChange((t=>{t<=e.minIntensityRange&&(e.minIntensityRange=t-1,Ss(e.debugUI,"minIntensityRange").updateDisplay()),n()})),s.add(e,"minElevationRange",e.minElevationRange,e.maxElevationRange).name("Elevation min").onChange((t=>{t>=e.maxElevationRange&&(e.maxElevationRange=t+1,Ss(e.debugUI,"maxElevationRange").updateDisplay()),n()})),s.add(e,"maxElevationRange",e.minElevationRange,e.maxElevationRange).name("Elevation max").onChange((t=>{t<=e.minElevationRange&&(e.minElevationRange=t-1,Ss(e.debugUI,"minElevationRange").updateDisplay()),n()})),s.add(e,"minAngleRange",e.minAngleRange,e.maxAngleRange).name("Angle min").onChange((t=>{t>=e.maxAngleRange&&(e.maxAngleRange=t+1,Ss(e.debugUI,"maxAngleRange").updateDisplay()),n()})),s.add(e,"maxAngleRange",e.minAngleRange,e.maxAngleRange).name("Angle max").onChange((t=>{t<=e.minAngleRange&&(e.minAngleRange=t-1,Ss(e.debugUI,"minAngleRange").updateDisplay()),n()}))}null!=e.material.shape&&s.add(e.material,"shape",o.cn).name("Shape mode").onChange(n),s.add(e,"opacity",0,1).name("Layer opacity").onChange(n),s.add(e,"pointSize",0,15).name("Point size").onChange(n),null!=e.material.sizeMode&&t.camera.camera3D.isPerspectiveCamera&&(s.add(e.material,"sizeAttenuation").name("Size attenuation").onChange(n),s.add(e.material,"minAttenuatedSize",0,15).name("Min size").onChange((t=>{t>e.material.maxAttenuatedSize&&(e.material.maxAttenuatedSize=t,Ss(e.debugUI,"maxAttenuatedSize").updateDisplay()),n()})),s.add(e.material,"maxAttenuatedSize",0,15).name("Max size").onChange((t=>{t<e.material.minAttenuatedSize&&(e.material.minAttenuatedSize=t,Ss(e.debugUI,"minAttenuatedSize").updateDisplay()),n()}))),null!=e.material.picking&&s.add(e.material,"picking").name("Display picking id").onChange(n);const a=e.debugUI.addFolder("Debug");a.add(e.bboxes,"visible").name("Display Bounding Boxes").onChange(n),a.add(e,"dbgStickyNode").name("Sticky node name").onChange(n),a.add(e,"dbgDisplaySticky").name("Display sticky node").onChange(n),a.add(e,"dbgDisplayChildren").name("Display children of sticky node").onChange(n),a.add(e,"dbgDisplayParents").name("Display parents of sticky node").onChange(n),Ds(e.debugUI,e.material.mode,e.material.sizeMode),t.addFrameRequester("before_layer_update",(()=>{if(e.dbgStickyNode.length){e.displayedCount=0;const t=e.dbgStickyNode.split(",");for(const i of e.group.children)i.visible=t.some((t=>{return n=t,s=i.owner.name,e.dbgDisplaySticky&&n===s||e.dbgDisplayParents&&n.startsWith(s)||e.dbgDisplayChildren&&s.startsWith(n);var n,s})),i.boxHelper&&(i.boxHelper.visible=i.visible),i.visible&&(e.displayedCount+=i.geometry.attributes.position.count)}}))}};var Ls=i(50040);function Ts(t,e){let i=0;const n=Date.now(),s={label:"Update 1st level",data:[{x:0,y:0}],borderColor:bs,borderWidth:1.5,pointRadius:1},o={label:"Update duration (ms)",data:[{x:0,y:0}],borderColor:ys,borderWidth:1.5,pointRadius:1},a=["0s"],r=new Qn(t,{type:"line",data:{labels:a,datasets:[s,o]},options:{animation:{duration:10},scales:_s}});this.update=(t,l)=>{const h=`${Math.floor((Date.now()-n)/1e3)}s`;i>0&&a[i]==h?a.push(""):(a.push(h),i=a.length-1),a.length>60&&(a.shift(),i--),s.data.push({x:0,y:e._latestUpdateStartingLevel}),o.data.push({x:0,y:l}),s.data.length>60&&(s.data.shift(),o.data.shift()),t&&r.update()},this.resize=()=>{r.resize()}}function Rs(t,e){const i=[],n=[],s=[],o=new Qn(t,{type:"bar",data:{labels:i,datasets:[{label:"Visible node per level",data:n,backgroundColor:bs},{label:"Diplayed node per level",data:s,backgroundColor:ys}]},options:{scales:_s}});this.update=t=>{const a={};!function t(i,n){if(i&&i.visible&&(i.level>=0&&i.layer===e&&(n[i.level]?n[i.level][0]+=1:n[i.level]=[1,0],i.material.visible&&(n[i.level][1]+=1)),i.children))for(const e of i.children)t(e,n)}(e.object3d,a),i.length=0,n.length=0;for(const t in a)({}).hasOwnProperty.call(a,t)&&(i[t]=`${t}`,n[t]=a[t][0],s[t]=a[t][1]);t&&o.update()},this.resize=()=>{o.resize()}}function Ps(t,e,i){t.defineLayerProperty(e,i,(()=>{(t.parent?t.parent.object3d:t.object3d).traverse((i=>{i.layer==t&&i.material?i.material[e]=t[e]:i.content&&i.content.layer==t&&i.content.traverse((i=>{i.material&&(i.material[e]=t[e])}))}))}))}const Is={addWireFrameCheckbox(t,e,i){t.add(i,"wireframe").name("Wireframe").onChange((()=>e.notifyChange(i)))},addMaterialSize(t,e,i,n,s){Ps(i,"size",1),t.add(i,"size",n,s).name("Size").onChange((()=>e.notifyChange(i)))},addMaterialLineWidth(t,e,i,n,s){Ps(i,"linewidth",1),t.add(i,"linewidth",n,s).name("Line Width").onChange((()=>e.notifyChange(i)))},createGeometryDebugUI(t,e,i){const n=t.addFolder(`Layer ${i.id}`);return n.add(i,"visible").name("Visible").onChange((()=>e.notifyChange(i))),n.add(i,"opacity",0,1).name("Opacity").onChange((()=>e.notifyChange(i))),n}};let zs;function Bs(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];zs&&(zs.material.overlayAlpha=0,zs.material.showOutline=t.tileLayer.showOutline,t.notifyChange(zs));const n=t.tileLayer.pickObjectsAt(t,e);return zs=n.length?n[0].object:void 0,zs&&(i&&console.info(zs),zs.material.overlayAlpha=.5,zs.material.showOutline=!0,t.notifyChange(zs)),zs}function Fs(t,e,i,s){let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e.isDebugMode&&!a)return;s=s||new Ms(e,t),i=i||e.tileLayer;const r=Is.createGeometryDebugUI(t,e,i),l=`${i.id}-nb-objects`,h=s.createChartContainer(l),c=`${i.id}-nb-visible`,d=s.createChartContainer(c);s.charts.push(new Ts(h.getContext("2d"),i)),s.charts.push(new Rs(d.getContext("2d"),i)),i.showOutline=!1,i.wireframe=!1;const u={objectChart:!0,visibilityChart:!0,sseHelper:!1};r.add(i,"showOutline").name("Show tiles").onChange((t=>{i.showOutline=t,function(e,i,n){i.traverse((e=>{e.material&&e.layer===n&&(e.material.showOutline=t)})),e.notifyChange()}(e,i.object3d,i)})),r.add(i,"wireframe").name("Wireframe").onChange((()=>{e.notifyChange(i)})),r.add(u,"objectChart").name("Object chart").onChange((t=>{document.getElementById(l).parentNode.style.display=t?"block":"none",s.updateChartDivSize(),s.charts.forEach((t=>t.update()))})),r.add(u,"visibilityChart").name("Visibility chart").onChange((t=>{document.getElementById(c).parentNode.style.display=t?"block":"none",s.updateChartDivSize(),s.charts.forEach((t=>t.update()))}));const p=`${i.id}_obb_debug`,f=`${i.id}_sb_debug`,g=new n.SphereGeometry(1,16,16);function m(t,e,i){if(!i.parent||!e.visible)return void o.cq.removeChildrenAndCleanupRecursively(e,i);let s=i.link[e.id];if(i.visible&&i.material&&i.material.visible){if(!s){if(s=new n.Group,s.layer=e,i.matrixWorld.decompose(s.position,s.quaternion,s.scale),e.id==p){const t=new Cs(i.obb);t.layer=e,s.add(t)}else if(e.id==f){const t=new n.Color(Math.random(),Math.random(),Math.random()),o=new n.MeshBasicMaterial({color:t.getHex(),wireframe:!0}),a=new n.Mesh(g,o);a.position.copy(i.boundingSphere.center),a.scale.multiplyScalar(i.boundingSphere.radius),a.scale.set(1,1,1).multiplyScalar(i.boundingSphere.radius),a.layer=e,s.add(a)}i.link[e.id]=s}e.object3d.add(s),s.updateMatrixWorld(!0)}else s&&e.object3d.remove(s)}class _ extends o.Q2{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e.object3d||new n.Group,e),this.update=m,this.isDebugLayer=!0}preUpdate(t,e){e.has(this.parent)&&this.object3d.clear()}}const b=new _(p,{visible:!1,cacheLifeTime:1/0,source:!1});e.addLayer(b).then((t=>{r.add(t,"visible").name("Bounding boxes").onChange((()=>{e.notifyChange(t)}))}));const y=new _(f,{visible:!1,cacheLifeTime:1/0,source:!1});e.addLayer(y).then((t=>{r.add(t,"visible").name("Bounding Spheres").onChange((()=>{e.notifyChange(t)}))}));const x=document.getElementById("viewerDiv"),v=document.createElement("span");v.className="circleBase",x.appendChild(v);const w=new n.Vector3;let C;const k=()=>{Ls.Ay.update(),e.notifyChange()},M=()=>{Ls.Ay.removeAll(),e._frameRequesters[o.n7.BEFORE_RENDER].includes(k)&&e.removeFrameRequester(o.n7.BEFORE_RENDER,k)};function S(t){const i=Bs(e,t,!1);if(i){v.style.display="table-cell",w.copy(i.boundingSphere.center).applyMatrix4(i.matrixWorld);const t=w.project(e.camera3D),n=e.normalizedToViewCoords(t),s=i.screenSize;if(C!=i){const t=Number(v.style.width.replace("px",""));C=i,M(),new Ls.Ay.Tween({size:t}).to({size:s},500).easing(Ls.Ay.Easing.Sinusoidal.In).easing(Ls.Ay.Easing.Exponential.Out).onUpdate((t=>{v.style["line-height"]=`${t.size}px`,v.style.width=`${t.size}px`,v.style.height=`${t.size}px`,v.innerHTML=`${Math.floor(t.size)} px`,v.style.left=n.x-.5*t.size+"px",v.style.top=n.y-.5*t.size+"px"})).onComplete(M).start(),e.addFrameRequester(o.n7.BEFORE_RENDER,k)}}else v.style.display="none"}r.add(u,"sseHelper").name("Sse helper").onChange((t=>{t?window.addEventListener("mousemove",S,!1):(v.style.display="none",M(),window.removeEventListener("mousemove",S))}));let E=null;window.addEventListener("mousedown",(t=>{83==E&&Bs(e,t)})),window.addEventListener("keydown",(t=>{E=t.which})),window.addEventListener("keyup",(()=>{E=null}))}const Ns=new n.Mesh;function Vs(t,e,i){const s=Is.createGeometryDebugUI(t,e,i);Is.addWireFrameCheckbox(s,e,i);const a=`${i.id}_bounding_volume_debug`,r=new o.Q2(a,new n.Object3D,{visible:!1,cacheLifeTime:1/0,source:!1});if(r.update=function(t,e,s){const a=s.userData.metadata;let r=s.userData.boundingVolumeHelper;if(r)r.visible=!(!e.visible||!s.visible);else if(e.visible&&s.visible&&a.boundingVolume){if(a.boundingVolume.initialVolumeType===o.he.box){if(Ns.geometry.boundingBox=a.boundingVolume.volume,r=new n.BoxHelper(Ns),r.material.linewidth=2,a.content?.uri&&a.content?.uri.endsWith("b3dm")){const t=i.tileset.asset.gltfUpAxis;void 0===t||"Y"===t?r.rotation.x=.5*-Math.PI:"X"===t&&(r.rotation.z=.5*-Math.PI),r.updateMatrix()}}else{if(a.boundingVolume.initialVolumeType!==o.he.sphere&&a.boundingVolume.initialVolumeType!==o.he.region)return void console.warn(`[3D Tiles Debug]: Unknown bounding volume: ${a.boundingVolume}`);{const t=new n.SphereGeometry(a.boundingVolume.volume.radius,32,32),e=new n.MeshBasicMaterial({wireframe:!0,color:16777215*Math.random()});r=new n.Mesh(t,e)}}s.userData.boundingVolumeHelper=r,s.parent.add(r),r.updateMatrixWorld(!0)}},o.Ss.prototype.addLayer.call(e,r,i).then((t=>{s.add(t,"visible").name("Bounding boxes").onChange((()=>{e.notifyChange(e.camera3D)}))})),s.add(i,"sseThreshold",0,100).name("sseThreshold").onChange((()=>{e.notifyChange(e.camera3D)})),s.add({frozen:i.frozen},"frozen").onChange((t=>{i.frozen=t,e.notifyChange(i)})),i.hasPnts){const t={CLASSIFICATION:o.qW.CLASSIFICATION,COLOR:o.qW.COLOR};s.add(i,"pntsMode",t).name("Display mode").onChange((()=>{i.pntsMode=+i.pntsMode,e.notifyChange(e.camera.camera3D)})),s.add(i,"pntsShape",o.cn).name("Points Shape").onChange((()=>{e.notifyChange(e.camera.camera3D)})),s.add(i,"pntsSizeMode",o.qU).name("Pnts size mode").onChange((()=>{e.notifyChange(e.camera.camera3D)})),s.add(i,"pntsMinAttenuatedSize",0,15).name("Min attenuated size").onChange((()=>{e.notifyChange(e.camera.camera3D)})),s.add(i,"pntsMaxAttenuatedSize",0,15).name("Max attenuated size").onChange((()=>{e.notifyChange(e.camera.camera3D)}))}}const Hs=new n.Vector3,js=["x","y","z"];class Us extends n.LineSegments{constructor(t,e=16776960,i=40){const s=new n.BufferGeometry,o=[];for(let t=0;t<3;t++){const e=js[t],n=js[(t+1)%3];Hs.set(0,0,0);for(let t=0;t<i;t++){let s;s=2*Math.PI*t/(i-1),Hs[e]=Math.sin(s),Hs[n]=Math.cos(s),o.push(Hs.x,Hs.y,Hs.z),s=2*Math.PI*(t+1)/(i-1),Hs[e]=Math.sin(s),Hs[n]=Math.cos(s),o.push(Hs.x,Hs.y,Hs.z)}}s.setAttribute("position",new n.BufferAttribute(new Float32Array(o),3)),s.computeBoundingSphere(),super(s,new n.LineBasicMaterial({color:e,toneMapped:!1})),this.sphere=t,this.type="SphereHelper"}updateMatrixWorld(t){const e=this.sphere;this.position.copy(e.center),this.scale.setScalar(e.radius),super.updateMatrixWorld(t)}}var Gs=i(5247);const Ws=new n.Vector3,$s=new n.Vector3,Ys=new n.Vector3;new n.Vector3,new n.Vector3;class Xs extends n.LineSegments{constructor(t=new Gs.M,e=16776960){super(),this.ellipsoidRegion=t,this.material.color.set(e),this.update()}update(){const t=function(t,{computeNormals:e=!1}={}){const{latStart:i=-Math.PI/2,latEnd:s=Math.PI/2,lonStart:o=0,lonEnd:a=2*Math.PI,heightStart:r=0,heightEnd:l=0}=t,h=new n.BoxGeometry(1,1,1,32,32),{normal:c,position:d}=h.attributes,u=d.clone();for(let e=0,h=d.count;e<h;e++){Ys.fromBufferAttribute(d,e);const h=n.MathUtils.mapLinear(Ys.x,-.5,.5,i,s),c=n.MathUtils.mapLinear(Ys.y,-.5,.5,o,a);let u=r;t.getCartographicToNormal(h,c,Ws),Ys.z<0&&(u=l),t.getCartographicToPosition(h,c,u,Ys),d.setXYZ(e,...Ys)}e&&h.computeVertexNormals();for(let e=0,r=u.count;e<r;e++){Ys.fromBufferAttribute(u,e);const r=n.MathUtils.mapLinear(Ys.x,-.5,.5,i,s),l=n.MathUtils.mapLinear(Ys.y,-.5,.5,o,a);Ws.fromBufferAttribute(c,e),t.getCartographicToNormal(r,l,$s),Math.abs(Ws.dot($s))>.1&&(Ys.z>0&&$s.multiplyScalar(-1),c.setXYZ(e,...$s))}return h}(this.ellipsoidRegion);this.geometry.dispose(),this.geometry=new n.EdgesGeometry(t,80)}dispose(){this.geometry.dispose(),this.material.dispose()}}n.Mesh;var qs=i(79175);const Ks=Symbol("ORIGINAL_MATERIAL"),Qs=Symbol("HAS_RANDOM_COLOR"),Js=Symbol("HAS_RANDOM_NODE_COLOR"),Zs=Symbol("LOAD_TIME"),to=Symbol("PARENT_BOUND_REF_COUNT"),eo=new n.Sphere,io=()=>{},no={};function so(t){if(!no[t]){const e=Math.random(),i=.5+.5*Math.random(),s=.375+.25*Math.random();no[t]=(new n.Color).setHSL(e,i,s)}return no[t]}const oo=Object.freeze({NONE:0,SCREEN_ERROR:1,GEOMETRIC_ERROR:2,DISTANCE:3,DEPTH:4,RELATIVE_DEPTH:5,IS_LEAF:6,RANDOM_COLOR:7,RANDOM_NODE_COLOR:8,CUSTOM_COLOR:9,LOAD_ORDER:10});class ao{static get ColorModes(){return oo}constructor(t){t={displayParentBounds:!1,displayBoxBounds:!1,displaySphereBounds:!1,displayRegionBounds:!1,colorMode:0,maxDebugDepth:-1,maxDebugDistance:-1,maxDebugError:-1,customColorCallback:null,...t},this.name="DEBUG_TILES_PLUGIN",this.tiles=null,this._enabled=!0,this.extremeDebugDepth=-1,this.extremeDebugError=-1,this.boxGroup=null,this.sphereGroup=null,this.regionGroup=null,this._displayParentBounds=t.displayParentBounds,this.displayBoxBounds=t.displayBoxBounds,this.displaySphereBounds=t.displaySphereBounds,this.displayRegionBounds=t.displayRegionBounds,this.colorMode=t.colorMode,this.maxDebugDepth=t.maxDebugDepth,this.maxDebugDistance=t.maxDebugDistance,this.maxDebugError=t.maxDebugError,this.customColorCallback=t.customColorCallback,this.getDebugColor=(t,e)=>{e.setRGB(t,t,t)}}get enabled(){return this._enabled}set enabled(t){t!==this._enabled&&(this._enabled=t,this._enabled?this.tiles&&this.init(this.tiles):this.dispose())}get displayParentBounds(){return this._displayParentBounds}set displayParentBounds(t){this._displayParentBounds!==t&&(this._displayParentBounds=t,t?this.tiles.traverse((t=>{t.__visible&&this._onTileVisibilityChange(t,!0)})):(0,qs.R4)(this.tiles.root,null,(t=>{t[to]=null,this._onTileVisibilityChange(t,t.__visible)})))}init(t){this.tiles=t;const e=t.group;this.boxGroup=new n.Group,this.boxGroup.name="DebugTilesRenderer.boxGroup",e.add(this.boxGroup),this.boxGroup.updateMatrixWorld(),this.sphereGroup=new n.Group,this.sphereGroup.name="DebugTilesRenderer.sphereGroup",e.add(this.sphereGroup),this.sphereGroup.updateMatrixWorld(),this.regionGroup=new n.Group,this.regionGroup.name="DebugTilesRenderer.regionGroup",e.add(this.regionGroup),this.regionGroup.updateMatrixWorld(),this._onLoadTileSetCB=()=>{this._initExtremes()},this._onLoadModelCB=({scene:t,tile:e})=>{this._onLoadModel(t,e)},this._onDisposeModelCB=({tile:t})=>{this._onDisposeModel(t)},this._onUpdateAfterCB=()=>{this._onUpdateAfter()},this._onTileVisibilityChangeCB=({scene:t,tile:e,visible:i})=>{this._onTileVisibilityChange(e,i)},t.addEventListener("load-tile-set",this._onLoadTileSetCB),t.addEventListener("load-model",this._onLoadModelCB),t.addEventListener("dispose-model",this._onDisposeModelCB),t.addEventListener("update-after",this._onUpdateAfterCB),t.addEventListener("tile-visibility-change",this._onTileVisibilityChangeCB),this._initExtremes(),t.traverse((t=>{t.cached.scene&&this._onLoadModel(t.cached.scene,t)})),t.visibleTiles.forEach((t=>{this._onTileVisibilityChange(t,!0)}))}getTileInformationFromActiveObject(t){let e=null;return this.tiles.activeTiles.forEach((i=>{if(e)return!0;const n=i.cached.scene;n&&n.traverse((n=>{n===t&&(e=i)}))})),e?{distanceToCamera:e.__distanceFromCamera,geometricError:e.geometricError,screenSpaceError:e.__error,depth:e.__depth,isLeaf:e.__isLeaf}:null}_initExtremes(){if(!this.tiles||!this.tiles.root)return;let t=-1,e=-1;(0,qs.R4)(this.tiles.root,null,((i,n,s)=>{t=Math.max(t,s),e=Math.max(e,i.geometricError)})),this.extremeDebugDepth=t,this.extremeDebugError=e}_onUpdateAfter(){const t=this.tiles;if(!t.root)return;this.boxGroup.visible=this.displayBoxBounds,this.sphereGroup.visible=this.displaySphereBounds,this.regionGroup.visible=this.displayRegionBounds;let e=-1;e=-1===this.maxDebugDepth?this.extremeDebugDepth:this.maxDebugDepth;let i=-1;i=-1===this.maxDebugError?this.extremeDebugError:this.maxDebugError;let s=-1;-1===this.maxDebugDistance?(t.getBoundingSphere(eo),s=eo.radius):s=this.maxDebugDistance;const o=this.errorTarget,a=this.colorMode,r=t.visibleTiles;let l;10===a&&(l=Array.from(r).sort(((t,e)=>t[Zs]-e[Zs]))),r.forEach((t=>{const r=t.cached.scene;let h,c,d;7===a&&(h=Math.random(),c=.5+.5*Math.random(),d=.375+.25*Math.random()),r.traverse((r=>{8===a&&(h=Math.random(),c=.5+.5*Math.random(),d=.375+.25*Math.random());const u=r.material;if(u){const p=r[Ks];if(0===a&&u!==p)r.material.dispose(),r.material=r[Ks];else if(0!==a&&u===p)if(r.isPoints){const t=new n.PointsMaterial;t.size=p.size,t.sizeAttenuation=p.sizeAttenuation,r.material=t}else r.material=new n.MeshStandardMaterial,r.material.flatShading=!0;switch(7!==a&&delete r.material[Qs],8!==a&&delete r.material[Js],a){case 4:{const i=t.__depth/e;this.getDebugColor(i,r.material.color);break}case 5:{const i=t.__depthFromRenderedParent/e;this.getDebugColor(i,r.material.color);break}case 1:{const e=t.__error/o;e>1?r.material.color.setRGB(1,0,0):this.getDebugColor(e,r.material.color);break}case 2:{const e=Math.min(t.geometricError/i,1);this.getDebugColor(e,r.material.color);break}case 3:{const e=Math.min(t.__distanceFromCamera/s,1);this.getDebugColor(e,r.material.color);break}case 6:t.children&&0!==t.children.length?this.getDebugColor(0,r.material.color):this.getDebugColor(1,r.material.color);break;case 8:r.material[Js]||(r.material.color.setHSL(h,c,d),r.material[Js]=!0);break;case 7:r.material[Qs]||(r.material.color.setHSL(h,c,d),r.material[Qs]=!0);break;case 9:this.customColorCallback?this.customColorCallback(t,r):console.warn("DebugTilesRenderer: customColorCallback not defined");break;case 10:{const e=l.indexOf(t);this.getDebugColor(e/(l.length-1),r.material.color);break}}}}))}))}_onTileVisibilityChange(t,e){this.displayParentBounds?(0,qs.pN)(t,(i=>{null==i[to]&&(i[to]=0),e?i[to]++:i[to]>0&&i[to]--;const n=i===t&&e||this.displayParentBounds&&i[to]>0;this._updateBoundHelper(i,n)})):this._updateBoundHelper(t,e)}_createBoundHelper(t){const e=this.tiles,i=t.cached,{sphere:s,obb:o,region:a}=i.boundingVolume;if(o){const s=new n.Group;s.name="DebugTilesRenderer.boxHelperGroup",s.matrix.copy(o.transform),s.matrixAutoUpdate=!1;const a=new n.Box3Helper(o.box,so(t.__depth));a.raycast=io,s.add(a),i.boxHelperGroup=s,e.visibleTiles.has(t)&&this.displayBoxBounds&&(this.boxGroup.add(s),s.updateMatrixWorld(!0))}if(s){const n=new Us(s,so(t.__depth));n.raycast=io,i.sphereHelper=n,e.visibleTiles.has(t)&&this.displaySphereBounds&&(this.sphereGroup.add(n),n.updateMatrixWorld(!0))}if(a){const s=new Xs(a,so(t.__depth));s.raycast=io;const o=new n.Sphere;a.getBoundingSphere(o),s.position.copy(o.center),o.center.multiplyScalar(-1),s.geometry.translate(...o.center),i.regionHelper=s,e.visibleTiles.has(t)&&this.displayRegionBounds&&(this.regionGroup.add(s),s.updateMatrixWorld(!0))}}_updateHelperMaterial(t,e){t.__visible||!this.displayParentBounds?e.opacity=1:e.opacity=.2;const i=e.transparent;e.transparent=e.opacity<1,e.transparent!==i&&(e.needsUpdate=!0)}_updateBoundHelper(t,e){const i=t.cached;if(!i)return;const n=this.sphereGroup,s=this.boxGroup,o=this.regionGroup;e&&null==i.boxHelperGroup&&null==i.sphereHelper&&null==i.regionHelper&&this._createBoundHelper(t);const a=i.boxHelperGroup,r=i.sphereHelper,l=i.regionHelper;e?(a&&(s.add(a),a.updateMatrixWorld(!0),this._updateHelperMaterial(t,a.children[0].material)),r&&(n.add(r),r.updateMatrixWorld(!0),this._updateHelperMaterial(t,r.material)),l&&(o.add(l),l.updateMatrixWorld(!0),this._updateHelperMaterial(t,l.material))):(a&&s.remove(a),r&&n.remove(r),l&&o.remove(l))}_onLoadModel(t,e){e[Zs]=performance.now(),t.traverse((t=>{const e=t.material;e&&(t[Ks]=e)}))}_onDisposeModel(t){const e=t.cached;e.boxHelperGroup&&(e.boxHelperGroup.children[0].geometry.dispose(),delete e.boxHelperGroup),e.sphereHelper&&(e.sphereHelper.geometry.dispose(),delete e.sphereHelper),e.regionHelper&&(e.regionHelper.geometry.dispose(),delete e.regionHelper)}dispose(){const t=this.tiles;t&&(t.removeEventListener("load-tile-set",this._onLoadTileSetCB),t.removeEventListener("load-model",this._onLoadModelCB),t.removeEventListener("dispose-model",this._onDisposeModelCB),t.removeEventListener("update-after",this._onUpdateAfterCB),t.removeEventListener("tile-visibility-change",this._onTileVisibilityChangeCB),this.colorMode=0,this._onUpdateAfter(),t.traverse((t=>{this._onDisposeModel(t)}))),this.boxGroup?.removeFromParent(),this.sphereGroup?.removeFromParent(),this.regionGroup?.removeFromParent()}}function ro(t,e,i){const n=Is.createGeometryDebugUI(t,e,i);Is.addWireFrameCheckbox(n,e,i),n.add({frozen:i.frozen},"frozen").onChange((t=>{i.frozen=t,e.notifyChange(i)}));const s=new ao;i.tilesRenderer.registerPlugin(s),n.add(s,"displayBoxBounds").name("Bounding boxes").onChange((()=>{e.notifyChange(e.camera3D)})),n.add(s,"displaySphereBounds").name("Bounding spheres").onChange((()=>{e.notifyChange(e.camera3D)})),n.add(s,"displayRegionBounds").name("Bounding regions").onChange((()=>{e.notifyChange(e.camera3D)})),n.add(i,"sseThreshold",0,100).name("sseThreshold").onChange((()=>{e.notifyChange(e.camera3D)})),i.addEventListener("load-model",(function t(s){let{scene:a}=s,r=!1;if(a.traverse((t=>{t.isPoints&&(r=!0)})),!r)return;const l={CLASSIFICATION:o.qW.CLASSIFICATION,COLOR:o.qW.COLOR};n.add(i,"pntsMode",l).name("Display mode").onChange((()=>{i.pntsMode=+i.pntsMode,e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsShape",o.cn).name("Points Shape").onChange((()=>{e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsSizeMode",o.qU).name("Pnts size mode").onChange((()=>{e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsMinAttenuatedSize",0,15).name("Min attenuated size").onChange((()=>{e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsMaxAttenuatedSize",0,15).name("Max attenuated size").onChange((()=>{e.notifyChange(e.camera.camera3D)})),i.removeEventListener("load-model",t)}))}function lo(t,e){var i=t.__state.conversionName.toString(),n=Math.round(t.r),s=Math.round(t.g),o=Math.round(t.b),a=t.a,r=Math.round(t.h),l=t.s.toFixed(1),h=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===i||"SIX_CHAR_HEX"===i){for(var c=t.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===i?"rgb("+n+","+s+","+o+")":"CSS_RGBA"===i?"rgba("+n+","+s+","+o+","+a+")":"HEX"===i?"0x"+t.hex.toString(16):"RGB_ARRAY"===i?"["+n+","+s+","+o+"]":"RGBA_ARRAY"===i?"["+n+","+s+","+o+","+a+"]":"RGB_OBJ"===i?"{r:"+n+",g:"+s+",b:"+o+"}":"RGBA_OBJ"===i?"{r:"+n+",g:"+s+",b:"+o+",a:"+a+"}":"HSV_OBJ"===i?"{h:"+r+",s:"+l+",v:"+h+"}":"HSVA_OBJ"===i?"{h:"+r+",s:"+l+",v:"+h+",a:"+a+"}":"unknown format"}var ho=Array.prototype.forEach,co=Array.prototype.slice,uo={BREAK:{},extend:function(t){return this.each(co.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(e[i])||(t[i]=e[i])}.bind(this))}),this),t},defaults:function(t){return this.each(co.call(arguments,1),(function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(i){this.isUndefined(t[i])&&(t[i]=e[i])}.bind(this))}),this),t},compose:function(){var t=co.call(arguments);return function(){for(var e=co.call(arguments),i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},each:function(t,e,i){if(t)if(ho&&t.forEach&&t.forEach===ho)t.forEach(e,i);else if(t.length===t.length+0){var n,s=void 0;for(s=0,n=t.length;s<n;s++)if(s in t&&e.call(i,t[s],s)===this.BREAK)return}else for(var o in t)if(e.call(i,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var n=void 0;return function(){var s=this,o=arguments,a=i||!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(s,o)}),e),a&&t.apply(s,o)}},toArray:function(t){return t.toArray?t.toArray():co.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return isNaN(t)})),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return t instanceof Function}},po=[{litmus:uo.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:lo},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:lo},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:lo},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:lo}}},{litmus:uo.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:uo.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:uo.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(uo.isNumber(t.r)&&uo.isNumber(t.g)&&uo.isNumber(t.b)&&uo.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(uo.isNumber(t.r)&&uo.isNumber(t.g)&&uo.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(uo.isNumber(t.h)&&uo.isNumber(t.s)&&uo.isNumber(t.v)&&uo.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(uo.isNumber(t.h)&&uo.isNumber(t.s)&&uo.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],fo=void 0,go=void 0,mo=function(){go=!1;var t=arguments.length>1?uo.toArray(arguments):arguments[0];return uo.each(po,(function(e){if(e.litmus(t))return uo.each(e.conversions,(function(e,i){if(fo=e.read(t),!1===go&&!1!==fo)return go=fo,fo.conversionName=i,fo.conversion=e,uo.BREAK})),uo.BREAK})),go},_o=void 0,bo={hsv_to_rgb:function(t,e,i){var n=Math.floor(t/60)%6,s=t/60-Math.floor(t/60),o=i*(1-e),a=i*(1-s*e),r=i*(1-(1-s)*e),l=[[i,r,o],[a,i,o],[o,i,r],[o,a,i],[r,o,i],[i,o,a]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(t,e,i){var n=Math.min(t,e,i),s=Math.max(t,e,i),o=s-n,a=void 0;return 0===s?{h:NaN,s:0,v:0}:(a=t===s?(e-i)/o:e===s?2+(i-t)/o:4+(t-e)/o,(a/=6)<0&&(a+=1),{h:360*a,s:o/s,v:s/255})},rgb_to_hex:function(t,e,i){var n=this.hex_with_component(0,2,t);return n=this.hex_with_component(n,1,e),this.hex_with_component(n,0,i)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,i){return i<<(_o=8*e)|t&~(255<<_o)}},yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xo=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},vo=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),wo=function t(e,i,n){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,i);if(void 0===s){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in s)return s.value;var a=s.get;return void 0!==a?a.call(n):void 0},Co=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},ko=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Mo=function(){function t(){if(xo(this,t),this.__state=mo.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return vo(t,[{key:"toString",value:function(){return lo(this)}},{key:"toHexString",value:function(){return lo(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function So(t,e,i){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||Mo.recalculateRGB(this,e,i),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(Mo.recalculateRGB(this,e,i),this.__state.space="RGB"),this.__state[e]=t}})}function Eo(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||Mo.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(Mo.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}Mo.recalculateRGB=function(t,e,i){if("HEX"===t.__state.space)t.__state[e]=bo.component_from_hex(t.__state.hex,i);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");uo.extend(t.__state,bo.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},Mo.recalculateHSV=function(t){var e=bo.rgb_to_hsv(t.r,t.g,t.b);uo.extend(t.__state,{s:e.s,v:e.v}),uo.isNaN(e.h)?uo.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},Mo.COMPONENTS=["r","g","b","h","s","v","hex","a"],So(Mo.prototype,"r",2),So(Mo.prototype,"g",1),So(Mo.prototype,"b",0),Eo(Mo.prototype,"h"),Eo(Mo.prototype,"s"),Eo(Mo.prototype,"v"),Object.defineProperty(Mo.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(Mo.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=bo.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}});var Ao=function(){function t(e,i){xo(this,t),this.initialValue=e[i],this.domElement=document.createElement("div"),this.object=e,this.property=i,this.__onChange=void 0,this.__onFinishChange=void 0}return vo(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),Do={};uo.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){uo.each(t,(function(t){Do[t]=e}))}));var Oo=/(\d+(\.\d+)?)px/;function Lo(t){if("0"===t||uo.isUndefined(t))return 0;var e=t.match(Oo);return uo.isNull(e)?0:parseFloat(e[1])}var To={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,i){var n=i,s=e;uo.isUndefined(s)&&(s=!0),uo.isUndefined(n)&&(n=!0),t.style.position="absolute",s&&(t.style.left=0,t.style.right=0),n&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,i,n){var s=i||{},o=Do[e];if(!o)throw new Error("Event type "+e+" not supported.");var a=document.createEvent(o);switch(o){case"MouseEvents":var r=s.x||s.clientX||0,l=s.y||s.clientY||0;a.initMouseEvent(e,s.bubbles||!1,s.cancelable||!0,window,s.clickCount||1,0,0,r,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var h=a.initKeyboardEvent||a.initKeyEvent;uo.defaults(s,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),h(e,s.bubbles||!1,s.cancelable,window,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.keyCode,s.charCode);break;default:a.initEvent(e,s.bubbles||!1,s.cancelable||!0)}uo.defaults(a,n),t.dispatchEvent(a)},bind:function(t,e,i,n){var s=n||!1;return t.addEventListener?t.addEventListener(e,i,s):t.attachEvent&&t.attachEvent("on"+e,i),To},unbind:function(t,e,i,n){var s=n||!1;return t.removeEventListener?t.removeEventListener(e,i,s):t.detachEvent&&t.detachEvent("on"+e,i),To},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var i=t.className.split(/ +/);-1===i.indexOf(e)&&(i.push(e),t.className=i.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return To},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var i=t.className.split(/ +/),n=i.indexOf(e);-1!==n&&(i.splice(n,1),t.className=i.join(" "))}else t.className=void 0;return To},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return Lo(e["border-left-width"])+Lo(e["border-right-width"])+Lo(e["padding-left"])+Lo(e["padding-right"])+Lo(e.width)},getHeight:function(t){var e=getComputedStyle(t);return Lo(e["border-top-width"])+Lo(e["border-bottom-width"])+Lo(e["padding-top"])+Lo(e["padding-bottom"])+Lo(e.height)},getOffset:function(t){var e=t,i={left:0,top:0};if(e.offsetParent)do{i.left+=e.offsetLeft,i.top+=e.offsetTop,e=e.offsetParent}while(e);return i},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},Ro=function(t){function e(t,i){xo(this,e);var n=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),To.bind(n.__checkbox,"change",(function(){s.setValue(!s.__prev)}),!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return Co(e,t),vo(e,[{key:"setValue",value:function(t){var i=wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),i}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Ao),Po=function(t){function e(t,i,n){xo(this,e);var s=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=n,a=s;if(s.__select=document.createElement("select"),uo.isArray(o)){var r={};uo.each(o,(function(t){r[t]=t})),o=r}return uo.each(o,(function(t,e){var i=document.createElement("option");i.innerHTML=e,i.setAttribute("value",t),a.__select.appendChild(i)})),s.updateDisplay(),To.bind(s.__select,"change",(function(){var t=this.options[this.selectedIndex].value;a.setValue(t)})),s.domElement.appendChild(s.__select),s}return Co(e,t),vo(e,[{key:"setValue",value:function(t){var i=wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),i}},{key:"updateDisplay",value:function(){return To.isActive(this.__select)?this:(this.__select.value=this.getValue(),wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(Ao),Io=function(t){function e(t,i){xo(this,e);var n=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n;function o(){s.setValue(s.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),To.bind(n.__input,"keyup",o),To.bind(n.__input,"change",o),To.bind(n.__input,"blur",(function(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())})),To.bind(n.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return Co(e,t),vo(e,[{key:"updateDisplay",value:function(){return To.isActive(this.__input)||(this.__input.value=this.getValue()),wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Ao);function zo(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var Bo=function(t){function e(t,i,n){xo(this,e);var s=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=n||{};return s.__min=o.min,s.__max=o.max,s.__step=o.step,uo.isUndefined(s.__step)?0===s.initialValue?s.__impliedStep=1:s.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(s.initialValue))/Math.LN10))/10:s.__impliedStep=s.__step,s.__precision=zo(s.__impliedStep),s}return Co(e,t),vo(e,[{key:"setValue",value:function(t){var i=t;return void 0!==this.__min&&i<this.__min?i=this.__min:void 0!==this.__max&&i>this.__max&&(i=this.__max),void 0!==this.__step&&i%this.__step!=0&&(i=Math.round(i/this.__step)*this.__step),wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,i)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=zo(t),this}}]),e}(Ao),Fo=function(t){function e(t,i,n){xo(this,e);var s=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n));s.__truncationSuspended=!1;var o=s,a=void 0;function r(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function l(t){var e=a-t.clientY;o.setValue(o.getValue()+e*o.__impliedStep),a=t.clientY}function h(){To.unbind(window,"mousemove",l),To.unbind(window,"mouseup",h),r()}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),To.bind(s.__input,"change",(function(){var t=parseFloat(o.__input.value);uo.isNaN(t)||o.setValue(t)})),To.bind(s.__input,"blur",(function(){r()})),To.bind(s.__input,"mousedown",(function(t){To.bind(window,"mousemove",l),To.bind(window,"mouseup",h),a=t.clientY})),To.bind(s.__input,"keydown",(function(t){13===t.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,r())})),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return Co(e,t),vo(e,[{key:"updateDisplay",value:function(){var t,i,n;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),i=this.__precision,n=Math.pow(10,i),Math.round(t*n)/n),wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Bo);function No(t,e,i,n,s){return n+(t-e)/(i-e)*(s-n)}var Vo=function(t){function e(t,i,n,s,o){xo(this,e);var a=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,{min:n,max:s,step:o})),r=a;function l(t){t.preventDefault();var e=r.__background.getBoundingClientRect();return r.setValue(No(t.clientX,e.left,e.right,r.__min,r.__max)),!1}function h(){To.unbind(window,"mousemove",l),To.unbind(window,"mouseup",h),r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}function c(t){var e=t.touches[0].clientX,i=r.__background.getBoundingClientRect();r.setValue(No(e,i.left,i.right,r.__min,r.__max))}function d(){To.unbind(window,"touchmove",c),To.unbind(window,"touchend",d),r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),To.bind(a.__background,"mousedown",(function(t){document.activeElement.blur(),To.bind(window,"mousemove",l),To.bind(window,"mouseup",h),l(t)})),To.bind(a.__background,"touchstart",(function(t){1===t.touches.length&&(To.bind(window,"touchmove",c),To.bind(window,"touchend",d),c(t))})),To.addClass(a.__background,"slider"),To.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return Co(e,t),vo(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",wo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Bo),Ho=function(t){function e(t,i,n){xo(this,e);var s=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),o=s;return s.__button=document.createElement("div"),s.__button.innerHTML=void 0===n?"Fire":n,To.bind(s.__button,"click",(function(t){return t.preventDefault(),o.fire(),!1})),To.addClass(s.__button,"button"),s.domElement.appendChild(s.__button),s}return Co(e,t),vo(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(Ao),jo=function(t){function e(t,i){xo(this,e);var n=ko(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));n.__color=new Mo(n.getValue()),n.__temp=new Mo(0);var s=n;n.domElement=document.createElement("div"),To.makeSelectable(n.domElement,!1),n.__selector=document.createElement("div"),n.__selector.className="selector",n.__saturation_field=document.createElement("div"),n.__saturation_field.className="saturation-field",n.__field_knob=document.createElement("div"),n.__field_knob.className="field-knob",n.__field_knob_border="2px solid ",n.__hue_knob=document.createElement("div"),n.__hue_knob.className="hue-knob",n.__hue_field=document.createElement("div"),n.__hue_field.className="hue-field",n.__input=document.createElement("input"),n.__input.type="text",n.__input_textShadow="0 1px 1px ",To.bind(n.__input,"keydown",(function(t){13===t.keyCode&&d.call(this)})),To.bind(n.__input,"blur",d),To.bind(n.__selector,"mousedown",(function(){To.addClass(this,"drag").bind(window,"mouseup",(function(){To.removeClass(s.__selector,"drag")}))})),To.bind(n.__selector,"touchstart",(function(){To.addClass(this,"drag").bind(window,"touchend",(function(){To.removeClass(s.__selector,"drag")}))}));var o,a=document.createElement("div");function r(t){p(t),To.bind(window,"mousemove",p),To.bind(window,"touchmove",p),To.bind(window,"mouseup",h),To.bind(window,"touchend",h)}function l(t){f(t),To.bind(window,"mousemove",f),To.bind(window,"touchmove",f),To.bind(window,"mouseup",c),To.bind(window,"touchend",c)}function h(){To.unbind(window,"mousemove",p),To.unbind(window,"touchmove",p),To.unbind(window,"mouseup",h),To.unbind(window,"touchend",h),u()}function c(){To.unbind(window,"mousemove",f),To.unbind(window,"touchmove",f),To.unbind(window,"mouseup",c),To.unbind(window,"touchend",c),u()}function d(){var t=mo(this.value);!1!==t?(s.__color.__state=t,s.setValue(s.__color.toOriginal())):this.value=s.__color.toString()}function u(){s.__onFinishChange&&s.__onFinishChange.call(s,s.__color.toOriginal())}function p(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=s.__saturation_field.getBoundingClientRect(),i=t.touches&&t.touches[0]||t,n=i.clientX,o=i.clientY,a=(n-e.left)/(e.right-e.left),r=1-(o-e.top)/(e.bottom-e.top);return r>1?r=1:r<0&&(r=0),a>1?a=1:a<0&&(a=0),s.__color.v=r,s.__color.s=a,s.setValue(s.__color.toOriginal()),!1}function f(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=s.__hue_field.getBoundingClientRect(),i=1-((t.touches&&t.touches[0]||t).clientY-e.top)/(e.bottom-e.top);return i>1?i=1:i<0&&(i=0),s.__color.h=360*i,s.setValue(s.__color.toOriginal()),!1}return uo.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),uo.extend(n.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:n.__field_knob_border+(n.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),uo.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),uo.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),uo.extend(a.style,{width:"100%",height:"100%",background:"none"}),Go(a,"top","rgba(0,0,0,0)","#000"),uo.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(o=n.__hue_field).style.background="",o.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",o.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",o.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",uo.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),To.bind(n.__saturation_field,"mousedown",r),To.bind(n.__saturation_field,"touchstart",r),To.bind(n.__field_knob,"mousedown",r),To.bind(n.__field_knob,"touchstart",r),To.bind(n.__hue_field,"mousedown",l),To.bind(n.__hue_field,"touchstart",l),n.__saturation_field.appendChild(a),n.__selector.appendChild(n.__field_knob),n.__selector.appendChild(n.__saturation_field),n.__selector.appendChild(n.__hue_field),n.__hue_field.appendChild(n.__hue_knob),n.domElement.appendChild(n.__input),n.domElement.appendChild(n.__selector),n.updateDisplay(),n}return Co(e,t),vo(e,[{key:"updateDisplay",value:function(){var t=mo(this.getValue());if(!1!==t){var e=!1;uo.each(Mo.COMPONENTS,(function(i){if(!uo.isUndefined(t[i])&&!uo.isUndefined(this.__color.__state[i])&&t[i]!==this.__color.__state[i])return e=!0,{}}),this),e&&uo.extend(this.__color.__state,t)}uo.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var i=this.__color.v<.5||this.__color.s>.5?255:0,n=255-i;uo.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+i+","+i+","+i+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,Go(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),uo.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+i+","+i+","+i+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),e}(Ao),Uo=["-moz-","-o-","-webkit-","-ms-",""];function Go(t,e,i,n){t.style.background="",uo.each(Uo,(function(s){t.style.cssText+="background: "+s+"linear-gradient("+e+", "+i+" 0%, "+n+" 100%); "}))}var Wo=function(t,e){var i=t[e];return uo.isArray(arguments[2])||uo.isObject(arguments[2])?new Po(t,e,arguments[2]):uo.isNumber(i)?uo.isNumber(arguments[2])&&uo.isNumber(arguments[3])?uo.isNumber(arguments[4])?new Vo(t,e,arguments[2],arguments[3],arguments[4]):new Vo(t,e,arguments[2],arguments[3]):uo.isNumber(arguments[4])?new Fo(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Fo(t,e,{min:arguments[2],max:arguments[3]}):uo.isString(i)?new Io(t,e):uo.isFunction(i)?new Ho(t,e,""):uo.isBoolean(i)?new Ro(t,e):null},$o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},Yo=function(){function t(){xo(this,t),this.backgroundElement=document.createElement("div"),uo.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),To.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),uo.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;To.bind(this.backgroundElement,"click",(function(){e.hide()}))}return vo(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),uo.defer((function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",To.unbind(t.domElement,"webkitTransitionEnd",e),To.unbind(t.domElement,"transitionend",e),To.unbind(t.domElement,"oTransitionEnd",e)};To.bind(this.domElement,"webkitTransitionEnd",e),To.bind(this.domElement,"transitionend",e),To.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-To.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-To.getHeight(this.domElement)/2+"px"}}]),t}();!function(t,e){var i=e||document,n=document.createElement("style");n.type="text/css",n.innerHTML=t;var s=i.getElementsByTagName("head")[0];try{s.appendChild(n)}catch(t){}}(function(t){if(t&&"undefined"!=typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var Xo="Default",qo=function(){try{return!!window.localStorage}catch(t){return!1}}(),Ko=void 0,Qo=!0,Jo=void 0,Zo=!1,ta=[],ea=function t(e){var i=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),To.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=uo.defaults(n,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),n=uo.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),uo.isUndefined(n.load)?n.load={preset:Xo}:n.preset&&(n.load.preset=n.preset),uo.isUndefined(n.parent)&&n.hideable&&ta.push(this),n.resizable=uo.isUndefined(n.parent)&&n.resizable,n.autoPlace&&uo.isUndefined(n.scrollable)&&(n.scrollable=!0);var s,o=qo&&"true"===localStorage.getItem(ra(0,"isLocal")),a=void 0,r=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return i.parent?i.getRoot().preset:n.load.preset},set:function(t){i.parent?i.getRoot().preset=t:n.load.preset=t,function(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}(this),i.revert()}},width:{get:function(){return n.width},set:function(t){n.width=t,da(i,t)}},name:{get:function(){return n.name},set:function(t){n.name=t,r&&(r.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(e){n.closed=e,n.closed?To.addClass(i.__ul,t.CLASS_CLOSED):To.removeClass(i.__ul,t.CLASS_CLOSED),this.onResize(),i.__closeButton&&(i.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return o},set:function(t){qo&&(o=t,t?To.bind(window,"unload",a):To.unbind(window,"unload",a),localStorage.setItem(ra(0,"isLocal"),t))}}}),uo.isUndefined(n.parent)){if(this.closed=n.closed||!1,To.addClass(this.domElement,t.CLASS_MAIN),To.makeSelectable(this.domElement,!1),qo&&o){i.useLocalStorage=!0;var l=localStorage.getItem(ra(0,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,To.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),n.closeOnTop?(To.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(To.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),To.bind(this.__closeButton,"click",(function(){i.closed=!i.closed}))}else{void 0===n.closed&&(n.closed=!0);var h=document.createTextNode(n.name);To.addClass(h,"controller-name"),r=ia(i,h),To.addClass(this.__ul,t.CLASS_CLOSED),To.addClass(r,"title"),To.bind(r,"click",(function(t){return t.preventDefault(),i.closed=!i.closed,!1})),n.closed||(this.closed=!1)}n.autoPlace&&(uo.isUndefined(n.parent)&&(Qo&&(Jo=document.createElement("div"),To.addClass(Jo,"dg"),To.addClass(Jo,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(Jo),Qo=!1),Jo.appendChild(this.domElement),To.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||da(i,n.width)),this.__resizeHandler=function(){i.onResizeDebounced()},To.bind(window,"resize",this.__resizeHandler),To.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),To.bind(this.__ul,"transitionend",this.__resizeHandler),To.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&ca(this),a=function(){qo&&"true"===localStorage.getItem(ra(0,"isLocal"))&&localStorage.setItem(ra(0,"gui"),JSON.stringify(i.getSaveObject()))},this.saveToLocalStorageIfPossible=a,n.parent||((s=i.getRoot()).width+=1,uo.defer((function(){s.width-=1})))};function ia(t,e,i){var n=document.createElement("li");return e&&n.appendChild(e),i?t.__ul.insertBefore(n,i):t.__ul.appendChild(n),t.onResize(),n}function na(t){To.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&To.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function sa(t,e){var i=t.__preset_select[t.__preset_select.selectedIndex];i.innerHTML=e?i.value+"*":i.value}function oa(t,e){var i=t.getRoot(),n=i.__rememberedObjects.indexOf(e.object);if(-1!==n){var s=i.__rememberedObjectIndecesToControllers[n];if(void 0===s&&(s={},i.__rememberedObjectIndecesToControllers[n]=s),s[e.property]=e,i.load&&i.load.remembered){var o=i.load.remembered,a=void 0;if(o[t.preset])a=o[t.preset];else{if(!o[Xo])return;a=o[Xo]}if(a[n]&&void 0!==a[n][e.property]){var r=a[n][e.property];e.initialValue=r,e.setValue(r)}}}}function aa(t,e,i,n){if(void 0===e[i])throw new Error('Object "'+e+'" has no property "'+i+'"');var s=void 0;if(n.color)s=new jo(e,i);else{var o=[e,i].concat(n.factoryArgs);s=Wo.apply(t,o)}n.before instanceof Ao&&(n.before=n.before.__li),oa(t,s),To.addClass(s.domElement,"c");var a=document.createElement("span");To.addClass(a,"property-name"),a.innerHTML=s.property;var r=document.createElement("div");r.appendChild(a),r.appendChild(s.domElement);var l=ia(t,r,n.before);return To.addClass(l,ea.CLASS_CONTROLLER_ROW),s instanceof jo?To.addClass(l,"color"):To.addClass(l,yo(s.getValue())),function(t,e,i){if(i.__li=e,i.__gui=t,uo.extend(i,{options:function(e){if(arguments.length>1){var n=i.__li.nextElementSibling;return i.remove(),aa(t,i.object,i.property,{before:n,factoryArgs:[uo.toArray(arguments)]})}if(uo.isArray(e)||uo.isObject(e)){var s=i.__li.nextElementSibling;return i.remove(),aa(t,i.object,i.property,{before:s,factoryArgs:[e]})}},name:function(t){return i.__li.firstElementChild.firstElementChild.innerHTML=t,i},listen:function(){return i.__gui.listen(i),i},remove:function(){return i.__gui.remove(i),i}}),i instanceof Vo){var n=new Fo(i.object,i.property,{min:i.__min,max:i.__max,step:i.__step});uo.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(t){var e=i[t],s=n[t];i[t]=n[t]=function(){var t=Array.prototype.slice.call(arguments);return s.apply(n,t),e.apply(i,t)}})),To.addClass(e,"has-slider"),i.domElement.insertBefore(n.domElement,i.domElement.firstElementChild)}else if(i instanceof Fo){var s=function(e){if(uo.isNumber(i.__min)&&uo.isNumber(i.__max)){var n=i.__li.firstElementChild.firstElementChild.innerHTML,s=i.__gui.__listening.indexOf(i)>-1;i.remove();var o=aa(t,i.object,i.property,{before:i.__li.nextElementSibling,factoryArgs:[i.__min,i.__max,i.__step]});return o.name(n),s&&o.listen(),o}return e};i.min=uo.compose(s,i.min),i.max=uo.compose(s,i.max)}else i instanceof Ro?(To.bind(e,"click",(function(){To.fakeEvent(i.__checkbox,"click")})),To.bind(i.__checkbox,"click",(function(t){t.stopPropagation()}))):i instanceof Ho?(To.bind(e,"click",(function(){To.fakeEvent(i.__button,"click")})),To.bind(e,"mouseover",(function(){To.addClass(i.__button,"hover")})),To.bind(e,"mouseout",(function(){To.removeClass(i.__button,"hover")}))):i instanceof jo&&(To.addClass(e,"color"),i.updateDisplay=uo.compose((function(t){return e.style.borderLeftColor=i.__color.toString(),t}),i.updateDisplay),i.updateDisplay());i.setValue=uo.compose((function(e){return t.getRoot().__preset_select&&i.isModified()&&sa(t.getRoot(),!0),e}),i.setValue)}(t,l,s),t.__controllers.push(s),s}function ra(t,e){return document.location.href+"."+e}function la(t,e,i){var n=document.createElement("option");n.innerHTML=e,n.value=e,t.__preset_select.appendChild(n),i&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function ha(t,e){e.style.display=t.useLocalStorage?"block":"none"}function ca(t){var e=void 0;function i(i){return i.preventDefault(),t.width+=e-i.clientX,t.onResize(),e=i.clientX,!1}function n(){To.removeClass(t.__closeButton,ea.CLASS_DRAG),To.unbind(window,"mousemove",i),To.unbind(window,"mouseup",n)}function s(s){return s.preventDefault(),e=s.clientX,To.addClass(t.__closeButton,ea.CLASS_DRAG),To.bind(window,"mousemove",i),To.bind(window,"mouseup",n),!1}t.__resize_handle=document.createElement("div"),uo.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),To.bind(t.__resize_handle,"mousedown",s),To.bind(t.__closeButton,"mousedown",s),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function da(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function ua(t,e){var i={};return uo.each(t.__rememberedObjects,(function(n,s){var o={},a=t.__rememberedObjectIndecesToControllers[s];uo.each(a,(function(t,i){o[i]=e?t.initialValue:t.getValue()})),i[s]=o})),i}function pa(t){0!==t.length&&$o.call(window,(function(){pa(t)})),uo.each(t,(function(t){t.updateDisplay()}))}ea.toggleHide=function(){Zo=!Zo,uo.each(ta,(function(t){t.domElement.style.display=Zo?"none":""}))},ea.CLASS_AUTO_PLACE="a",ea.CLASS_AUTO_PLACE_CONTAINER="ac",ea.CLASS_MAIN="main",ea.CLASS_CONTROLLER_ROW="cr",ea.CLASS_TOO_TALL="taller-than-window",ea.CLASS_CLOSED="closed",ea.CLASS_CLOSE_BUTTON="close-button",ea.CLASS_CLOSE_TOP="close-top",ea.CLASS_CLOSE_BOTTOM="close-bottom",ea.CLASS_DRAG="drag",ea.DEFAULT_WIDTH=245,ea.TEXT_CLOSED="Close Controls",ea.TEXT_OPEN="Open Controls",ea._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||ea.toggleHide()},To.bind(window,"keydown",ea._keydownHandler,!1),uo.extend(ea.prototype,{add:function(t,e){return aa(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return aa(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;uo.defer((function(){e.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&Jo.removeChild(this.domElement);var t=this;uo.each(this.__folders,(function(e){t.removeFolder(e)})),To.unbind(window,"keydown",ea._keydownHandler,!1),na(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var i=new ea(e);this.__folders[t]=i;var n=ia(this,i.domElement);return To.addClass(n,"folder"),i},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],na(t);var e=this;uo.each(t.__folders,(function(e){t.removeFolder(e)})),uo.defer((function(){e.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=To.getOffset(t.__ul).top,i=0;uo.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(i+=To.getHeight(e))})),window.innerHeight-e-20<i?(To.addClass(t.domElement,ea.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(To.removeClass(t.domElement,ea.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&uo.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:uo.debounce((function(){this.onResize()}),50),remember:function(){if(uo.isUndefined(Ko)&&((Ko=new Yo).domElement.innerHTML='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>'),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;uo.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&function(t){var e=t.__save_row=document.createElement("li");To.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),To.addClass(e,"save-row");var i=document.createElement("span");i.innerHTML="&nbsp;",To.addClass(i,"button gears");var n=document.createElement("span");n.innerHTML="Save",To.addClass(n,"button"),To.addClass(n,"save");var s=document.createElement("span");s.innerHTML="New",To.addClass(s,"button"),To.addClass(s,"save-as");var o=document.createElement("span");o.innerHTML="Revert",To.addClass(o,"button"),To.addClass(o,"revert");var a=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?uo.each(t.load.remembered,(function(e,i){la(t,i,i===t.preset)})):la(t,Xo,!1),To.bind(a,"change",(function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value})),e.appendChild(a),e.appendChild(i),e.appendChild(n),e.appendChild(s),e.appendChild(o),qo){var r=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(ra(0,"isLocal"))&&l.setAttribute("checked","checked"),ha(t,r),To.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,ha(t,r)}))}var h=document.getElementById("dg-new-constructor");To.bind(h,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||Ko.hide()})),To.bind(i,"click",(function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),Ko.show(),h.focus(),h.select()})),To.bind(n,"click",(function(){t.save()})),To.bind(s,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),To.bind(o,"click",(function(){t.revert()}))}(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&da(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=ua(this)),t.folders={},uo.each(this.__folders,(function(e,i){t.folders[i]=e.getSaveObject()})),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=ua(this),sa(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered[Xo]=ua(this,!0)),this.load.remembered[t]=ua(this),this.preset=t,la(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){uo.each(this.__controllers,(function(e){this.getRoot().load.remembered?oa(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),uo.each(this.__folders,(function(t){t.revert(t)})),t||sa(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&pa(this.__listening)},updateDisplay:function(){uo.each(this.__controllers,(function(t){t.updateDisplay()})),uo.each(this.__folders,(function(t){t.updateDisplay()}))}});var fa=ea;function ga(t,e,i){if(e){const t=document.createElement("div");t.id="menuDiv",this.gui=new fa({autoPlace:!1,width:i||245}),t.appendChild(this.gui.domElement),document.body.appendChild(t),this.colorGui=this.gui.addFolder("Color Layers"),this.elevationGui=this.gui.addFolder("Elevation Layers"),this.geoidGui=this.gui.addFolder("Geoid Layers"),this.elevationGui.hide(),this.colorGui.hide(),this.geoidGui.hide(),this.view=e,e.addEventListener("layers-order-changed",(()=>{let t;const i=e.getLayers((t=>t.isColorLayer));for(t=0;t<i.length;t++)this.removeLayersGUI(i[t].id);this.addImageryLayersGUI(i)}))}}fa.prototype.removeFolder=function(t){const e=this.__folders[t];e&&(e.close(),this.__ul.removeChild(e.domElement.parentNode),delete this.__folders[t],this.onResize())},fa.prototype.colorLayerFolder=function(t,e){const i=this.__folders[t];if(!i)return;const n=i.__ul.getElementsByClassName("title")[0];n.style&&(n.style.background=e)},fa.prototype.hasFolder=function(t){return this.__folders[t]},ga.prototype.addLayerGUI=function(t){t.isColorLayer?this.addImageryLayerGUI(t):t.isElevationLayer?this.addElevationLayerGUI(t):t.isGeoidLayer&&this.addGeoidLayerGUI(t)},ga.prototype.addLayersGUI=function(){this.addImageryLayersGUI(this.view.getLayers((function(t){return t.isColorLayer}))),this.addElevationLayersGUI(this.view.getLayers((function(t){return t.isElevationLayer}))),console.info("menu initialized")},ga.prototype.addImageryLayerGUI=function(t){if(this.colorGui.hasFolder(t.id))return;this.colorGui.show();const e=this.colorGui.addFolder(t.id);e.add({visible:t.visible},"visible").onChange((e=>{t.visible=e,this.view.notifyChange(t)})),e.add({opacity:t.opacity},"opacity",0,1,.01).onChange((e=>{t.opacity=e,this.view.notifyChange(t)})),e.add({frozen:t.frozen},"frozen").onChange((e=>{t.frozen=e,this.view.notifyChange(t)}))},ga.prototype.addElevationLayerGUI=function(t){if(this.elevationGui.hasFolder(t.id))return;this.elevationGui.show();const e=this.elevationGui.addFolder(t.id);e.add({frozen:t.frozen},"frozen").onChange((e=>{t.frozen=e})),e.add({scale:t.scale},"scale").min(1).max(2e4).onChange((e=>{t.scale=e,this.view.notifyChange(t)}))},ga.prototype.addGeoidLayerGUI=function(t){if(this.geoidGui.hasFolder(t.id))return;this.geoidGui.show();const e=this.geoidGui.addFolder(t.id);e.add({frozen:t.frozen},"frozen").onChange((e=>{t.frozen=e})),e.add({visible:t.visible},"visible").onChange((e=>{t.visible=e,this.view.notifyChange(t)}))},ga.prototype.addImageryLayersGUI=function(t){let e;const i=o.p8.getColorLayersIdOrderedBySequence(t),n=t.sort(((t,e)=>i.indexOf(t.id)<i.indexOf(e.id)));for(e=0;e<n.length;e++)this.addImageryLayerGUI(n[e])},ga.prototype.addElevationLayersGUI=function(t){let e;for(e=0;e<t.length;e++)this.addElevationLayerGUI(t[e])},ga.prototype.removeLayersGUI=function(t){this.colorGui.removeFolder(t)},ga.prototype.addGUI=function(t,e,i){return this[t]=e,this.gui.add(this,t).onChange(i)},ga.prototype.colorLayerFolder=function(t,e){this.colorGui.colorLayerFolder(t,e)};const ma=ga}},t=>t(t.s=38171)])));
3
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * @kurkle/color v0.3.2
3
+ * https://github.com/kurkle/color#readme
4
+ * (c) 2023 Jukka Kurkela
5
+ * Released under the MIT License
6
+ */
7
+
8
+ /*!
9
+ * Chart.js v4.4.4
10
+ * https://www.chartjs.org
11
+ * (c) 2024 Chart.js Contributors
12
+ * Released under the MIT License
13
+ */