itowns 2.45.1 → 2.45.2-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.
- package/dist/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +8 -2
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.LICENSE.txt +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_lasparser.js +1 -1
- package/dist/itowns_lasparser.js.map +1 -1
- package/dist/itowns_lasworker.js +1 -1
- package/dist/itowns_lasworker.js.map +1 -1
- package/dist/itowns_potree2worker.js +1 -1
- package/dist/itowns_potree2worker.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/copc_simple_loader.html +3 -3
- package/examples/entwine_3d_loader.html +2 -2
- package/examples/entwine_simple_loader.html +10 -6
- package/examples/potree2_25d_map.html +2 -2
- package/examples/potree_25d_map.html +2 -2
- package/examples/potree_3d_map.html +2 -2
- package/examples/view_3d_map_webxr.html +2 -5
- package/lib/Controls/FirstPersonControls.d.ts +90 -0
- package/lib/Controls/FlyControls.d.ts +36 -0
- package/lib/Controls/GlobeControls.d.ts +274 -0
- package/lib/Controls/PlanarControls.d.ts +339 -0
- package/lib/Controls/StateControl.d.ts +140 -0
- package/lib/Controls/StreetControls.d.ts +134 -0
- package/lib/Controls/VRControls.d.ts +56 -0
- package/lib/Controls/VRControls.js +409 -0
- package/lib/Converter/Feature2Mesh.d.ts +42 -0
- package/lib/Converter/Feature2Texture.d.ts +5 -0
- package/lib/Converter/convertToTile.d.ts +5 -0
- package/lib/Converter/convertToTile.js +2 -2
- package/lib/Converter/textureConverter.d.ts +4 -0
- package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
- package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
- package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
- package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
- package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
- package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
- package/lib/Core/AnimationPlayer.d.ts +53 -0
- package/lib/Core/CopcNode.d.ts +68 -0
- package/lib/Core/CopcNode.js +57 -74
- package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
- package/lib/Core/EntwinePointTileNode.d.ts +59 -0
- package/lib/Core/EntwinePointTileNode.js +16 -41
- package/lib/Core/Feature.d.ts +323 -0
- package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
- package/lib/Core/Label.d.ts +86 -0
- package/lib/Core/MainLoop.d.ts +23 -0
- package/lib/Core/Picking.d.ts +6 -0
- package/lib/Core/Picking.js +4 -0
- package/lib/Core/PointCloudNode.d.ts +16 -0
- package/lib/Core/PointCloudNode.js +34 -4
- package/lib/Core/Potree2Node.d.ts +11 -0
- package/lib/Core/Potree2Node.js +5 -60
- package/lib/Core/Potree2PointAttributes.d.ts +97 -0
- package/lib/Core/PotreeNode.d.ts +14 -0
- package/lib/Core/PotreeNode.js +28 -18
- package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
- package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
- package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
- package/lib/Core/Prefab/GlobeView.d.ts +65 -0
- package/lib/Core/Prefab/GlobeView.js +9 -0
- package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
- package/lib/Core/Prefab/PlanarView.d.ts +33 -0
- package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
- package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
- package/lib/Core/Scheduler/Cache.d.ts +25 -0
- package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
- package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
- package/lib/Core/Style.d.ts +248 -0
- package/lib/Core/StyleOptions.d.ts +455 -0
- package/lib/Core/System/Capabilities.d.ts +9 -0
- package/lib/Core/Tile/Tile.d.ts +70 -0
- package/lib/Core/Tile/TileGrid.d.ts +12 -0
- package/lib/Core/TileGeometry.d.ts +46 -0
- package/lib/Core/TileMesh.d.ts +50 -0
- package/lib/Core/TileMesh.js +2 -4
- package/lib/Core/View.d.ts +403 -0
- package/lib/Core/View.js +1 -7
- package/lib/Layer/C3DTilesLayer.d.ts +140 -0
- package/lib/Layer/ColorLayer.d.ts +128 -0
- package/lib/Layer/ColorLayer.js +4 -4
- package/lib/Layer/CopcLayer.d.ts +42 -0
- package/lib/Layer/CopcLayer.js +3 -6
- package/lib/Layer/ElevationLayer.d.ts +96 -0
- package/lib/Layer/ElevationLayer.js +3 -3
- package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
- package/lib/Layer/EntwinePointTileLayer.js +4 -3
- package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
- package/lib/Layer/GeoidLayer.d.ts +41 -0
- package/lib/Layer/GeometryLayer.d.ts +120 -0
- package/lib/Layer/InfoLayer.d.ts +24 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/LabelLayer.d.ts +93 -0
- package/lib/Layer/LabelLayer.js +2 -2
- package/lib/Layer/Layer.d.ts +185 -0
- package/lib/Layer/LayerUpdateState.d.ts +24 -0
- package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
- package/lib/Layer/LayerUpdateStrategy.js +2 -7
- package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
- package/lib/Layer/OGC3DTilesLayer.js +21 -0
- package/lib/Layer/OrientedImageLayer.d.ts +53 -0
- package/lib/Layer/PointCloudLayer.d.ts +103 -0
- package/lib/Layer/PointCloudLayer.js +8 -11
- package/lib/Layer/Potree2Layer.d.ts +56 -0
- package/lib/Layer/Potree2Layer.js +0 -2
- package/lib/Layer/PotreeLayer.d.ts +55 -0
- package/lib/Layer/RasterLayer.d.ts +8 -0
- package/lib/Layer/RasterLayer.js +2 -2
- package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
- package/lib/Layer/ReferencingLayerProperties.js +0 -12
- package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
- package/lib/Layer/TiledGeometryLayer.js +4 -3
- package/lib/Main.d.ts +89 -0
- package/lib/Main.js +3 -1
- package/lib/Parser/B3dmParser.d.ts +26 -0
- package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
- package/lib/Parser/GDFParser.d.ts +24 -0
- package/lib/Parser/GTXParser.d.ts +28 -0
- package/lib/Parser/GeoJsonParser.d.ts +12 -0
- package/lib/Parser/GpxParser.d.ts +12 -0
- package/lib/Parser/ISGParser.d.ts +23 -0
- package/lib/Parser/KMLParser.d.ts +12 -0
- package/lib/Parser/LASParser.d.ts +61 -0
- package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
- package/lib/Parser/PntsParser.d.ts +4 -0
- package/lib/Parser/Potree2BinParser.d.ts +8 -0
- package/lib/Parser/PotreeBinParser.d.ts +4 -0
- package/lib/Parser/PotreeCinParser.d.ts +4 -0
- package/lib/Parser/ShapefileParser.d.ts +25 -0
- package/lib/Parser/VectorTileParser.d.ts +34 -0
- package/lib/Parser/XbilParser.d.ts +18 -0
- package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
- package/lib/Parser/iGLTFLoader.d.ts +104 -0
- package/lib/Process/3dTilesProcessing.d.ts +43 -0
- package/lib/Process/FeatureProcessing.d.ts +4 -0
- package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
- package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
- package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
- package/lib/Process/handlerNodeError.d.ts +1 -0
- package/lib/Provider/3dTilesProvider.d.ts +7 -0
- package/lib/Provider/DataSourceProvider.d.ts +4 -0
- package/lib/Provider/Fetcher.d.ts +101 -0
- package/lib/Provider/PointCloudProvider.d.ts +4 -0
- package/lib/Provider/TileProvider.d.ts +4 -0
- package/lib/Provider/URLBuilder.d.ts +28 -0
- package/lib/Renderer/Camera.d.ts +95 -0
- package/lib/Renderer/Color.d.ts +3 -0
- package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
- package/lib/Renderer/ColorLayersOrdering.js +2 -2
- package/lib/Renderer/CommonMaterial.d.ts +6 -0
- package/lib/Renderer/Label2DRenderer.d.ts +31 -0
- package/lib/Renderer/LayeredMaterial.d.ts +121 -0
- package/lib/Renderer/LayeredMaterial.js +221 -141
- package/lib/Renderer/OBB.d.ts +65 -0
- package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
- package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
- package/lib/Renderer/PointsMaterial.d.ts +226 -0
- package/lib/Renderer/PointsMaterial.js +60 -22
- package/lib/Renderer/RasterTile.d.ts +53 -0
- package/lib/Renderer/RasterTile.js +8 -9
- package/lib/Renderer/RenderMode.d.ts +11 -0
- package/lib/Renderer/RenderMode.js +1 -0
- package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
- package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
- package/lib/Renderer/WebXR.d.ts +33 -0
- package/lib/Renderer/WebXR.js +128 -47
- package/lib/Renderer/c3DEngine.d.ts +55 -0
- package/lib/Renderer/c3DEngine.js +5 -1
- package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
- package/lib/Source/C3DTilesIonSource.d.ts +31 -0
- package/lib/Source/C3DTilesSource.d.ts +17 -0
- package/lib/Source/CopcSource.d.ts +79 -0
- package/lib/Source/EntwinePointTileSource.d.ts +40 -0
- package/lib/Source/EntwinePointTileSource.js +0 -5
- package/lib/Source/FileSource.d.ts +118 -0
- package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
- package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
- package/lib/Source/OGC3DTilesSource.d.ts +21 -0
- package/lib/Source/OrientedImageSource.d.ts +48 -0
- package/lib/Source/Potree2Source.d.ts +157 -0
- package/lib/Source/PotreeSource.d.ts +69 -0
- package/lib/Source/Source.d.ts +122 -0
- package/lib/Source/TMSSource.d.ts +77 -0
- package/lib/Source/VectorTilesSource.d.ts +56 -0
- package/lib/Source/WFSSource.d.ts +110 -0
- package/lib/Source/WMSSource.d.ts +85 -0
- package/lib/Source/WMTSSource.d.ts +65 -0
- package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
- package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
- package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
- package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
- package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
- package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
- package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
- package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
- package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
- package/lib/Utils/CameraUtils.d.ts +132 -0
- package/lib/Utils/DEMUtils.d.ts +84 -0
- package/lib/Utils/DEMUtils.js +2 -2
- package/lib/Utils/FeaturesUtils.d.ts +17 -0
- package/lib/Utils/Gradients.d.ts +13 -0
- package/lib/Utils/ThreeUtils.d.ts +14 -0
- package/lib/Utils/placeObjectOnGround.d.ts +28 -0
- package/lib/global.d.js +0 -0
- package/package.json +18 -15
package/dist/debug.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see debug.js.LICENSE.txt */
|
|
2
|
-
"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("debug",[],e):"object"==typeof exports?exports.debug=e():t.debug=e()}(self,(()=>(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=" ",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)])));
|
|
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.webpackChunkitowns_repository=self.webpackChunkitowns_repository||[]).push([[40],{44685:(t,e,i)=>{i.r(e),i.d(e,{Debug:()=>Dl,GeometryDebug:()=>Vl,GuiTools:()=>vc,PointCloudDebug:()=>Il,create3dTilesDebugUI:()=>Gl,createOGC3DTilesDebugUI:()=>ph,createTileDebugUI:()=>jl});const n=2300,s=2301,r=2302,a="srgb",o="srgb-linear",l="linear",h="srgb",c=7680,d=2e3;class u{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const p=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function m(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(p[255&t]+p[t>>8&255]+p[t>>16&255]+p[t>>24&255]+"-"+p[255&e]+p[e>>8&255]+"-"+p[e>>16&15|64]+p[e>>24&255]+"-"+p[63&i|128]+p[i>>8&255]+"-"+p[i>>16&255]+p[i>>24&255]+p[255&n]+p[n>>8&255]+p[n>>16&255]+p[n>>24&255]).toLowerCase()}function f(t,e,i){return Math.max(e,Math.min(i,t))}function g(t,e,i){return(1-i)*t+i*e}function _(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function y(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}Math.PI,Math.PI;class x{constructor(t=0,e=0){x.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(f(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class b{constructor(t,e,i,n,s,r,a,o,l){b.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,l)}set(t,e,i,n,s,r,a,o,l){const h=this.elements;return h[0]=t,h[1]=n,h[2]=a,h[3]=e,h[4]=s,h[5]=o,h[6]=i,h[7]=r,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],l=i[1],h=i[4],c=i[7],d=i[2],u=i[5],p=i[8],m=n[0],f=n[3],g=n[6],_=n[1],y=n[4],x=n[7],b=n[2],v=n[5],w=n[8];return s[0]=r*m+a*_+o*b,s[3]=r*f+a*y+o*v,s[6]=r*g+a*x+o*w,s[1]=l*m+h*_+c*b,s[4]=l*f+h*y+c*v,s[7]=l*g+h*x+c*w,s[2]=d*m+u*_+p*b,s[5]=d*f+u*y+p*v,s[8]=d*g+u*x+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=t[8];return e*r*h-e*a*l-i*s*h+i*a*o+n*s*l-n*r*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=h*r-a*l,d=a*o-h*s,u=l*s-r*o,p=e*c+i*d+n*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=c*m,t[1]=(n*l-h*i)*m,t[2]=(a*i-n*r)*m,t[3]=d*m,t[4]=(h*e-n*o)*m,t[5]=(n*s-a*e)*m,t[6]=u*m,t[7]=(i*o-l*e)*m,t[8]=(r*e-i*s)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),l=Math.sin(s);return this.set(i*o,i*l,-i*(o*r+l*a)+r+t,-n*l,n*o,-n*(-l*r+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(v.makeScale(t,e)),this}rotate(t){return this.premultiply(v.makeRotation(-t)),this}translate(t,e){return this.premultiply(v.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const v=new b;function w(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const M={enabled:!0,workingColorSpace:o,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===h&&(t.r=S(t.r),t.g=S(t.g),t.b=S(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===h&&(t.r=C(t.r),t.g=C(t.g),t.b=C(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?l:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}};function S(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function C(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const k=[.64,.33,.3,.6,.15,.06],A=[.2126,.7152,.0722],E=[.3127,.329],T=(new b).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),z=(new b).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);let D;M.define({[o]:{primaries:k,whitePoint:E,transfer:l,toXYZ:T,fromXYZ:z,luminanceCoefficients:A,workingColorSpaceConfig:{unpackColorSpace:a},outputColorSpaceConfig:{drawingBufferColorSpace:a}},[a]:{primaries:k,whitePoint:E,transfer:h,toXYZ:T,fromXYZ:z,luminanceCoefficients:A,outputColorSpaceConfig:{drawingBufferColorSpace:a}}});class O{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===D&&(D=w("canvas")),D.width=t.width,D.height=t.height;const i=D.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=D}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=w("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),s=n.data;for(let t=0;t<s.length;t++)s[t]=255*S(s[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*S(e[t]/255)):e[t]=S(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let P=0;class R{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:P++}),this.uuid=m(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(I(n[e].image)):t.push(I(n[e]))}else t=I(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function I(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?O.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let L=0;class B extends u{constructor(t=B.DEFAULT_IMAGE,e=B.DEFAULT_MAPPING,i=1001,n=1001,s=1006,r=1008,a=1023,o=1009,l=B.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:L++}),this.uuid=m(),this.name="",this.source=new R(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new x(0,0),this.repeat=new x(1,1),this.center=new x(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new b,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}B.DEFAULT_IMAGE=null,B.DEFAULT_MAPPING=300,B.DEFAULT_ANISOTROPY=1;class N{constructor(t=0,e=0,i=0,n=1){N.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*e+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*e+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*e+r[7]*i+r[11]*n+r[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,s;const r=.01,a=.1,o=t.elements,l=o[0],h=o[4],c=o[8],d=o[1],u=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(h-d)<r&&Math.abs(c-m)<r&&Math.abs(p-f)<r){if(Math.abs(h+d)<a&&Math.abs(c+m)<a&&Math.abs(p+f)<a&&Math.abs(l+u+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(u+1)/2,_=(g+1)/2,y=(h+d)/4,x=(c+m)/4,b=(p+f)/4;return t>o&&t>_?t<r?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(t),n=y/i,s=x/i):o>_?o<r?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(o),i=y/n,s=b/n):_<r?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(_),i=x/s,n=b/s),this.set(i,n,s,e),this}let _=Math.sqrt((f-p)*(f-p)+(c-m)*(c-m)+(d-h)*(d-h));return Math.abs(_)<.001&&(_=1),this.x=(f-p)/_,this.y=(c-m)/_,this.z=(d-h)/_,this.w=Math.acos((l+u+g-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class F{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,s,r,a){let o=i[n+0],l=i[n+1],h=i[n+2],c=i[n+3];const d=s[r+0],u=s[r+1],p=s[r+2],m=s[r+3];if(0===a)return t[e+0]=o,t[e+1]=l,t[e+2]=h,void(t[e+3]=c);if(1===a)return t[e+0]=d,t[e+1]=u,t[e+2]=p,void(t[e+3]=m);if(c!==m||o!==d||l!==u||h!==p){let t=1-a;const e=o*d+l*u+h*p+c*m,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const s=Math.sqrt(n),r=Math.atan2(s,e*i);t=Math.sin(t*r)/s,a=Math.sin(a*r)/s}const s=a*i;if(o=o*t+d*s,l=l*t+u*s,h=h*t+p*s,c=c*t+m*s,t===1-a){const t=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=t,l*=t,h*=t,c*=t}}t[e]=o,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,s,r){const a=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=s[r],d=s[r+1],u=s[r+2],p=s[r+3];return t[e]=a*p+h*c+o*u-l*d,t[e+1]=o*p+h*d+l*c-a*u,t[e+2]=l*p+h*u+a*d-o*c,t[e+3]=h*p-a*c-o*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,n=t._y,s=t._z,r=t._order,a=Math.cos,o=Math.sin,l=a(i/2),h=a(n/2),c=a(s/2),d=o(i/2),u=o(n/2),p=o(s/2);switch(r){case"XYZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"YXZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"ZXY":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"ZYX":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"YZX":this._x=d*h*c+l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c-d*u*p;break;case"XZY":this._x=d*h*c-l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],s=e[8],r=e[1],a=e[5],o=e[9],l=e[2],h=e[6],c=e[10],d=i+a+c;if(d>0){const t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(h-o)*t,this._y=(s-l)*t,this._z=(r-n)*t}else if(i>a&&i>c){const t=2*Math.sqrt(1+i-a-c);this._w=(h-o)/t,this._x=.25*t,this._y=(n+r)/t,this._z=(s+l)/t}else if(a>c){const t=2*Math.sqrt(1+a-i-c);this._w=(s-l)/t,this._x=(n+r)/t,this._y=.25*t,this._z=(o+h)/t}else{const t=2*Math.sqrt(1+c-i-a);this._w=(r-n)/t,this._x=(s+l)/t,this._y=(o+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(f(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,s=t._z,r=t._w,a=e._x,o=e._y,l=e._z,h=e._w;return this._x=i*h+r*a+n*l-s*o,this._y=n*h+r*o+s*a-i*l,this._z=s*h+r*l+i*o-n*a,this._w=r*h-i*a-n*o-s*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,s=this._z,r=this._w;let a=r*t._w+i*t._x+n*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*r+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*s+e*this._z,this.normalize(),this}const l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=r*c+this._w*d,this._x=i*c+this._x*d,this._y=n*c+this._y*d,this._z=s*c+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class V{constructor(t=0,e=0,i=0){V.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(H.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(H.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,a=t.z,o=t.w,l=2*(r*n-a*i),h=2*(a*e-s*n),c=2*(s*i-r*e);return this.x=e+o*l+r*c-a*h,this.y=i+o*h+a*l-s*c,this.z=n+o*c+s*h-r*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-s*a,this.y=s*r-i*o,this.z=i*a-n*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return U.copy(this).projectOnVector(t),this.sub(U)}reflect(t){return this.sub(U.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(f(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const U=new V,H=new F;class j{constructor(t=new V(1/0,1/0,1/0),e=new V(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(G.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(G.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=G.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,G):G.fromBufferAttribute(n,e),G.applyMatrix4(t.matrixWorld),this.expandByPoint(G);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Y.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Y.copy(i.boundingBox)),Y.applyMatrix4(t.matrixWorld),this.union(Y)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,G),G.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Q),tt.subVectors(this.max,Q),q.subVectors(t.a,Q),X.subVectors(t.b,Q),Z.subVectors(t.c,Q),$.subVectors(X,q),J.subVectors(Z,X),K.subVectors(q,Z);let e=[0,-$.z,$.y,0,-J.z,J.y,0,-K.z,K.y,$.z,0,-$.x,J.z,0,-J.x,K.z,0,-K.x,-$.y,$.x,0,-J.y,J.x,0,-K.y,K.x,0];return!!nt(e,q,X,Z,tt)&&(e=[1,0,0,0,1,0,0,0,1],!!nt(e,q,X,Z,tt)&&(et.crossVectors($,J),e=[et.x,et.y,et.z],nt(e,q,X,Z,tt)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,G).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(G).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(W[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),W[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),W[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),W[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),W[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),W[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),W[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),W[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(W)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const W=[new V,new V,new V,new V,new V,new V,new V,new V],G=new V,Y=new j,q=new V,X=new V,Z=new V,$=new V,J=new V,K=new V,Q=new V,tt=new V,et=new V,it=new V;function nt(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){it.fromArray(t,r);const a=s.x*Math.abs(it.x)+s.y*Math.abs(it.y)+s.z*Math.abs(it.z),o=e.dot(it),l=i.dot(it),h=n.dot(it);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>a)return!1}return!0}const st=new j,rt=new V,at=new V;class ot{constructor(t=new V,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):st.setFromPoints(t).getCenter(i);let n=0;for(let e=0,s=t.length;e<s;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;rt.subVectors(t,this.center);const e=rt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(rt,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(at.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(rt.copy(t.center).add(at)),this.expandByPoint(rt.copy(t.center).sub(at))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const lt=new V,ht=new V,ct=new V,dt=new V,ut=new V,pt=new V,mt=new V;class ft{constructor(t=new V,e=new V(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,lt)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=lt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(lt.copy(this.origin).addScaledVector(this.direction,e),lt.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){ht.copy(t).add(e).multiplyScalar(.5),ct.copy(e).sub(t).normalize(),dt.copy(this.origin).sub(ht);const s=.5*t.distanceTo(e),r=-this.direction.dot(ct),a=dt.dot(this.direction),o=-dt.dot(ct),l=dt.lengthSq(),h=Math.abs(1-r*r);let c,d,u,p;if(h>0)if(c=r*o-a,d=r*a-o,p=s*h,c>=0)if(d>=-p)if(d<=p){const t=1/h;c*=t,d*=t,u=c*(c+r*d+2*a)+d*(r*c+d+2*o)+l}else d=s,c=Math.max(0,-(r*d+a)),u=-c*c+d*(d+2*o)+l;else d=-s,c=Math.max(0,-(r*d+a)),u=-c*c+d*(d+2*o)+l;else d<=-p?(c=Math.max(0,-(-r*s+a)),d=c>0?-s:Math.min(Math.max(-s,-o),s),u=-c*c+d*(d+2*o)+l):d<=p?(c=0,d=Math.min(Math.max(-s,-o),s),u=d*(d+2*o)+l):(c=Math.max(0,-(r*s+a)),d=c>0?s:Math.min(Math.max(-s,-o),s),u=-c*c+d*(d+2*o)+l);else d=r>0?-s:s,c=Math.max(0,-(r*d+a)),u=-c*c+d*(d+2*o)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,c),n&&n.copy(ht).addScaledVector(ct,d),u}intersectSphere(t,e){lt.subVectors(t.center,this.origin);const i=lt.dot(this.direction),n=lt.dot(lt)-i*i,s=t.radius*t.radius;if(n>s)return null;const r=Math.sqrt(s-n),a=i-r,o=i+r;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,s,r,a,o;const l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),h>=0?(s=(t.min.y-d.y)*h,r=(t.max.y-d.y)*h):(s=(t.max.y-d.y)*h,r=(t.min.y-d.y)*h),i>r||s>n?null:((s>i||isNaN(i))&&(i=s),(r<n||isNaN(n))&&(n=r),c>=0?(a=(t.min.z-d.z)*c,o=(t.max.z-d.z)*c):(a=(t.max.z-d.z)*c,o=(t.min.z-d.z)*c),i>o||a>n?null:((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,lt)}intersectTriangle(t,e,i,n,s){ut.subVectors(e,t),pt.subVectors(i,t),mt.crossVectors(ut,pt);let r,a=this.direction.dot(mt);if(a>0){if(n)return null;r=1}else{if(!(a<0))return null;r=-1,a=-a}dt.subVectors(this.origin,t);const o=r*this.direction.dot(pt.crossVectors(dt,pt));if(o<0)return null;const l=r*this.direction.dot(ut.cross(dt));if(l<0)return null;if(o+l>a)return null;const h=-r*dt.dot(mt);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class gt{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,m,f){gt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,l,h,c,d,u,p,m,f)}set(t,e,i,n,s,r,a,o,l,h,c,d,u,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=d,g[3]=u,g[7]=p,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new gt).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/_t.setFromMatrixColumn(t,0).length(),s=1/_t.setFromMatrixColumn(t,1).length(),r=1/_t.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,s=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(s),c=Math.sin(s);if("XYZ"===t.order){const t=r*h,i=r*c,n=a*h,s=a*c;e[0]=o*h,e[4]=-o*c,e[8]=l,e[1]=i+n*l,e[5]=t-s*l,e[9]=-a*o,e[2]=s-t*l,e[6]=n+i*l,e[10]=r*o}else if("YXZ"===t.order){const t=o*h,i=o*c,n=l*h,s=l*c;e[0]=t+s*a,e[4]=n*a-i,e[8]=r*l,e[1]=r*c,e[5]=r*h,e[9]=-a,e[2]=i*a-n,e[6]=s+t*a,e[10]=r*o}else if("ZXY"===t.order){const t=o*h,i=o*c,n=l*h,s=l*c;e[0]=t-s*a,e[4]=-r*c,e[8]=n+i*a,e[1]=i+n*a,e[5]=r*h,e[9]=s-t*a,e[2]=-r*l,e[6]=a,e[10]=r*o}else if("ZYX"===t.order){const t=r*h,i=r*c,n=a*h,s=a*c;e[0]=o*h,e[4]=n*l-i,e[8]=t*l+s,e[1]=o*c,e[5]=s*l+t,e[9]=i*l-n,e[2]=-l,e[6]=a*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*l,n=a*o,s=a*l;e[0]=o*h,e[4]=s-t*c,e[8]=n*c+i,e[1]=c,e[5]=r*h,e[9]=-a*h,e[2]=-l*h,e[6]=i*c+n,e[10]=t-s*c}else if("XZY"===t.order){const t=r*o,i=r*l,n=a*o,s=a*l;e[0]=o*h,e[4]=-c,e[8]=l*h,e[1]=t*c+s,e[5]=r*h,e[9]=i*c-n,e[2]=n*c-i,e[6]=a*h,e[10]=s*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(xt,t,bt)}lookAt(t,e,i){const n=this.elements;return Mt.subVectors(t,e),0===Mt.lengthSq()&&(Mt.z=1),Mt.normalize(),vt.crossVectors(i,Mt),0===vt.lengthSq()&&(1===Math.abs(i.z)?Mt.x+=1e-4:Mt.z+=1e-4,Mt.normalize(),vt.crossVectors(i,Mt)),vt.normalize(),wt.crossVectors(Mt,vt),n[0]=vt.x,n[4]=wt.x,n[8]=Mt.x,n[1]=vt.y,n[5]=wt.y,n[9]=Mt.y,n[2]=vt.z,n[6]=wt.z,n[10]=Mt.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[4],o=i[8],l=i[12],h=i[1],c=i[5],d=i[9],u=i[13],p=i[2],m=i[6],f=i[10],g=i[14],_=i[3],y=i[7],x=i[11],b=i[15],v=n[0],w=n[4],M=n[8],S=n[12],C=n[1],k=n[5],A=n[9],E=n[13],T=n[2],z=n[6],D=n[10],O=n[14],P=n[3],R=n[7],I=n[11],L=n[15];return s[0]=r*v+a*C+o*T+l*P,s[4]=r*w+a*k+o*z+l*R,s[8]=r*M+a*A+o*D+l*I,s[12]=r*S+a*E+o*O+l*L,s[1]=h*v+c*C+d*T+u*P,s[5]=h*w+c*k+d*z+u*R,s[9]=h*M+c*A+d*D+u*I,s[13]=h*S+c*E+d*O+u*L,s[2]=p*v+m*C+f*T+g*P,s[6]=p*w+m*k+f*z+g*R,s[10]=p*M+m*A+f*D+g*I,s[14]=p*S+m*E+f*O+g*L,s[3]=_*v+y*C+x*T+b*P,s[7]=_*w+y*k+x*z+b*R,s[11]=_*M+y*A+x*D+b*I,s[15]=_*S+y*E+x*O+b*L,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],s=t[12],r=t[1],a=t[5],o=t[9],l=t[13],h=t[2],c=t[6],d=t[10],u=t[14];return t[3]*(+s*o*c-n*l*c-s*a*d+i*l*d+n*a*u-i*o*u)+t[7]*(+e*o*u-e*l*d+s*r*d-n*r*u+n*l*h-s*o*h)+t[11]*(+e*l*c-e*a*u-s*r*c+i*r*u+s*a*h-i*l*h)+t[15]*(-n*a*h-e*o*c+e*a*d+n*r*c-i*r*d+i*o*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=t[9],d=t[10],u=t[11],p=t[12],m=t[13],f=t[14],g=t[15],_=c*f*l-m*d*l+m*o*u-a*f*u-c*o*g+a*d*g,y=p*d*l-h*f*l-p*o*u+r*f*u+h*o*g-r*d*g,x=h*m*l-p*c*l+p*a*u-r*m*u-h*a*g+r*c*g,b=p*c*o-h*m*o-p*a*d+r*m*d+h*a*f-r*c*f,v=e*_+i*y+n*x+s*b;if(0===v)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/v;return t[0]=_*w,t[1]=(m*d*s-c*f*s-m*n*u+i*f*u+c*n*g-i*d*g)*w,t[2]=(a*f*s-m*o*s+m*n*l-i*f*l-a*n*g+i*o*g)*w,t[3]=(c*o*s-a*d*s-c*n*l+i*d*l+a*n*u-i*o*u)*w,t[4]=y*w,t[5]=(h*f*s-p*d*s+p*n*u-e*f*u-h*n*g+e*d*g)*w,t[6]=(p*o*s-r*f*s-p*n*l+e*f*l+r*n*g-e*o*g)*w,t[7]=(r*d*s-h*o*s+h*n*l-e*d*l-r*n*u+e*o*u)*w,t[8]=x*w,t[9]=(p*c*s-h*m*s-p*i*u+e*m*u+h*i*g-e*c*g)*w,t[10]=(r*m*s-p*a*s+p*i*l-e*m*l-r*i*g+e*a*g)*w,t[11]=(h*a*s-r*c*s-h*i*l+e*c*l+r*i*u-e*a*u)*w,t[12]=b*w,t[13]=(h*m*n-p*c*n+p*i*d-e*m*d-h*i*f+e*c*f)*w,t[14]=(p*a*n-r*m*n-p*i*o+e*m*o+r*i*f-e*a*f)*w,t[15]=(r*c*n-h*a*n+h*i*o-e*c*o-r*i*d+e*a*d)*w,this}scale(t){const e=this.elements,i=t.x,n=t.y,s=t.z;return e[0]*=i,e[4]*=n,e[8]*=s,e[1]*=i,e[5]*=n,e[9]*=s,e[2]*=i,e[6]*=n,e[10]*=s,e[3]*=i,e[7]*=n,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,a=t.y,o=t.z,l=s*r,h=s*a;return this.set(l*r+i,l*a-n*o,l*o+n*a,0,l*a+n*o,h*a+i,h*o-n*r,0,l*o-n*a,h*o+n*r,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,s,r){return this.set(1,i,s,0,t,1,r,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,s=e._x,r=e._y,a=e._z,o=e._w,l=s+s,h=r+r,c=a+a,d=s*l,u=s*h,p=s*c,m=r*h,f=r*c,g=a*c,_=o*l,y=o*h,x=o*c,b=i.x,v=i.y,w=i.z;return n[0]=(1-(m+g))*b,n[1]=(u+x)*b,n[2]=(p-y)*b,n[3]=0,n[4]=(u-x)*v,n[5]=(1-(d+g))*v,n[6]=(f+_)*v,n[7]=0,n[8]=(p+y)*w,n[9]=(f-_)*w,n[10]=(1-(d+m))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let s=_t.set(n[0],n[1],n[2]).length();const r=_t.set(n[4],n[5],n[6]).length(),a=_t.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),t.x=n[12],t.y=n[13],t.z=n[14],yt.copy(this);const o=1/s,l=1/r,h=1/a;return yt.elements[0]*=o,yt.elements[1]*=o,yt.elements[2]*=o,yt.elements[4]*=l,yt.elements[5]*=l,yt.elements[6]*=l,yt.elements[8]*=h,yt.elements[9]*=h,yt.elements[10]*=h,e.setFromRotationMatrix(yt),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,l=2*s/(e-t),h=2*s/(i-n),c=(e+t)/(e-t),u=(i+n)/(i-n);let p,m;if(a===d)p=-(r+s)/(r-s),m=-2*r*s/(r-s);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);p=-r/(r-s),m=-r*s/(r-s)}return o[0]=l,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=h,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=p,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,l=1/(e-t),h=1/(i-n),c=1/(r-s),u=(e+t)*l,p=(i+n)*h;let m,f;if(a===d)m=(r+s)*c,f=-2*c;else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);m=s*c,f=-1*c}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-p,o[2]=0,o[6]=0,o[10]=f,o[14]=-m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const _t=new V,yt=new gt,xt=new V(0,0,0),bt=new V(1,1,1),vt=new V,wt=new V,Mt=new V,St=new gt,Ct=new F;class kt{constructor(t=0,e=0,i=0,n=kt.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,s=n[0],r=n[4],a=n[8],o=n[1],l=n[5],h=n[9],c=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(f(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-f(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,s),this._z=0);break;case"ZXY":this._x=Math.asin(f(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-f(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(f(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,s)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-f(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return St.makeRotationFromQuaternion(t),this.setFromRotationMatrix(St,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ct.setFromEuler(this),this.setFromQuaternion(Ct,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}kt.DEFAULT_ORDER="XYZ";class At{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Et=0;const Tt=new V,zt=new F,Dt=new gt,Ot=new V,Pt=new V,Rt=new V,It=new F,Lt=new V(1,0,0),Bt=new V(0,1,0),Nt=new V(0,0,1),Ft={type:"added"},Vt={type:"removed"},Ut={type:"childadded",child:null},Ht={type:"childremoved",child:null};class jt extends u{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Et++}),this.uuid=m(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=jt.DEFAULT_UP.clone();const t=new V,e=new kt,i=new F,n=new V(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new gt},normalMatrix:{value:new b}}),this.matrix=new gt,this.matrixWorld=new gt,this.matrixAutoUpdate=jt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new At,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return zt.setFromAxisAngle(t,e),this.quaternion.multiply(zt),this}rotateOnWorldAxis(t,e){return zt.setFromAxisAngle(t,e),this.quaternion.premultiply(zt),this}rotateX(t){return this.rotateOnAxis(Lt,t)}rotateY(t){return this.rotateOnAxis(Bt,t)}rotateZ(t){return this.rotateOnAxis(Nt,t)}translateOnAxis(t,e){return Tt.copy(t).applyQuaternion(this.quaternion),this.position.add(Tt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Lt,t)}translateY(t){return this.translateOnAxis(Bt,t)}translateZ(t){return this.translateOnAxis(Nt,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Dt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Ot.copy(t):Ot.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),Pt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Dt.lookAt(Pt,Ot,this.up):Dt.lookAt(Ot,Pt,this.up),this.quaternion.setFromRotationMatrix(Dt),n&&(Dt.extractRotation(n.matrixWorld),zt.setFromRotationMatrix(Dt),this.quaternion.premultiply(zt.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Ft),Ut.child=t,this.dispatchEvent(Ut),Ut.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Vt),Ht.child=t,this.dispatchEvent(Ht),Ht.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Dt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Dt.multiply(t.parent.matrixWorld)),t.applyMatrix4(Dt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Ft),Ut.child=t,this.dispatchEvent(Ut),Ut.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pt,t,Rt),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Pt,It,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];s(t.shapes,n)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(s(t.materials,this.material[i]));n.material=e}else n.material=s(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(s(t.animations,i))}}if(e){const e=r(t.geometries),n=r(t.materials),s=r(t.textures),a=r(t.images),o=r(t.shapes),l=r(t.skeletons),h=r(t.animations),c=r(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=n,i;function r(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}jt.DEFAULT_UP=new V(0,1,0),jt.DEFAULT_MATRIX_AUTO_UPDATE=!0,jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wt=new V,Gt=new V,Yt=new V,qt=new V,Xt=new V,Zt=new V,$t=new V,Jt=new V,Kt=new V,Qt=new V,te=new N,ee=new N,ie=new N;class ne{constructor(t=new V,e=new V,i=new V){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Wt.subVectors(t,e),n.cross(Wt);const s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(t,e,i,n,s){Wt.subVectors(n,e),Gt.subVectors(i,e),Yt.subVectors(t,e);const r=Wt.dot(Wt),a=Wt.dot(Gt),o=Wt.dot(Yt),l=Gt.dot(Gt),h=Gt.dot(Yt),c=r*l-a*a;if(0===c)return s.set(0,0,0),null;const d=1/c,u=(l*o-a*h)*d,p=(r*h-a*o)*d;return s.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return null!==this.getBarycoord(t,e,i,n,qt)&&qt.x>=0&&qt.y>=0&&qt.x+qt.y<=1}static getInterpolation(t,e,i,n,s,r,a,o){return null===this.getBarycoord(t,e,i,n,qt)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(s,qt.x),o.addScaledVector(r,qt.y),o.addScaledVector(a,qt.z),o)}static getInterpolatedAttribute(t,e,i,n,s,r){return te.setScalar(0),ee.setScalar(0),ie.setScalar(0),te.fromBufferAttribute(t,e),ee.fromBufferAttribute(t,i),ie.fromBufferAttribute(t,n),r.setScalar(0),r.addScaledVector(te,s.x),r.addScaledVector(ee,s.y),r.addScaledVector(ie,s.z),r}static isFrontFacing(t,e,i,n){return Wt.subVectors(i,e),Gt.subVectors(t,e),Wt.cross(Gt).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Wt.subVectors(this.c,this.b),Gt.subVectors(this.a,this.b),.5*Wt.cross(Gt).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ne.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ne.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,n,s){return ne.getInterpolation(t,this.a,this.b,this.c,e,i,n,s)}containsPoint(t){return ne.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ne.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,s=this.c;let r,a;Xt.subVectors(n,i),Zt.subVectors(s,i),Jt.subVectors(t,i);const o=Xt.dot(Jt),l=Zt.dot(Jt);if(o<=0&&l<=0)return e.copy(i);Kt.subVectors(t,n);const h=Xt.dot(Kt),c=Zt.dot(Kt);if(h>=0&&c<=h)return e.copy(n);const d=o*c-h*l;if(d<=0&&o>=0&&h<=0)return r=o/(o-h),e.copy(i).addScaledVector(Xt,r);Qt.subVectors(t,s);const u=Xt.dot(Qt),p=Zt.dot(Qt);if(p>=0&&u<=p)return e.copy(s);const m=u*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(i).addScaledVector(Zt,a);const f=h*p-u*c;if(f<=0&&c-h>=0&&u-p>=0)return $t.subVectors(s,n),a=(c-h)/(c-h+(u-p)),e.copy(n).addScaledVector($t,a);const g=1/(f+m+d);return r=m*g,a=d*g,e.copy(i).addScaledVector(Xt,r).addScaledVector(Zt,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const se={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},re={h:0,s:0,l:0},ae={h:0,s:0,l:0};function oe(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class le{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=a){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,M.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=M.workingColorSpace){return this.r=t,this.g=e,this.b=i,M.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=M.workingColorSpace){if(t=(t%(s=1)+s)%s,e=f(e,0,1),i=f(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=oe(s,n,t+1/3),this.g=oe(s,n,t),this.b=oe(s,n,t-1/3)}var s;return M.toWorkingColorSpace(this,n),this}setStyle(t,e=a){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=n[1],s=i.length;if(3===s)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===s)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=a){const i=se[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=S(t.r),this.g=S(t.g),this.b=S(t.b),this}copyLinearToSRGB(t){return this.r=C(t.r),this.g=C(t.g),this.b=C(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=a){return M.fromWorkingColorSpace(he.copy(this),t),65536*Math.round(f(255*he.r,0,255))+256*Math.round(f(255*he.g,0,255))+Math.round(f(255*he.b,0,255))}getHexString(t=a){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=M.workingColorSpace){M.fromWorkingColorSpace(he.copy(this),e);const i=he.r,n=he.g,s=he.b,r=Math.max(i,n,s),a=Math.min(i,n,s);let o,l;const h=(a+r)/2;if(a===r)o=0,l=0;else{const t=r-a;switch(l=h<=.5?t/(r+a):t/(2-r-a),r){case i:o=(n-s)/t+(n<s?6:0);break;case n:o=(s-i)/t+2;break;case s:o=(i-n)/t+4}o/=6}return t.h=o,t.s=l,t.l=h,t}getRGB(t,e=M.workingColorSpace){return M.fromWorkingColorSpace(he.copy(this),e),t.r=he.r,t.g=he.g,t.b=he.b,t}getStyle(t=a){M.fromWorkingColorSpace(he.copy(this),t);const e=he.r,i=he.g,n=he.b;return t!==a?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(re),this.setHSL(re.h+t,re.s+e,re.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(re),t.getHSL(ae);const i=g(re.h,ae.h,e),n=g(re.s,ae.s,e),s=g(re.l,ae.l,e);return this.setHSL(i,n,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*n,this.g=s[1]*e+s[4]*i+s[7]*n,this.b=s[2]*e+s[5]*i+s[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const he=new le;le.NAMES=se;let ce=0;class de extends u{static get type(){return"Material"}get type(){return this.constructor.type}set type(t){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ce++}),this.uuid=m(),this.name="",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new le(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=c,this.stencilZFail=c,this.stencilZPass=c,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==c&&(i.stencilFail=this.stencilFail),this.stencilZFail!==c&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==c&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=n(t.textures),s=n(t.images);e.length>0&&(i.textures=e),s.length>0&&(i.images=s)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class ue extends de{static get type(){return"MeshBasicMaterial"}constructor(t){super(),this.isMeshBasicMaterial=!0,this.color=new le(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kt,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const pe=new V,me=new x;class fe{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)me.fromBufferAttribute(this,e),me.applyMatrix3(t),this.setXY(e,me.x,me.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)pe.fromBufferAttribute(this,e),pe.applyMatrix3(t),this.setXYZ(e,pe.x,pe.y,pe.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)pe.fromBufferAttribute(this,e),pe.applyMatrix4(t),this.setXYZ(e,pe.x,pe.y,pe.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)pe.fromBufferAttribute(this,e),pe.applyNormalMatrix(t),this.setXYZ(e,pe.x,pe.y,pe.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)pe.fromBufferAttribute(this,e),pe.transformDirection(t),this.setXYZ(e,pe.x,pe.y,pe.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=_(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=y(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=_(e,this.array)),e}setX(t,e){return this.normalized&&(e=y(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=_(e,this.array)),e}setY(t,e){return this.normalized&&(e=y(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=_(e,this.array)),e}setZ(t,e){return this.normalized&&(e=y(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=_(e,this.array)),e}setW(t,e){return this.normalized&&(e=y(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=y(e,this.array),i=y(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=y(e,this.array),i=y(i,this.array),n=y(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=y(e,this.array),i=y(i,this.array),n=y(n,this.array),s=y(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class ge extends fe{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class _e extends fe{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class ye extends fe{constructor(t,e,i){super(new Float32Array(t),e,i)}}let xe=0;const be=new gt,ve=new jt,we=new V,Me=new j,Se=new j,Ce=new V;class ke extends u{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:xe++}),this.uuid=m(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?_e:ge)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new b).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return be.makeRotationFromQuaternion(t),this.applyMatrix4(be),this}rotateX(t){return be.makeRotationX(t),this.applyMatrix4(be),this}rotateY(t){return be.makeRotationY(t),this.applyMatrix4(be),this}rotateZ(t){return be.makeRotationZ(t),this.applyMatrix4(be),this}translate(t,e,i){return be.makeTranslation(t,e,i),this.applyMatrix4(be),this}scale(t,e,i){return be.makeScale(t,e,i),this.applyMatrix4(be),this}lookAt(t){return ve.lookAt(t),ve.updateMatrix(),this.applyMatrix4(ve.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(we).negate(),this.translate(we.x,we.y,we.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}this.setAttribute("position",new ye(e,3))}else{for(let i=0,n=e.count;i<n;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new j);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new V(-1/0,-1/0,-1/0),new V(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Me.setFromBufferAttribute(i),this.morphTargetsRelative?(Ce.addVectors(this.boundingBox.min,Me.min),this.boundingBox.expandByPoint(Ce),Ce.addVectors(this.boundingBox.max,Me.max),this.boundingBox.expandByPoint(Ce)):(this.boundingBox.expandByPoint(Me.min),this.boundingBox.expandByPoint(Me.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ot);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new V,1/0);if(t){const i=this.boundingSphere.center;if(Me.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Se.setFromBufferAttribute(i),this.morphTargetsRelative?(Ce.addVectors(Me.min,Se.min),Me.expandByPoint(Ce),Ce.addVectors(Me.max,Se.max),Me.expandByPoint(Ce)):(Me.expandByPoint(Se.min),Me.expandByPoint(Se.max))}Me.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)Ce.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Ce));if(e)for(let s=0,r=e.length;s<r;s++){const r=e[s],a=this.morphTargetsRelative;for(let e=0,s=r.count;e<s;e++)Ce.fromBufferAttribute(r,e),a&&(we.fromBufferAttribute(t,e),Ce.add(we)),n=Math.max(n,i.distanceToSquared(Ce))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new fe(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new V,o[t]=new V;const l=new V,h=new V,c=new V,d=new x,u=new x,p=new x,m=new V,f=new V;function g(t,e,n){l.fromBufferAttribute(i,t),h.fromBufferAttribute(i,e),c.fromBufferAttribute(i,n),d.fromBufferAttribute(s,t),u.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),h.sub(l),c.sub(l),u.sub(d),p.sub(d);const r=1/(u.x*p.y-p.x*u.y);isFinite(r)&&(m.copy(h).multiplyScalar(p.y).addScaledVector(c,-u.y).multiplyScalar(r),f.copy(c).multiplyScalar(u.x).addScaledVector(h,-p.x).multiplyScalar(r),a[t].add(m),a[e].add(m),a[n].add(m),o[t].add(f),o[e].add(f),o[n].add(f))}let _=this.groups;0===_.length&&(_=[{start:0,count:t.count}]);for(let e=0,i=_.length;e<i;++e){const i=_[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const y=new V,b=new V,v=new V,w=new V;function M(t){v.fromBufferAttribute(n,t),w.copy(v);const e=a[t];y.copy(e),y.sub(v.multiplyScalar(v.dot(e))).normalize(),b.crossVectors(w,e);const i=b.dot(o[t])<0?-1:1;r.setXYZW(t,y.x,y.y,y.z,i)}for(let e=0,i=_.length;e<i;++e){const i=_[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)M(t.getX(e+0)),M(t.getX(e+1)),M(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new fe(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new V,s=new V,r=new V,a=new V,o=new V,l=new V,h=new V,c=new V;if(t)for(let d=0,u=t.count;d<u;d+=3){const u=t.getX(d+0),p=t.getX(d+1),m=t.getX(d+2);n.fromBufferAttribute(e,u),s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,m),h.subVectors(r,s),c.subVectors(n,s),h.cross(c),a.fromBufferAttribute(i,u),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,m),a.add(h),o.add(h),l.add(h),i.setXYZ(u,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),r.fromBufferAttribute(e,t+2),h.subVectors(r,s),c.subVectors(n,s),h.cross(c),i.setXYZ(t+0,h.x,h.y,h.z),i.setXYZ(t+1,h.x,h.y,h.z),i.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Ce.fromBufferAttribute(t,e),Ce.normalize(),t.setXYZ(e,Ce.x,Ce.y,Ce.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,s=t.normalized,r=new i.constructor(e.length*n);let a=0,o=0;for(let s=0,l=e.length;s<l;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*n;for(let t=0;t<n;t++)r[o++]=i[a++]}return new fe(r,n,s)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new ke,i=this.index.array,n=this.attributes;for(const s in n){const r=t(n[s],i);e.setAttribute(s,r)}const s=this.morphAttributes;for(const n in s){const r=[],a=s[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);r.push(n)}e.morphAttributes[n]=r}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let t=0,i=r.length;t<i;t++){const i=r[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],r=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];r.push(n.toJSON(t.data))}r.length>0&&(n[e]=r,s=!0)}s&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],n=s[t];for(let t=0,s=n.length;t<s;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let t=0,e=r.length;t<e;t++){const e=r[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ae=new gt,Ee=new ft,Te=new ot,ze=new V,De=new V,Oe=new V,Pe=new V,Re=new V,Ie=new V,Le=new V,Be=new V;class Ne extends jt{constructor(t=new ke,e=new ue){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,n=i.attributes.position,s=i.morphAttributes.position,r=i.morphTargetsRelative;e.fromBufferAttribute(n,t);const a=this.morphTargetInfluences;if(s&&a){Ie.set(0,0,0);for(let i=0,n=s.length;i<n;i++){const n=a[i],o=s[i];0!==n&&(Re.fromBufferAttribute(o,t),r?Ie.addScaledVector(Re,n):Ie.addScaledVector(Re.sub(e),n))}e.add(Ie)}return e}raycast(t,e){const i=this.geometry,n=this.material,s=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),Te.copy(i.boundingSphere),Te.applyMatrix4(s),Ee.copy(t.ray).recast(t.near),!1===Te.containsPoint(Ee.origin)){if(null===Ee.intersectSphere(Te,ze))return;if(Ee.origin.distanceToSquared(ze)>(t.far-t.near)**2)return}Ae.copy(s).invert(),Ee.copy(t.ray).applyMatrix4(Ae),null!==i.boundingBox&&!1===Ee.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,Ee)}}_computeIntersections(t,e,i){let n;const s=this.geometry,r=this.material,a=s.index,o=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,c=s.attributes.normal,d=s.groups,u=s.drawRange;if(null!==a)if(Array.isArray(r))for(let s=0,o=d.length;s<o;s++){const o=d[s],p=r[o.materialIndex];for(let s=Math.max(o.start,u.start),r=Math.min(a.count,Math.min(o.start+o.count,u.start+u.count));s<r;s+=3)n=Fe(this,p,t,i,l,h,c,a.getX(s),a.getX(s+1),a.getX(s+2)),n&&(n.faceIndex=Math.floor(s/3),n.face.materialIndex=o.materialIndex,e.push(n))}else for(let s=Math.max(0,u.start),o=Math.min(a.count,u.start+u.count);s<o;s+=3)n=Fe(this,r,t,i,l,h,c,a.getX(s),a.getX(s+1),a.getX(s+2)),n&&(n.faceIndex=Math.floor(s/3),e.push(n));else if(void 0!==o)if(Array.isArray(r))for(let s=0,a=d.length;s<a;s++){const a=d[s],p=r[a.materialIndex];for(let s=Math.max(a.start,u.start),r=Math.min(o.count,Math.min(a.start+a.count,u.start+u.count));s<r;s+=3)n=Fe(this,p,t,i,l,h,c,s,s+1,s+2),n&&(n.faceIndex=Math.floor(s/3),n.face.materialIndex=a.materialIndex,e.push(n))}else for(let s=Math.max(0,u.start),a=Math.min(o.count,u.start+u.count);s<a;s+=3)n=Fe(this,r,t,i,l,h,c,s,s+1,s+2),n&&(n.faceIndex=Math.floor(s/3),e.push(n))}}function Fe(t,e,i,n,s,r,a,o,l,h){t.getVertexPosition(o,De),t.getVertexPosition(l,Oe),t.getVertexPosition(h,Pe);const c=function(t,e,i,n,s,r,a,o){let l;if(l=1===e.side?n.intersectTriangle(a,r,s,!0,o):n.intersectTriangle(s,r,a,0===e.side,o),null===l)return null;Be.copy(o),Be.applyMatrix4(t.matrixWorld);const h=i.ray.origin.distanceTo(Be);return h<i.near||h>i.far?null:{distance:h,point:Be.clone(),object:t}}(t,e,i,n,De,Oe,Pe,Le);if(c){const t=new V;ne.getBarycoord(Le,De,Oe,Pe,t),s&&(c.uv=ne.getInterpolatedAttribute(s,o,l,h,t,new x)),r&&(c.uv1=ne.getInterpolatedAttribute(r,o,l,h,t,new x)),a&&(c.normal=ne.getInterpolatedAttribute(a,o,l,h,t,new V),c.normal.dot(n.direction)>0&&c.normal.multiplyScalar(-1));const e={a:o,b:l,c:h,normal:new V,materialIndex:0};ne.getNormal(De,Oe,Pe,e.normal),c.face=e,c.barycoord=t}return c}function Ve(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const s=t[i][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][n]=null):e[i][n]=s.clone():Array.isArray(s)?e[i][n]=s.slice():e[i][n]=s}}return e}function Ue(t){const e={};for(let i=0;i<t.length;i++){const n=Ve(t[i]);for(const t in n)e[t]=n[t]}return e}class He extends jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new gt,this.projectionMatrix=new gt,this.projectionMatrixInverse=new gt,this.coordinateSystem=d}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const je="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",We="uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",Ge="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",Ye="#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",qe="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",Xe="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",Ze="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",$e="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",Je="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",Ke="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",Qe="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",ti="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",ei="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",ii="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",ni="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",si="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",ri="#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",ai="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",oi="#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",li="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",hi="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",ci="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",di="#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",ui="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",pi="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",mi="#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",fi="#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",gi="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",_i="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",yi="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",xi="#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",bi="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",vi="uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",wi="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",Mi={common:{diffuse:{value:new le(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new b},alphaMap:{value:null},alphaMapTransform:{value:new b},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new b}},envmap:{envMap:{value:null},envMapRotation:{value:new b},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new b}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new b}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new b},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new b},normalScale:{value:new x(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new b},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new b}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new b}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new b}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new le(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new b},alphaTest:{value:0},uvTransform:{value:new b}},sprite:{diffuse:{value:new le(16777215)},opacity:{value:1},center:{value:new x(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new b},alphaMap:{value:null},alphaMapTransform:{value:new b},alphaTest:{value:0}}},Si={basic:{uniforms:Ue([Mi.common,Mi.specularmap,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.fog]),vertexShader:ni,fragmentShader:si},lambert:{uniforms:Ue([Mi.common,Mi.specularmap,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.fog,Mi.lights,{emissive:{value:new le(0)}}]),vertexShader:ri,fragmentShader:ai},phong:{uniforms:Ue([Mi.common,Mi.specularmap,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.fog,Mi.lights,{emissive:{value:new le(0)},specular:{value:new le(1118481)},shininess:{value:30}}]),vertexShader:di,fragmentShader:ui},standard:{uniforms:Ue([Mi.common,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.roughnessmap,Mi.metalnessmap,Mi.fog,Mi.lights,{emissive:{value:new le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pi,fragmentShader:mi},toon:{uniforms:Ue([Mi.common,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.gradientmap,Mi.fog,Mi.lights,{emissive:{value:new le(0)}}]),vertexShader:fi,fragmentShader:gi},matcap:{uniforms:Ue([Mi.common,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.fog,{matcap:{value:null}}]),vertexShader:oi,fragmentShader:li},points:{uniforms:Ue([Mi.points,Mi.fog]),vertexShader:_i,fragmentShader:yi},dashed:{uniforms:Ue([Mi.common,Mi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ei,fragmentShader:ii},depth:{uniforms:Ue([Mi.common,Mi.displacementmap]),vertexShader:Ze,fragmentShader:$e},normal:{uniforms:Ue([Mi.common,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,{opacity:{value:1}}]),vertexShader:hi,fragmentShader:ci},sprite:{uniforms:Ue([Mi.sprite,Mi.fog]),vertexShader:vi,fragmentShader:wi},background:{uniforms:{uvTransform:{value:new b},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je,fragmentShader:We},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new b}},vertexShader:Ge,fragmentShader:Ye},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:qe,fragmentShader:Xe},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe,fragmentShader:ti},distanceRGBA:{uniforms:Ue([Mi.common,Mi.displacementmap,{referencePosition:{value:new V},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Je,fragmentShader:Ke},shadow:{uniforms:Ue([Mi.lights,Mi.fog,{color:{value:new le(0)},opacity:{value:1}}]),vertexShader:xi,fragmentShader:bi}};Si.physical={uniforms:Ue([Si.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new b},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new b},clearcoatNormalScale:{value:new x(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new b},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new b},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new b},sheen:{value:0},sheenColor:{value:new le(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new b},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new b},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new b},transmissionSamplerSize:{value:new x},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new b},attenuationDistance:{value:0},attenuationColor:{value:new le(0)},specularColor:{value:new le(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new b},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new b},anisotropyVector:{value:new x},anisotropyMap:{value:null},anisotropyMapTransform:{value:new b}}]),vertexShader:pi,fragmentShader:mi},Math.sqrt(5),new Float32Array(16),new Float32Array(9),new Float32Array(4),new Map;class Ci extends jt{constructor(){super(),this.isGroup=!0,this.type="Group"}}class ki extends de{static get type(){return"LineBasicMaterial"}constructor(t){super(),this.isLineBasicMaterial=!0,this.color=new le(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Ai=new V,Ei=new V,Ti=new gt,zi=new ft,Di=new ot,Oi=new V,Pi=new V;class Ri extends jt{constructor(t=new ke,e=new ki){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Ai.fromBufferAttribute(e,t-1),Ei.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Ai.distanceTo(Ei);t.setAttribute("lineDistance",new ye(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,s=t.params.Line.threshold,r=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Di.copy(i.boundingSphere),Di.applyMatrix4(n),Di.radius+=s,!1===t.ray.intersectsSphere(Di))return;Ti.copy(n).invert(),zi.copy(t.ray).applyMatrix4(Ti);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,h=i.index,c=i.attributes.position;if(null!==h){const i=Math.max(0,r.start),n=Math.min(h.count,r.start+r.count);for(let s=i,r=n-1;s<r;s+=l){const i=h.getX(s),n=h.getX(s+1),r=Ii(this,t,zi,o,i,n);r&&e.push(r)}if(this.isLineLoop){const s=h.getX(n-1),r=h.getX(i),a=Ii(this,t,zi,o,s,r);a&&e.push(a)}}else{const i=Math.max(0,r.start),n=Math.min(c.count,r.start+r.count);for(let s=i,r=n-1;s<r;s+=l){const i=Ii(this,t,zi,o,s,s+1);i&&e.push(i)}if(this.isLineLoop){const s=Ii(this,t,zi,o,n-1,i);s&&e.push(s)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Ii(t,e,i,n,s,r){const a=t.geometry.attributes.position;if(Ai.fromBufferAttribute(a,s),Ei.fromBufferAttribute(a,r),i.distanceSqToSegment(Ai,Ei,Oi,Pi)>n)return;Oi.applyMatrix4(t.matrixWorld);const o=e.ray.origin.distanceTo(Oi);return o<e.near||o>e.far?void 0:{distance:o,point:Pi.clone().applyMatrix4(t.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:t}}const Li=new V,Bi=new V;class Ni extends Ri{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)Li.fromBufferAttribute(e,t),Bi.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Li.distanceTo(Bi);t.setAttribute("lineDistance",new ye(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Fi extends ke{constructor(t=1,e=32,i=16,n=0,s=2*Math.PI,r=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:s,thetaStart:r,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const o=Math.min(r+a,Math.PI);let l=0;const h=[],c=new V,d=new V,u=[],p=[],m=[],f=[];for(let u=0;u<=i;u++){const g=[],_=u/i;let y=0;0===u&&0===r?y=.5/e:u===i&&o===Math.PI&&(y=-.5/e);for(let i=0;i<=e;i++){const o=i/e;c.x=-t*Math.cos(n+o*s)*Math.sin(r+_*a),c.y=t*Math.cos(r+_*a),c.z=t*Math.sin(n+o*s)*Math.sin(r+_*a),p.push(c.x,c.y,c.z),d.copy(c).normalize(),m.push(d.x,d.y,d.z),f.push(o+y,1-_),g.push(l++)}h.push(g)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=h[t][n+1],s=h[t][n],a=h[t+1][n],l=h[t+1][n+1];(0!==t||r>0)&&u.push(e,s,l),(t!==i-1||o<Math.PI)&&u.push(s,a,l)}this.setIndex(u),this.setAttribute("position",new ye(p,3)),this.setAttribute("normal",new ye(m,3)),this.setAttribute("uv",new ye(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Fi(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}function Vi(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}class Ui{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],s=e[i-1];t:{e:{let r;i:{n:if(!(t<n)){for(let r=i+2;;){if(void 0===n){if(t<s)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===r)break;if(s=n,n=e[++i],t<n)break e}r=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let r=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===r)break;if(n=s,s=e[--i-1],t>=s)break e}r=i,i=0}}for(;i<r;){const n=i+r>>>1;t<e[n]?r=n:i=n+1}if(n=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n;for(let t=0;t!==n;++t)e[t]=i[s+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Hi extends Ui{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let s=t-2,r=t+1,a=n[s],o=n[r];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:s=t,a=2*e-i;break;case 2402:s=n.length-2,a=e+n[s]-n[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:r=t,o=2*i-e;break;case 2402:r=1,o=i+n[1]-n[0];break;default:r=t-1,o=e}const l=.5*(i-e),h=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-i),this._offsetPrev=s*h,this._offsetNext=r*h}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,h=this._offsetPrev,c=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(i-e)/(n-e),m=p*p,f=m*p,g=-d*f+2*d*m-d*p,_=(1+d)*f+(-1.5-2*d)*m+(-.5+d)*p+1,y=(-1-u)*f+(1.5+u)*m+.5*p,x=u*f-u*m;for(let t=0;t!==a;++t)s[t]=g*r[h+t]+_*r[l+t]+y*r[o+t]+x*r[c+t];return s}}class ji extends Ui{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,h=(i-e)/(n-e),c=1-h;for(let t=0;t!==a;++t)s[t]=r[l+t]*c+r[o+t]*h;return s}}class Wi extends Ui{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class Gi{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Vi(e,this.TimeBufferType),this.values=Vi(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Vi(t.times,Array),values:Vi(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Wi(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new ji(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Hi(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case n:e=this.InterpolantFactoryMethodDiscrete;break;case s:e=this.InterpolantFactoryMethodLinear;break;case r:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return n;case this.InterpolantFactoryMethodLinear:return s;case this.InterpolantFactoryMethodSmooth:return r}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let s=0,r=n-1;for(;s!==n&&i[s]<t;)++s;for(;-1!==r&&i[r]>e;)--r;if(++r,0!==s||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);const t=this.getValueSize();this.times=i.slice(s,r),this.values=this.values.slice(s*t,r*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,s=i.length;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let e=0;e!==s;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==r&&r>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,r),t=!1;break}r=n}if(void 0!==n&&(a=n,ArrayBuffer.isView(a)&&!(a instanceof DataView)))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}var a;return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===r,s=t.length-1;let a=1;for(let r=1;r<s;++r){let s=!1;const o=t[r];if(o!==t[r+1]&&(1!==r||o!==t[0]))if(n)s=!0;else{const t=r*i,n=t-i,a=t+i;for(let r=0;r!==i;++r){const i=e[t+r];if(i!==e[n+r]||i!==e[a+r]){s=!0;break}}}if(s){if(r!==a){t[a]=t[r];const n=r*i,s=a*i;for(let t=0;t!==i;++t)e[s+t]=e[n+t]}++a}}if(s>0){t[a]=t[s];for(let t=s*i,n=a*i,r=0;r!==i;++r)e[n+r]=e[t+r];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Gi.prototype.TimeBufferType=Float32Array,Gi.prototype.ValueBufferType=Float32Array,Gi.prototype.DefaultInterpolation=s;class Yi extends Gi{constructor(t,e,i){super(t,e,i)}}Yi.prototype.ValueTypeName="bool",Yi.prototype.ValueBufferType=Array,Yi.prototype.DefaultInterpolation=n,Yi.prototype.InterpolantFactoryMethodLinear=void 0,Yi.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends Gi{}).prototype.ValueTypeName="color";(class extends Gi{}).prototype.ValueTypeName="number";class qi extends Ui{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=(i-e)/(n-e);let l=t*a;for(let t=l+a;l!==t;l+=4)F.slerpFlat(s,0,r,l-a,r,l,o);return s}}class Xi extends Gi{InterpolantFactoryMethodLinear(t){return new qi(this.times,this.values,this.getValueSize(),t)}}Xi.prototype.ValueTypeName="quaternion",Xi.prototype.InterpolantFactoryMethodSmooth=void 0;class Zi extends Gi{constructor(t,e,i){super(t,e,i)}}Zi.prototype.ValueTypeName="string",Zi.prototype.ValueBufferType=Array,Zi.prototype.DefaultInterpolation=n,Zi.prototype.InterpolantFactoryMethodLinear=void 0,Zi.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends Gi{}).prototype.ValueTypeName="vector";Error;const $i="\\[\\]\\.:\\/",Ji=new RegExp("["+$i+"]","g"),Ki="[^"+$i+"]",Qi="[^"+$i.replace("\\.","")+"]",tn=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Ki)+/(WCOD+)?/.source.replace("WCOD",Qi)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ki)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ki)+"$"),en=["material","materials","bones","map"];class nn{constructor(t,e,i){this.path=e,this.parsedPath=i||nn.parseTrackName(e),this.node=nn.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new nn.Composite(t,e,i):new nn(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ji,"")}static parseTrackName(t){const e=tn.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==en.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const s=t[n];if(s.name===e||s.uuid===e)return s;const r=i(s.children);if(r)return r}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let s=e.propertyIndex;if(t||(t=nn.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const r=t[n];if(void 0===r){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==s){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[s]&&(s=t.morphTargetDictionary[s])}o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else void 0!==r.fromArray&&void 0!==r.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(o=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nn.Composite=class{constructor(t,e,i){const n=i||nn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},nn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},nn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},nn.prototype.GetterByBindingType=[nn.prototype._getValue_direct,nn.prototype._getValue_array,nn.prototype._getValue_arrayElement,nn.prototype._getValue_toArray],nn.prototype.SetterByBindingTypeAndVersioning=[[nn.prototype._setValue_direct,nn.prototype._setValue_direct_setNeedsUpdate,nn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nn.prototype._setValue_array,nn.prototype._setValue_array_setNeedsUpdate,nn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nn.prototype._setValue_arrayElement,nn.prototype._setValue_arrayElement_setNeedsUpdate,nn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nn.prototype._setValue_fromArray,nn.prototype._setValue_fromArray_setNeedsUpdate,nn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1);const sn=new V,rn=new He;class an extends Ni{constructor(t){const e=new ke,i=new ki({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],r={};function a(t,e){o(t),o(e)}function o(t){n.push(0,0,0),s.push(0,0,0),void 0===r[t]&&(r[t]=[]),r[t].push(n.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new ye(n,3)),e.setAttribute("color",new ye(s,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=r,this.update();const l=new le(16755200),h=new le(16711680),c=new le(43775),d=new le(16777215),u=new le(3355443);this.setColors(l,h,c,d,u)}setColors(t,e,i,n,s){const r=this.geometry.getAttribute("color");r.setXYZ(0,t.r,t.g,t.b),r.setXYZ(1,t.r,t.g,t.b),r.setXYZ(2,t.r,t.g,t.b),r.setXYZ(3,t.r,t.g,t.b),r.setXYZ(4,t.r,t.g,t.b),r.setXYZ(5,t.r,t.g,t.b),r.setXYZ(6,t.r,t.g,t.b),r.setXYZ(7,t.r,t.g,t.b),r.setXYZ(8,t.r,t.g,t.b),r.setXYZ(9,t.r,t.g,t.b),r.setXYZ(10,t.r,t.g,t.b),r.setXYZ(11,t.r,t.g,t.b),r.setXYZ(12,t.r,t.g,t.b),r.setXYZ(13,t.r,t.g,t.b),r.setXYZ(14,t.r,t.g,t.b),r.setXYZ(15,t.r,t.g,t.b),r.setXYZ(16,t.r,t.g,t.b),r.setXYZ(17,t.r,t.g,t.b),r.setXYZ(18,t.r,t.g,t.b),r.setXYZ(19,t.r,t.g,t.b),r.setXYZ(20,t.r,t.g,t.b),r.setXYZ(21,t.r,t.g,t.b),r.setXYZ(22,t.r,t.g,t.b),r.setXYZ(23,t.r,t.g,t.b),r.setXYZ(24,e.r,e.g,e.b),r.setXYZ(25,e.r,e.g,e.b),r.setXYZ(26,e.r,e.g,e.b),r.setXYZ(27,e.r,e.g,e.b),r.setXYZ(28,e.r,e.g,e.b),r.setXYZ(29,e.r,e.g,e.b),r.setXYZ(30,e.r,e.g,e.b),r.setXYZ(31,e.r,e.g,e.b),r.setXYZ(32,i.r,i.g,i.b),r.setXYZ(33,i.r,i.g,i.b),r.setXYZ(34,i.r,i.g,i.b),r.setXYZ(35,i.r,i.g,i.b),r.setXYZ(36,i.r,i.g,i.b),r.setXYZ(37,i.r,i.g,i.b),r.setXYZ(38,n.r,n.g,n.b),r.setXYZ(39,n.r,n.g,n.b),r.setXYZ(40,s.r,s.g,s.b),r.setXYZ(41,s.r,s.g,s.b),r.setXYZ(42,s.r,s.g,s.b),r.setXYZ(43,s.r,s.g,s.b),r.setXYZ(44,s.r,s.g,s.b),r.setXYZ(45,s.r,s.g,s.b),r.setXYZ(46,s.r,s.g,s.b),r.setXYZ(47,s.r,s.g,s.b),r.setXYZ(48,s.r,s.g,s.b),r.setXYZ(49,s.r,s.g,s.b),r.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;rn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),on("c",e,t,rn,0,0,-1),on("t",e,t,rn,0,0,1),on("n1",e,t,rn,-1,-1,-1),on("n2",e,t,rn,1,-1,-1),on("n3",e,t,rn,-1,1,-1),on("n4",e,t,rn,1,1,-1),on("f1",e,t,rn,-1,-1,1),on("f2",e,t,rn,1,-1,1),on("f3",e,t,rn,-1,1,1),on("f4",e,t,rn,1,1,1),on("u1",e,t,rn,.7,1.1,-1),on("u2",e,t,rn,-.7,1.1,-1),on("u3",e,t,rn,0,2,-1),on("cf1",e,t,rn,-1,0,1),on("cf2",e,t,rn,1,0,1),on("cf3",e,t,rn,0,-1,1),on("cf4",e,t,rn,0,1,1),on("cn1",e,t,rn,-1,0,-1),on("cn2",e,t,rn,1,0,-1),on("cn3",e,t,rn,0,-1,-1),on("cn4",e,t,rn,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function on(t,e,i,n,s,r,a){sn.set(s,r,a).unproject(n);const o=e[t];if(void 0!==o){const t=i.getAttribute("position");for(let e=0,i=o.length;e<i;e++)t.setXYZ(o[e],sn.x,sn.y,sn.z)}}const ln=new j;class hn extends Ni{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new ke;s.setIndex(new fe(i,1)),s.setAttribute("position",new fe(n,3)),super(s,new ki({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&ln.setFromObject(this.object),ln.isEmpty())return;const e=ln.min,i=ln.max,n=this.geometry.attributes.position,s=n.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=e.x,s[4]=i.y,s[5]=i.z,s[6]=e.x,s[7]=e.y,s[8]=i.z,s[9]=i.x,s[10]=e.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=e.z,s[15]=e.x,s[16]=i.y,s[17]=e.z,s[18]=e.x,s[19]=e.y,s[20]=e.z,s[21]=i.x,s[22]=e.y,s[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class cn extends Ni{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new ke;n.setIndex(new fe(i,1)),n.setAttribute("position",new ye([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(n,new ki({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"170"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="170");var dn=i(80353),un=i(66257);function pn(t){return t+.5|0}const mn=(t,e,i)=>Math.max(Math.min(t,i),e);function fn(t){return mn(pn(2.55*t),0,255)}function gn(t){return mn(pn(255*t),0,255)}function _n(t){return mn(pn(t/2.55)/100,0,1)}function yn(t){return mn(pn(100*t),0,100)}const xn={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},bn=[..."0123456789ABCDEF"],vn=t=>bn[15&t],wn=t=>bn[(240&t)>>4]+bn[15&t],Mn=t=>(240&t)>>4==(15&t);const Sn=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Cn(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 kn(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 An(t,e,i){const n=Cn(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 En(t){const e=t.r/255,i=t.g/255,n=t.b/255,s=Math.max(e,i,n),r=Math.min(e,i,n),a=(s+r)/2;let o,l,h;return s!==r&&(h=s-r,l=a>.5?h/(2-s-r):h/(s+r),o=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),o=60*o+.5),[0|o,l||0,a]}function Tn(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(gn)}function zn(t,e,i){return Tn(Cn,t,e,i)}function Dn(t){return(t%360+360)%360}const On={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"},Pn={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 Rn;const In=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,Ln=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Bn=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Nn(t,e,i){if(t){let n=En(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=zn(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function Fn(t,e){return t?Object.assign(e||{},t):t}function Vn(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=gn(t[3]))):(e=Fn(t,{r:0,g:0,b:0,a:1})).a=gn(e.a),e}function Un(t){return"r"===t.charAt(0)?function(t){const e=In.exec(t);let i,n,s,r=255;if(e){if(e[7]!==i){const t=+e[7];r=e[8]?fn(t):mn(255*t,0,255)}return i=+e[1],n=+e[3],s=+e[5],i=255&(e[2]?fn(i):mn(i,0,255)),n=255&(e[4]?fn(n):mn(n,0,255)),s=255&(e[6]?fn(s):mn(s,0,255)),{r:i,g:n,b:s,a:r}}}(t):function(t){const e=Sn.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?fn(+e[5]):gn(+e[5]));const s=Dn(+e[2]),r=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Tn(An,t,e,i)}(s,r,a):"hsv"===e[1]?function(t,e,i){return Tn(kn,t,e,i)}(s,r,a):zn(s,r,a),{r:i[0],g:i[1],b:i[2],a:n}}(t)}class Hn{constructor(t){if(t instanceof Hn)return t;const e=typeof t;let i;var n,s,r;"object"===e?i=Vn(t):"string"===e&&(r=(n=t).length,"#"===n[0]&&(4===r||5===r?s={r:255&17*xn[n[1]],g:255&17*xn[n[2]],b:255&17*xn[n[3]],a:5===r?17*xn[n[4]]:255}:7!==r&&9!==r||(s={r:xn[n[1]]<<4|xn[n[2]],g:xn[n[3]]<<4|xn[n[4]],b:xn[n[5]]<<4|xn[n[6]],a:9===r?xn[n[7]]<<4|xn[n[8]]:255})),i=s||function(t){Rn||(Rn=function(){const t={},e=Object.keys(Pn),i=Object.keys(On);let n,s,r,a,o;for(n=0;n<e.length;n++){for(a=o=e[n],s=0;s<i.length;s++)r=i[s],o=o.replace(r,On[r]);r=parseInt(Pn[a],16),t[o]=[r>>16&255,r>>8&255,255&r]}return t}(),Rn.transparent=[0,0,0,0]);const e=Rn[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||Un(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Fn(this._rgb);return t&&(t.a=_n(t.a)),t}set rgb(t){this._rgb=Vn(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${_n(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?(t=this._rgb,e=(t=>Mn(t.r)&&Mn(t.g)&&Mn(t.b)&&Mn(t.a))(t)?vn:wn,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=En(t),i=e[0],n=yn(e[1]),s=yn(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${s}%, ${_n(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 r=e===s?.5:e,a=2*r-1,o=i.a-n.a,l=((a*o==-1?a:(a+o)/(1+a*o))+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=r*i.a+(1-r)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=Bn(_n(t.r)),s=Bn(_n(t.g)),r=Bn(_n(t.b));return{r:gn(Ln(n+i*(Bn(_n(e.r))-n))),g:gn(Ln(s+i*(Bn(_n(e.g))-s))),b:gn(Ln(r+i*(Bn(_n(e.b))-r))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Hn(this.rgb)}alpha(t){return this._rgb.a=gn(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=pn(.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 Nn(this._rgb,2,t),this}darken(t){return Nn(this._rgb,2,-t),this}saturate(t){return Nn(this._rgb,1,t),this}desaturate(t){return Nn(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=En(t);i[0]=Dn(i[0]+e),i=zn(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}const jn=(()=>{let t=0;return()=>t++})();function Wn(t){return null==t}function Gn(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 Yn(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function qn(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function Xn(t,e){return qn(t)?t:e}function Zn(t,e){return void 0===t?e:t}function $n(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function Jn(t,e,i,n){let s,r,a;if(Gn(t))if(r=t.length,n)for(s=r-1;s>=0;s--)e.call(i,t[s],s);else for(s=0;s<r;s++)e.call(i,t[s],s);else if(Yn(t))for(a=Object.keys(t),r=a.length,s=0;s<r;s++)e.call(i,t[a[s]],a[s])}function Kn(t,e){let i,n,s,r;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(s=t[i],r=e[i],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function Qn(t){if(Gn(t))return t.map(Qn);if(Yn(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let s=0;for(;s<n;++s)e[i[s]]=Qn(t[i[s]]);return e}return t}function ts(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function es(t,e,i,n){if(!ts(t))return;const s=e[t],r=i[t];Yn(s)&&Yn(r)?is(s,r,n):e[t]=Qn(r)}function is(t,e,i){const n=Gn(e)?e:[e],s=n.length;if(!Yn(t))return t;const r=(i=i||{}).merger||es;let a;for(let e=0;e<s;++e){if(a=n[e],!Yn(a))continue;const s=Object.keys(a);for(let e=0,n=s.length;e<n;++e)r(s[e],t,a,i)}return t}function ns(t,e){return is(t,e,{merger:ss})}function ss(t,e,i){if(!ts(t))return;const n=e[t],s=i[t];Yn(n)&&Yn(s)?ns(n,s):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Qn(s))}const rs={"":t=>t,x:t=>t.x,y:t=>t.y};function as(t,e){const i=rs[e]||(rs[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 os(t){return t.charAt(0).toUpperCase()+t.slice(1)}const ls=t=>void 0!==t,hs=t=>"function"==typeof t,cs=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},ds=Math.PI,us=2*ds,ps=us+ds,ms=Number.POSITIVE_INFINITY,fs=ds/180,gs=ds/2,_s=ds/4,ys=2*ds/3,xs=Math.log10,bs=Math.sign;function vs(t,e,i){return Math.abs(t-e)<i}function ws(t){const e=Math.round(t);t=vs(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(xs(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function Ms(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Ss(t){return t*(ds/180)}function Cs(t){if(!qn(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function ks(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function As(t,e){return(t-e+ps)%us-ds}function Es(t){return(t%us+us)%us}function Ts(t,e,i,n){const s=Es(t),r=Es(e),a=Es(i),o=Es(r-s),l=Es(a-s),h=Es(s-r),c=Es(s-a);return s===r||s===a||n&&r===a||o>l&&h<c}function zs(t,e,i){return Math.max(e,Math.min(i,t))}function Ds(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function Os(t,e,i){i=i||(i=>t[i]<e);let n,s=t.length-1,r=0;for(;s-r>1;)n=r+s>>1,i(n)?r=n:s=n;return{lo:r,hi:s}}const Ps=(t,e,i,n)=>Os(t,i,n?n=>{const s=t[n][e];return s<i||s===i&&t[n+1][e]===i}:n=>t[n][e]<i),Rs=(t,e,i)=>Os(t,i,(n=>t[n][e]>=i)),Is=["push","pop","shift","splice","unshift"];function Ls(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||(Is.forEach((e=>{delete t[e]})),delete t._chartjs)}const Bs="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Ns(t,e){let i=[],n=!1;return function(...s){i=s,n||(n=!0,Bs.call(window,(()=>{n=!1,t.apply(e,i)})))}}const Fs=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;const Vs=t=>0===t||1===t,Us=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*us/i),Hs=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*us/i)+1,js={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*gs),easeOutSine:t=>Math.sin(t*gs),easeInOutSine:t=>-.5*(Math.cos(ds*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=>Vs(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=>Vs(t)?t:Us(t,.075,.3),easeOutElastic:t=>Vs(t)?t:Hs(t,.075,.3),easeInOutElastic(t){const e=.1125;return Vs(t)?t:t<.5?.5*Us(2*t,e,.45):.5+.5*Hs(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-js.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*js.easeInBounce(2*t):.5*js.easeOutBounce(2*t-1)+.5};function Ws(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Gs(t){return Ws(t)?t:new Hn(t)}function Ys(t){return Ws(t)?t:new Hn(t).saturate(.5).darken(.1).hexString()}const qs=["x","y","borderWidth","radius","tension"],Xs=["color","borderColor","backgroundColor"],Zs=new Map;function $s(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=Zs.get(i);return n||(n=new Intl.NumberFormat(t,e),Zs.set(i,n)),n}(e,i).format(t)}const Js={values:t=>Gn(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let s,r=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"),r=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=xs(Math.abs(r)),o=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:o,maximumFractionDigits:o};return Object.assign(l,this.options.ticks.format),$s(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(xs(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?Js.numeric.call(this,t,e,i):""}};var Ks={formatters:Js};const Qs=Object.create(null),tr=Object.create(null);function er(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 ir(t,e,i){return"string"==typeof e?is(er(t,e),i):is(er(t,""),e)}class nr{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)=>Ys(e.backgroundColor),this.hoverBorderColor=(t,e)=>Ys(e.borderColor),this.hoverColor=(t,e)=>Ys(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 ir(this,t,e)}get(t){return er(this,t)}describe(t,e){return ir(tr,t,e)}override(t,e){return ir(Qs,t,e)}route(t,e,i,n){const s=er(this,t),r=er(this,i),a="_"+e;Object.defineProperties(s,{[a]:{value:s[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=r[n];return Yn(t)?Object.assign({},e,t):Zn(t,e)},set(t){this[a]=t}}})}apply(t){t.forEach((t=>t(this)))}}var sr=new nr({_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:Xs},numbers:{type:"number",properties:qs}}),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:Ks.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 rr(t,e,i,n,s){let r=e[s];return r||(r=e[s]=t.measureText(s).width,i.push(s)),r>n&&(n=r),n}function ar(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 or(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function lr(t,e,i,n){!function(t,e,i,n,s){let r,a,o,l,h,c,d,u;const p=e.pointStyle,m=e.rotation,f=e.radius;let g=(m||0)*fs;if(p&&"object"==typeof p&&(r=p.toString(),"[object HTMLImageElement]"===r||"[object HTMLCanvasElement]"===r))return t.save(),t.translate(i,n),t.rotate(g),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(f)||f<=0)){switch(t.beginPath(),p){default:s?t.ellipse(i,n,s/2,f,0,0,us):t.arc(i,n,f,0,us),t.closePath();break;case"triangle":c=s?s/2:f,t.moveTo(i+Math.sin(g)*c,n-Math.cos(g)*f),g+=ys,t.lineTo(i+Math.sin(g)*c,n-Math.cos(g)*f),g+=ys,t.lineTo(i+Math.sin(g)*c,n-Math.cos(g)*f),t.closePath();break;case"rectRounded":h=.516*f,l=f-h,a=Math.cos(g+_s)*l,d=Math.cos(g+_s)*(s?s/2-h:l),o=Math.sin(g+_s)*l,u=Math.sin(g+_s)*(s?s/2-h:l),t.arc(i-d,n-o,h,g-ds,g-gs),t.arc(i+u,n-a,h,g-gs,g),t.arc(i+d,n+o,h,g,g+gs),t.arc(i-u,n+a,h,g+gs,g+ds),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*f,c=s?s/2:l,t.rect(i-c,n-l,2*c,2*l);break}g+=_s;case"rectRot":d=Math.cos(g)*(s?s/2:f),a=Math.cos(g)*f,o=Math.sin(g)*f,u=Math.sin(g)*(s?s/2:f),t.moveTo(i-d,n-o),t.lineTo(i+u,n-a),t.lineTo(i+d,n+o),t.lineTo(i-u,n+a),t.closePath();break;case"crossRot":g+=_s;case"cross":d=Math.cos(g)*(s?s/2:f),a=Math.cos(g)*f,o=Math.sin(g)*f,u=Math.sin(g)*(s?s/2:f),t.moveTo(i-d,n-o),t.lineTo(i+d,n+o),t.moveTo(i+u,n-a),t.lineTo(i-u,n+a);break;case"star":d=Math.cos(g)*(s?s/2:f),a=Math.cos(g)*f,o=Math.sin(g)*f,u=Math.sin(g)*(s?s/2:f),t.moveTo(i-d,n-o),t.lineTo(i+d,n+o),t.moveTo(i+u,n-a),t.lineTo(i-u,n+a),g+=_s,d=Math.cos(g)*(s?s/2:f),a=Math.cos(g)*f,o=Math.sin(g)*f,u=Math.sin(g)*(s?s/2:f),t.moveTo(i-d,n-o),t.lineTo(i+d,n+o),t.moveTo(i+u,n-a),t.lineTo(i-u,n+a);break;case"line":a=s?s/2:Math.cos(g)*f,o=Math.sin(g)*f,t.moveTo(i-a,n-o),t.lineTo(i+a,n+o);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(g)*(s?s/2:f),n+Math.sin(g)*f);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}(t,e,i,n,null)}function hr(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 cr(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function dr(t){t.restore()}function ur(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 pr(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 mr(t,e,i,n,s){if(s.strikethrough||s.underline){const r=t.measureText(n),a=e-r.actualBoundingBoxLeft,o=e+r.actualBoundingBoxRight,l=i-r.actualBoundingBoxAscent,h=i+r.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(o,c),t.stroke()}}function fr(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function gr(t,e,i,n,s,r={}){const a=Gn(e)?e:[e],o=r.strokeWidth>0&&""!==r.strokeColor;let l,h;for(t.save(),t.font=s.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),Wn(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,r),l=0;l<a.length;++l)h=a[l],r.backdrop&&fr(t,r.backdrop),o&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),Wn(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(h,i,n,r.maxWidth)),t.fillText(h,i,n,r.maxWidth),mr(t,i,n,h,r),n+=Number(s.lineHeight);t.restore()}function _r(t,e){const{x:i,y:n,w:s,h:r,radius:a}=e;t.arc(i+a.topLeft,n+a.topLeft,a.topLeft,1.5*ds,ds,!0),t.lineTo(i,n+r-a.bottomLeft),t.arc(i+a.bottomLeft,n+r-a.bottomLeft,a.bottomLeft,ds,gs,!0),t.lineTo(i+s-a.bottomRight,n+r),t.arc(i+s-a.bottomRight,n+r-a.bottomRight,a.bottomRight,gs,0,!0),t.lineTo(i+s,n+a.topRight),t.arc(i+s-a.topRight,n+a.topRight,a.topRight,0,-gs,!0),t.lineTo(i+a.topLeft,n)}const yr=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,xr=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function br(t,e){const i=(""+t).match(yr);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 vr(t,e){const i={},n=Yn(e),s=n?Object.keys(e):e,r=Yn(t)?n?i=>Zn(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of s)i[t]=+r(t)||0;return i}function wr(t){return vr(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Mr(t){const e=wr(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Sr(t,e){t=t||{},e=e||sr.font;let i=Zn(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=Zn(t.style,e.style);n&&!(""+n).match(xr)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const s={family:Zn(t.family,e.family),lineHeight:br(Zn(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:Zn(t.weight,e.weight),string:""};return s.string=function(t){return!t||Wn(t.size)||Wn(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(s),s}function Cr(t,e,i,n){let s,r,a,o=!0;for(s=0,r=t.length;s<r;++s)if(a=t[s],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),o=!1),void 0!==i&&Gn(a)&&(a=a[i%a.length],o=!1),void 0!==a))return n&&!o&&(n.cacheable=!1),a}function kr(t,e){return Object.assign(Object.create(t),e)}function Ar(t,e=[""],i,n,s=()=>t[0]){const r=i||t;void 0===n&&(n=Nr("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:r,_fallback:n,_getTarget:s,override:i=>Ar([i,...t],e,r,n)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>Or(i,n,(()=>function(t,e,i,n){let s;for(const r of e)if(s=Nr(zr(r,t),i),void 0!==s)return Dr(t,s)?Lr(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)=>Fr(t).includes(e),ownKeys:t=>Fr(t),set(t,e,i){const n=t._storage||(t._storage=s());return t[e]=n[e]=i,delete t._keys,!0}})}function Er(t,e,i,n){const s={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Tr(t,n),setContext:e=>Er(t,e,i,n),override:s=>Er(t.override(s),e,i,n)};return new Proxy(s,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Or(t,e,(()=>function(t,e,i){const{_proxy:n,_context:s,_subProxy:r,_descriptors:a}=t;let o=n[e];return hs(o)&&a.isScriptable(e)&&(o=function(t,e,i,n){const{_proxy:s,_context:r,_subProxy:a,_stack:o}=i;if(o.has(t))throw new Error("Recursion detected: "+Array.from(o).join("->")+"->"+t);o.add(t);let l=e(r,a||n);return o.delete(t),Dr(t,l)&&(l=Lr(s._scopes,s,t,l)),l}(e,o,t,i)),Gn(o)&&o.length&&(o=function(t,e,i,n){const{_proxy:s,_context:r,_subProxy:a,_descriptors:o}=i;if(void 0!==r.index&&n(t))return e[r.index%e.length];if(Yn(e[0])){const i=e,n=s._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=Lr(n,s,t,l);e.push(Er(i,r,a&&a[t],o))}}return e}(e,o,t,a.isIndexable)),Dr(e,o)&&(o=Er(o,s,r&&r[e],a)),o}(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 Tr(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:hs(i)?i:()=>i,isIndexable:hs(n)?n:()=>n}}const zr=(t,e)=>t?t+os(e):e,Dr=(t,e)=>Yn(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Or(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function Pr(t,e,i){return hs(t)?t(e,i):t}const Rr=(t,e)=>!0===t?e:"string"==typeof t?as(e,t):void 0;function Ir(t,e,i,n,s){for(const r of e){const e=Rr(i,r);if(e){t.add(e);const r=Pr(e._fallback,i,s);if(void 0!==r&&r!==i&&r!==n)return r}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function Lr(t,e,i,n){const s=e._rootScopes,r=Pr(e._fallback,i,n),a=[...t,...s],o=new Set;o.add(n);let l=Br(o,a,i,r||i,n);return null!==l&&(void 0===r||r===i||(l=Br(o,a,r,l,n),null!==l))&&Ar(Array.from(o),[""],s,r,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const s=n[e];return Gn(s)&&Yn(i)?i:s||{}}(e,i,n)))}function Br(t,e,i,n,s){for(;i;)i=Ir(t,e,i,n,s);return i}function Nr(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function Fr(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 Vr=Number.EPSILON||1e-14,Ur=(t,e)=>e<t.length&&!t[e].skip&&t[e],Hr=t=>"x"===t?"y":"x";function jr(t,e,i,n){const s=t.skip?e:t,r=e,a=i.skip?e:i,o=ks(r,s),l=ks(a,r);let h=o/(o+l),c=l/(o+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=n*h,u=n*c;return{previous:{x:r.x-d*(a.x-s.x),y:r.y-d*(a.y-s.y)},next:{x:r.x+u*(a.x-s.x),y:r.y+u*(a.y-s.y)}}}function Wr(t,e,i){return Math.max(Math.min(t,i),e)}function Gr(t,e,i,n,s){let r,a,o,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){const i=Hr(e),n=t.length,s=Array(n).fill(0),r=Array(n);let a,o,l,h=Ur(t,0);for(a=0;a<n;++a)if(o=l,l=h,h=Ur(t,a+1),l){if(h){const t=h[e]-l[e];s[a]=0!==t?(h[i]-l[i])/t:0}r[a]=o?h?bs(s[a-1])!==bs(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}!function(t,e,i){const n=t.length;let s,r,a,o,l,h=Ur(t,0);for(let c=0;c<n-1;++c)l=h,h=Ur(t,c+1),l&&h&&(vs(e[c],0,Vr)?i[c]=i[c+1]=0:(s=i[c]/e[c],r=i[c+1]/e[c],o=Math.pow(s,2)+Math.pow(r,2),o<=9||(a=3/Math.sqrt(o),i[c]=s*a*e[c],i[c+1]=r*a*e[c])))}(t,s,r),function(t,e,i="x"){const n=Hr(i),s=t.length;let r,a,o,l=Ur(t,0);for(let h=0;h<s;++h){if(a=o,o=l,l=Ur(t,h+1),!o)continue;const s=o[i],c=o[n];a&&(r=(s-a[i])/3,o[`cp1${i}`]=s-r,o[`cp1${n}`]=c-r*e[h]),l&&(r=(l[i]-s)/3,o[`cp2${i}`]=s+r,o[`cp2${n}`]=c+r*e[h])}}(t,r,e)}(t,s);else{let i=n?t[t.length-1]:t[0];for(r=0,a=t.length;r<a;++r)o=t[r],l=jr(i,o,t[Math.min(r+1,a-(n?0:1))%a],e.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,i=o}e.capBezierPoints&&function(t,e){let i,n,s,r,a,o=hr(t[0],e);for(i=0,n=t.length;i<n;++i)a=r,r=o,o=i<n-1&&hr(t[i+1],e),r&&(s=t[i],a&&(s.cp1x=Wr(s.cp1x,e.left,e.right),s.cp1y=Wr(s.cp1y,e.top,e.bottom)),o&&(s.cp2x=Wr(s.cp2x,e.left,e.right),s.cp2y=Wr(s.cp2y,e.top,e.bottom)))}(t,i)}function Yr(){return"undefined"!=typeof window&&"undefined"!=typeof document}function qr(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function Xr(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 Zr=t=>t.ownerDocument.defaultView.getComputedStyle(t,null),$r=["top","right","bottom","left"];function Jr(t,e,i){const n={};i=i?"-"+i:"";for(let s=0;s<4;s++){const r=$r[s];n[r]=parseFloat(t[e+"-"+r+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function Kr(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,s=Zr(i),r="border-box"===s.boxSizing,a=Jr(s,"padding"),o=Jr(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:r}=n;let a,o,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(s,r,t.target))a=s,o=r;else{const t=e.getBoundingClientRect();a=n.clientX-t.left,o=n.clientY-t.top,l=!0}return{x:a,y:o,box:l}}(t,i),d=a.left+(c&&o.left),u=a.top+(c&&o.top);let{width:p,height:m}=e;return r&&(p-=a.width+o.width,m-=a.height+o.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((h-u)/m*i.height/n)}}const Qr=t=>Math.round(10*t)/10;function ta(t,e,i){const n=e||1,s=Math.floor(t.height*n),r=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!==r)&&(t.currentDevicePixelRatio=n,a.height=s,a.width=r,t.ctx.setTransform(n,0,0,n,0,0),!0)}const ea=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Yr()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function ia(t,e){const i=function(t,e){return Zr(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function na(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function sa(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 ra(t,e,i,n){const s={x:t.cp2x,y:t.cp2y},r={x:e.cp1x,y:e.cp1y},a=na(t,s,i),o=na(s,r,i),l=na(r,e,i),h=na(a,o,i),c=na(o,l,i);return na(h,c,i)}function aa(t){return"angle"===t?{between:Ts,compare:As,normalize:Es}:{between:Ds,compare:(t,e)=>t-e,normalize:t=>t}}function oa({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 la(t,e,i){if(!i)return[t];const{property:n,start:s,end:r}=i,a=e.length,{compare:o,between:l,normalize:h}=aa(n),{start:c,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:s,end:r}=i,{between:a,normalize:o}=aa(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(o(e[d%l][n]),s,r);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),m=[];let f,g,_,y=!1,x=null;for(let t=c,i=c;t<=d;++t)g=e[t%a],g.skip||(f=h(g[n]),f!==_&&(y=l(f,s,r),null===x&&(y||l(s,_,f)&&0!==o(s,_))&&(x=0===o(f,s)?t:i),null!==x&&(!y||0===o(r,f)||l(r,_,f))&&(m.push(oa({start:x,end:t,loop:u,count:a,style:p})),x=null),i=t,_=f));return null!==x&&m.push(oa({start:x,end:d,loop:u,count:a,style:p})),m}function ha(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function ca(t,e){if(!e)return!1;const i=[],n=function(t,e){return Ws(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}class da{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],r=e.duration;s.forEach((n=>n({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)})))}_refresh(){this._request||(this._running=!0,this._request=Bs.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 r,a=s.length-1,o=!1;for(;a>=0;--a)r=s[a],r._active?(r._total>i.duration&&(i.duration=r._total),r.tick(t),o=!0):(s[a]=s[s.length-1],s.pop());o&&(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 ua=new da;const pa="transparent",ma={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=Gs(t||pa),s=n.valid&&Gs(e||pa);return s&&s.valid?s.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class fa{constructor(t,e,i,n){const s=e[i];n=Cr([t.to,n,s,t.from]);const r=Cr([t.from,s,n]);this._active=!0,this._fn=t.fn||ma[t.type||typeof r],this._easing=js[t.easing]||js.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=r,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,r=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=s,this._loop=!!t.loop,this._to=Cr([t.to,e,n,t.from]),this._from=Cr([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,r=this._loop,a=this._to;let o;if(this._active=s!==a&&(r||e<i),!this._active)return this._target[n]=a,void this._notify(!0);e<0?this._target[n]=s:(o=e/i%2,o=r&&o>1?2-o:o,o=this._easing(Math.min(1,Math.max(0,o))),this._target[n]=this._fn(s,a,o))}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 ga{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!Yn(t))return;const e=Object.keys(sr.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const s=t[n];if(!Yn(s))return;const r={};for(const t of e)r[t]=s[t];(Gn(s.properties)&&s.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,r)}))}))}_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={}),r=Object.keys(e),a=Date.now();let o;for(o=r.length-1;o>=0;--o){const l=r[o];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 fa(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?(ua.add(this._chart,i),!0):void 0}}function _a(t,e){const i=t&&t.options||{},n=i.reverse,s=void 0===i.min?e:0,r=void 0===i.max?e:0;return{start:n?r:s,end:n?s:r}}function ya(t,e){const i=[],n=t._getSortedDatasetMetas(e);let s,r;for(s=0,r=n.length;s<r;++s)i.push(n[s].index);return i}function xa(t,e,i,n={}){const s=t.keys,r="single"===n.mode;let a,o,l,h;if(null===e)return;let c=!1;for(a=0,o=s.length;a<o;++a){if(l=+s[a],l===i){if(c=!0,n.all)continue;break}h=t.values[l],qn(h)&&(r||0===e||bs(e)===bs(h))&&(e+=h)}return c||n.all?e:0}function ba(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function va(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function wa(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 Ma(t,e){const{chart:i,_cachedMeta:n}=t,s=i._stacks||(i._stacks={}),{iScale:r,vScale:a,index:o}=n,l=r.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(r,a,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:r,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=va(s,c,r),u[o]=d,u._top=wa(u,a,!0,n.type),u._bottom=wa(u,a,!1,n.type),(u._visualValues||(u._visualValues={}))[o]=d}}function Sa(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Ca(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 ka=t=>"reset"===t||"none"===t,Aa=(t,e)=>e?t:Object.assign({},t);class Ea{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=ba(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&&Ca(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=Zn(i.xAxisID,Sa(t,"x")),r=e.yAxisID=Zn(i.yAxisID,Sa(t,"y")),a=e.rAxisID=Zn(i.rAxisID,Sa(t,"r")),o=e.indexAxis,l=e.iAxisID=n(o,s,r,a),h=e.vAxisID=n(o,r,s,a);e.xScale=this.getScaleForId(s),e.yScale=this.getScaleForId(r),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&&Ls(this._data,this),t._stacked&&Ca(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(Yn(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,s="x"===i.axis?"x":"y",r="x"===n.axis?"x":"y",a=Object.keys(t),o=new Array(a.length);let l,h,c;for(l=0,h=a.length;l<h;++l)c=a[l],o[l]={[s]:c,[r]:t[c]};return o}(e,t)}else if(i!==e){if(i){Ls(i,this);const t=this._cachedMeta;Ca(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]}}),Is.forEach((t=>{const e="_onData"+os(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=ba(e.vScale,e),e.stack!==i.stack&&(n=!0,Ca(e),e.stack=i.stack),this._resyncElements(t),(n||s!==e._stacked)&&(Ma(this,e._parsed),e._stacked=ba(e.vScale,e))}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:r}=i,a=s.axis;let o,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=Gn(n[t])?this.parseArrayData(i,n,t,e):Yn(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(o=0;o<e;++o)i._parsed[o+t]=l=h[o],c&&(s()&&(c=!1),d=l);i._sorted=c}r&&Ma(this,h)}parsePrimitiveData(t,e,i,n){const{iScale:s,vScale:r}=t,a=s.axis,o=r.axis,l=s.getLabels(),h=s===r,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),[o]:r.parse(e[p],p)};return c}parseArrayData(t,e,i,n){const{xScale:s,yScale:r}=t,a=new Array(n);let o,l,h,c;for(o=0,l=n;o<l;++o)h=o+i,c=e[h],a[o]={x:s.parse(c[0],h),y:r.parse(c[1],h)};return a}parseObjectData(t,e,i,n){const{xScale:s,yScale:r}=t,{xAxisKey:a="x",yAxisKey:o="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(as(u,a),d),y:r.parse(as(u,o),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,r=e[t.axis];return xa({keys:ya(n,!0),values:e._stacks[t.axis]._visualValues},r,s.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const s=i[e.axis];let r=null===s?NaN:s;const a=n&&i._stacks[e.axis];n&&a&&(n.values=a,r=xa(n,s,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,s=i._sorted&&t===i.iScale,r=n.length,a=this._getOtherScale(t),o=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:ya(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!qn(u[t.axis])||h>e||c<e}for(d=0;d<r&&(p()||(this.updateRangeFromParsed(l,t,u,o),!s));++d);if(s)for(d=r-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,o);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,s,r;for(n=0,s=e.length;n<s;++n)r=e[n][t.axis],qn(r)&&i.push(r);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 Yn(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}}(Zn(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=_a(t,i),s=_a(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,r=[],a=this._drawStart||0,o=this._drawCount||n.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,s,a,o),h=a;h<a+o;++h){const e=n[h];e.hidden||(e.active&&l?r.push(e):e.draw(t,s))}for(h=0;h<r.length;++h)r[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 kr(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 kr(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,r=t+"-"+e,a=s[r],o=this.enableOptionSharing&&ls(i);if(a)return Aa(a,o);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(sr.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),c);return p.$shared&&(p.$shared=o,s[r]=Object.freeze(Aa(p,o))),p}_resolveAnimations(t,e,i){const n=this.chart,s=this._cachedDataOpts,r=`animation-${e}`,a=s[r];if(a)return a;let o;if(!1!==n.options.animation){const n=this.chart.config,s=n.datasetAnimationScopeKeys(this._type,e),r=n.getOptionScopes(this.getDataset(),s);o=n.createResolver(r,this.getContext(t,i,e))}const l=new ga(n,o&&o.animations);return o&&o._cacheable&&(s[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ka(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,s=this.getSharedOptions(i),r=this.includeOptions(e,s)||s!==n;return this.updateSharedOptions(s,e,i),{sharedOptions:s,includeOptions:r}}updateElement(t,e,i,n){ka(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!ka(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,r=Math.min(s,n);r&&this.parse(0,r),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,r=t+e;let a;const o=t=>{for(t.length+=e,a=t.length-1;a>=r;a--)t[a]=t[a-e]};for(o(s),a=t;a<r;++a)s[a]=new this.dataElementType;this._parsing&&o(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&&Ca(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 Ta(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,r,a,o=e._length;const l=()=>{32767!==r&&-32768!==r&&(ls(a)&&(o=Math.min(o,Math.abs(r-a)||o)),a=r)};for(n=0,s=i.length;n<s;++n)r=e.getPixelForValue(i[n]),l();for(a=void 0,n=0,s=e.ticks.length;n<s;++n)r=e.getPixelForTick(n),l();return o}function za(t,e,i,n){return Gn(t)?function(t,e,i,n){const s=i.parse(t[0],n),r=i.parse(t[1],n),a=Math.min(s,r),o=Math.max(s,r);let l=a,h=o;Math.abs(a)>Math.abs(o)&&(l=o,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:s,end:r,min:a,max:o}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function Da(t,e,i,n){const s=t.iScale,r=t.vScale,a=s.getLabels(),o=s===r,l=[];let h,c,d,u;for(h=i,c=i+n;h<c;++h)u=e[h],d={},d[s.axis]=o||s.parse(a[h],h),l.push(za(u,d,r,h));return l}function Oa(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Pa(t,e,i,n){let s=e.borderSkipped;const r={};if(!s)return void(t.borderSkipped=r);if(!0===s)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:o,reverse:l,top:h,bottom:c}=function(t){let e,i,n,s,r;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(s="end",r="start"):(s="start",r="end"),{start:i,end:n,reverse:e,top:s,bottom:r}}(t);"middle"===s&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?s=h:(i._bottom||0)===n?s=c:(r[Ra(c,a,o,l)]=!0,s=h)),r[Ra(s,a,o,l)]=!0,t.borderSkipped=r}function Ra(t,e,i,n){var s,r,a;return n?(a=i,t=Ia(t=(s=t)===(r=e)?a:s===a?r:s,i,e)):t=Ia(t,e,i),t}function Ia(t,e,i){return"start"===t?e:"end"===t?i:t}function La(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}function Ba(t,e,i,n){const{controller:s,data:r,_sorted:a}=t,o=s._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(o&&e===o.axis&&"r"!==e&&a&&r.length){const a=o._reversePixels?Rs:Ps;if(!n){const n=a(r,e,i);if(l){const{vScale:e}=s._cachedMeta,{_parsed:i}=t,r=i.slice(0,n.lo+1).reverse().findIndex((t=>!Wn(t[e.axis])));n.lo-=Math.max(0,r);const a=i.slice(n.hi).findIndex((t=>!Wn(t[e.axis])));n.hi+=Math.max(0,a)}return n}if(s._sharedOptions){const t=r[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=a(r,e,i-n),s=a(r,e,i+n);return{lo:t.lo,hi:s.hi}}}}return{lo:0,hi:r.length-1}}function Na(t,e,i,n,s){const r=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=r.length;t<i;++t){const{index:i,data:o}=r[t],{lo:l,hi:h}=Ba(r[t],e,a,s);for(let t=l;t<=h;++t){const e=o[t];e.skip||n(e,i,t)}}}function Fa(t,e,i,n,s){const r=[];return s||t.isPointInArea(e)?(Na(t,i,e,(function(i,a,o){(s||hr(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&r.push({element:i,datasetIndex:a,index:o})}),!0),r):r}function Va(t,e,i,n,s,r){return r||t.isPointInArea(e)?"r"!==i||n?function(t,e,i,n,s,r){let a=[];const o=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,r=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(r,2))}}(i);let l=Number.POSITIVE_INFINITY;return Na(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(!r&&!t.isPointInArea(u)&&!d)return;const p=o(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,r):function(t,e,i,n){let s=[];return Na(t,i,e,(function(t,i,r){const{startAngle:a,endAngle:o}=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 r=Math.atan2(n,i);return r<-.5*ds&&(r+=us),{angle:r,distance:s}}(t,{x:e.x,y:e.y});Ts(l,a,o)&&s.push({element:t,datasetIndex:i,index:r})})),s}(t,e,i,s):[]}function Ua(t,e,i,n,s){const r=[],a="x"===i?"inXRange":"inYRange";let o=!1;return Na(t,i,e,((t,n,l)=>{t[a]&&t[a](e[i],s)&&(r.push({element:t,datasetIndex:n,index:l}),o=o||t.inRange(e.x,e.y,s))})),n&&!o?[]:r}var Ha={evaluateInteractionItems:Na,modes:{index(t,e,i,n){const s=Kr(e,t),r=i.axis||"x",a=i.includeInvisible||!1,o=i.intersect?Fa(t,s,r,n,a):Va(t,s,r,!1,n,a),l=[];return o.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=o[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=Kr(e,t),r=i.axis||"xy",a=i.includeInvisible||!1;let o=i.intersect?Fa(t,s,r,n,a):Va(t,s,r,!1,n,a);if(o.length>0){const e=o[0].datasetIndex,i=t.getDatasetMeta(e).data;o=[];for(let t=0;t<i.length;++t)o.push({element:i[t],datasetIndex:e,index:t})}return o},point:(t,e,i,n)=>Fa(t,Kr(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const s=Kr(e,t),r=i.axis||"xy",a=i.includeInvisible||!1;return Va(t,s,r,i.intersect,n,a)},x:(t,e,i,n)=>Ua(t,Kr(e,t),"x",i.intersect,n),y:(t,e,i,n)=>Ua(t,Kr(e,t),"y",i.intersect,n)}};const ja=["left","top","right","bottom"];function Wa(t,e){return t.filter((t=>t.pos===e))}function Ga(t,e){return t.filter((t=>-1===ja.indexOf(t.pos)&&t.box.axis===e))}function Ya(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 qa(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Xa(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 Za(t,e,i,n){const{pos:s,box:r}=i,a=t.maxPadding;if(!Yn(s)){i.size&&(t[s]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[s]+=i.size}r.getPadding&&Xa(a,r.getPadding());const o=Math.max(0,e.outerWidth-qa(a,t,"left","right")),l=Math.max(0,e.outerHeight-qa(a,t,"top","bottom")),h=o!==t.w,c=l!==t.h;return t.w=o,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function $a(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 Ja(t,e,i,n){const s=[];let r,a,o,l,h,c;for(r=0,a=t.length,h=0;r<a;++r){o=t[r],l=o.box,l.update(o.width||e.w,o.height||e.h,$a(o.horizontal,e));const{same:a,other:d}=Za(e,i,o,n);h|=a&&s.length,c=c||d,l.fullSize||s.push(o)}return h&&Ja(s,e,i,n)||c}function Ka(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 Qa(t,e,i,n){const s=i.padding;let{x:r,y:a}=e;for(const o of t){const t=o.box,l=n[o.stack]||{count:1,placed:0,weight:1},h=o.stackWeight/l.weight||1;if(o.horizontal){const n=e.w*h,r=l.size||t.height;ls(l.start)&&(a=l.start),t.fullSize?Ka(t,s.left,a,i.outerWidth-s.right-s.left,r):Ka(t,e.left+l.placed,a,n,r),l.start=a,l.placed+=n,a=t.bottom}else{const n=e.h*h,a=l.size||t.width;ls(l.start)&&(r=l.start),t.fullSize?Ka(t,r,s.top,a,i.outerHeight-s.bottom-s.top):Ka(t,r,e.top+l.placed,a,n),l.start=r,l.placed+=n,r=t.right}}e.x=r,e.y=a}var to={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=Mr(t.options.layout.padding),r=Math.max(e-s.width,0),a=Math.max(i-s.height,0),o=function(t){const e=function(t){const e=[];let i,n,s,r,a,o;for(i=0,n=(t||[]).length;i<n;++i)s=t[i],({position:r,options:{stack:a,stackWeight:o=1}}=s),e.push({index:i,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&r+a,stackWeight:o});return e}(t),i=Ya(e.filter((t=>t.box.fullSize)),!0),n=Ya(Wa(e,"left"),!0),s=Ya(Wa(e,"right")),r=Ya(Wa(e,"top"),!0),a=Ya(Wa(e,"bottom")),o=Ga(e,"x"),l=Ga(e,"y");return{fullSize:i,leftAndTop:n.concat(r),rightAndBottom:s.concat(l).concat(a).concat(o),chartArea:Wa(e,"chartArea"),vertical:n.concat(s).concat(l),horizontal:r.concat(a).concat(o)}}(t.boxes),l=o.vertical,h=o.horizontal;Jn(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:r,availableHeight:a,vBoxMaxWidth:r/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},s);Xa(u,Mr(n));const p=Object.assign({maxPadding:u,w:r,h:a,x:s.left,y:s.top},s),m=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:s}=i;if(!t||!ja.includes(n))continue;const r=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=s}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:s}=e;let r,a,o;for(r=0,a=t.length;r<a;++r){o=t[r];const{fullSize:a}=o.box,l=i[o.stack],h=l&&o.stackWeight/l.weight;o.horizontal?(o.width=h?h*n:a&&e.availableWidth,o.height=s):(o.width=n,o.height=h?h*s:a&&e.availableHeight)}return i}(l.concat(h),d);Ja(o.fullSize,p,d,m),Ja(l,p,d,m),Ja(h,p,d,m)&&Ja(l,p,d,m),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),Qa(o.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,Qa(o.rightAndBottom,p,d,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Jn(o.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 eo{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 io extends eo{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const no="$chartjs",so={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ro=t=>null===t||""===t,ao=!!ea&&{passive:!0};function oo(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,ao)}function lo(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function ho(t,e,i){const n=t.canvas,s=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||lo(i.addedNodes,n),e=e&&!lo(i.removedNodes,n);e&&i()}));return s.observe(document,{childList:!0,subtree:!0}),s}function co(t,e,i){const n=t.canvas,s=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||lo(i.removedNodes,n),e=e&&!lo(i.addedNodes,n);e&&i()}));return s.observe(document,{childList:!0,subtree:!0}),s}const uo=new Map;let po=0;function mo(){const t=window.devicePixelRatio;t!==po&&(po=t,uo.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function fo(t,e,i){const n=t.canvas,s=n&&qr(n);if(!s)return;const r=Ns(((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||r(i,n)}));return a.observe(s),function(t,e){uo.size||window.addEventListener("resize",mo),uo.set(t,e)}(t,r),a}function go(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){uo.delete(t),uo.size||window.removeEventListener("resize",mo)}(t)}function _o(t,e,i){const n=t.canvas,s=Ns((e=>{null!==t.ctx&&i(function(t,e){const i=so[t.type]||t.type,{x:n,y:s}=Kr(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,ao)}(n,e,s),s}class yo extends eo{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[no]={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",ro(s)){const e=ia(t,"width");void 0!==e&&(t.width=e)}if(ro(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ia(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[no])return!1;const i=e[no].initial;["height","width"].forEach((t=>{const n=i[t];Wn(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[no],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),s={attach:ho,detach:co,resize:fo}[e]||_o;n[e]=s(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];n&&(({attach:go,detach:go,resize:go}[e]||oo)(t,e,n),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return function(t,e,i,n){const s=Zr(t),r=Jr(s,"margin"),a=Xr(s.maxWidth,t,"clientWidth")||ms,o=Xr(s.maxHeight,t,"clientHeight")||ms,l=function(t,e,i){let n,s;if(void 0===e||void 0===i){const r=t&&qr(t);if(r){const t=r.getBoundingClientRect(),a=Zr(r),o=Jr(a,"border","width"),l=Jr(a,"padding");e=t.width-l.width-o.width,i=t.height-l.height-o.height,n=Xr(a.maxWidth,r,"clientWidth"),s=Xr(a.maxHeight,r,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||ms,maxHeight:s||ms}}(t,e,i);let{width:h,height:c}=l;if("content-box"===s.boxSizing){const t=Jr(s,"border","width"),e=Jr(s,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-r.width),c=Math.max(0,n?h/n:c-r.height),h=Qr(Math.min(h,a,l.maxWidth)),c=Qr(Math.min(c,o,l.maxHeight)),h&&!c&&(c=Qr(h/2)),(void 0!==e||void 0!==i)&&n&&l.height&&c>l.height&&(c=l.height,h=Qr(Math.floor(c*n))),{width:h,height:c}}(t,e,i,n)}isAttached(t){const e=t&&qr(t);return!(!e||!e.isConnected)}}class xo{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 Ms(this.x)&&Ms(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 bo(t,e,i,n,s){const r=Zn(n,0),a=Math.min(Zn(s,t.length),t.length);let o,l,h,c=0;for(i=Math.ceil(i),s&&(o=s-n,i=o/Math.floor(o/i)),h=r;h<0;)c++,h=Math.round(r+c*i);for(l=Math.max(r,0);l<a;l++)l===h&&(e.push(t[l]),c++,h=Math.round(r+c*i))}const vo=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,wo=(t,e)=>Math.min(e||t,t);function Mo(t,e){const i=[],n=t.length/e,s=t.length;let r=0;for(;r<s;r+=n)i.push(t[Math.floor(r)]);return i}function So(t,e,i){const n=t.ticks.length,s=Math.min(e,n-1),r=t._startPixel,a=t._endPixel,o=1e-6;let l,h=t.getPixelForTick(s);if(!(i&&(l=1===n?Math.max(h-r,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(s-1))/2,h+=s<e?l:-l,h<r-o||h>a+o)))return h}function Co(t){return t.drawTicks?t.tickLength:0}function ko(t,e){if(!t.display)return 0;const i=Sr(t.font,e),n=Mr(t.padding);return(Gn(t.text)?t.text.length:1)*i.lineHeight+n.height}function Ao(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 Eo extends xo{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=Xn(t,Number.POSITIVE_INFINITY),e=Xn(e,Number.NEGATIVE_INFINITY),i=Xn(i,Number.POSITIVE_INFINITY),n=Xn(n,Number.NEGATIVE_INFINITY),{min:Xn(t,i),max:Xn(e,n),minDefined:qn(t),maxDefined:qn(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:s,maxDefined:r}=this.getUserBounds();if(s&&r)return{min:i,max:n};const a=this.getMatchingVisibleMetas();for(let o=0,l=a.length;o<l;++o)e=a[o].controller.getMinMax(this,t),s||(i=Math.min(i,e.min)),r||(n=Math.max(n,e.max));return i=r&&i>n?n:i,n=s&&i>n?i:n,{min:Xn(i,Xn(n,i)),max:Xn(n,Xn(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(){$n(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:s,ticks:r}=this.options,a=r.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,r=(l=(s-n)/2,"string"==typeof(o=e)&&o.endsWith("%")?parseFloat(o)/100*l:+o),a=(t,e)=>i&&0===t?0:t+e;var o,l;return{min:a(n,-Math.abs(r)),max:a(s,r)}}(this,s,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const o=a<this.ticks.length;this._convertTicksToLabels(o?Mo(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.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),r=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=r.length,o=r[0],l=r[a-1],h=[];if(a>s)return function(t,e,i,n){let s,r=0,a=i[0];for(n=Math.ceil(n),s=0;s<t.length;s++)s===a&&(e.push(t[s]),r++,a=i[r*n])}(e,h,r,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 r=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=r.length-1;t<e;t++){const e=r[t];if(e>s)return e}return Math.max(s,1)}(r,e,s);if(a>0){let t,i;const n=a>1?Math.round((l-o)/(a-1)):null;for(bo(e,h,c,Wn(n)?0:o-n,o),t=0,i=a-1;t<i;t++)bo(e,h,c,r[t],r[t+1]);return bo(e,h,c,l,Wn(n)?e.length:l+n),h}return bo(e,h,c),h}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),o&&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(){$n(this.options.afterUpdate,[this])}beforeSetDimensions(){$n(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(){$n(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),$n(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){$n(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=$n(e.callback,[s.value,i,t],this)}afterTickToLabelConversion(){$n(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){$n(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=wo(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,s=e.maxRotation;let r,a,o,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=zs(this.chart.width-c,0,this.maxWidth);r=t.offset?this.maxWidth/i:u/(i-1),c+6>r&&(r=u/(i-(t.offset?.5:1)),a=this.maxHeight-Co(t.grid)-e.padding-ko(t.title,this.chart.options.font),o=Math.sqrt(c*c+d*d),l=Math.min(Math.asin(zs((h.highest.height+6)/r,-1,1)),Math.asin(zs(a/o,-1,1))-Math.asin(zs(d/o,-1,1)))*(180/ds),l=Math.max(n,Math.min(s,l))),this.labelRotation=l}afterCalculateLabelRotation(){$n(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){$n(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:s}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const r=ko(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=Co(s)+r):(t.height=this.maxHeight,t.width=Co(s)+r),i.display&&this.ticks.length){const{first:e,last:n,widest:s,highest:r}=this._getLabelSizes(),o=2*i.padding,l=Ss(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*s.width+h*r.height;t.height=Math.min(this.maxHeight,t.height+e+o)}else{const e=i.mirror?0:h*s.width+c*r.height;t.width=Math.min(this.maxWidth,t.width+e+o)}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:r},position:a}=this.options,o=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;o?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+r)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+r)*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+r,this.paddingBottom=n+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){$n(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"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++)Wn(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=Mo(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,r=[],a=[],o=Math.floor(e/wo(e,i));let l,h,c,d,u,p,m,f,g,_,y,x=0,b=0;for(l=0;l<e;l+=o){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,m=s[p]=s[p]||{data:{},gc:[]},f=u.lineHeight,g=_=0,Wn(d)||Gn(d)){if(Gn(d))for(h=0,c=d.length;h<c;++h)y=d[h],Wn(y)||Gn(y)||(g=rr(n,m.data,m.gc,g,y),_+=f)}else g=rr(n,m.data,m.gc,g,d),_=f;r.push(g),a.push(_),x=Math.max(g,x),b=Math.max(_,b)}!function(t,e){Jn(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=r.indexOf(x),w=a.indexOf(b),M=t=>({width:r[t]||0,height:a[t]||0});return{first:M(0),last:M(e-1),widest:M(v),highest:M(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return zs(this._alignToPixels?ar(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 kr(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=kr(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Ss(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),s=this._getLabelSizes(),r=t.autoSkipPadding||0,a=s?s.widest.width+r:0,o=s?s.highest.height+r:0;return this.isHorizontal()?o*i>a*n?a/i:o/n:o*n<a*i?o/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:r,border:a}=n,o=s.offset,l=this.isHorizontal(),h=this.ticks.length+(o?1:0),c=Co(s),d=[],u=a.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,f=function(t){return ar(i,t,p)};let g,_,y,x,b,v,w,M,S,C,k,A;if("top"===r)g=f(this.bottom),v=this.bottom-c,M=g-m,C=f(t.top)+m,A=t.bottom;else if("bottom"===r)g=f(this.top),C=t.top,A=f(t.bottom)-m,v=g+m,M=this.top+c;else if("left"===r)g=f(this.right),b=this.right-c,w=g-m,S=f(t.left)+m,k=t.right;else if("right"===r)g=f(this.left),S=t.left,k=f(t.right)-m,b=g+m,w=this.left+c;else if("x"===e){if("center"===r)g=f((t.top+t.bottom)/2+.5);else if(Yn(r)){const t=Object.keys(r)[0],e=r[t];g=f(this.chart.scales[t].getPixelForValue(e))}C=t.top,A=t.bottom,v=g+m,M=v+c}else if("y"===e){if("center"===r)g=f((t.left+t.right)/2);else if(Yn(r)){const t=Object.keys(r)[0],e=r[t];g=f(this.chart.scales[t].getPixelForValue(e))}b=g-m,w=b-c,S=t.left,k=t.right}const E=Zn(n.ticks.maxTicksLimit,h),T=Math.max(1,Math.ceil(h/E));for(_=0;_<h;_+=T){const t=this.getContext(_),e=s.setContext(t),n=a.setContext(t),r=e.lineWidth,h=e.color,c=n.dash||[],u=n.dashOffset,p=e.tickWidth,m=e.tickColor,f=e.tickBorderDash||[],g=e.tickBorderDashOffset;y=So(this,_,o),void 0!==y&&(x=ar(i,y,r),l?b=w=S=k=x:v=M=C=A=x,d.push({tx1:b,ty1:v,tx2:w,ty2:M,x1:S,y1:C,x2:k,y2:A,width:r,color:h,borderDash:c,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:f,tickBorderDashOffset:g}))}return this._ticksLength=h,this._borderValue=g,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:s}=i,r=this.isHorizontal(),a=this.ticks,{align:o,crossAlign:l,padding:h,mirror:c}=s,d=Co(i.grid),u=d+h,p=c?-h:u,m=-Ss(this.labelRotation),f=[];let g,_,y,x,b,v,w,M,S,C,k,A,E="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,b=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,b=t.x}else if("x"===e){if("center"===n)v=(t.top+t.bottom)/2+u;else if(Yn(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)b=(t.left+t.right)/2-u;else if(Yn(n)){const t=Object.keys(n)[0],e=n[t];b=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===o?E="top":"end"===o&&(E="bottom"));const T=this._getLabelSizes();for(g=0,_=a.length;g<_;++g){y=a[g],x=y.label;const t=s.setContext(this.getContext(g));M=this.getPixelForTick(g)+s.labelOffset,S=this._resolveTickFontOptions(g),C=S.lineHeight,k=Gn(x)?x.length:1;const e=k/2,i=t.color,o=t.textStrokeColor,h=t.textStrokeWidth;let d,u=w;if(r?(b=M,"inner"===w&&(u=g===_-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==m?-k*C+C/2:"center"===l?-T.highest.height/2-e*C+C:-T.highest.height+C/2:"near"===l||0!==m?C/2:"center"===l?T.highest.height/2-e*C:T.highest.height-k*C,c&&(A*=-1),0===m||t.showLabelBackdrop||(b+=C/2*Math.sin(m))):(v=M,A=(1-k)*C/2),t.showLabelBackdrop){const e=Mr(t.backdropPadding),i=T.heights[g],n=T.widths[g];let s=A-e.top,r=0-e.left;switch(E){case"middle":s-=i/2;break;case"bottom":s-=i}switch(w){case"center":r-=n/2;break;case"right":r-=n;break;case"inner":g===_-1?r-=n:g>0&&(r-=n/2)}d={left:r,top:s,width:n+e.width,height:i+e.height,color:t.backdropColor}}f.push({label:x,font:S,textOffset:A,options:{rotation:m,color:i,strokeColor:o,strokeWidth:h,textAlign:u,textBaseline:E,translation:[b,v],backdrop:d}})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Ss(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,r=t+s,a=this._getLabelSizes().widest.width;let o,l;return"left"===e?n?(l=this.right+s,"near"===i?o="left":"center"===i?(o="center",l+=a/2):(o="right",l+=a)):(l=this.right-r,"near"===i?o="right":"center"===i?(o="center",l-=a/2):(o="left",l=this.left)):"right"===e?n?(l=this.left+s,"near"===i?o="right":"center"===i?(o="center",l-=a/2):(o="left",l-=a)):(l=this.left+r,"near"===i?o="left":"center"===i?(o="center",l+=a/2):(o="right",l=this.right)):o="right",{textAlign:o,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:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,s,r),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,r;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,r=n.length;s<r;++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()),r=i.display?s.width:0;if(!r)return;const a=n.setContext(this.getContext(0)).lineWidth,o=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=ar(t,this.left,r)-r/2,h=ar(t,this.right,a)+a/2,c=d=o):(c=ar(t,this.top,r)-r/2,d=ar(t,this.bottom,a)+a/2,l=h=o),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&&cr(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;gr(e,t.label,0,t.textOffset,n,i)}i&&dr(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const s=Sr(i.font),r=Mr(i.padding),a=i.align;let o=s.lineHeight/2;"bottom"===e||"center"===e||Yn(e)?(o+=r.bottom,Gn(i.text)&&(o+=s.lineHeight*(i.text.length-1))):o+=r.top;const{titleX:l,titleY:h,maxWidth:c,rotation:d}=function(t,e,i,n){const{top:s,left:r,bottom:a,right:o,chart:l}=t,{chartArea:h,scales:c}=l;let d,u,p,m=0;const f=a-s,g=o-r;if(t.isHorizontal()){if(u=Fs(n,r,o),Yn(i)){const t=Object.keys(i)[0],n=i[t];p=c[t].getPixelForValue(n)+f-e}else p="center"===i?(h.bottom+h.top)/2+f-e:vo(t,i,e);d=o-r}else{if(Yn(i)){const t=Object.keys(i)[0],n=i[t];u=c[t].getPixelForValue(n)-g+e}else u="center"===i?(h.left+h.right)/2-g+e:vo(t,i,e);p=Fs(n,a,s),m="left"===i?-gs:gs}return{titleX:u,titleY:p,maxWidth:d,rotation:m}}(this,o,e,a);gr(t,i.text,0,0,s,{color:i.color,maxWidth:c,rotation:d,textAlign:Ao(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=Zn(t.grid&&t.grid.z,-1),n=Zn(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Eo.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,r;for(s=0,r=e.length;s<r;++s){const r=e[s];r[i]!==this.id||t&&r.type!==t||n.push(r)}return n}_resolveTickFontOptions(t){return Sr(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class To{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,r=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=is(Object.create(null),[i?sr.get(i):{},sr.get(e),t.defaults]);sr.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),s=n.pop(),r=[t].concat(n).join("."),a=e[i].split("."),o=a.pop(),l=a.join(".");sr.route(r,s,l,o)}))}(e,t.defaultRoutes),t.descriptors&&sr.describe(e,t.descriptors)}(t,r,i),this.override&&sr.override(t.id,t.overrides)),r}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 sr[n]&&(delete sr[n][i],this.override&&delete Qs[i])}}class zo{constructor(){this.controllers=new To(Ea,"datasets",!0),this.elements=new To(xo,"elements"),this.plugins=new To(Object,"plugins"),this.scales=new To(Eo,"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):Jn(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=os(t);$n(i["before"+n],[],i),e[t](i),$n(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 Do=new zo;class Oo{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),r=this._notify(s,t,e,i);return"afterDestroy"===e&&(this._notify(s,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,i,n){n=n||{};for(const s of t){const t=s.plugin;if(!1===$n(t[i],[e,n,s.options],t)&&n.cancelable)return!1}return!0}invalidate(){Wn(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=Zn(i.options&&i.options.plugins,{}),s=function(t){const e={},i=[],n=Object.keys(Do.plugins.items);for(let t=0;t<n.length;t++)i.push(Do.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 r=[],a=t.getContext();for(const o of e){const e=o.id,l=Po(n[e],s);null!==l&&r.push({plugin:o,options:Ro(t.config,{plugin:o,local:i[e]},l,a)})}return r}(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 Po(t,e){return e||!1!==t?!0===t?{}:t:null}function Ro(t,{plugin:e,local:i},n,s){const r=t.pluginScopeKeys(e),a=t.getOptionScopes(n,r);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Io(t,e){const i=sr.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Lo(t){if("x"===t||"y"===t||"r"===t)return t}function Bo(t,...e){if(Lo(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&&Lo(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 No(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Fo(t){const e=t.options||(t.options={});e.plugins=Zn(e.plugins,{}),e.scales=function(t,e){const i=Qs[t.type]||{scales:{}},n=e.scales||{},s=Io(t.type,e),r=Object.create(null);return Object.keys(n).forEach((e=>{const a=n[e];if(!Yn(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 o=Bo(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 No(t,"x",i[0])||No(t,"y",i[0])}return{}}(e,t),sr.scales[a.type]),l=function(t,e){return t===e?"_index_":"_value_"}(o,s),h=i.scales||{};r[e]=ns(Object.create(null),[{axis:o},a,h[o],h[l]])})),t.data.datasets.forEach((i=>{const s=i.type||t.type,a=i.indexAxis||Io(s,e),o=(Qs[s]||{}).scales||{};Object.keys(o).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;r[s]=r[s]||Object.create(null),ns(r[s],[{axis:e},n[s],o[t]])}))})),Object.keys(r).forEach((t=>{const e=r[t];ns(e,[sr.scales[e.type],sr.scale])})),r}(t,e)}function Vo(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Uo=new Map,Ho=new Set;function jo(t,e){let i=Uo.get(t);return i||(i=e(),Uo.set(t,i),Ho.add(i)),i}const Wo=(t,e,i)=>{const n=as(e,i);void 0!==n&&t.add(n)};class Go{constructor(t){this._config=function(t){return(t=t||{}).data=Vo(t.data),Fo(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=Vo(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(),Fo(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return jo(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return jo(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return jo(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return jo(`${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,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;const o=new Set;e.forEach((e=>{t&&(o.add(t),e.forEach((e=>Wo(o,t,e)))),e.forEach((t=>Wo(o,n,t))),e.forEach((t=>Wo(o,Qs[s]||{},t))),e.forEach((t=>Wo(o,sr,t))),e.forEach((t=>Wo(o,tr,t)))}));const l=Array.from(o);return 0===l.length&&l.push(Object.create(null)),Ho.has(e)&&r.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Qs[e]||{},sr.datasets[e]||{},{type:e},sr,tr]}resolveNamedOptions(t,e,i,n=[""]){const s={$shared:!0},{resolver:r,subPrefixes:a}=Yo(this._resolverCache,t,n);let o=r;(function(t,e){const{isScriptable:i,isIndexable:n}=Tr(t);for(const s of e){const e=i(s),r=n(s),a=(r||e)&&t[s];if(e&&(hs(a)||qo(a))||r&&Gn(a))return!0}return!1})(r,e)&&(s.$shared=!1,o=Er(r,i=hs(i)?i():i,this.createResolver(t,i,a)));for(const t of e)s[t]=o[t];return s}createResolver(t,e,i=[""],n){const{resolver:s}=Yo(this._resolverCache,t,i);return Yn(e)?Er(s,e,void 0,n):s}}function Yo(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const s=i.join();let r=n.get(s);return r||(r={resolver:Ar(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(s,r)),r}const qo=t=>Yn(t)&&Object.getOwnPropertyNames(t).some((e=>hs(t[e]))),Xo=["top","bottom","left","right","chartArea"];function Zo(t,e){return"top"===t||"bottom"===t||-1===Xo.indexOf(t)&&"x"===e}function $o(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function Jo(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),$n(i&&i.onComplete,[t],e)}function Ko(t){const e=t.chart,i=e.options.animation;$n(i&&i.onProgress,[t],e)}function Qo(t){return Yr()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const tl={},el=t=>{const e=Qo(t);return Object.values(tl).filter((t=>t.canvas===e)).pop()};function il(t,e,i){const n=Object.keys(t);for(const s of n){const n=+s;if(n>=e){const r=t[s];delete t[s],(i>0||n>e)&&(t[n+i]=r)}}}function nl(t,e,i){return t.options.clip?t[i]:e[i]}class sl{static defaults=sr;static instances=tl;static overrides=Qs;static registry=Do;static version="4.4.8";static getChart=el;static register(...t){Do.add(...t),rl()}static unregister(...t){Do.remove(...t),rl()}constructor(t,e){const i=this.config=new Go(e),n=Qo(t),s=el(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 r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!Yr()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?io:yo}(n)),this.platform.updateConfig(i);const a=this.platform.acquireContext(n,r.aspectRatio),o=a&&a.canvas,l=o&&o.height,h=o&&o.width;this.id=jn(),this.ctx=a,this.canvas=o,this.width=h,this.height=l,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Oo,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)),r.resizeDelay||0),this._dataChanges=[],tl[this.id]=this,a&&o?(ua.listen(this,"complete",Jo),ua.listen(this,"progress",Ko),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 Wn(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 Do}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ta(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return or(this.canvas,this.ctx),this}stop(){return ua.stop(this),this}resize(t,e){ua.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,r=this.platform.getMaximumSize(n,t,e,s),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),o=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,ta(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),$n(i.onResize,[this,r],this),this.attached&&this._doResize(o)&&this.render())}ensureScalesHaveIDs(){Jn(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=Bo(t,i),s="r"===n,r="x"===n;return{options:i,dposition:s?"chartArea":r?"bottom":"left",dtype:s?"radialLinear":r?"category":"linear"}})))),Jn(s,(e=>{const s=e.options,r=s.id,a=Bo(r,s),o=Zn(s.type,e.dtype);void 0!==s.position&&Zo(s.position,a)===Zo(e.dposition)||(s.position=e.dposition),n[r]=!0;let l=null;r in i&&i[r].type===o?l=i[r]:(l=new(Do.getScale(o))({id:r,type:o,ctx:this.ctx,chart:this}),i[l.id]=l),l.init(s,t)})),Jn(n,((t,e)=>{t||delete i[e]})),Jn(i,(t=>{to.configure(this,t,t.options),to.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($o("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 r=n.type||this.config.type;if(s.type&&s.type!==r&&(this._destroyDatasetMeta(i),s=this.getDatasetMeta(i)),s.type=r,s.indexAxis=n.indexAxis||Io(r,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=Do.getController(r),{datasetElementType:n,dataElementType:a}=sr.datasets[r];Object.assign(e,{dataElementType:Do.getElement(a),datasetElementType:n&&Do.getElement(n)}),s.controller=new e(this,i),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){Jn(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 r=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),r=Math.max(+e.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),n||Jn(s,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort($o("z","_idx"));const{_active:a,_lastEvent:o}=this;o?this._eventHandler(o,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){Jn(this.scales,(t=>{to.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);cs(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)il(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(!cs(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;to.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],Jn(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,hs(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})&&(ua.has(this)?this.attached&&!ua.running(this)&&ua.start(this):(this.draw(),Jo({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:nl(i,e,"left"),right:nl(i,e,"right"),top:nl(n,e,"top"),bottom:nl(n,e,"bottom")}:e}(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",r)&&(n&&cr(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&&dr(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return hr(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const s=Ha.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=kr(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),r=s.controller._resolveAnimations(void 0,n);ls(e)?(s.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.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(),ua.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(),or(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete tl[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)};Jn(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 r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",s),i("detach",r)};r=()=>{this.attached=!1,n("resize",s),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){Jn(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},Jn(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,r,a,o;for("dataset"===e&&(s=this.getDatasetMeta(t[0].datasetIndex),s.controller["_"+n+"DatasetHoverStyle"]()),a=0,o=t.length;a<o;++a){r=t[a];const e=r&&this.getDatasetMeta(r.datasetIndex).controller;e&&e[n+"HoverStyle"](r.element,r.datasetIndex,r.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}}));!Kn(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)))),r=s(e,t),a=i?t:s(t,e);r.length&&this.updateHoverStyle(r,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,r=e,a=this._getActiveElements(t,n,i,r),o=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,o);i&&(this._lastEvent=null,$n(s.onHover,[t,a,this],this),o&&$n(s.onClick,[t,a,this],this));const h=!Kn(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 rl(){return Jn(sl.instances,(t=>t._plugins.invalidate()))}function al(t,e,i=e){t.lineCap=Zn(i.borderCapStyle,e.borderCapStyle),t.setLineDash(Zn(i.borderDash,e.borderDash)),t.lineDashOffset=Zn(i.borderDashOffset,e.borderDashOffset),t.lineJoin=Zn(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Zn(i.borderWidth,e.borderWidth),t.strokeStyle=Zn(i.borderColor,e.borderColor)}function ol(t,e,i){t.lineTo(i.x,i.y)}function ll(t,e,i={}){const n=t.length,{start:s=0,end:r=n-1}=i,{start:a,end:o}=e,l=Math.max(s,a),h=Math.min(r,o),c=s<a&&r<a||s>o&&r>o;return{count:n,start:l,loop:e.loop,ilen:h<l&&!c?n+h-l:h-l}}function hl(t,e,i,n){const{points:s,options:r}=e,{count:a,start:o,loop:l,ilen:h}=ll(s,i,n),c=function(t){return t.stepped?ur:t.tension||"monotone"===t.cubicInterpolationMode?pr:ol}(r);let d,u,p,{move:m=!0,reverse:f}=n||{};for(d=0;d<=h;++d)u=s[(o+(f?h-d:d))%a],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):c(t,p,u,f,r.stepped),p=u);return l&&(u=s[(o+(f?h:0))%a],c(t,p,u,f,r.stepped)),!!l}function cl(t,e,i,n){const s=e.points,{count:r,start:a,ilen:o}=ll(s,i,n),{move:l=!0,reverse:h}=n||{};let c,d,u,p,m,f,g=0,_=0;const y=t=>(a+(h?o-t:t))%r,x=()=>{p!==m&&(t.lineTo(g,m),t.lineTo(g,p),t.lineTo(g,f))};for(l&&(d=s[y(0)],t.moveTo(d.x,d.y)),c=0;c<=o;++c){if(d=s[y(c)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>m&&(m=i),g=(_*g+e)/++_):(x(),t.lineTo(e,i),u=n,_=0,p=m=i),f=i}x()}function dl(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?hl:cl}const ul="function"==typeof Path2D;function pl(t,e,i,n){const s=t.options,{[i]:r}=t.getProps([i],n);return Math.abs(e-r)<s.radius+s.hitRadius}function ml(t,e){const{x:i,y:n,base:s,width:r,height:a}=t.getProps(["x","y","base","width","height"],e);let o,l,h,c,d;return t.horizontal?(d=a/2,o=Math.min(i,s),l=Math.max(i,s),h=n-d,c=n+d):(d=r/2,o=i-d,l=i+d,h=Math.min(n,s),c=Math.max(n,s)),{left:o,top:h,right:l,bottom:c}}function fl(t,e,i,n){return t?0:zs(e,i,n)}function gl(t){const e=ml(t),i=e.right-e.left,n=e.bottom-e.top,s=function(t,e,i){const n=t.options.borderWidth,s=t.borderSkipped,r=wr(n);return{t:fl(s.top,r.top,0,i),r:fl(s.right,r.right,0,e),b:fl(s.bottom,r.bottom,0,i),l:fl(s.left,r.left,0,e)}}(t,i/2,n/2),r=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),s=t.options.borderRadius,r=function(t){return vr(t,["topLeft","topRight","bottomLeft","bottomRight"])}(s),a=Math.min(e,i),o=t.borderSkipped,l=n||Yn(s);return{topLeft:fl(!l||o.top||o.left,r.topLeft,0,a),topRight:fl(!l||o.top||o.right,r.topRight,0,a),bottomLeft:fl(!l||o.bottom||o.left,r.bottomLeft,0,a),bottomRight:fl(!l||o.bottom||o.right,r.bottomRight,0,a)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:r},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,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function _l(t,e,i,n){const s=null===e,r=null===i,a=t&&!(s&&r)&&ml(t,n);return a&&(s||Ds(e,a.left,a.right))&&(r||Ds(i,a.top,a.bottom))}function yl(t,e){t.rect(e.x,e.y,e.w,e.h)}function xl(t,e,i={}){const n=t.x!==i.x?-e:0,s=t.y!==i.y?-e:0,r=(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+r,h:t.h+a,radius:t.radius}}function bl(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}new WeakMap;function vl(t,e,{horizontal:i,minRotation:n}){const s=Ss(n),r=(i?Math.sin(s):Math.cos(s))||.001,a=.75*e*(""+t).length;return Math.min(e/r,a)}class wl extends Eo{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 Wn(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 r=t=>n=e?n:t,a=t=>s=i?s:t;if(t){const t=bs(n),e=bs(s);t<0&&e<0?a(0):t>0&&e>0&&r(0)}if(n===s){let e=0===s?1:Math.abs(.05*s);a(s+e),t||r(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:r,max:a,precision:o,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=s||1,p=h-1,{min:m,max:f}=e,g=!Wn(r),_=!Wn(a),y=!Wn(l),x=(f-m)/(c+1);let b,v,w,M,S=ws((f-m)/p/u)*u;if(S<1e-14&&!g&&!_)return[{value:m},{value:f}];M=Math.ceil(f/S)-Math.floor(m/S),M>p&&(S=ws(M*S/p/u)*u),Wn(o)||(b=Math.pow(10,o),S=Math.ceil(S*b)/b),"ticks"===n?(v=Math.floor(m/S)*S,w=Math.ceil(f/S)*S):(v=m,w=f),g&&_&&s&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((a-r)/s,S/1e3)?(M=Math.round(Math.min((a-r)/S,h)),S=(a-r)/M,v=r,w=a):y?(v=g?r:v,w=_?a:w,M=l-1,S=(w-v)/M):(M=(w-v)/S,M=vs(M,Math.round(M),S/1e3)?Math.round(M):Math.ceil(M));const C=Math.max(Cs(S),Cs(v));b=Math.pow(10,Wn(o)?C:o),v=Math.round(v*b)/b,w=Math.round(w*b)/b;let k=0;for(g&&(d&&v!==r?(i.push({value:r}),v<r&&k++,vs(Math.round((v+k*S)*b)/b,r,vl(r,x,t))&&k++):v<r&&k++);k<M;++k){const t=Math.round((v+k*S)*b)/b;if(_&&t>a)break;i.push({value:t})}return _&&d&&w!==a?i.length&&vs(i[i.length-1].value,a,vl(a,x,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,r;for(n=0,s=t.length;n<s;n++)r=t[n][i],isNaN(r)||(e.min=Math.min(e.min,r),e.max=Math.max(e.max,r))}(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 $s(t,this.chart.options.locale,this.options.ticks.format)}}class Ml extends wl{static id="linear";static defaults={ticks:{callback:Ks.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=qn(t)?t:0,this.max=qn(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Ss(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}}Ks.formatters.logarithmic,Ks.formatters.numeric,sl.defaults.color="#b0b0b0";const Sl={y:{display:!0,ticks:{suggestedMin:0},gridLines:{color:"#606060",zeroLineColor:"#606060"}}},Cl="#e7c9e5",kl="#64a6bd",Al="#404040";function El(t,e){let i=-1;const n=Date.now(),s={label:"texture count",data:[{x:0,y:0}],borderColor:Cl,borderWidth:1.5,pointRadius:1},r={label:"geometry count",data:[{x:0,y:0}],borderColor:kl,borderWidth:1.5,pointRadius:1},a=["0s"],o=new sl(t,{type:"line",data:{labels:a,datasets:[s,r]},options:{animation:{duration:10},scales:Sl}});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}),r.data.push({x:l,y:c.geometries}),s.data.length>60&&(s.data.shift(),r.data.shift()),t&&o.update()},this.resize=()=>{o.resize()}}sl.register(class extends Ea{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,r=this.chart._animationsDisabled;let{start:a,count:o}=function(t,e,i){const n=e.length;let s=0,r=n;if(t._sorted){const{iScale:a,vScale:o,_parsed:l}=t,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,c=a.axis,{min:d,max:u,minDefined:p,maxDefined:m}=a.getUserBounds();if(p){if(s=Math.min(Ps(l,c,d).lo,i?n:Ps(e,c,a.getPixelForValue(d)).lo),h){const t=l.slice(0,s+1).reverse().findIndex((t=>!Wn(t[o.axis])));s-=Math.max(0,t)}s=zs(s,0,n-1)}if(m){let t=Math.max(Ps(l,a.axis,u,!0).hi+1,i?0:Ps(e,c,a.getPixelForValue(u),!0).hi+1);if(h){const e=l.slice(t-1).findIndex((t=>!Wn(t[o.axis])));t+=Math.max(0,e)}r=zs(t,s,n)-s}else r=n-s}return{start:s,count:r}}(e,n,r);this._drawStart=a,this._drawCount=o,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 r=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,s),r}(e)&&(a=0,o=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:!r,options:l},t),this.updateElements(n,a,o,t)}updateElements(t,e,i,n){const s="reset"===n,{iScale:r,vScale:a,_stacked:o,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:c}=this._getSharedOptions(e,n),d=r.axis,u=a.axis,{spanGaps:p,segment:m}=this.options,f=Ms(p)?p:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||s||"none"===n,_=e+i,y=t.length;let x=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=g?p:{};if(i<e||i>=_){y.skip=!0;continue}const b=this.getParsed(i),v=Wn(b[u]),w=y[d]=r.getPixelForValue(b[d],i),M=y[u]=s||v?a.getBasePixel():a.getPixelForValue(o?this.applyStack(a,b,o):b[u],i);y.skip=isNaN(w)||isNaN(M)||v,y.stop=i>0&&Math.abs(b[d]-x[d])>f,m&&(y.parsed=b,y.raw=l.data[i]),c&&(y.options=h||this.resolveDataElementOptions(i,p.active?"active":n)),g||this.updateElement(p,i,y,n),x=b}}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)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,s,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},class extends xo{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;Gr(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 r=!!t._loop,{start:a,end:o}=function(t,e,i,n){let s=0,r=e-1;if(i&&!n)for(;s<e&&!t[s].skip;)s++;for(;s<e&&t[s].skip;)s++;for(s%=e,i&&(r+=s);r>s&&t[r%e].skip;)r--;return r%=e,{start:s,end:r}}(i,s,r,n);return function(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const s=t._chart.getContext(),r=ha(t.options),{_datasetIndex:a,options:{spanGaps:o}}=t,l=i.length,h=[];let c=r,d=e[0].start,u=d;function p(t,e,n,s){const r=o?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=r;for(;i[e%l].skip;)e+=r;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=o?d:t.start;let e,r=i[d%l];for(u=d+1;u<=t.end;u++){const o=i[u%l];e=ha(n.setContext(kr(s,{type:"segment",p0:r,p1:o,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),ca(e,c)&&p(d,u-1,t.loop,c),r=o,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:o,loop:r}]:function(t,e,i,n){const s=t.length,r=[];let a,o=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%s];i.skip||i.stop?l.skip||(n=!1,r.push({start:e%s,end:(a-1)%s,loop:n}),e=o=i.stop?a:null):(o=a,l.skip&&(e=a)),l=i}return null!==o&&r.push({start:e%s,end:o%s,loop:n}),r}(i,a,o<a?o+s:o,!!t._fullLoop&&0===a&&o===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,r=function(t,e){const i=[],n=t.segments;for(let s=0;s<n.length;s++){const r=la(n[s],t.points,e);r.length&&i.push(...r)}return i}(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],o=function(t){return t.stepped?sa:t.tension||"monotone"===t.cubicInterpolationMode?ra:na}(i);let l,h;for(l=0,h=r.length;l<h;++l){const{start:h,end:c}=r[l],d=s[h],u=s[c];if(d===u){a.push(d);continue}const p=o(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 dl(this)(t,this,e,i)}path(t,e,i){const n=this.segments,s=dl(this);let r=this._loop;e=e||0,i=i||this.points.length-e;for(const a of n)r&=s(t,this,a,{start:e,end:e+i-1});return!!r}draw(t,e,i,n){const s=this.options||{};(this.points||[]).length&&s.borderWidth&&(t.save(),function(t,e,i,n){ul&&!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()),al(t,e.options),t.stroke(s)}(t,e,i,n):function(t,e,i,n){const{segments:s,options:r}=e,a=dl(e);for(const o of s)al(t,r,o.style),t.beginPath(),a(t,e,o,{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 xo{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:r}=this.getProps(["x","y"],i);return Math.pow(t-s,2)+Math.pow(e-r,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return pl(this,t,"x",e)}inYRange(t,e){return pl(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||!hr(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,lr(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}},Ml,class extends Eo{static id="category";static defaults={ticks:{callback:bl}};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(Wn(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:zs(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,Zn(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 bl.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 xo{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:r}=gl(this),a=(o=r.radius).topLeft||o.topRight||o.bottomLeft||o.bottomRight?_r:yl;var o;t.save(),r.w===s.w&&r.h===s.h||(t.beginPath(),a(t,xl(r,e,s)),t.clip(),a(t,xl(s,-e,r)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,xl(s,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return _l(this,t,e,i)}inXRange(t,e){return _l(this,t,null,e)}inYRange(t,e){return _l(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 Ea{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 Da(t,e,i,n)}parseArrayData(t,e,i,n){return Da(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:s,vScale:r}=t,{xAxisKey:a="x",yAxisKey:o="y"}=this._parsing,l="x"===s.axis?a:o,h="x"===r.axis?a:o,c=[];let d,u,p,m;for(d=i,u=i+n;d<u;++d)m=e[d],p={},p[s.axis]=s.parse(as(m,l),d),c.push(za(as(m,h),p,r,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),r=s._custom,a=Oa(r)?"["+r.start+", "+r.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:r,_cachedMeta:{vScale:a}}=this,o=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||Wn(e[a.axis])?{base:o,head:o}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,h),m=(e._stacks||{})[a.axis],f={horizontal:l,base:i.base,enableBorderRadius:!m||Oa(e._custom)||r===m._top||r===m._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&&(f.options=c||this.resolveDataElementOptions(u,t[u].active?"active":n));const g=f.options||t[u].options;Pa(f,g,m,r),La(f,g,h.ratio),this.updateElement(t[u],u,f,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),s=i.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),o=a&&a[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===o)),n=e&&e[t.vScale.axis];if(Wn(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===s||-1===r.indexOf(i.stack)||void 0===s&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),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,r;for(s=0,r=e.data.length;s<r;++s)n.push(i.getPixelForValue(this.getParsed(s)[i.axis],s));const a=t.barThickness;return{min:a||Ta(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:r}}=this,a=s||0,o=this.getParsed(t),l=o._custom,h=Oa(l);let c,d,u=o[e.axis],p=0,m=i?this.applyStack(e,o,i):u;m!==u&&(p=m-u,m=u),h&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&bs(u)!==bs(l.barEnd)&&(p=0),p+=u);const f=Wn(s)||h?p:s;let g=e.getPixelForValue(f);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):g,d=c-g,Math.abs(d)<r){d=function(t,e,i){return 0!==t?bs(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,a)*r,u===a&&(g-=d/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),l=Math.min(t,s),p=Math.max(t,s);g=Math.max(Math.min(g,p),l),c=g+d,i&&!h&&(o._stacks[e.axis]._visualValues[n]=e.getValueForPixel(c)-e.getValueForPixel(g))}if(g===e.getPixelForValue(a)){const t=bs(d)*e.getLineWidthForValue(a)/2;g+=t,d-=t}return{size:d,base:g,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,s=n.skipNull,r=Zn(n.maxBarThickness,1/0);let a,o;if(e.grouped){const i=s?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const s=e.pixels,r=s[t];let a=t>0?s[t-1]:null,o=t<s.length-1?s[t+1]:null;const l=i.categoryPercentage;null===a&&(a=r-(null===o?e.end-e.start:o-r)),null===o&&(o=r+r-a);const h=r-(r-Math.min(a,o))/2*l;return{chunk:Math.abs(o-a)/2*l/n,ratio:i.barPercentage,start:h}}(t,e,n,i):function(t,e,i,n){const s=i.barThickness;let r,a;return Wn(s)?(r=e.min*i.categoryPercentage,a=i.barPercentage):(r=s*n,a=1),{chunk:r/n,ratio:a,start:e.pixels[t]-r/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,o=Math.min(r,l.chunk*l.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),o=Math.min(r,e.min*e.ratio);return{base:a-o/2,head:a+o/2,center:a,size:o}}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)}});const Tl=class extends cn{constructor(t,e,i){i=i||new le(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(),jt.prototype.updateMatrixWorld.call(this,t))}};function zl(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: ${Al}; display: none`,document.body.appendChild(i)),this.chartDivContainer=i;const n=this.createChartContainer("three-info").getContext("2d");this.charts=[],this.charts.push(new El(n,t.mainLoop.gfxEngine.renderer));const s=this.charts,r=t.tileLayer,a=new dn.E$(t.referenceCrs,0,0,0),o=new dn.E$("EPSG:4326",0,0,0),l=e.addFolder("Debug Tools"),h={displayCharts:!1,eventsDebug:!1,debugCameraWindow:!1,freeze:!1};let c;const d=()=>{c=Date.now()},u=()=>{!function(t){const e="none"!=i.style.display;s.forEach((i=>i.update(e,t)))}(Date.now()-c)};let p,m,f,g;l.add(h,"displayCharts").name("Display charts").onChange((e=>{e?(t.addFrameRequester(un.n7.UPDATE_START,d),t.addFrameRequester(un.n7.UPDATE_END,u),i.style.display="flex"):(t.removeFrameRequester(un.n7.UPDATE_START,d),t.removeFrameRequester(un.n7.UPDATE_END,u),i.style.display="none"),this.updateChartDivSize(),t.notifyChange()})),l.add(h,"debugCameraWindow").name("debug Camera").onChange((e=>{e?t.addFrameRequester(un.n7.AFTER_RENDER,O):t.removeFrameRequester(un.n7.AFTER_RENDER,O),t.notifyChange()})),l.add(h,"freeze").name("freeze update").onChange((e=>{r.frozen=e,t.notifyChange()}));const _=t.controls;a.crs=t.referenceCrs;const y=new V,x=_&&_.getCameraTargetPosition?_.getCameraTargetPosition:()=>t.camera3D.position,b=e=>{t.getPickingPositionFromDepth(t.eventToViewCoords(e),y)?(a.setFromVector3(y).as("EPSG:4326",o),h.latitude=`${o.y.toFixed(6)}`,h.longitude=`${o.x.toFixed(6)}`,h.altitude=`${o.z.toFixed(2)}`):(h.latitude="---------",h.longitude="---------",h.altitude="---------"),p.updateDisplay(),m.updateDisplay(),f.updateDisplay()};l.add(h,"eventsDebug").name("Debug event").onChange((e=>{e?(g=l.addFolder("Events"),g.open(),a.setFromVector3(x()).as("EPSG:4326",o),h.latitude=`${o.y.toFixed(6)}`,h.longitude=`${o.x.toFixed(6)}`,h.altitude=`${o.z.toFixed(2)}`,p=g.add(h,"latitude"),m=g.add(h,"longitude"),f=g.add(h,"altitude"),t.domElement.addEventListener("mousemove",b)):(t.domElement.removeEventListener("mousemove",b),l.removeFolder("Events"))}));const v=new an(t.camera3D),w=t.camera3D.clone();w.fov*=1.5,w.updateProjectionMatrix();const M=t.mainLoop.gfxEngine,S=M.renderer;let C=1e11;const k=t.getLayerById("atmosphere");k&&(C=k.fog.distance),v.visible=!1,t.scene.add(v);const A=new un.Wz,E=new Tl(A,"",new le(kl));function T(t){t.material&&C&&t.material.setUniform("fogDistance",C)}E.visible=!1,t.scene.add(A),t.scene.add(E);const z=new le,D=new V;function O(){if(h.debugCameraWindow&&w){const e=.25,n={x:M.width*e,y:M.height*e};w.aspect=n.x/n.y;const s=t.camera3D,a=new dn.E$(t.referenceCrs).setFromVector3(s.position).as(r.extent.crs),o=t.tileLayer.info.displayed.extent;A.setFromExtent(o),E.visible=!0,E.updateMatrixWorld(!0);const l=1.5*a.z;if(a.z=l,a.as(t.referenceCrs).toVector3(w.position),s.worldToLocal(w.position),w.position.z+=l,s.localToWorld(w.position),D.copy(t.camera3D.position),s.worldToLocal(D),D.z-=1.5*l,s.localToWorld(D),w.lookAt(D),v.update(),w.updateProjectionMatrix(),k){k.object3d.visible=!1,C=1e11;for(const t of r.level0Nodes)t.traverseVisible(T)}const c=h.displayCharts?Math.round(parseFloat(i.style.height.replace("%",""))*M.height/100)+3:0;if(v.visible=!0,v.updateMatrixWorld(!0),S.getClearColor(z),S.setViewport(M.width-n.x,c,n.x,n.y),S.setScissor(M.width-n.x,c,n.x,n.y),S.setScissorTest(!0),S.setClearColor(Al),S.clear(),S.render(t.scene,w),S.setScissorTest(!1),S.setClearColor(z),S.setViewport(0,0,M.width,M.height),v.visible=!1,E.visible=!1,k&&(k.object3d.visible=!0),k){C=k.fog.distance;for(const t of r.level0Nodes)t.traverseVisible(T)}}}}zl.prototype.createChartContainer=function(t){const e=document.createElement("div");e.style.cssText=`background-color: ${Al}; flex: auto;`,this.chartDivContainer.appendChild(e);const i=document.createElement("canvas");return i.height="20rem",i.id=t,e.appendChild(i),i},zl.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 Dl=zl,Ol="Styling";function Pl(t,e){return t.folders.filter((t=>t._title===Ol))[0].controllers.filter((t=>t.property===e||t.name===e))[0]}function Rl(t,e,i){e=parseInt(e,10),[un.qW.INTENSITY,un.qW.ELEVATION,un.qW.SCAN_ANGLE].includes(e)?Pl(t,"gradient").show():Pl(t,"gradient").hide(),un.qW.INTENSITY===e?(Pl(t,"minIntensityRange").show(),Pl(t,"maxIntensityRange").show()):(Pl(t,"minIntensityRange").hide(),Pl(t,"maxIntensityRange").hide()),un.qW.ELEVATION===e?(Pl(t,"minElevationRange").show(),Pl(t,"maxElevationRange").show()):(Pl(t,"minElevationRange").hide(),Pl(t,"maxElevationRange").hide()),un.qW.SCAN_ANGLE===e?(Pl(t,"minAngleRange").show(),Pl(t,"maxAngleRange").show()):(Pl(t,"minAngleRange").hide(),Pl(t,"maxAngleRange").hide()),(i=parseInt(i,10))===un.qU.VALUE?(Pl(t,"minAttenuatedSize").hide(),Pl(t,"maxAttenuatedSize").hide()):(Pl(t,"minAttenuatedSize").show(),Pl(t,"maxAttenuatedSize").show())}const Il={initTools(t,e,i){i.title("Layer Controls"),e.debugUI=i.addFolder(`${e.id}`);const n=()=>{Rl(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(Ol).close();if(null!=e.material.mode){const t=Object.keys(un.qW),i=t.filter((t=>un.qW[t]===e.material.mode))[0];s.add({mode:i},"mode",t).name("Display mode").onChange((t=>{e.material.mode=un.qW[t],n()}));const r=s.addFolder("Classe Visibility").close();Object.entries(e.material.classificationScheme).forEach((t=>{r.add(t[1],"visible").name(t[1].name).onChange((()=>{e.material.recomputeVisibilityTexture(),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,Pl(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,Pl(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,Pl(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,Pl(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,Pl(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,Pl(e.debugUI,"minAngleRange").updateDisplay()),n()}))}null!=e.material.shape&&s.add(e.material,"shape",un.cn).name("Shape mode").onChange(n),null!=e.material.gamma&&s.add(e.material,"gamma",1,10).name("Gamma").onChange(n),null!=e.material.ambientBoost&&s.add(e.material,"ambientBoost",0,.5).name("Ambient Boost").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,Pl(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,Pl(e.debugUI,"minAttenuatedSize").updateDisplay()),n()}))),null!=e.material.picking&&s.add(e.material,"picking").name("Display picking id").onChange(n);const r=e.debugUI.addFolder("Debug").close();r.add(e.bboxes,"visible").name("Display Bounding Boxes").onChange(n),r.add(e,"dbgStickyNode").name("Sticky node name").onChange(n),r.add(e,"dbgDisplaySticky").name("Display sticky node").onChange(n),r.add(e,"dbgDisplayChildren").name("Display children of sticky node").onChange(n),r.add(e,"dbgDisplayParents").name("Display parents of sticky node").onChange(n),Rl(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 Ll=i(50040);function Bl(t,e){let i=0;const n=Date.now(),s={label:"Update 1st level",data:[{x:0,y:0}],borderColor:Cl,borderWidth:1.5,pointRadius:1},r={label:"Update duration (ms)",data:[{x:0,y:0}],borderColor:kl,borderWidth:1.5,pointRadius:1},a=["0s"],o=new sl(t,{type:"line",data:{labels:a,datasets:[s,r]},options:{animation:{duration:10},scales:Sl}});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}),r.data.push({x:0,y:l}),s.data.length>60&&(s.data.shift(),r.data.shift()),t&&o.update()},this.resize=()=>{o.resize()}}function Nl(t,e){const i=[],n=[],s=[],r=new sl(t,{type:"bar",data:{labels:i,datasets:[{label:"Visible node per level",data:n,backgroundColor:Cl},{label:"Diplayed node per level",data:s,backgroundColor:kl}]},options:{scales:Sl}});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&&r.update()},this.resize=()=>{r.resize()}}function Fl(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 Vl={addWireFrameCheckbox(t,e,i){t.add(i,"wireframe").name("Wireframe").onChange((()=>e.notifyChange(i)))},addMaterialSize(t,e,i,n,s){Fl(i,"size",1),t.add(i,"size",n,s).name("Size").onChange((()=>e.notifyChange(i)))},addMaterialLineWidth(t,e,i,n,s){Fl(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 Ul;function Hl(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ul&&(Ul.material.overlayAlpha=0,Ul.material.setUniform("showOutline",t.tileLayer.showOutline),t.notifyChange(Ul));const n=t.tileLayer.pickObjectsAt(t,e);return Ul=n.length?n[0].object:void 0,Ul&&(i&&console.info(Ul),Ul.material.overlayAlpha=.5,Ul.material.setUniform("showOutline",!0),t.notifyChange(Ul)),Ul}function jl(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e.isDebugMode&&!s)return;n=n||new Dl(e,t),i=i||e.tileLayer;const r=Vl.createGeometryDebugUI(t,e,i),a=`${i.id}-nb-objects`,o=n.createChartContainer(a),l=`${i.id}-nb-visible`,h=n.createChartContainer(l);n.charts.push(new Bl(o.getContext("2d"),i)),n.charts.push(new Nl(h.getContext("2d"),i)),i.showOutline=!1,i.wireframe=!1;const c={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.setUniform("showOutline",t)})),e.notifyChange()}(e,i.object3d,i)})),r.add(i,"wireframe").name("Wireframe").onChange((()=>{e.notifyChange(i)})),r.add(c,"objectChart").name("Object chart").onChange((t=>{document.getElementById(a).parentNode.style.display=t?"block":"none",n.updateChartDivSize(),n.charts.forEach((t=>t.update()))})),r.add(c,"visibilityChart").name("Visibility chart").onChange((t=>{document.getElementById(l).parentNode.style.display=t?"block":"none",n.updateChartDivSize(),n.charts.forEach((t=>t.update()))}));const d=`${i.id}_obb_debug`,u=`${i.id}_sb_debug`,p=new Fi(1,16,16);function m(t,e,i){if(!i.parent||!e.visible)return void un.cq.removeChildrenAndCleanupRecursively(e,i);let n=i.link[e.id];if(i.visible&&i.material&&i.material.visible){if(!n){if(n=new Ci,n.layer=e,i.matrixWorld.decompose(n.position,n.quaternion,n.scale),e.id==d){const t=new Tl(i.obb);t.layer=e,n.add(t)}else if(e.id==u){const t=new le(Math.random(),Math.random(),Math.random()),s=new ue({color:t.getHex(),wireframe:!0}),r=new Ne(p,s);r.position.copy(i.boundingSphere.center),r.scale.multiplyScalar(i.boundingSphere.radius),r.scale.set(1,1,1).multiplyScalar(i.boundingSphere.radius),r.layer=e,n.add(r)}i.link[e.id]=n}e.object3d.add(n),n.updateMatrixWorld(!0)}else n&&e.object3d.remove(n)}class f extends un.Q2{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e.object3d||new Ci,e),this.update=m,this.isDebugLayer=!0}preUpdate(t,e){e.has(this.parent)&&this.object3d.clear()}}const g=new f(d,{visible:!1,cacheLifeTime:1/0,source:!1});e.addLayer(g).then((t=>{r.add(t,"visible").name("Bounding boxes").onChange((()=>{e.notifyChange(t)}))}));const _=new f(u,{visible:!1,cacheLifeTime:1/0,source:!1});e.addLayer(_).then((t=>{r.add(t,"visible").name("Bounding Spheres").onChange((()=>{e.notifyChange(t)}))}));const y=document.getElementById("viewerDiv"),x=document.createElement("span");x.className="circleBase",y.appendChild(x);const b=new V;let v;const w=()=>{Ll.Ay.update(),e.notifyChange()},M=()=>{Ll.Ay.removeAll(),e._frameRequesters[un.n7.BEFORE_RENDER].includes(w)&&e.removeFrameRequester(un.n7.BEFORE_RENDER,w)};function S(t){const i=Hl(e,t,!1);if(i){x.style.display="table-cell",b.copy(i.boundingSphere.center).applyMatrix4(i.matrixWorld);const t=b.project(e.camera3D),n=e.normalizedToViewCoords(t),s=i.screenSize;if(v!=i){const t=Number(x.style.width.replace("px",""));v=i,M(),new Ll.Ay.Tween({size:t}).to({size:s},500).easing(Ll.Ay.Easing.Sinusoidal.In).easing(Ll.Ay.Easing.Exponential.Out).onUpdate((t=>{x.style["line-height"]=`${t.size}px`,x.style.width=`${t.size}px`,x.style.height=`${t.size}px`,x.innerHTML=`${Math.floor(t.size)} px`,x.style.left=n.x-.5*t.size+"px",x.style.top=n.y-.5*t.size+"px"})).onComplete(M).start(),e.addFrameRequester(un.n7.BEFORE_RENDER,w)}}else x.style.display="none"}r.add(c,"sseHelper").name("Sse helper").onChange((t=>{t?window.addEventListener("mousemove",S,!1):(x.style.display="none",M(),window.removeEventListener("mousemove",S))}));let C=null;window.addEventListener("mousedown",(t=>{83==C&&Hl(e,t)})),window.addEventListener("keydown",(t=>{C=t.which})),window.addEventListener("keyup",(()=>{C=null}))}const Wl=new Ne;function Gl(t,e,i){const n=Vl.createGeometryDebugUI(t,e,i);Vl.addWireFrameCheckbox(n,e,i);const s=`${i.id}_bounding_volume_debug`,r=new un.Q2(s,new jt,{visible:!1,cacheLifeTime:1/0,source:!1});if(r.update=function(t,e,n){const s=n.userData.metadata;let r=n.userData.boundingVolumeHelper;if(r)r.visible=!(!e.visible||!n.visible);else if(e.visible&&n.visible&&s.boundingVolume){if(s.boundingVolume.initialVolumeType===un.he.box){if(Wl.geometry.boundingBox=s.boundingVolume.volume,r=new hn(Wl),r.material.linewidth=2,s.content?.uri&&s.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(s.boundingVolume.initialVolumeType!==un.he.sphere&&s.boundingVolume.initialVolumeType!==un.he.region)return void console.warn(`[3D Tiles Debug]: Unknown bounding volume: ${s.boundingVolume}`);{const t=new Fi(s.boundingVolume.volume.radius,32,32),e=new ue({wireframe:!0,color:16777215*Math.random()});r=new Ne(t,e)}}n.userData.boundingVolumeHelper=r,n.parent.add(r),r.updateMatrixWorld(!0)}},un.Ss.prototype.addLayer.call(e,r,i).then((t=>{n.add(t,"visible").name("Bounding boxes").onChange((()=>{e.notifyChange(e.camera3D)}))})),n.add(i,"sseThreshold",0,100).name("sseThreshold").onChange((()=>{e.notifyChange(e.camera3D)})),n.add({frozen:i.frozen},"frozen").onChange((t=>{i.frozen=t,e.notifyChange(i)})),i.hasPnts){const t={CLASSIFICATION:un.qW.CLASSIFICATION,COLOR:un.qW.COLOR};n.add(i,"pntsMode",t).name("Display mode").onChange((()=>{i.pntsMode=+i.pntsMode,e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsShape",un.cn).name("Points Shape").onChange((()=>{e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsSizeMode",un.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)}))}}var Yl=i(24922);const ql=new Yl.Pq0,Xl=["x","y","z"];class Zl extends Yl.DXC{constructor(t,e=16776960,i=40){const n=new Yl.LoY,s=[];for(let t=0;t<3;t++){const e=Xl[t],n=Xl[(t+1)%3];ql.set(0,0,0);for(let t=0;t<i;t++){let r;r=2*Math.PI*t/(i-1),ql[e]=Math.sin(r),ql[n]=Math.cos(r),s.push(ql.x,ql.y,ql.z),r=2*Math.PI*(t+1)/(i-1),ql[e]=Math.sin(r),ql[n]=Math.cos(r),s.push(ql.x,ql.y,ql.z)}}n.setAttribute("position",new Yl.THS(new Float32Array(s),3)),n.computeBoundingSphere(),super(n,new Yl.mrM({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 $l=i(5247);const Jl=new Yl.Pq0,Kl=new Yl.Pq0,Ql=new Yl.Pq0;new Yl.Pq0,new Yl.Pq0;class th extends Yl.DXC{constructor(t=new $l.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:n=Math.PI/2,lonStart:s=0,lonEnd:r=2*Math.PI,heightStart:a=0,heightEnd:o=0}=t,l=new Yl.iNn(1,1,1,32,32),{normal:h,position:c}=l.attributes,d=c.clone();for(let e=0,l=c.count;e<l;e++){Ql.fromBufferAttribute(c,e);const l=Yl.cj9.mapLinear(Ql.x,-.5,.5,i,n),h=Yl.cj9.mapLinear(Ql.y,-.5,.5,s,r);let d=a;t.getCartographicToNormal(l,h,Jl),Ql.z<0&&(d=o),t.getCartographicToPosition(l,h,d,Ql),c.setXYZ(e,...Ql)}e&&l.computeVertexNormals();for(let e=0,a=d.count;e<a;e++){Ql.fromBufferAttribute(d,e);const a=Yl.cj9.mapLinear(Ql.x,-.5,.5,i,n),o=Yl.cj9.mapLinear(Ql.y,-.5,.5,s,r);Jl.fromBufferAttribute(h,e),t.getCartographicToNormal(a,o,Kl),Math.abs(Jl.dot(Kl))>.1&&(Ql.z>0&&Kl.multiplyScalar(-1),h.setXYZ(e,...Kl))}return l}(this.ellipsoidRegion);this.geometry.dispose(),this.geometry=new Yl.TDQ(t,80)}dispose(){this.geometry.dispose(),this.material.dispose()}}Yl.eaF;var eh=i(79175);const ih=Symbol("ORIGINAL_MATERIAL"),nh=Symbol("HAS_RANDOM_COLOR"),sh=Symbol("HAS_RANDOM_NODE_COLOR"),rh=Symbol("LOAD_TIME"),ah=Symbol("PARENT_BOUND_REF_COUNT"),oh=new Yl.iyt,lh=()=>{},hh={};function ch(t){if(!hh[t]){const e=Math.random(),i=.5+.5*Math.random(),n=.375+.25*Math.random();hh[t]=(new Yl.Q1f).setHSL(e,i,n)}return hh[t]}const dh=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 uh{static get ColorModes(){return dh}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,eh.R4)(this.tiles.root,null,(t=>{t[ah]=null,this._onTileVisibilityChange(t,t.__visible)})))}init(t){this.tiles=t;const e=t.group;this.boxGroup=new Yl.YJl,this.boxGroup.name="DebugTilesRenderer.boxGroup",e.add(this.boxGroup),this.boxGroup.updateMatrixWorld(),this.sphereGroup=new Yl.YJl,this.sphereGroup.name="DebugTilesRenderer.sphereGroup",e.add(this.sphereGroup),this.sphereGroup.updateMatrixWorld(),this.regionGroup=new Yl.YJl,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,eh.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 n=-1;-1===this.maxDebugDistance?(t.getBoundingSphere(oh),n=oh.radius):n=this.maxDebugDistance;const s=this.errorTarget,r=this.colorMode,a=t.visibleTiles;let o;10===r&&(o=Array.from(a).sort(((t,e)=>t[rh]-e[rh]))),a.forEach((t=>{const a=t.cached.scene;let l,h,c;7===r&&(l=Math.random(),h=.5+.5*Math.random(),c=.375+.25*Math.random()),a.traverse((a=>{8===r&&(l=Math.random(),h=.5+.5*Math.random(),c=.375+.25*Math.random());const d=a.material;if(d){const u=a[ih];if(0===r&&d!==u)a.material.dispose(),a.material=a[ih];else if(0!==r&&d===u)if(a.isPoints){const t=new Yl.BH$;t.size=u.size,t.sizeAttenuation=u.sizeAttenuation,a.material=t}else a.material=new Yl._4j,a.material.flatShading=!0;switch(7!==r&&delete a.material[nh],8!==r&&delete a.material[sh],r){case 4:{const i=t.__depth/e;this.getDebugColor(i,a.material.color);break}case 5:{const i=t.__depthFromRenderedParent/e;this.getDebugColor(i,a.material.color);break}case 1:{const e=t.__error/s;e>1?a.material.color.setRGB(1,0,0):this.getDebugColor(e,a.material.color);break}case 2:{const e=Math.min(t.geometricError/i,1);this.getDebugColor(e,a.material.color);break}case 3:{const e=Math.min(t.__distanceFromCamera/n,1);this.getDebugColor(e,a.material.color);break}case 6:t.children&&0!==t.children.length?this.getDebugColor(0,a.material.color):this.getDebugColor(1,a.material.color);break;case 8:a.material[sh]||(a.material.color.setHSL(l,h,c),a.material[sh]=!0);break;case 7:a.material[nh]||(a.material.color.setHSL(l,h,c),a.material[nh]=!0);break;case 9:this.customColorCallback?this.customColorCallback(t,a):console.warn("DebugTilesRenderer: customColorCallback not defined");break;case 10:{const e=o.indexOf(t);this.getDebugColor(e/(o.length-1),a.material.color);break}}}}))}))}_onTileVisibilityChange(t,e){this.displayParentBounds?(0,eh.pN)(t,(i=>{null==i[ah]&&(i[ah]=0),e?i[ah]++:i[ah]>0&&i[ah]--;const n=i===t&&e||this.displayParentBounds&&i[ah]>0;this._updateBoundHelper(i,n)})):this._updateBoundHelper(t,e)}_createBoundHelper(t){const e=this.tiles,i=t.cached,{sphere:n,obb:s,region:r}=i.boundingVolume;if(s){const n=new Yl.YJl;n.name="DebugTilesRenderer.boxHelperGroup",n.matrix.copy(s.transform),n.matrixAutoUpdate=!1;const r=new Yl.BND(s.box,ch(t.__depth));r.raycast=lh,n.add(r),i.boxHelperGroup=n,e.visibleTiles.has(t)&&this.displayBoxBounds&&(this.boxGroup.add(n),n.updateMatrixWorld(!0))}if(n){const s=new Zl(n,ch(t.__depth));s.raycast=lh,i.sphereHelper=s,e.visibleTiles.has(t)&&this.displaySphereBounds&&(this.sphereGroup.add(s),s.updateMatrixWorld(!0))}if(r){const n=new th(r,ch(t.__depth));n.raycast=lh;const s=new Yl.iyt;r.getBoundingSphere(s),n.position.copy(s.center),s.center.multiplyScalar(-1),n.geometry.translate(...s.center),i.regionHelper=n,e.visibleTiles.has(t)&&this.displayRegionBounds&&(this.regionGroup.add(n),n.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,r=this.regionGroup;e&&null==i.boxHelperGroup&&null==i.sphereHelper&&null==i.regionHelper&&this._createBoundHelper(t);const a=i.boxHelperGroup,o=i.sphereHelper,l=i.regionHelper;e?(a&&(s.add(a),a.updateMatrixWorld(!0),this._updateHelperMaterial(t,a.children[0].material)),o&&(n.add(o),o.updateMatrixWorld(!0),this._updateHelperMaterial(t,o.material)),l&&(r.add(l),l.updateMatrixWorld(!0),this._updateHelperMaterial(t,l.material))):(a&&s.remove(a),o&&n.remove(o),l&&r.remove(l))}_onLoadModel(t,e){e[rh]=performance.now(),t.traverse((t=>{const e=t.material;e&&(t[ih]=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 ph(t,e,i){const n=Vl.createGeometryDebugUI(t,e,i);Vl.addWireFrameCheckbox(n,e,i),n.add({frozen:i.frozen},"frozen").onChange((t=>{i.frozen=t,e.notifyChange(i)}));const s=new uh;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:r}=s,a=!1;if(r.traverse((t=>{t.isPoints&&(a=!0)})),!a)return;const o={CLASSIFICATION:un.qW.CLASSIFICATION,COLOR:un.qW.COLOR};n.add(i,"pntsMode",o).name("Display mode").onChange((()=>{i.pntsMode=+i.pntsMode,e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsShape",un.cn).name("Points Shape").onChange((()=>{e.notifyChange(e.camera.camera3D)})),n.add(i,"pntsSizeMode",un.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 mh(t,e){var i=t.__state.conversionName.toString(),n=Math.round(t.r),s=Math.round(t.g),r=Math.round(t.b),a=t.a,o=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+","+r+")":"CSS_RGBA"===i?"rgba("+n+","+s+","+r+","+a+")":"HEX"===i?"0x"+t.hex.toString(16):"RGB_ARRAY"===i?"["+n+","+s+","+r+"]":"RGBA_ARRAY"===i?"["+n+","+s+","+r+","+a+"]":"RGB_OBJ"===i?"{r:"+n+",g:"+s+",b:"+r+"}":"RGBA_OBJ"===i?"{r:"+n+",g:"+s+",b:"+r+",a:"+a+"}":"HSV_OBJ"===i?"{h:"+o+",s:"+l+",v:"+h+"}":"HSVA_OBJ"===i?"{h:"+o+",s:"+l+",v:"+h+",a:"+a+"}":"unknown format"}var fh=Array.prototype.forEach,gh=Array.prototype.slice,_h={BREAK:{},extend:function(t){return this.each(gh.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(gh.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=gh.call(arguments);return function(){for(var e=gh.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(fh&&t.forEach&&t.forEach===fh)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 r in t)if(e.call(i,t[r],r)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,i){var n=void 0;return function(){var s=this,r=arguments,a=i||!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(s,r)}),e),a&&t.apply(s,r)}},toArray:function(t){return t.toArray?t.toArray():gh.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}},yh=[{litmus:_h.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:mh},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:mh},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:mh},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:mh}}},{litmus:_h.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:_h.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:_h.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(_h.isNumber(t.r)&&_h.isNumber(t.g)&&_h.isNumber(t.b)&&_h.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!!(_h.isNumber(t.r)&&_h.isNumber(t.g)&&_h.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!!(_h.isNumber(t.h)&&_h.isNumber(t.s)&&_h.isNumber(t.v)&&_h.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!!(_h.isNumber(t.h)&&_h.isNumber(t.s)&&_h.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}}}}}],xh=void 0,bh=void 0,vh=function(){bh=!1;var t=arguments.length>1?_h.toArray(arguments):arguments[0];return _h.each(yh,(function(e){if(e.litmus(t))return _h.each(e.conversions,(function(e,i){if(xh=e.read(t),!1===bh&&!1!==xh)return bh=xh,xh.conversionName=i,xh.conversion=e,_h.BREAK})),_h.BREAK})),bh},wh=void 0,Mh={hsv_to_rgb:function(t,e,i){var n=Math.floor(t/60)%6,s=t/60-Math.floor(t/60),r=i*(1-e),a=i*(1-s*e),o=i*(1-(1-s)*e),l=[[i,o,r],[a,i,r],[r,i,o],[r,a,i],[o,r,i],[i,r,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),r=s-n,a=void 0;return 0===s?{h:NaN,s:0,v:0}:(a=t===s?(e-i)/r:e===s?2+(i-t)/r:4+(t-e)/r,(a/=6)<0&&(a+=1),{h:360*a,s:r/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<<(wh=8*e)|t&~(255<<wh)}},Sh="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},Ch=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},kh=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}}(),Ah=function t(e,i,n){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,i);if(void 0===s){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,i,n)}if("value"in s)return s.value;var a=s.get;return void 0!==a?a.call(n):void 0},Eh=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)},Th=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},zh=function(){function t(){if(Ch(this,t),this.__state=vh.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return kh(t,[{key:"toString",value:function(){return mh(this)}},{key:"toHexString",value:function(){return mh(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();function Dh(t,e,i){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space||zh.recalculateRGB(this,e,i),this.__state[e]},set:function(t){"RGB"!==this.__state.space&&(zh.recalculateRGB(this,e,i),this.__state.space="RGB"),this.__state[e]=t}})}function Oh(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space||zh.recalculateHSV(this),this.__state[e]},set:function(t){"HSV"!==this.__state.space&&(zh.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}zh.recalculateRGB=function(t,e,i){if("HEX"===t.__state.space)t.__state[e]=Mh.component_from_hex(t.__state.hex,i);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");_h.extend(t.__state,Mh.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},zh.recalculateHSV=function(t){var e=Mh.rgb_to_hsv(t.r,t.g,t.b);_h.extend(t.__state,{s:e.s,v:e.v}),_h.isNaN(e.h)?_h.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},zh.COMPONENTS=["r","g","b","h","s","v","hex","a"],Dh(zh.prototype,"r",2),Dh(zh.prototype,"g",1),Dh(zh.prototype,"b",0),Oh(zh.prototype,"h"),Oh(zh.prototype,"s"),Oh(zh.prototype,"v"),Object.defineProperty(zh.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(zh.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=Mh.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 Ph=function(){function t(e,i){Ch(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 kh(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}(),Rh={};_h.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},(function(t,e){_h.each(t,(function(t){Rh[t]=e}))}));var Ih=/(\d+(\.\d+)?)px/;function Lh(t){if("0"===t||_h.isUndefined(t))return 0;var e=t.match(Ih);return _h.isNull(e)?0:parseFloat(e[1])}var Bh={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;_h.isUndefined(s)&&(s=!0),_h.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||{},r=Rh[e];if(!r)throw new Error("Event type "+e+" not supported.");var a=document.createEvent(r);switch(r){case"MouseEvents":var o=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,o,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var h=a.initKeyboardEvent||a.initKeyEvent;_h.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)}_h.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),Bh},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),Bh},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 Bh},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 Bh},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return Lh(e["border-left-width"])+Lh(e["border-right-width"])+Lh(e["padding-left"])+Lh(e["padding-right"])+Lh(e.width)},getHeight:function(t){var e=getComputedStyle(t);return Lh(e["border-top-width"])+Lh(e["border-bottom-width"])+Lh(e["padding-top"])+Lh(e["padding-bottom"])+Lh(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)}},Nh=function(t){function e(t,i){Ch(this,e);var n=Th(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"),Bh.bind(n.__checkbox,"change",(function(){s.setValue(!s.__prev)}),!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return Eh(e,t),kh(e,[{key:"setValue",value:function(t){var i=Ah(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),Ah(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Ph),Fh=function(t){function e(t,i,n){Ch(this,e);var s=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n,a=s;if(s.__select=document.createElement("select"),_h.isArray(r)){var o={};_h.each(r,(function(t){o[t]=t})),r=o}return _h.each(r,(function(t,e){var i=document.createElement("option");i.innerHTML=e,i.setAttribute("value",t),a.__select.appendChild(i)})),s.updateDisplay(),Bh.bind(s.__select,"change",(function(){var t=this.options[this.selectedIndex].value;a.setValue(t)})),s.domElement.appendChild(s.__select),s}return Eh(e,t),kh(e,[{key:"setValue",value:function(t){var i=Ah(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 Bh.isActive(this.__select)?this:(this.__select.value=this.getValue(),Ah(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(Ph),Vh=function(t){function e(t,i){Ch(this,e);var n=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),s=n;function r(){s.setValue(s.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),Bh.bind(n.__input,"keyup",r),Bh.bind(n.__input,"change",r),Bh.bind(n.__input,"blur",(function(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())})),Bh.bind(n.__input,"keydown",(function(t){13===t.keyCode&&this.blur()})),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return Eh(e,t),kh(e,[{key:"updateDisplay",value:function(){return Bh.isActive(this.__input)||(this.__input.value=this.getValue()),Ah(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Ph);function Uh(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var Hh=function(t){function e(t,i,n){Ch(this,e);var s=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=n||{};return s.__min=r.min,s.__max=r.max,s.__step=r.step,_h.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=Uh(s.__impliedStep),s}return Eh(e,t),kh(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),Ah(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=Uh(t),this}}]),e}(Ph),jh=function(t){function e(t,i,n){Ch(this,e);var s=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,n));s.__truncationSuspended=!1;var r=s,a=void 0;function o(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}function l(t){var e=a-t.clientY;r.setValue(r.getValue()+e*r.__impliedStep),a=t.clientY}function h(){Bh.unbind(window,"mousemove",l),Bh.unbind(window,"mouseup",h),o()}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),Bh.bind(s.__input,"change",(function(){var t=parseFloat(r.__input.value);_h.isNaN(t)||r.setValue(t)})),Bh.bind(s.__input,"blur",(function(){o()})),Bh.bind(s.__input,"mousedown",(function(t){Bh.bind(window,"mousemove",l),Bh.bind(window,"mouseup",h),a=t.clientY})),Bh.bind(s.__input,"keydown",(function(t){13===t.keyCode&&(r.__truncationSuspended=!0,this.blur(),r.__truncationSuspended=!1,o())})),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return Eh(e,t),kh(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),Ah(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Hh);function Wh(t,e,i,n,s){return n+(t-e)/(i-e)*(s-n)}var Gh=function(t){function e(t,i,n,s,r){Ch(this,e);var a=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,{min:n,max:s,step:r})),o=a;function l(t){t.preventDefault();var e=o.__background.getBoundingClientRect();return o.setValue(Wh(t.clientX,e.left,e.right,o.__min,o.__max)),!1}function h(){Bh.unbind(window,"mousemove",l),Bh.unbind(window,"mouseup",h),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function c(t){var e=t.touches[0].clientX,i=o.__background.getBoundingClientRect();o.setValue(Wh(e,i.left,i.right,o.__min,o.__max))}function d(){Bh.unbind(window,"touchmove",c),Bh.unbind(window,"touchend",d),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}return a.__background=document.createElement("div"),a.__foreground=document.createElement("div"),Bh.bind(a.__background,"mousedown",(function(t){document.activeElement.blur(),Bh.bind(window,"mousemove",l),Bh.bind(window,"mouseup",h),l(t)})),Bh.bind(a.__background,"touchstart",(function(t){1===t.touches.length&&(Bh.bind(window,"touchmove",c),Bh.bind(window,"touchend",d),c(t))})),Bh.addClass(a.__background,"slider"),Bh.addClass(a.__foreground,"slider-fg"),a.updateDisplay(),a.__background.appendChild(a.__foreground),a.domElement.appendChild(a.__background),a}return Eh(e,t),kh(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",Ah(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Hh),Yh=function(t){function e(t,i,n){Ch(this,e);var s=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i)),r=s;return s.__button=document.createElement("div"),s.__button.innerHTML=void 0===n?"Fire":n,Bh.bind(s.__button,"click",(function(t){return t.preventDefault(),r.fire(),!1})),Bh.addClass(s.__button,"button"),s.domElement.appendChild(s.__button),s}return Eh(e,t),kh(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}(Ph),qh=function(t){function e(t,i){Ch(this,e);var n=Th(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i));n.__color=new zh(n.getValue()),n.__temp=new zh(0);var s=n;n.domElement=document.createElement("div"),Bh.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 ",Bh.bind(n.__input,"keydown",(function(t){13===t.keyCode&&d.call(this)})),Bh.bind(n.__input,"blur",d),Bh.bind(n.__selector,"mousedown",(function(){Bh.addClass(this,"drag").bind(window,"mouseup",(function(){Bh.removeClass(s.__selector,"drag")}))})),Bh.bind(n.__selector,"touchstart",(function(){Bh.addClass(this,"drag").bind(window,"touchend",(function(){Bh.removeClass(s.__selector,"drag")}))}));var r,a=document.createElement("div");function o(t){p(t),Bh.bind(window,"mousemove",p),Bh.bind(window,"touchmove",p),Bh.bind(window,"mouseup",h),Bh.bind(window,"touchend",h)}function l(t){m(t),Bh.bind(window,"mousemove",m),Bh.bind(window,"touchmove",m),Bh.bind(window,"mouseup",c),Bh.bind(window,"touchend",c)}function h(){Bh.unbind(window,"mousemove",p),Bh.unbind(window,"touchmove",p),Bh.unbind(window,"mouseup",h),Bh.unbind(window,"touchend",h),u()}function c(){Bh.unbind(window,"mousemove",m),Bh.unbind(window,"touchmove",m),Bh.unbind(window,"mouseup",c),Bh.unbind(window,"touchend",c),u()}function d(){var t=vh(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,r=i.clientY,a=(n-e.left)/(e.right-e.left),o=1-(r-e.top)/(e.bottom-e.top);return o>1?o=1:o<0&&(o=0),a>1?a=1:a<0&&(a=0),s.__color.v=o,s.__color.s=a,s.setValue(s.__color.toOriginal()),!1}function m(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 _h.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),_h.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}),_h.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),_h.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),_h.extend(a.style,{width:"100%",height:"100%",background:"none"}),Zh(a,"top","rgba(0,0,0,0)","#000"),_h.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(r=n.__hue_field).style.background="",r.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",r.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",r.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",r.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",r.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",_h.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),Bh.bind(n.__saturation_field,"mousedown",o),Bh.bind(n.__saturation_field,"touchstart",o),Bh.bind(n.__field_knob,"mousedown",o),Bh.bind(n.__field_knob,"touchstart",o),Bh.bind(n.__hue_field,"mousedown",l),Bh.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 Eh(e,t),kh(e,[{key:"updateDisplay",value:function(){var t=vh(this.getValue());if(!1!==t){var e=!1;_h.each(zh.COMPONENTS,(function(i){if(!_h.isUndefined(t[i])&&!_h.isUndefined(this.__color.__state[i])&&t[i]!==this.__color.__state[i])return e=!0,{}}),this),e&&_h.extend(this.__color.__state,t)}_h.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;_h.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,Zh(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),_h.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+i+","+i+","+i+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),e}(Ph),Xh=["-moz-","-o-","-webkit-","-ms-",""];function Zh(t,e,i,n){t.style.background="",_h.each(Xh,(function(s){t.style.cssText+="background: "+s+"linear-gradient("+e+", "+i+" 0%, "+n+" 100%); "}))}var $h=function(t,e){var i=t[e];return _h.isArray(arguments[2])||_h.isObject(arguments[2])?new Fh(t,e,arguments[2]):_h.isNumber(i)?_h.isNumber(arguments[2])&&_h.isNumber(arguments[3])?_h.isNumber(arguments[4])?new Gh(t,e,arguments[2],arguments[3],arguments[4]):new Gh(t,e,arguments[2],arguments[3]):_h.isNumber(arguments[4])?new jh(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new jh(t,e,{min:arguments[2],max:arguments[3]}):_h.isString(i)?new Vh(t,e):_h.isFunction(i)?new Yh(t,e,""):_h.isBoolean(i)?new Nh(t,e):null},Jh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)},Kh=function(){function t(){Ch(this,t),this.backgroundElement=document.createElement("div"),_h.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"}),Bh.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),_h.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;Bh.bind(this.backgroundElement,"click",(function(){e.hide()}))}return kh(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(),_h.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",Bh.unbind(t.domElement,"webkitTransitionEnd",e),Bh.unbind(t.domElement,"transitionend",e),Bh.unbind(t.domElement,"oTransitionEnd",e)};Bh.bind(this.domElement,"webkitTransitionEnd",e),Bh.bind(this.domElement,"transitionend",e),Bh.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-Bh.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-Bh.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 Qh="Default",tc=function(){try{return!!window.localStorage}catch(t){return!1}}(),ec=void 0,ic=!0,nc=void 0,sc=!1,rc=[],ac=function t(e){var i=this,n=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),Bh.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=_h.defaults(n,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),n=_h.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),_h.isUndefined(n.load)?n.load={preset:Qh}:n.preset&&(n.load.preset=n.preset),_h.isUndefined(n.parent)&&n.hideable&&rc.push(this),n.resizable=_h.isUndefined(n.parent)&&n.resizable,n.autoPlace&&_h.isUndefined(n.scrollable)&&(n.scrollable=!0);var s,r=tc&&"true"===localStorage.getItem(uc(0,"isLocal")),a=void 0,o=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,gc(i,t)}},name:{get:function(){return n.name},set:function(t){n.name=t,o&&(o.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(e){n.closed=e,n.closed?Bh.addClass(i.__ul,t.CLASS_CLOSED):Bh.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 r},set:function(t){tc&&(r=t,t?Bh.bind(window,"unload",a):Bh.unbind(window,"unload",a),localStorage.setItem(uc(0,"isLocal"),t))}}}),_h.isUndefined(n.parent)){if(this.closed=n.closed||!1,Bh.addClass(this.domElement,t.CLASS_MAIN),Bh.makeSelectable(this.domElement,!1),tc&&r){i.useLocalStorage=!0;var l=localStorage.getItem(uc(0,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,Bh.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),n.closeOnTop?(Bh.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(Bh.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),Bh.bind(this.__closeButton,"click",(function(){i.closed=!i.closed}))}else{void 0===n.closed&&(n.closed=!0);var h=document.createTextNode(n.name);Bh.addClass(h,"controller-name"),o=oc(i,h),Bh.addClass(this.__ul,t.CLASS_CLOSED),Bh.addClass(o,"title"),Bh.bind(o,"click",(function(t){return t.preventDefault(),i.closed=!i.closed,!1})),n.closed||(this.closed=!1)}n.autoPlace&&(_h.isUndefined(n.parent)&&(ic&&(nc=document.createElement("div"),Bh.addClass(nc,"dg"),Bh.addClass(nc,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(nc),ic=!1),nc.appendChild(this.domElement),Bh.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||gc(i,n.width)),this.__resizeHandler=function(){i.onResizeDebounced()},Bh.bind(window,"resize",this.__resizeHandler),Bh.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),Bh.bind(this.__ul,"transitionend",this.__resizeHandler),Bh.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&fc(this),a=function(){tc&&"true"===localStorage.getItem(uc(0,"isLocal"))&&localStorage.setItem(uc(0,"gui"),JSON.stringify(i.getSaveObject()))},this.saveToLocalStorageIfPossible=a,n.parent||((s=i.getRoot()).width+=1,_h.defer((function(){s.width-=1})))};function oc(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 lc(t){Bh.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&Bh.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function hc(t,e){var i=t.__preset_select[t.__preset_select.selectedIndex];i.innerHTML=e?i.value+"*":i.value}function cc(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 r=i.load.remembered,a=void 0;if(r[t.preset])a=r[t.preset];else{if(!r[Qh])return;a=r[Qh]}if(a[n]&&void 0!==a[n][e.property]){var o=a[n][e.property];e.initialValue=o,e.setValue(o)}}}}function dc(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 qh(e,i);else{var r=[e,i].concat(n.factoryArgs);s=$h.apply(t,r)}n.before instanceof Ph&&(n.before=n.before.__li),cc(t,s),Bh.addClass(s.domElement,"c");var a=document.createElement("span");Bh.addClass(a,"property-name"),a.innerHTML=s.property;var o=document.createElement("div");o.appendChild(a),o.appendChild(s.domElement);var l=oc(t,o,n.before);return Bh.addClass(l,ac.CLASS_CONTROLLER_ROW),s instanceof qh?Bh.addClass(l,"color"):Bh.addClass(l,Sh(s.getValue())),function(t,e,i){if(i.__li=e,i.__gui=t,_h.extend(i,{options:function(e){if(arguments.length>1){var n=i.__li.nextElementSibling;return i.remove(),dc(t,i.object,i.property,{before:n,factoryArgs:[_h.toArray(arguments)]})}if(_h.isArray(e)||_h.isObject(e)){var s=i.__li.nextElementSibling;return i.remove(),dc(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 Gh){var n=new jh(i.object,i.property,{min:i.__min,max:i.__max,step:i.__step});_h.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)}})),Bh.addClass(e,"has-slider"),i.domElement.insertBefore(n.domElement,i.domElement.firstElementChild)}else if(i instanceof jh){var s=function(e){if(_h.isNumber(i.__min)&&_h.isNumber(i.__max)){var n=i.__li.firstElementChild.firstElementChild.innerHTML,s=i.__gui.__listening.indexOf(i)>-1;i.remove();var r=dc(t,i.object,i.property,{before:i.__li.nextElementSibling,factoryArgs:[i.__min,i.__max,i.__step]});return r.name(n),s&&r.listen(),r}return e};i.min=_h.compose(s,i.min),i.max=_h.compose(s,i.max)}else i instanceof Nh?(Bh.bind(e,"click",(function(){Bh.fakeEvent(i.__checkbox,"click")})),Bh.bind(i.__checkbox,"click",(function(t){t.stopPropagation()}))):i instanceof Yh?(Bh.bind(e,"click",(function(){Bh.fakeEvent(i.__button,"click")})),Bh.bind(e,"mouseover",(function(){Bh.addClass(i.__button,"hover")})),Bh.bind(e,"mouseout",(function(){Bh.removeClass(i.__button,"hover")}))):i instanceof qh&&(Bh.addClass(e,"color"),i.updateDisplay=_h.compose((function(t){return e.style.borderLeftColor=i.__color.toString(),t}),i.updateDisplay),i.updateDisplay());i.setValue=_h.compose((function(e){return t.getRoot().__preset_select&&i.isModified()&&hc(t.getRoot(),!0),e}),i.setValue)}(t,l,s),t.__controllers.push(s),s}function uc(t,e){return document.location.href+"."+e}function pc(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 mc(t,e){e.style.display=t.useLocalStorage?"block":"none"}function fc(t){var e=void 0;function i(i){return i.preventDefault(),t.width+=e-i.clientX,t.onResize(),e=i.clientX,!1}function n(){Bh.removeClass(t.__closeButton,ac.CLASS_DRAG),Bh.unbind(window,"mousemove",i),Bh.unbind(window,"mouseup",n)}function s(s){return s.preventDefault(),e=s.clientX,Bh.addClass(t.__closeButton,ac.CLASS_DRAG),Bh.bind(window,"mousemove",i),Bh.bind(window,"mouseup",n),!1}t.__resize_handle=document.createElement("div"),_h.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),Bh.bind(t.__resize_handle,"mousedown",s),Bh.bind(t.__closeButton,"mousedown",s),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function gc(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 _c(t,e){var i={};return _h.each(t.__rememberedObjects,(function(n,s){var r={},a=t.__rememberedObjectIndecesToControllers[s];_h.each(a,(function(t,i){r[i]=e?t.initialValue:t.getValue()})),i[s]=r})),i}function yc(t){0!==t.length&&Jh.call(window,(function(){yc(t)})),_h.each(t,(function(t){t.updateDisplay()}))}ac.toggleHide=function(){sc=!sc,_h.each(rc,(function(t){t.domElement.style.display=sc?"none":""}))},ac.CLASS_AUTO_PLACE="a",ac.CLASS_AUTO_PLACE_CONTAINER="ac",ac.CLASS_MAIN="main",ac.CLASS_CONTROLLER_ROW="cr",ac.CLASS_TOO_TALL="taller-than-window",ac.CLASS_CLOSED="closed",ac.CLASS_CLOSE_BUTTON="close-button",ac.CLASS_CLOSE_TOP="close-top",ac.CLASS_CLOSE_BOTTOM="close-bottom",ac.CLASS_DRAG="drag",ac.DEFAULT_WIDTH=245,ac.TEXT_CLOSED="Close Controls",ac.TEXT_OPEN="Open Controls",ac._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||ac.toggleHide()},Bh.bind(window,"keydown",ac._keydownHandler,!1),_h.extend(ac.prototype,{add:function(t,e){return dc(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return dc(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;_h.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&&nc.removeChild(this.domElement);var t=this;_h.each(this.__folders,(function(e){t.removeFolder(e)})),Bh.unbind(window,"keydown",ac._keydownHandler,!1),lc(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 ac(e);this.__folders[t]=i;var n=oc(this,i.domElement);return Bh.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],lc(t);var e=this;_h.each(t.__folders,(function(e){t.removeFolder(e)})),_h.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=Bh.getOffset(t.__ul).top,i=0;_h.each(t.__ul.childNodes,(function(e){t.autoPlace&&e===t.__save_row||(i+=Bh.getHeight(e))})),window.innerHeight-e-20<i?(Bh.addClass(t.domElement,ac.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(Bh.removeClass(t.domElement,ac.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&_h.defer((function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"})),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:_h.debounce((function(){this.onResize()}),50),remember:function(){if(_h.isUndefined(ec)&&((ec=new Kh).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;_h.each(Array.prototype.slice.call(arguments),(function(e){0===t.__rememberedObjects.length&&function(t){var e=t.__save_row=document.createElement("li");Bh.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),Bh.addClass(e,"save-row");var i=document.createElement("span");i.innerHTML=" ",Bh.addClass(i,"button gears");var n=document.createElement("span");n.innerHTML="Save",Bh.addClass(n,"button"),Bh.addClass(n,"save");var s=document.createElement("span");s.innerHTML="New",Bh.addClass(s,"button"),Bh.addClass(s,"save-as");var r=document.createElement("span");r.innerHTML="Revert",Bh.addClass(r,"button"),Bh.addClass(r,"revert");var a=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?_h.each(t.load.remembered,(function(e,i){pc(t,i,i===t.preset)})):pc(t,Qh,!1),Bh.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(r),tc){var o=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(uc(0,"isLocal"))&&l.setAttribute("checked","checked"),mc(t,o),Bh.bind(l,"change",(function(){t.useLocalStorage=!t.useLocalStorage,mc(t,o)}))}var h=document.getElementById("dg-new-constructor");Bh.bind(h,"keydown",(function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||ec.hide()})),Bh.bind(i,"click",(function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),ec.show(),h.focus(),h.select()})),Bh.bind(n,"click",(function(){t.save()})),Bh.bind(s,"click",(function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)})),Bh.bind(r,"click",(function(){t.revert()}))}(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)})),this.autoPlace&&gc(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]=_c(this)),t.folders={},_h.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]=_c(this),hc(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered[Qh]=_c(this,!0)),this.load.remembered[t]=_c(this),this.preset=t,pc(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){_h.each(this.__controllers,(function(e){this.getRoot().load.remembered?cc(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())}),this),_h.each(this.__folders,(function(t){t.revert(t)})),t||hc(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&yc(this.__listening)},updateDisplay:function(){_h.each(this.__controllers,(function(t){t.updateDisplay()})),_h.each(this.__folders,(function(t){t.updateDisplay()}))}});var xc=ac;function bc(t,e,i){if(e){const t=document.createElement("div");t.id="menuDiv",this.gui=new xc({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)}))}}xc.prototype.removeFolder=function(t){const e=this.__folders[t];e&&(e.close(),this.__ul.removeChild(e.domElement.parentNode),delete this.__folders[t],this.onResize())},xc.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)},xc.prototype.hasFolder=function(t){return this.__folders[t]},bc.prototype.addLayerGUI=function(t){t.isColorLayer?this.addImageryLayerGUI(t):t.isElevationLayer?this.addElevationLayerGUI(t):t.isGeoidLayer&&this.addGeoidLayerGUI(t)},bc.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")},bc.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)}))},bc.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)}))},bc.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)}))},bc.prototype.addImageryLayersGUI=function(t){let e;const i=un.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])},bc.prototype.addElevationLayersGUI=function(t){let e;for(e=0;e<t.length;e++)this.addElevationLayerGUI(t[e])},bc.prototype.removeLayersGUI=function(t){this.colorGui.removeFolder(t)},bc.prototype.addGUI=function(t,e,i){return this[t]=e,this.gui.add(this,t).onChange(i)},bc.prototype.colorLayerFolder=function(t,e){this.colorGui.colorLayerFolder(t,e)};const vc=bc}},t=>t(t.s=44685)])));
|
|
3
3
|
//# sourceMappingURL=debug.js.map
|