@realsee/five-webgpu 1.0.0-alpha.1 → 1.0.0-alpha.11
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/README.md +9 -9
- package/_virtual/_rolldown/runtime.js +255 -0
- package/ai_guides/README.md +2 -2
- package/ai_guides/api.md +9 -8
- package/ai_guides/features/camera-animation.md +1 -1
- package/ai_guides/features/clipper.md +1 -1
- package/ai_guides/features/coordinate-system.md +1 -1
- package/ai_guides/features/event.md +1 -2
- package/ai_guides/features/five.md +81 -12
- package/ai_guides/features/gesture.md +3 -3
- package/ai_guides/features/get-screen-pixels.md +1 -1
- package/ai_guides/features/image-options.md +3 -3
- package/ai_guides/features/load-external-model.md +15 -15
- package/ai_guides/features/load-progress.md +2 -2
- package/ai_guides/features/material.md +35 -8
- package/ai_guides/features/mode.md +28 -31
- package/ai_guides/features/model.md +1 -1
- package/ai_guides/features/pano-filter.md +3 -3
- package/ai_guides/features/pano-tile.md +2 -2
- package/ai_guides/features/raycast.md +1 -1
- package/ai_guides/features/screen-project.md +1 -1
- package/ai_guides/features/state.md +3 -3
- package/ai_guides/features/ultra-hdr.md +41 -32
- package/ai_guides/features/work.md +2 -2
- package/ai_guides/quick-start.md +3 -3
- package/ai_guides/release_notes/6.6.md +2 -2
- package/ai_guides/release_notes/6.7.md +1 -1
- package/ai_guides/release_notes/6.8.md +3 -3
- package/ai_guides/support.md +0 -4
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/index.BoundingMesh.html +1 -1
- package/docs/classes/index.Camera.html +1 -1
- package/docs/classes/index.EffectComposer.html +1 -1
- package/docs/classes/index.EyeDomeLightingPass.html +1 -1
- package/docs/classes/index.Five.html +77 -68
- package/docs/classes/index.FivePass.html +1 -1
- package/docs/classes/index.FiveRenderer.html +2 -2
- package/docs/classes/index.FlowingFireworks3DPass.html +7 -3
- package/docs/classes/index.FlowingLight2DPass.html +6 -3
- package/docs/classes/index.FlowingLight3DPass.html +6 -3
- package/docs/classes/index.GaussianBlurPass.html +1 -1
- package/docs/classes/index.InternalWebGPURenderer.html +17 -3
- package/docs/classes/index.Model.html +1 -1
- package/docs/classes/index.ModelScene.html +1 -1
- package/docs/classes/index.NetworkSubscribe.html +1 -1
- package/docs/classes/index.PBMCustomNode.html +57 -0
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +9 -6
- package/docs/classes/index.PBMGaussianSplattingObject.html +18 -4
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +41 -11
- package/docs/classes/index.PBMGroup.html +1 -1
- package/docs/classes/index.PBMMesh.html +1 -1
- package/docs/classes/index.PBMMeshBasicMaterial.html +19 -6
- package/docs/classes/index.PBMMeshBasicNodeMaterial.html +31 -8
- package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +19 -6
- package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +31 -8
- package/docs/classes/index.PBMMeshPhongMaterial.html +19 -6
- package/docs/classes/index.PBMMeshPhongNodeMaterial.html +31 -8
- package/docs/classes/index.PBMMeshPhysicalMaterial.html +19 -6
- package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +31 -8
- package/docs/classes/index.PBMPanoFilter.html +8 -8
- package/docs/classes/index.PBMPointCloud.html +6 -7
- package/docs/classes/index.PBMPointCloudMaterial.html +83 -0
- package/docs/classes/index.PBMSkinnedMesh.html +1 -1
- package/docs/classes/index.PBMUpdateable.html +1 -1
- package/docs/classes/index.PanoCircleMesh.html +1 -1
- package/docs/classes/index.PanoCircleMeshCustom.html +5 -5
- package/docs/classes/index.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/index.Parameter.html +61 -53
- package/docs/classes/index.Scene.html +1 -1
- package/docs/classes/index.Subscribe.html +1 -1
- package/docs/classes/index.TextureLoader.html +4 -1
- package/docs/classes/index.Tile3D.html +23 -21
- package/docs/classes/index.TileNode.html +1 -1
- package/docs/classes/index.Tileset.html +4 -4
- package/docs/classes/index.TrajectoryNode.html +3 -3
- package/docs/classes/index.Work.html +20 -18
- package/docs/classes/index.WorkResolvedObserver.html +22 -22
- package/docs/classes/index.XRButton.html +3 -0
- package/docs/documents/README.html +2 -2
- package/docs/documents/api.html +11 -10
- package/docs/documents/features_camera-animation.html +1 -1
- package/docs/documents/features_clipper.html +1 -1
- package/docs/documents/features_coordinate-system.html +1 -1
- package/docs/documents/features_event.html +1 -2
- package/docs/documents/features_five.html +53 -11
- package/docs/documents/features_gesture.html +3 -3
- package/docs/documents/features_get-screen-pixels.html +1 -1
- package/docs/documents/features_image-options.html +3 -3
- package/docs/documents/features_load-external-model.html +13 -13
- package/docs/documents/features_load-progress.html +1 -1
- package/docs/documents/features_material.html +20 -9
- package/docs/documents/features_mode.html +30 -15
- package/docs/documents/features_model.html +1 -1
- package/docs/documents/features_pano-filter.html +3 -3
- package/docs/documents/features_pano-tile.html +2 -2
- package/docs/documents/features_raycast.html +1 -1
- package/docs/documents/features_screen-project.html +1 -1
- package/docs/documents/features_state.html +2 -2
- package/docs/documents/features_ultra-hdr.html +50 -44
- package/docs/documents/features_work.html +2 -2
- package/docs/documents/quick-start.html +2 -2
- package/docs/documents/release_notes_6.6.html +2 -2
- package/docs/documents/release_notes_6.7.html +1 -1
- package/docs/documents/release_notes_6.8.html +3 -3
- package/docs/documents/support.html +1 -3
- package/docs/functions/index.customNodesCacheKey.html +3 -0
- package/docs/functions/index.parseWork.html +1 -1
- package/docs/functions/index.workToJson.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/index.AddableObject.html +1 -1
- package/docs/interfaces/index.AjaxOptions.html +1 -1
- package/docs/interfaces/index.BaseEvent.html +2 -2
- package/docs/interfaces/index.Clock.html +24 -0
- package/docs/interfaces/index.DeviceProfile.html +8 -0
- package/docs/interfaces/index.EventCallback.html +49 -47
- package/docs/interfaces/index.FiveInitArgs.html +65 -41
- package/docs/interfaces/index.GainmapCfgData.html +15 -0
- package/docs/interfaces/index.GestureEvent.html +2 -2
- package/docs/interfaces/index.IPBMMaterial.html +18 -5
- package/docs/interfaces/index.ImageOptions.html +1 -1
- package/docs/interfaces/index.IntersectEvent.html +2 -2
- package/docs/interfaces/index.IntersectMesh.html +1 -1
- package/docs/interfaces/index.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/index.Intersection.html +1 -1
- package/docs/interfaces/index.LoosePanoWork.html +2 -2
- package/docs/interfaces/index.LooseWork.html +2 -2
- package/docs/interfaces/index.LooseWorkInitial.html +2 -2
- package/docs/interfaces/index.LooseWorkModel.html +2 -2
- package/docs/interfaces/index.LooseWorkObserver.html +2 -2
- package/docs/interfaces/index.LooseWorkPanorama.html +4 -3
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +15 -9
- package/docs/interfaces/index.ModeChangeEvent.html +2 -2
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ModelEvent.html +2 -2
- package/docs/interfaces/index.ModelSceneEvent.html +2 -2
- package/docs/interfaces/index.ModelTileEvent.html +2 -2
- package/docs/interfaces/index.MovePanoOptions.html +1 -1
- package/docs/interfaces/index.NetworkAbortError.html +1 -1
- package/docs/interfaces/index.NetworkFirbiddenError.html +1 -1
- package/docs/interfaces/index.NetworkOptions.html +1 -1
- package/docs/interfaces/index.NetworkProxyError.html +1 -1
- package/docs/interfaces/index.NetworkResourceEvent.html +2 -2
- package/docs/interfaces/index.NetworkResponseError.html +1 -1
- package/docs/interfaces/index.NetworkTimeoutError.html +1 -1
- package/docs/interfaces/index.ObjectEvent.html +2 -2
- package/docs/interfaces/index.PBMClipperParameter.html +2 -2
- package/docs/interfaces/index.PBMCustomNodeContext.html +87 -0
- package/docs/interfaces/index.PBMCustomNodeOptions.html +10 -0
- package/docs/interfaces/index.PBMCustomNodePanoContext.html +20 -0
- package/docs/interfaces/index.PBMCustomNodeSlots.html +31 -0
- package/docs/interfaces/index.PBMGaussianSplattingNodeMaterialOptions.html +4 -0
- package/docs/interfaces/index.PBMPanoDepth.html +5 -5
- package/docs/interfaces/index.PBMPanoFilterValue.html +2 -2
- package/docs/interfaces/index.PBMPanoGainmap.html +6 -0
- package/docs/interfaces/index.PBMPanoPicture.html +9 -8
- package/docs/interfaces/index.PBMRefinedScreen.html +2 -2
- package/docs/interfaces/index.PanoCircleMeshCustomOptions.html +2 -2
- package/docs/interfaces/index.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/index.PanoEvent.html +2 -2
- package/docs/interfaces/index.PanoPrepareEvent.html +15 -0
- package/docs/interfaces/index.PanoTextureEvent.html +2 -2
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ParameterMaterialValue.html +46 -38
- package/docs/interfaces/index.ParameterTilesetValue.html +15 -15
- package/docs/interfaces/index.ParameterValue.html +60 -52
- package/docs/interfaces/index.Pose.html +1 -1
- package/docs/interfaces/index.RenderEvent.html +2 -2
- package/docs/interfaces/index.ResolvedParameterValue.html +60 -52
- package/docs/interfaces/index.SplatData.html +10 -5
- package/docs/interfaces/index.State.html +1 -1
- package/docs/interfaces/index.StateEvent.html +2 -2
- package/docs/interfaces/index.TextureOptions.html +1 -1
- package/docs/interfaces/index.TilesetOptions.html +7 -2
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.VRPanoramaControllerCustomInitArgs.html +37 -0
- package/docs/interfaces/index.ViewLayer.html +23 -21
- package/docs/interfaces/index.WorkCubeHdrGainmapImage.html +10 -0
- package/docs/interfaces/index.WorkCubeImage.html +5 -9
- package/docs/interfaces/index.WorkImage.html +8 -12
- package/docs/interfaces/index.WorkInitial.html +8 -8
- package/docs/interfaces/index.WorkModel.html +8 -8
- package/docs/interfaces/index.WorkModelLayer.html +6 -6
- package/docs/interfaces/index.WorkObserver.html +23 -23
- package/docs/interfaces/index.WorkPanoramaJson.html +3 -2
- package/docs/interfaces/index.WorkTile.html +8 -12
- package/docs/interfaces/index.WorksEvent.html +2 -2
- package/docs/interfaces/index.XRControllerEvent.html +2 -2
- package/docs/interfaces/index.XRGestureEvent.html +2 -2
- package/docs/interfaces/index.XRPanoramaControllerCustomInitArgs.html +52 -0
- package/docs/interfaces/index.XRSessionEvent.html +2 -2
- package/docs/modules/index.html +1 -1
- package/docs/types/index.ControllerCustomInitTypes.html +4 -2
- package/docs/types/index.ControllerEventTypes.html +25 -23
- package/docs/types/index.DeviceProfileOverride.html +5 -0
- package/docs/types/index.EventTypes.html +26 -26
- package/docs/types/index.FlowingFireworks3DPassLine.html +5 -2
- package/docs/types/index.FlowingLight2DPassLine.html +4 -2
- package/docs/types/index.FlowingLight3DPassLine.html +7 -2
- package/docs/types/index.FlowingLightLineInput.html +12 -0
- package/docs/types/index.Mode.html +6 -3
- package/docs/types/index.OutputTextureDataType.html +1 -1
- package/docs/types/index.PBMColorStyle.html +1 -1
- package/docs/types/index.PBMCustomNodeTargetType.html +2 -0
- package/docs/types/index.PBMPointBack.html +1 -1
- package/docs/types/index.PBMPointShape.html +1 -1
- package/docs/types/index.PBMPointSize.html +1 -1
- package/docs/types/index.PBMRoofStyle.html +6 -0
- package/docs/types/index.ParseOptions.html +14 -8
- package/docs/types/index.XRMachineType.html +7 -0
- package/docs/variables/index.GSPLAT_PIPELINE_AUTO.html +2 -0
- package/docs/variables/index.GSPLAT_PIPELINE_RASTER_CPU_SORT.html +2 -0
- package/docs/variables/index.GSPLAT_PIPELINE_RASTER_GPU_SORT.html +2 -0
- package/docs/variables/index.PBMVertexMarkFlag.html +4 -0
- package/docs/variables/index.PROXY_CONTROLLER_EVENT_NAMES.html +1 -1
- package/docs/variables/index.controllersDefaultInitArgs.html +1 -1
- package/five/application/controllers.d.ts +8 -0
- package/five/application/events.d.ts +1 -1
- package/five/application/five.d.ts +15 -1
- package/five/application/fiveInitArgs.d.ts +32 -1
- package/five/application/mode.d.ts +8 -1
- package/five/cardboard/helper.d.ts +2 -0
- package/five/cardboard/index.d.ts +13 -0
- package/five/cardboard/sensor.d.ts +158 -0
- package/five/controllers/base.d.ts +3 -0
- package/five/controllers/events.d.ts +5 -3
- package/five/controllers/panorama.d.ts +2 -2
- package/five/controllers/vrPanorama.d.ts +56 -0
- package/five/controllers/xrPanorama.d.ts +506 -0
- package/five/core/internalWebGPURenderer.d.ts +23 -1
- package/five/core/panoVideo.d.ts +4 -1
- package/five/core/tiling.d.ts +40 -9
- package/five/core/webglAsyncReadFix.d.ts +25 -0
- package/five/gaussian-splatting/gpu-sort/prefixSumKernel.d.ts +65 -0
- package/five/gaussian-splatting/gpu-sort/radixSortModule.d.ts +128 -0
- package/five/gaussian-splatting/gpu-sort/shaders/radixHistogram.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/shaders/radixReorder.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/shaders/sortKeygen.d.ts +2 -0
- package/five/gaussian-splatting/gpu-sort/sortAdapter.d.ts +234 -0
- package/five/gaussian-splatting/layerRegistry.d.ts +17 -0
- package/five/gaussian-splatting/pipelines/cpuSortPipeline.d.ts +159 -0
- package/five/gaussian-splatting/pipelines/gpuSortPipeline.d.ts +98 -0
- package/five/gaussian-splatting/pipelines/gsplatPipeline.d.ts +104 -0
- package/five/gaussian-splatting/pipelines/pipelineMode.d.ts +42 -0
- package/five/gaussian-splatting/pipelines/sortThrottle.d.ts +45 -0
- package/five/gaussian-splatting/shStore.d.ts +22 -0
- package/five/gaussian-splatting/splatAssembler.d.ts +69 -0
- package/five/gaussian-splatting/transformStore.d.ts +37 -0
- package/five/gaussian-splatting/wasm/sort.d.ts +4 -3
- package/five/index.d.ts +8 -2
- package/five/index.js +404 -344
- package/five/index.mjs +9472 -4878
- package/five/meshes/panoCircleMeshCustom.d.ts +1 -0
- package/five/model/index.d.ts +3 -2
- package/five/model/loaders/spz.d.ts +50 -2
- package/five/model/materials/nodes/pbmMeshBasicNodeMaterial.d.ts +2 -0
- package/five/model/materials/nodes/pbmMeshPanoOnlyNodeMaterial.d.ts +2 -0
- package/five/model/materials/nodes/pbmMeshPhongNodeMaterial.d.ts +2 -0
- package/five/model/materials/nodes/pbmMeshPhysicalNodeMaterial.d.ts +2 -0
- package/five/model/materials/pbmGaussianSplattingNodeMaterial.d.ts +12 -5
- package/five/model/materials/pbmMaterial.d.ts +288 -6
- package/five/model/materials/pbmMeshMaterial.d.ts +0 -9
- package/five/model/materials/pbmPointCloudNodeMaterial.d.ts +1 -1
- package/five/model/materials/tsl/defines.d.ts +8 -2
- package/five/model/materials/tsl/outputBuilder.d.ts +8 -15
- package/five/model/materials/tsl/panoColor.d.ts +8 -2
- package/five/model/materials/tsl/utils.d.ts +13 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +30 -4
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +113 -48
- package/five/model/objects/pbmPointCloud.d.ts +0 -1
- package/five/model/objects/pbmPointCloudObject.d.ts +1 -1
- package/five/model/parameter.d.ts +20 -5
- package/five/model/tile3d/index.d.ts +2 -0
- package/five/model/tile3d/tileset.d.ts +5 -0
- package/five/model/tile3d/trajectory-content.d.ts +53 -0
- package/five/renderer/compute-renderers/binned/binned-core.d.ts +46 -0
- package/five/renderer/compute-renderers/binned/binned-pipelines.d.ts +10 -0
- package/five/renderer/compute-renderers/binned/shaders/args-builder.d.ts +2 -0
- package/five/renderer/compute-renderers/binned/shaders/classify.d.ts +2 -0
- package/five/renderer/compute-renderers/binned/shaders/coop.d.ts +2 -0
- package/five/renderer/compute-renderers/pointcloud-compute-renderer.d.ts +14 -38
- package/five/renderer/compute-renderers/shaders/lib/color.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/cull.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/encode.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/point-setup.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/point-size.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/raster.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/size-class.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/tile-bindings.d.ts +2 -0
- package/five/renderer/compute-renderers/uniform-layout.d.ts +23 -0
- package/five/renderer/five-renderer.d.ts +2 -0
- package/five/renderer/index.d.ts +1 -1
- package/five/renderer/postprocessing/index.d.ts +1 -1
- package/five/renderer/postprocessing/passes/flowing-fireworks-3d-pass.d.ts +23 -0
- package/five/renderer/postprocessing/passes/flowing-light-2d-pass.d.ts +2 -0
- package/five/renderer/postprocessing/passes/flowing-light-3d-pass.d.ts +23 -0
- package/five/renderer/postprocessing/passes/pass.js +255 -0
- package/five/renderer/postprocessing/passes/pass.mjs +255 -0
- package/five/renderer/tools/full-screen-quad.js +255 -0
- package/five/renderer/tools/full-screen-quad.mjs +255 -0
- package/five/texture/loader.d.ts +6 -0
- package/five/types/cube.d.ts +0 -1
- package/five/utils/calculateThreeMouse.js +255 -0
- package/five/utils/calculateThreeMouse.mjs +255 -0
- package/five/utils/detector.d.ts +11 -1
- package/five/utils/distance.js +255 -0
- package/five/utils/distance.mjs +255 -0
- package/five/utils/error.d.ts +1 -0
- package/five/utils/event.d.ts +26 -3
- package/five/utils/gainmap-data.d.ts +23 -0
- package/five/utils/isNil.js +255 -0
- package/five/utils/isNil.mjs +255 -0
- package/five/utils/ktx2.d.ts +3 -3
- package/five/utils/uuid.js +255 -0
- package/five/utils/uuid.mjs +255 -0
- package/five/webxr/XRControllerModelFactory.d.ts +55 -0
- package/five/webxr/buttonStateMachine.d.ts +31 -0
- package/five/webxr/deviceProfile.d.ts +70 -0
- package/five/webxr/inputSourceTracker.d.ts +59 -0
- package/five/webxr/referenceSpace.d.ts +60 -0
- package/five/webxr/renderTargetBridge.d.ts +45 -0
- package/five/webxr/xrButton.d.ts +4 -0
- package/five/webxr/xrManager.d.ts +174 -0
- package/five/work/index.d.ts +1 -1
- package/five/work/looseWorkType.d.ts +2 -1
- package/five/work/work.d.ts +30 -7
- package/five/work/workJsonType.d.ts +2 -1
- package/gltf-loader/gltf-object.d.ts +17 -0
- package/gltf-loader/index.d.ts +45 -0
- package/gltf-loader/index.js +255 -0
- package/gltf-loader/index.mjs +302 -0
- package/line/circle_png.d.ts +1 -0
- package/line/index.d.ts +49 -0
- package/line/index.js +255 -0
- package/line/index.mjs +340 -0
- package/llms.txt +1 -1
- package/package.json +34 -5
- package/plugins/BackgroundPlugin/Controller.d.ts +20 -0
- package/plugins/BackgroundPlugin/Controller.js +276 -0
- package/plugins/BackgroundPlugin/Controller.mjs +276 -0
- package/plugins/BackgroundPlugin/index.d.ts +5 -0
- package/plugins/BackgroundPlugin/index.js +255 -0
- package/plugins/BackgroundPlugin/index.mjs +255 -0
- package/plugins/BackgroundPlugin/typings.d.ts +44 -0
- package/plugins/BasePlugin/index.d.ts +1 -1
- package/plugins/BasePlugin/index.js +255 -0
- package/plugins/BasePlugin/index.mjs +255 -0
- package/plugins/CSS2DPlugin/Controller.d.ts +59 -0
- package/plugins/CSS2DPlugin/Controller.js +255 -0
- package/plugins/CSS2DPlugin/Controller.mjs +255 -0
- package/plugins/CSS2DPlugin/index.d.ts +5 -0
- package/plugins/CSS2DPlugin/index.js +255 -0
- package/plugins/CSS2DPlugin/index.mjs +255 -0
- package/plugins/CSS2DPlugin/style.css_raw.js +275 -0
- package/plugins/CSS2DPlugin/style.css_raw.mjs +275 -0
- package/plugins/CSS2DPlugin/typing.d.ts +31 -0
- package/plugins/CSS3DPlugin/Controller.d.ts +64 -0
- package/plugins/CSS3DPlugin/Controller.js +255 -0
- package/plugins/CSS3DPlugin/Controller.mjs +255 -0
- package/plugins/CSS3DPlugin/index.d.ts +5 -0
- package/plugins/CSS3DPlugin/index.js +255 -0
- package/plugins/CSS3DPlugin/index.mjs +255 -0
- package/plugins/CSS3DPlugin/style.css_raw.js +274 -0
- package/plugins/CSS3DPlugin/style.css_raw.mjs +274 -0
- package/plugins/CSS3DPlugin/typing.d.ts +33 -0
- package/plugins/FloorplanPlugin/Controller.d.ts +100 -0
- package/plugins/FloorplanPlugin/Controller.js +255 -0
- package/plugins/FloorplanPlugin/Controller.mjs +255 -0
- package/plugins/FloorplanPlugin/index.d.ts +6 -0
- package/plugins/FloorplanPlugin/index.js +255 -0
- package/plugins/FloorplanPlugin/index.mjs +255 -0
- package/plugins/FloorplanPlugin/render/assets.d.ts +9 -0
- package/plugins/FloorplanPlugin/render/assets.js +255 -0
- package/plugins/FloorplanPlugin/render/assets.mjs +255 -0
- package/plugins/FloorplanPlugin/render/index.d.ts +35 -0
- package/plugins/FloorplanPlugin/render/index.js +255 -0
- package/plugins/FloorplanPlugin/render/index.mjs +255 -0
- package/plugins/FloorplanPlugin/render/isPointInPolygon.d.ts +5 -0
- package/plugins/FloorplanPlugin/render/isPointInPolygon.js +255 -0
- package/plugins/FloorplanPlugin/render/isPointInPolygon.mjs +255 -0
- package/plugins/FloorplanPlugin/render/renderFloor.d.ts +22 -0
- package/plugins/FloorplanPlugin/render/renderFloor.js +255 -0
- package/plugins/FloorplanPlugin/render/renderFloor.mjs +255 -0
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.d.ts +10 -0
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.js +255 -0
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.mjs +255 -0
- package/plugins/FloorplanPlugin/render/style.css_raw.js +585 -0
- package/plugins/FloorplanPlugin/render/style.css_raw.mjs +585 -0
- package/plugins/FloorplanPlugin/typing.d.ts +156 -0
- package/plugins/FloorplanPlugin/typings/floorplanData.d.ts +112 -0
- package/plugins/FloorplanPlugin/typings/floorplanJson.d.ts +167 -0
- package/plugins/FloorplanPlugin/typings/floorplanServerData.d.ts +78 -0
- package/plugins/FloorplanPlugin/typings/index.d.ts +3 -0
- package/plugins/FloorplanPlugin/utils/changeMode.d.ts +5 -0
- package/plugins/FloorplanPlugin/utils/changeMode.js +255 -0
- package/plugins/FloorplanPlugin/utils/changeMode.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js +255 -0
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/correctFiveState.d.ts +11 -0
- package/plugins/FloorplanPlugin/utils/correctFiveState.js +255 -0
- package/plugins/FloorplanPlugin/utils/correctFiveState.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/equal.d.ts +9 -0
- package/plugins/FloorplanPlugin/utils/equal.js +255 -0
- package/plugins/FloorplanPlugin/utils/equal.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/filter.d.ts +8 -0
- package/plugins/FloorplanPlugin/utils/filter.js +255 -0
- package/plugins/FloorplanPlugin/utils/filter.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.js +255 -0
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/formatData.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/formatData.js +255 -0
- package/plugins/FloorplanPlugin/utils/formatData.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.d.ts +20 -0
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.js +255 -0
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/formatPosition.d.ts +33 -0
- package/plugins/FloorplanPlugin/utils/formatPosition.js +255 -0
- package/plugins/FloorplanPlugin/utils/formatPosition.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.d.ts +6 -0
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.js +255 -0
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/getPxmm.d.ts +19 -0
- package/plugins/FloorplanPlugin/utils/getPxmm.js +255 -0
- package/plugins/FloorplanPlugin/utils/getPxmm.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/isTruelyObject.d.ts +4 -0
- package/plugins/FloorplanPlugin/utils/isTruelyObject.js +255 -0
- package/plugins/FloorplanPlugin/utils/isTruelyObject.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/nearlyEqual.d.ts +8 -0
- package/plugins/FloorplanPlugin/utils/nearlyEqual.js +255 -0
- package/plugins/FloorplanPlugin/utils/nearlyEqual.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/polylabel.d.ts +8 -0
- package/plugins/FloorplanPlugin/utils/polylabel.js +255 -0
- package/plugins/FloorplanPlugin/utils/polylabel.mjs +255 -0
- package/plugins/FloorplanPlugin/utils/to.d.ts +5 -0
- package/plugins/FloorplanPlugin/utils/to.js +255 -0
- package/plugins/FloorplanPlugin/utils/to.mjs +255 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.d.ts +1 -1
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.js +255 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.mjs +255 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.d.ts +1 -1
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.js +255 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Controller.d.ts +99 -0
- package/plugins/Object3DHelperPlugin/Controller.js +255 -0
- package/plugins/Object3DHelperPlugin/Controller.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.d.ts +139 -0
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.js +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.d.ts +16 -0
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.js +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.d.ts +66 -0
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.js +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.d.ts +61 -0
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.js +255 -0
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.mjs +255 -0
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.d.ts +17 -0
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.js +255 -0
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.d.ts +97 -0
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.js +255 -0
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.d.ts +16 -0
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.js +255 -0
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.d.ts +37 -0
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.js +255 -0
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.mjs +255 -0
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.d.ts +93 -0
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.js +255 -0
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.mjs +255 -0
- package/plugins/Object3DHelperPlugin/constant.d.ts +27 -0
- package/plugins/Object3DHelperPlugin/constant.js +255 -0
- package/plugins/Object3DHelperPlugin/constant.mjs +255 -0
- package/plugins/Object3DHelperPlugin/index.d.ts +6 -0
- package/plugins/Object3DHelperPlugin/index.js +255 -0
- package/plugins/Object3DHelperPlugin/index.mjs +255 -0
- package/plugins/Object3DHelperPlugin/typing.d.ts +143 -0
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.d.ts +22 -0
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.d.ts +23 -0
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.d.ts +19 -0
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.d.ts +5 -0
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.d.ts +3 -0
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/direction.d.ts +14 -0
- package/plugins/Object3DHelperPlugin/utils/direction.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/direction.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.d.ts +5 -0
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.d.ts +8 -0
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.d.ts +8 -0
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/solidGuide.d.ts +27 -0
- package/plugins/Object3DHelperPlugin/utils/solidGuide.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/solidGuide.mjs +255 -0
- package/plugins/Object3DHelperPlugin/utils/tipsDom.d.ts +8 -0
- package/plugins/Object3DHelperPlugin/utils/tipsDom.js +255 -0
- package/plugins/Object3DHelperPlugin/utils/tipsDom.mjs +255 -0
- package/plugins/PanoAnimePlugin/Controller.d.ts +49 -0
- package/plugins/PanoAnimePlugin/Controller.js +255 -0
- package/plugins/PanoAnimePlugin/Controller.mjs +255 -0
- package/plugins/PanoAnimePlugin/index.d.ts +5 -0
- package/plugins/PanoAnimePlugin/index.js +255 -0
- package/plugins/PanoAnimePlugin/index.mjs +255 -0
- package/plugins/PanoAnimePlugin/typing.d.ts +37 -0
- package/plugins/WordPassPlugin/Controller.d.ts +62 -0
- package/plugins/WordPassPlugin/Controller.js +255 -0
- package/plugins/WordPassPlugin/Controller.mjs +255 -0
- package/plugins/WordPassPlugin/hersheyFont.d.ts +11 -0
- package/plugins/WordPassPlugin/hersheyFont.js +255 -0
- package/plugins/WordPassPlugin/hersheyFont.mjs +255 -0
- package/plugins/WordPassPlugin/index.d.ts +7 -0
- package/plugins/WordPassPlugin/index.js +255 -0
- package/plugins/WordPassPlugin/index.mjs +255 -0
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.d.ts +82 -0
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.js +256 -0
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.mjs +256 -0
- package/plugins/WordPassPlugin/typing.d.ts +109 -0
- package/plugins/WordPassPlugin/word-pass.d.ts +172 -0
- package/plugins/WordPassPlugin/word-pass.js +255 -0
- package/plugins/WordPassPlugin/word-pass.mjs +255 -0
- package/plugins/index.d.ts +8 -0
- package/plugins/index.js +3 -3
- package/plugins/index.mjs +3 -287
- package/plugins/thirdParty/CSS2DRenderer.d.ts +37 -0
- package/plugins/thirdParty/CSS2DRenderer.js +255 -0
- package/plugins/thirdParty/CSS2DRenderer.mjs +255 -0
- package/plugins/thirdParty/CSS3DRenderer.d.ts +45 -0
- package/plugins/thirdParty/CSS3DRenderer.js +255 -0
- package/plugins/thirdParty/CSS3DRenderer.mjs +255 -0
- package/plugins/thirdParty/OrbitControls.d.ts +78 -0
- package/plugins/thirdParty/doctorstrange-model.d.ts +92 -0
- package/plugins/thirdParty/doctorstrange-model.js +610 -0
- package/plugins/thirdParty/doctorstrange-model.mjs +610 -0
- package/plugins/thirdParty/domevents.d.ts +36 -0
- package/plugins/thirdParty/domevents.js +255 -0
- package/plugins/thirdParty/domevents.mjs +255 -0
- package/plugins/utils/absoluteUrl.js +255 -0
- package/plugins/utils/absoluteUrl.mjs +255 -0
- package/plugins/utils/calculatePath.d.ts +3 -0
- package/plugins/utils/calculatePath.js +255 -0
- package/plugins/utils/calculatePath.mjs +255 -0
- package/plugins/utils/clamp.d.ts +2 -0
- package/plugins/utils/clamp.js +255 -0
- package/plugins/utils/clamp.mjs +255 -0
- package/plugins/utils/uuid.d.ts +2 -0
- package/plugins/utils/uuid.js +255 -0
- package/plugins/utils/uuid.mjs +255 -0
- package/react/context.d.ts +1 -1
- package/react/createProvider.d.ts +1 -1
- package/react/fiveApp.d.ts +1 -1
- package/react/hooks/unsafe__useFiveInstance.d.ts +1 -1
- package/react/hooks/useFiveAction.d.ts +1 -1
- package/react/hooks/useFiveCurrentObserver.d.ts +1 -1
- package/react/hooks/useFiveCurrentState.d.ts +1 -1
- package/react/hooks/useFiveEventCallback.d.ts +1 -1
- package/react/hooks/useFiveModelEffect.d.ts +1 -1
- package/react/hooks/useFiveModelIntersectRaycaster.d.ts +1 -1
- package/react/hooks/useFivePlugin.d.ts +1 -1
- package/react/hooks/useFiveSceneEffect.d.ts +1 -1
- package/react/hooks/useFiveState.d.ts +1 -1
- package/react/hooks/useFiveWork.d.ts +1 -1
- package/react/index.js +3 -3
- package/react/index.mjs +3 -3
- package/react/withFive.d.ts +1 -1
- package/sticker/geometry.d.ts +3 -0
- package/sticker/index.d.ts +68 -0
- package/sticker/index.js +255 -0
- package/sticker/index.mjs +358 -0
- package/umd/five-gltf-loader.js +255 -0
- package/umd/five-line.js +322 -0
- package/umd/five-plugins.js +817 -3
- package/umd/five-react.js +3 -3
- package/umd/five-sticker.js +255 -0
- package/umd/five-vfx.js +323 -0
- package/umd/five.js +472 -412
- package/vfx/airflow/airflow.d.ts +18 -0
- package/vfx/common/simplex-noise.d.ts +2 -0
- package/vfx/frame/frame.d.ts +27 -0
- package/vfx/index.d.ts +7 -0
- package/vfx/index.js +255 -0
- package/vfx/index.mjs +738 -0
- package/vfx/particle/instance.d.ts +36 -0
- package/vfx/particle/particle.d.ts +119 -0
- package/vfx/particle/utils.d.ts +11 -0
- package/vfx/particle-gpu/particle.d.ts +75 -0
- package/vfx/particle-gpu/utils.d.ts +11 -0
- package/vfx/spotLight/spotLight.d.ts +15 -0
- package/work-downloader/components/model-3d-tile.d.ts +2 -0
- package/work-downloader/components/model.d.ts +3 -0
- package/work-downloader/components/observer.d.ts +9 -0
- package/work-downloader/download.d.ts +16 -0
- package/work-downloader/index.d.ts +2 -0
- package/work-downloader/index.js +255 -0
- package/work-downloader/index.mjs +567 -0
- package/work-downloader/type.d.ts +28 -0
- package/work-downloader/utils/download-to-file.d.ts +1 -0
- package/work-downloader/utils/image-processing.d.ts +7 -0
- package/work-downloader/utils/join-url.d.ts +2 -0
- package/work-downloader/utils/log.d.ts +1 -0
- package/work-downloader/utils/relative-url.d.ts +1 -0
- package/docs/interfaces/index.PBMHDRConfig.html +0 -12
- package/five/gaussian-splatting/util/renderData.d.ts +0 -66
- package/five/gaussian-splatting/worker/dataWorker.d.ts +0 -1
- package/five/three-version-check.d.ts +0 -1
- package/five/utils/hdr-data.d.ts +0 -13
- package/five/utils/shaderContentFix.d.ts +0 -7
- /package/five/{renderer/compute-renderers/shaders/rasterize.d.ts → gaussian-splatting/gpu-sort/shaders/prefixSum.d.ts} +0 -0
package/umd/five-vfx.js
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* @realsee/five-webgpu
|
|
4
|
+
* Generated: 10/27/2026
|
|
5
|
+
* Version: 1.0.0-alpha.11
|
|
6
|
+
* Terms:
|
|
7
|
+
* Realsee SDK License Agreement
|
|
8
|
+
* Update: July 28, 2021
|
|
9
|
+
* THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK)
|
|
10
|
+
* LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN
|
|
11
|
+
* RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee
|
|
12
|
+
* Software Development Kit(s) for the software and related explanatory materials
|
|
13
|
+
* (the "SDK") and includes any upgrades, modified versions, updates, additions,
|
|
14
|
+
* and copies of the SDK licensed to You by Realsee.
|
|
15
|
+
* BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE
|
|
16
|
+
* THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE
|
|
17
|
+
* AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO
|
|
18
|
+
* THE TERMS AND CONDITIONS STATED BELOW.
|
|
19
|
+
* This Agreement applies to Your use of the SDK in the country in which You
|
|
20
|
+
* legally install it (“Territory”) and is subject to the laws of such Territory
|
|
21
|
+
* and further subject to Section 12 below. Different terms, conditions, and
|
|
22
|
+
* limitations may apply to the use of the SDK in any additional countries.
|
|
23
|
+
* 1. DEFINITIONS.
|
|
24
|
+
* “Agreement” means this Realsee SDK License Agreement.
|
|
25
|
+
* “Developer”, “You” and “Your” means the person(s) or entity acquiring or using
|
|
26
|
+
* the SDK or otherwise exercising rights under the terms of this Agreement.
|
|
27
|
+
* “Documentation” means the technical or other specifications or documentation
|
|
28
|
+
* that Realsee may provide to You for use in connection with the SDK.
|
|
29
|
+
* “Integrated Product” means any software, website, or on-line service developed
|
|
30
|
+
* by You based on or using the SDK (collectively, the “Integrated Product”).
|
|
31
|
+
* “Intellectual Property” means any patents, patent rights, trademarks, service
|
|
32
|
+
* marks, registered and unregistered designs, applications for any of the
|
|
33
|
+
* foregoing, copyright, and any other similar protected rights in any country and
|
|
34
|
+
* to the extent recognised by any relevant jurisdiction as intellectual property,
|
|
35
|
+
* trade secrets, know-how and confidential information. Realsee reserves all
|
|
36
|
+
* rights not expressly granted to You.
|
|
37
|
+
* “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated
|
|
38
|
+
* and validly existing under the laws of Hong Kong].
|
|
39
|
+
* “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided
|
|
40
|
+
* hereunder, includes all development tools (including any compiler and debugger),
|
|
41
|
+
* application programming interfaces (“APIs”), libraries, binary utilities, header
|
|
42
|
+
* files, Documentation, content, data, code samples, and other materials provided
|
|
43
|
+
* to You in connection with this Agreement, whether delivered through a download,
|
|
44
|
+
* or any other media or form, and is licensed, not sold, to You by Realsee for use
|
|
45
|
+
* only under the terms of this Agreement. The terms of this Agreement will govern
|
|
46
|
+
* any updates provided by Realsee that replace and/or supplement the original SDK
|
|
47
|
+
* delivered to You, unless such update is accompanied by a separate license, in
|
|
48
|
+
* which case the terms of such license will govern.
|
|
49
|
+
* 2. LICENSED USES AND RESTRICTIONS.
|
|
50
|
+
* 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to
|
|
51
|
+
* You during the term, a limited, non-exclusive, revocable, non-sublicensable,
|
|
52
|
+
* non-transferable license to install and use the SDK within the Territory only
|
|
53
|
+
* for the purpose of internal development.
|
|
54
|
+
* 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall
|
|
55
|
+
* ensure that Your affiliates, employees, agents, representatives, officers,
|
|
56
|
+
* representatives, and subcontractors do not (directly or indirectly):
|
|
57
|
+
* 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source
|
|
58
|
+
* code of, those components of the SDK provided in object code form, or any part
|
|
59
|
+
* thereof;
|
|
60
|
+
* 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights
|
|
61
|
+
* notice on any part of the SDK;
|
|
62
|
+
* 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website
|
|
63
|
+
* or server for use by any third party except You, redistribute, or sublicense the
|
|
64
|
+
* SDK (or any part thereof), or operate the SDK (or any part thereof) in the
|
|
65
|
+
* capacity of a service bureau or other hosted services provider, in whole or in
|
|
66
|
+
* part, nor may You enable others to do so;
|
|
67
|
+
* 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
|
|
68
|
+
* 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner
|
|
69
|
+
* that is inconsistent with the terms of this Agreement, or to engage in any
|
|
70
|
+
* illegal activity;
|
|
71
|
+
* 2.2.6 use the SDK (or any part thereof) in any manner that may damage the
|
|
72
|
+
* operation of Realsee’s products or services; or
|
|
73
|
+
* 2.2.7 use the SDK or any information contained therein or otherwise provided by
|
|
74
|
+
* Realsee for the purpose of developing, or having developed, any product
|
|
75
|
+
* competitive with any Realsee product or service, as determined by Realsee in its
|
|
76
|
+
* sole discretion;
|
|
77
|
+
* 2.2.8 include any portion of the SDK in Your Developer products.
|
|
78
|
+
* 2.3 Realsee has the right to impose reasonable conditions such as a reasonable
|
|
79
|
+
* fee for use of the SDK in Integrated Product in the future.
|
|
80
|
+
* 2.4 You may make a limited number of copies of the SDK to be used by Your
|
|
81
|
+
* employees or consultants as provided herein, and not for general business
|
|
82
|
+
* purposes, and such employees or consultants shall be subject to the obligations
|
|
83
|
+
* and restrictions in this Agreement.
|
|
84
|
+
* 2.5 All licenses not expressly granted in this Agreement are reserved and no
|
|
85
|
+
* other licenses, immunity, or rights, express or implied, are granted by Realsee,
|
|
86
|
+
* by implication, estoppel, or otherwise.
|
|
87
|
+
* 3. CONFIDENTIALITY.
|
|
88
|
+
* The SDK and all source code, Documentation, specifications, engineering details,
|
|
89
|
+
* and related information pertaining to the SDK, whether in oral, written,
|
|
90
|
+
* graphic, or electronic form, are and shall remain the confidential and
|
|
91
|
+
* proprietary information of Realsee or its licensors (collectively, the
|
|
92
|
+
* “Confidential Information”). You shall (i) disclose Confidential Information to
|
|
93
|
+
* only those directors and employees (collectively, “Affiliates”) whose duties
|
|
94
|
+
* justify their need to know such information and who have been clearly informed
|
|
95
|
+
* of their obligation to maintain the confidential, proprietary, and/or trade
|
|
96
|
+
* secret status of such Confidential Information; and (ii) use Confidential
|
|
97
|
+
* Information solely in accordance with the license granted hereunder. In any
|
|
98
|
+
* event, You and Your Affiliates shall treat Confidential Information as strictly
|
|
99
|
+
* confidential and shall use the same care to prevent disclosure of such
|
|
100
|
+
* information as You use with respect to Your own similar confidential and/or
|
|
101
|
+
* proprietary information, which shall not be less than the care a reasonable
|
|
102
|
+
* person would use under similar circumstances. All Confidential Information, and
|
|
103
|
+
* any copies thereof, shall be returned promptly to Realsee upon request. You
|
|
104
|
+
* shall ensure that Your Affiliates comply with the provisions of this Section 3,
|
|
105
|
+
* and You shall be liable for any breach of this Section 3 resulting from the act
|
|
106
|
+
* or omission of any of Your Affiliates. You shall not disclose Confidential
|
|
107
|
+
* Information to any third party, including, without limitation, any of Your
|
|
108
|
+
* subcontractors.
|
|
109
|
+
* 4. PROPRIETARY RIGHTS.
|
|
110
|
+
* 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of
|
|
111
|
+
* all right, title, and interest in, to, and under the SDK, including, without
|
|
112
|
+
* limitation, all patents, copyrights, trade secrets, trademarks and other
|
|
113
|
+
* intellectual property and other proprietary rights therein, and reserve all
|
|
114
|
+
* rights not expressly granted to You.
|
|
115
|
+
* 4.2 The items contained in the SDK are the intellectual property of Realsee and
|
|
116
|
+
* its licensors and are protected by PRC copyright and patent law, international
|
|
117
|
+
* treaty provisions and applicable laws of the country in which it is being used.
|
|
118
|
+
* You agree to protect all copyright and other ownership interests of Realsee
|
|
119
|
+
* and/or its licensors in all items in the SDK supplied under this License
|
|
120
|
+
* Agreement. You agree that all copies of the items in the SDK, reproduced for any
|
|
121
|
+
* reason by You, contain the same copyright notices, and other proprietary notices
|
|
122
|
+
* as appropriate, as appear on or in the original items delivered by Realsee in
|
|
123
|
+
* the SDK. Realsee and/or its licensors retain title and ownership of the items in
|
|
124
|
+
* the SDK, the media on which it is loaded, and all subsequent copies, regardless
|
|
125
|
+
* of the form or media in or on which the original and other copies may exist.
|
|
126
|
+
* Except as stated above, this Agreement does not grant You any rights to patents,
|
|
127
|
+
* copyrights, trade secrets, trademarks or any other rights in respect to the
|
|
128
|
+
* items in the SDK.
|
|
129
|
+
* 5. TERM AND TERMINATION.
|
|
130
|
+
* 5.1 This Agreement is effective until terminated. Realsee has the right to
|
|
131
|
+
* terminate this Agreement immediately, without judicial intervention, if You fail
|
|
132
|
+
* to comply with any term herein. Upon any such termination You must remove all
|
|
133
|
+
* full and partial copies of the items in the SDK from Your computer and
|
|
134
|
+
* discontinue the use of the items in the SDK.
|
|
135
|
+
* 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have
|
|
136
|
+
* breached any provision of the Agreement; or (B) Realsee is required to do so by
|
|
137
|
+
* law; or (C) Realsee decides to no longer provide the SDK or certain parts of the
|
|
138
|
+
* SDK to users in the country in which You are resident or from which You use the
|
|
139
|
+
* service, or the provision of the SDK or certain SDK services to You by Realsee
|
|
140
|
+
* is, in Realsee's sole discretion, no longer legally or commercially viable.
|
|
141
|
+
* 5.3 When the Agreement comes to an end, all of the legal rights, obligations and
|
|
142
|
+
* liabilities that You and Realsee have benefited from, been subject to (or which
|
|
143
|
+
* have accrued over time whilst the Agreement has been in force) or which are
|
|
144
|
+
* expressed to continue indefinitely, shall be unaffected by this cessation, and
|
|
145
|
+
* the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such
|
|
146
|
+
* rights, obligations and liabilities indefinitely.
|
|
147
|
+
* 6. DISCLAIMER OF WARRANTY.
|
|
148
|
+
* YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE
|
|
149
|
+
* LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE
|
|
150
|
+
* ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS
|
|
151
|
+
* WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE
|
|
152
|
+
* MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK,
|
|
153
|
+
* WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY
|
|
154
|
+
* PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR
|
|
155
|
+
* RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING
|
|
156
|
+
* OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT
|
|
157
|
+
* CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL
|
|
158
|
+
* WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
|
|
159
|
+
* CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
160
|
+
* OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK
|
|
161
|
+
* OR ANY SERVICES RELATED TO THE SDK.
|
|
162
|
+
* REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE
|
|
163
|
+
* AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS
|
|
164
|
+
* THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
|
|
165
|
+
* 7. LIMITATION OF LIABILITY.
|
|
166
|
+
* TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS
|
|
167
|
+
* LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR
|
|
168
|
+
* CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE,
|
|
169
|
+
* LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR
|
|
170
|
+
* INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME,
|
|
171
|
+
* OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF
|
|
172
|
+
* PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER
|
|
173
|
+
* COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY
|
|
174
|
+
* TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY
|
|
175
|
+
* SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART
|
|
176
|
+
* THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT,
|
|
177
|
+
* OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
178
|
+
* DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES
|
|
179
|
+
* EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN
|
|
180
|
+
* IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS
|
|
181
|
+
* CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS
|
|
182
|
+
* OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT
|
|
183
|
+
* OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
|
|
184
|
+
* 8. INDEMNIFICATION.
|
|
185
|
+
* To the extent permitted by applicable law, You agree to indemnify, defend and
|
|
186
|
+
* hold harmless Realsee, its affiliates and each of their directors, officers,
|
|
187
|
+
* employees, independent contractors, and agents (each a “Realsee Indemnified
|
|
188
|
+
* Party”) from any and all claims, losses, liabilities, damages, expenses, and
|
|
189
|
+
* costs (including without limitation attorneys’ fees and court costs) incurred by
|
|
190
|
+
* a Realsee Indemnified Party as a result of: (i) Your non-compliance with any
|
|
191
|
+
* terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or
|
|
192
|
+
* (iii) Your use of any Integrated Product, including any claim that Integrated
|
|
193
|
+
* Product infringes the copyright, trademark, trade secret or other intellectual
|
|
194
|
+
* property right of a third party.
|
|
195
|
+
* 9. ACKNOWLEDGEMENTS.
|
|
196
|
+
* Portions of the SDK may utilize or include third party software and other
|
|
197
|
+
* copyrighted material. Acknowledgments, licensing terms, and disclaimers for such
|
|
198
|
+
* material are contained in Documentation for the SDK or may otherwise accompany
|
|
199
|
+
* such material, and Your use of such materials governed by their respective
|
|
200
|
+
* terms. In the event of conflict between the terms of this Agreement and an
|
|
201
|
+
* applicable open source or third party agreement, the open source or third party
|
|
202
|
+
* agreement will control solely with respect to the open source software or third
|
|
203
|
+
* party software. Moreover, You shall not subject any items (including not limited
|
|
204
|
+
* to source code, object code, and any software) included in the SDK to any open
|
|
205
|
+
* source license.
|
|
206
|
+
* 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
|
|
207
|
+
* You acknowledge that Realsee is currently developing or may develop technologies
|
|
208
|
+
* and products in the future that have or may have design and/or functionality
|
|
209
|
+
* similar to Integrated Product that You may develop based on Your license herein.
|
|
210
|
+
* Nothing in this Agreement shall impair, limit or curtail Realsee's right to
|
|
211
|
+
* continue with its development, maintenance and/or distribution of Realsee's
|
|
212
|
+
* technology or products.
|
|
213
|
+
* 11. GENERAL.
|
|
214
|
+
* 11.1 Export Control. You may not use or otherwise export or re-export the SDK
|
|
215
|
+
* (or any part thereof) except as authorized by United States law and the laws of
|
|
216
|
+
* the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In
|
|
217
|
+
* particular, but without limitation, the SDK may not be exported or re-exported
|
|
218
|
+
* (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury
|
|
219
|
+
* Department's list of Specially Designated Nationals or the U.S. Department of
|
|
220
|
+
* Commerce Denied Person's List or Entity List. By using the SDK (or any part
|
|
221
|
+
* thereof), You represent and warrant that You are not located in any such country
|
|
222
|
+
* or on any such list.
|
|
223
|
+
* 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall
|
|
224
|
+
* be governed by and construed in accordance with the laws of People’s Republic of
|
|
225
|
+
* China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau),
|
|
226
|
+
* without reference to its conflict of laws principles. Any dispute, controversy
|
|
227
|
+
* or claim arising from or in connection with this Agreement, or the breach,
|
|
228
|
+
* termination or invalidity thereof, shall be submitted to China International
|
|
229
|
+
* Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing
|
|
230
|
+
* which shall be conducted in accordance with the CIETAC's arbitration rules in
|
|
231
|
+
* effect at the time of applying for arbitration. The arbitral award is final and
|
|
232
|
+
* binding upon both parties.
|
|
233
|
+
* 11.3 Severability. If any provision of this Agreement is held by a court of
|
|
234
|
+
* competent jurisdiction to be unenforceable for any reason, the remaining
|
|
235
|
+
* provisions hereof will be unaffected and remain in full force and effect.
|
|
236
|
+
* 11.4. Modifications. Realsee reserves the right, from time to time, with or
|
|
237
|
+
* without notice to You, to make revisions to this Agreement in our sole and
|
|
238
|
+
* absolute discretion. The most current version of this Agreement will supersede
|
|
239
|
+
* all previous versions and shall be made available on the website where the SDK
|
|
240
|
+
* is made available, or by such other means as Realsee may determine in its
|
|
241
|
+
* discretion. Any modified versions of this Agreement hereto shall take effect
|
|
242
|
+
* from the time that it is made available. You shall be responsible for regularly
|
|
243
|
+
* checking for notice of any such modifications. You agree that Your continued use
|
|
244
|
+
* of the SDK constitutes Your agreement to the modified Agreement.
|
|
245
|
+
* 11.5 Relationship of the Parties. This Agreement will not be construed as
|
|
246
|
+
* creating an agency, partnership, joint venture, fiduciary duty, or any other
|
|
247
|
+
* form of legal association between You and Realsee, and You will not represent to
|
|
248
|
+
* the contrary, whether expressly, by implication, appearance, or otherwise.
|
|
249
|
+
* 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire
|
|
250
|
+
* agreement between You and Realsee with respect to the use of the SDK licensed
|
|
251
|
+
* hereunder and supersedes all prior understandings regarding such subject matter.
|
|
252
|
+
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
|
+
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
|
+
* Agreement and all related documents shall be drafted in English.
|
|
255
|
+
*/(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FiveSDK_VFX={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?a(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){s(a,r,i,o,c,`next`,e)}function c(e){s(a,r,i,o,c,`throw`,e)}o(void 0)})}}var l=1e3,u=1001,d=1002,f=1003,p=1006,m=1008,h=1008,g=1009,_=1014,v=1015,y=1016,b=1023,x=1026,S=1030,C=2300,ee=2301,te=2302,ne=2303,re=2400,ie=2401,ae=2402,w=`srgb`,oe=`srgb-linear`,se=`linear`,ce=`srgb`,le=7680,ue=35044,de=35048,fe=2e3,pe=2001,me={TEXTURE_COMPARE:`depthTextureCompare`};function he(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function ge(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _e(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}var ve={},ye=null;function be(...e){let t=`THREE.`+e.shift();ye?ye(`log`,t,...e):console.log(t,...e)}function xe(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function T(...e){e=xe(e);let t=`THREE.`+e.shift();if(ye)ye(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function E(...e){e=xe(e);let t=`THREE.`+e.shift();if(ye)ye(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function Se(...e){let t=e.join(` `);t in ve||(ve[t]=!0,T(...e))}var Ce=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},we=`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`.split(`.`),Te=1234567,Ee=Math.PI/180,De=180/Math.PI;function Oe(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(we[e&255]+we[e>>8&255]+we[e>>16&255]+we[e>>24&255]+`-`+we[t&255]+we[t>>8&255]+`-`+we[t>>16&15|64]+we[t>>24&255]+`-`+we[n&63|128]+we[n>>8&255]+`-`+we[n>>16&255]+we[n>>24&255]+we[r&255]+we[r>>8&255]+we[r>>16&255]+we[r>>24&255]).toLowerCase()}function D(e,t,n){return Math.max(t,Math.min(n,e))}function ke(e,t){return(e%t+t)%t}function Ae(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function je(e,t,n){return e===t?0:(n-e)/(t-e)}function Me(e,t,n){return(1-n)*e+n*t}function Ne(e,t,n,r){return Me(e,t,1-Math.exp(-n*r))}function Pe(e,t=1){return t-Math.abs(ke(e,t*2)-t)}function Fe(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Ie(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Le(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Re(e,t){return e+Math.random()*(t-e)}function ze(e){return e*(.5-Math.random())}function Be(e){e!==void 0&&(Te=e);let t=Te+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ve(e){return e*Ee}function He(e){return e*De}function Ue(e){return(e&e-1)==0&&e!==0}function We(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Ge(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Ke(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:T(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function qe(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function Je(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var Ye={DEG2RAD:Ee,RAD2DEG:De,generateUUID:Oe,clamp:D,euclideanModulo:ke,mapLinear:Ae,inverseLerp:je,lerp:Me,damp:Ne,pingpong:Pe,smoothstep:Fe,smootherstep:Ie,randInt:Le,randFloat:Re,randFloatSpread:ze,seededRandom:Be,degToRad:Ve,radToDeg:He,isPowerOfTwo:Ue,ceilPowerOfTwo:We,floorPowerOfTwo:Ge,setQuaternionFromProperEuler:Ke,normalize:Je,denormalize:qe},Xe=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=D(this.x,e.x,t.x),this.y=D(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=D(this.x,e,t),this.y=D(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(D(n,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(D(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ze=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:T(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(D(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},O=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion($e.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion($e.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=D(this.x,e.x,t.x),this.y=D(this.y,e.y,t.y),this.z=D(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=D(this.x,e,t),this.y=D(this.y,e,t),this.z=D(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(D(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Qe.copy(this).projectOnVector(e),this.sub(Qe)}reflect(e){return this.sub(Qe.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(D(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Qe=new O,$e=new Ze,et=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(tt.makeScale(e,t)),this}rotate(e){return this.premultiply(tt.makeRotation(-e)),this}translate(e,t){return this.premultiply(tt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},tt=new et,nt=new et().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),rt=new et().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function it(){let e={enabled:!0,workingColorSpace:oe,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=ot(e.r),e.g=ot(e.g),e.b=ot(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=st(e.r),e.g=st(e.g),e.b=st(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?se:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Se(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Se(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[oe]:{primaries:t,whitePoint:r,transfer:se,toXYZ:nt,fromXYZ:rt,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:w},outputColorSpaceConfig:{drawingBufferColorSpace:w}},[w]:{primaries:t,whitePoint:r,transfer:ce,toXYZ:nt,fromXYZ:rt,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:w}}}),e}var at=it();function ot(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function st(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var ct,lt=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ct===void 0&&(ct=_e(`canvas`)),ct.width=e.width,ct.height=e.height;let t=ct.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=ct}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=_e(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=ot(i[e]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(ot(t[e]/255)*255):t[e]=ot(t[e]);return{data:t,width:e.width,height:e.height}}else return T(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},ut=0,dt=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ut++}),this.uuid=Oe(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(ft(r[t].image)):e.push(ft(r[t]))}else e=ft(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function ft(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?lt.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(T(`Texture: Unable to serialize Texture.`),{})}var pt=0,mt=new O,ht=class e extends Ce{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=u,i=u,a=p,o=m,s=b,c=g,l=e.DEFAULT_ANISOTROPY,d=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:pt++}),this.uuid=Oe(),this.name=``,this.source=new dt(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new Xe(0,0),this.repeat=new Xe(1,1),this.center=new Xe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new et,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(mt).x}get height(){return this.source.getSize(mt).y}get depth(){return this.source.getSize(mt).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){T(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){T(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case l:e.x-=Math.floor(e.x);break;case u:e.x=e.x<0?0:1;break;case d:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case l:e.y-=Math.floor(e.y);break;case u:e.y=e.y<0?0:1;break;case d:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};ht.DEFAULT_IMAGE=null,ht.DEFAULT_MAPPING=300,ht.DEFAULT_ANISOTROPY=1;var gt=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=D(this.x,e.x,t.x),this.y=D(this.y,e.y,t.y),this.z=D(this.z,e.z,t.z),this.w=D(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=D(this.x,e,t),this.y=D(this.y,e,t),this.z=D(this.z,e,t),this.w=D(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(D(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}},_t=class extends Ce{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:p,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t),this.textures=[];let r=new ht({width:e,height:t,depth:n.depth}),i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:p,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new dt(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:`dispose`})}},vt=class extends ht{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=f,this.minFilter=f,this.wrapR=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},yt=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,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 e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,r=1/bt.setFromMatrixColumn(e,0).length(),i=1/bt.setFromMatrixColumn(e,1).length(),a=1/bt.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(St,e,Ct)}lookAt(e,t,n){let r=this.elements;return Et.subVectors(e,t),Et.lengthSq()===0&&(Et.z=1),Et.normalize(),wt.crossVectors(n,Et),wt.lengthSq()===0&&(Math.abs(n.z)===1?Et.x+=1e-4:Et.z+=1e-4,Et.normalize(),wt.crossVectors(n,Et)),wt.normalize(),Tt.crossVectors(Et,wt),r[0]=wt.x,r[4]=Tt.x,r[8]=Et.x,r[1]=wt.y,r[5]=Tt.y,r[9]=Et.y,r[2]=wt.z,r[6]=Tt.z,r[10]=Et.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],ee=r[12],te=r[1],ne=r[5],re=r[9],ie=r[13],ae=r[2],w=r[6],oe=r[10],se=r[14],ce=r[3],le=r[7],ue=r[11],de=r[15];return i[0]=a*x+o*te+s*ae+c*ce,i[4]=a*S+o*ne+s*w+c*le,i[8]=a*C+o*re+s*oe+c*ue,i[12]=a*ee+o*ie+s*se+c*de,i[1]=l*x+u*te+d*ae+f*ce,i[5]=l*S+u*ne+d*w+f*le,i[9]=l*C+u*re+d*oe+f*ue,i[13]=l*ee+u*ie+d*se+f*de,i[2]=p*x+m*te+h*ae+g*ce,i[6]=p*S+m*ne+h*w+g*le,i[10]=p*C+m*re+h*oe+g*ue,i[14]=p*ee+m*ie+h*se+g*de,i[3]=_*x+v*te+y*ae+b*ce,i[7]=_*S+v*ne+y*w+b*le,i[11]=_*C+v*re+y*oe+b*ue,i[15]=_*ee+v*ie+y*se+b*de,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,ee=l*h-d*p,te=l*g-f*p,ne=u*h-d*m,re=u*g-f*m,ie=d*g-f*h,ae=_*ie-v*re+y*ne+b*te-x*ee+S*C;if(ae===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/ae;return e[0]=(o*ie-s*re+c*ne)*w,e[1]=(r*re-n*ie-i*ne)*w,e[2]=(m*S-h*x+g*b)*w,e[3]=(d*x-u*S-f*b)*w,e[4]=(s*te-a*ie-c*ee)*w,e[5]=(t*ie-r*te+i*ee)*w,e[6]=(h*y-p*S-g*v)*w,e[7]=(l*S-d*y+f*v)*w,e[8]=(a*re-o*te+c*C)*w,e[9]=(n*te-t*re-i*C)*w,e[10]=(p*x-m*y+g*_)*w,e[11]=(u*y-l*x-f*_)*w,e[12]=(o*ee-a*ne-s*C)*w,e[13]=(t*ne-n*ee+r*C)*w,e[14]=(m*v-p*b-h*_)*w,e[15]=(l*b-u*v+d*_)*w,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinant();if(i===0)return n.set(1,1,1),t.identity(),this;let a=bt.set(r[0],r[1],r[2]).length(),o=bt.set(r[4],r[5],r[6]).length(),s=bt.set(r[8],r[9],r[10]).length();i<0&&(a=-a),xt.copy(this);let c=1/a,l=1/o,u=1/s;return xt.elements[0]*=c,xt.elements[1]*=c,xt.elements[2]*=c,xt.elements[4]*=l,xt.elements[5]*=l,xt.elements[6]*=l,xt.elements[8]*=u,xt.elements[9]*=u,xt.elements[10]*=u,t.setFromRotationMatrix(xt),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=fe,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=fe,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},bt=new O,xt=new yt,St=new O(0,0,0),Ct=new O(1,1,1),wt=new O,Tt=new O,Et=new O,Dt=new yt,Ot=new Ze,kt=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(D(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-D(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(D(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-D(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(D(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-D(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:T(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Dt.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Dt,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ot.setFromEuler(this),this.setFromQuaternion(Ot,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};kt.DEFAULT_ORDER=`XYZ`;var At=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},jt=0,Mt=new O,Nt=new Ze,Pt=new yt,Ft=new O,It=new O,Lt=new O,Rt=new Ze,zt=new O(1,0,0),Bt=new O(0,1,0),Vt=new O(0,0,1),Ht={type:`added`},Ut={type:`removed`},Wt={type:`childadded`,child:null},Gt={type:`childremoved`,child:null},Kt=class e extends Ce{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jt++}),this.uuid=Oe(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new O,n=new kt,r=new Ze,i=new O(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new yt},normalMatrix:{value:new et}}),this.matrix=new yt,this.matrixWorld=new yt,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.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.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Nt.setFromAxisAngle(e,t),this.quaternion.multiply(Nt),this}rotateOnWorldAxis(e,t){return Nt.setFromAxisAngle(e,t),this.quaternion.premultiply(Nt),this}rotateX(e){return this.rotateOnAxis(zt,e)}rotateY(e){return this.rotateOnAxis(Bt,e)}rotateZ(e){return this.rotateOnAxis(Vt,e)}translateOnAxis(e,t){return Mt.copy(e).applyQuaternion(this.quaternion),this.position.add(Mt.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(zt,e)}translateY(e){return this.translateOnAxis(Bt,e)}translateZ(e){return this.translateOnAxis(Vt,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Pt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ft.copy(e):Ft.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),It.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Pt.lookAt(It,Ft,this.up):Pt.lookAt(Ft,It,this.up),this.quaternion.setFromRotationMatrix(Pt),r&&(Pt.extractRotation(r.matrixWorld),Nt.setFromRotationMatrix(Pt),this.quaternion.premultiply(Nt.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(E(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ht),Wt.child=e,this.dispatchEvent(Wt),Wt.child=null):E(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ut),Gt.child=e,this.dispatchEvent(Gt),Gt.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Pt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Pt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Pt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ht),Wt.child=e,this.dispatchEvent(Wt),Wt.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(It,e,Lt),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(It,Rt,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>o(o({},e),{},{boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>o({},e)),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};Kt.DEFAULT_UP=new O(0,1,0),Kt.DEFAULT_MATRIX_AUTO_UPDATE=!0,Kt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var qt=class extends Kt{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Jt={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},Yt={h:0,s:0,l:0},Xt={h:0,s:0,l:0};function Zt(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Qt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=w){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,at.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=at.workingColorSpace){return this.r=e,this.g=t,this.b=n,at.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=at.workingColorSpace){if(e=ke(e,1),t=D(t,0,1),n=D(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Zt(i,r,e+1/3),this.g=Zt(i,r,e),this.b=Zt(i,r,e-1/3)}return at.colorSpaceToWorking(this,r),this}setStyle(e,t=w){function n(t){t!==void 0&&parseFloat(t)<1&&T(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:T(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);T(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=w){let n=Jt[e.toLowerCase()];return n===void 0?T(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ot(e.r),this.g=ot(e.g),this.b=ot(e.b),this}copyLinearToSRGB(e){return this.r=st(e.r),this.g=st(e.g),this.b=st(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=w){return at.workingToColorSpace($t.copy(this),e),Math.round(D($t.r*255,0,255))*65536+Math.round(D($t.g*255,0,255))*256+Math.round(D($t.b*255,0,255))}getHexString(e=w){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=at.workingColorSpace){at.workingToColorSpace($t.copy(this),t);let n=$t.r,r=$t.g,i=$t.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4;break}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=at.workingColorSpace){return at.workingToColorSpace($t.copy(this),t),e.r=$t.r,e.g=$t.g,e.b=$t.b,e}getStyle(e=w){at.workingToColorSpace($t.copy(this),e);let t=$t.r,n=$t.g,r=$t.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Yt),this.setHSL(Yt.h+e,Yt.s+t,Yt.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Yt),e.getHSL(Xt);let n=Me(Yt.h,Xt.h,t),r=Me(Yt.s,Xt.s,t),i=Me(Yt.l,Xt.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},$t=new Qt;Qt.NAMES=Jt;var en=new O,tn=new O,nn=new O,rn=new O,an=new O,on=new O,sn=new O,cn=new O,ln=new O,un=new O,dn=new gt,fn=new gt,pn=new gt,mn=class e{constructor(e=new O,t=new O,n=new O){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),en.subVectors(e,t),r.cross(en);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){en.subVectors(r,t),tn.subVectors(n,t),nn.subVectors(e,t);let a=en.dot(en),o=en.dot(tn),s=en.dot(nn),c=tn.dot(tn),l=tn.dot(nn),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,rn)===null?!1:rn.x>=0&&rn.y>=0&&rn.x+rn.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,rn)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,rn.x),s.addScaledVector(a,rn.y),s.addScaledVector(o,rn.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return dn.setScalar(0),fn.setScalar(0),pn.setScalar(0),dn.fromBufferAttribute(e,t),fn.fromBufferAttribute(e,n),pn.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(dn,i.x),a.addScaledVector(fn,i.y),a.addScaledVector(pn,i.z),a}static isFrontFacing(e,t,n,r){return en.subVectors(n,t),tn.subVectors(e,t),en.cross(tn).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return en.subVectors(this.c,this.b),tn.subVectors(this.a,this.b),en.cross(tn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;an.subVectors(r,n),on.subVectors(i,n),cn.subVectors(e,n);let s=an.dot(cn),c=on.dot(cn);if(s<=0&&c<=0)return t.copy(n);ln.subVectors(e,r);let l=an.dot(ln),u=on.dot(ln);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(an,a);un.subVectors(e,i);let f=an.dot(un),p=on.dot(un);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(on,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return sn.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(sn,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(an,a).addScaledVector(on,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},hn=class{constructor(e=new O(1/0,1/0,1/0),t=new O(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(_n.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(_n.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=_n.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,_n):_n.fromBufferAttribute(r,t),_n.applyMatrix4(e.matrixWorld),this.expandByPoint(_n);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),vn.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),vn.copy(e.boundingBox)),vn.applyMatrix4(e.matrixWorld),this.union(vn)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,_n),_n.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Tn),En.subVectors(this.max,Tn),yn.subVectors(e.a,Tn),bn.subVectors(e.b,Tn),xn.subVectors(e.c,Tn),Sn.subVectors(bn,yn),Cn.subVectors(xn,bn),wn.subVectors(yn,xn);let t=[0,-Sn.z,Sn.y,0,-Cn.z,Cn.y,0,-wn.z,wn.y,Sn.z,0,-Sn.x,Cn.z,0,-Cn.x,wn.z,0,-wn.x,-Sn.y,Sn.x,0,-Cn.y,Cn.x,0,-wn.y,wn.x,0];return!kn(t,yn,bn,xn,En)||(t=[1,0,0,0,1,0,0,0,1],!kn(t,yn,bn,xn,En))?!1:(Dn.crossVectors(Sn,Cn),t=[Dn.x,Dn.y,Dn.z],kn(t,yn,bn,xn,En))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,_n).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(_n).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(gn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),gn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),gn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),gn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),gn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),gn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),gn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),gn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(gn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},gn=[new O,new O,new O,new O,new O,new O,new O,new O],_n=new O,vn=new hn,yn=new O,bn=new O,xn=new O,Sn=new O,Cn=new O,wn=new O,Tn=new O,En=new O,Dn=new O,On=new O;function kn(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){On.fromArray(e,a);let o=i.x*Math.abs(On.x)+i.y*Math.abs(On.y)+i.z*Math.abs(On.z),s=t.dot(On),c=n.dot(On),l=r.dot(On);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var An=new O,jn=new Xe,Mn=0,Nn=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Mn++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=ue,this.updateRanges=[],this.gpuType=v,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)jn.fromBufferAttribute(this,t),jn.applyMatrix3(e),this.setXY(t,jn.x,jn.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.applyMatrix3(e),this.setXYZ(t,An.x,An.y,An.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.applyMatrix4(e),this.setXYZ(t,An.x,An.y,An.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.applyNormalMatrix(e),this.setXYZ(t,An.x,An.y,An.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.transformDirection(e),this.setXYZ(t,An.x,An.y,An.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=qe(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=qe(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=qe(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=qe(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=qe(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),r=Je(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),r=Je(r,this.array),i=Je(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}},Pn=class extends Nn{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Fn=class extends Nn{constructor(e,t,n){super(new Uint32Array(e),t,n)}},In=class extends Nn{constructor(e,t,n){super(new Float32Array(e),t,n)}},Ln=new hn,Rn=new O,zn=new O,Bn=class{constructor(e=new O,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Ln.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Rn.subVectors(e,this.center);let t=Rn.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Rn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(zn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Rn.copy(e.center).add(zn)),this.expandByPoint(Rn.copy(e.center).sub(zn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Vn=0,Hn=new yt,Un=new Kt,Wn=new O,Gn=new hn,Kn=new hn,qn=new O,Jn=class e extends Ce{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Vn++}),this.uuid=Oe(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,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(e){return Array.isArray(e)?this.index=new(he(e)?Fn:Pn)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new et().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Hn.makeRotationFromQuaternion(e),this.applyMatrix4(Hn),this}rotateX(e){return Hn.makeRotationX(e),this.applyMatrix4(Hn),this}rotateY(e){return Hn.makeRotationY(e),this.applyMatrix4(Hn),this}rotateZ(e){return Hn.makeRotationZ(e),this.applyMatrix4(Hn),this}translate(e,t,n){return Hn.makeTranslation(e,t,n),this.applyMatrix4(Hn),this}scale(e,t,n){return Hn.makeScale(e,t,n),this.applyMatrix4(Hn),this}lookAt(e){return Un.lookAt(e),Un.updateMatrix(),this.applyMatrix4(Un.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wn).negate(),this.translate(Wn.x,Wn.y,Wn.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new In(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&T(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){E(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new O(-1/0,-1/0,-1/0),new O(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Gn.setFromBufferAttribute(n),this.morphTargetsRelative?(qn.addVectors(this.boundingBox.min,Gn.min),this.boundingBox.expandByPoint(qn),qn.addVectors(this.boundingBox.max,Gn.max),this.boundingBox.expandByPoint(qn)):(this.boundingBox.expandByPoint(Gn.min),this.boundingBox.expandByPoint(Gn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&E(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Bn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){E(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new O,1/0);return}if(e){let n=this.boundingSphere.center;if(Gn.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Kn.setFromBufferAttribute(n),this.morphTargetsRelative?(qn.addVectors(Gn.min,Kn.min),Gn.expandByPoint(qn),qn.addVectors(Gn.max,Kn.max),Gn.expandByPoint(qn)):(Gn.expandByPoint(Kn.min),Gn.expandByPoint(Kn.max))}Gn.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)qn.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(qn));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)qn.fromBufferAttribute(a,t),o&&(Wn.fromBufferAttribute(e,t),qn.add(Wn)),r=Math.max(r,n.distanceToSquared(qn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&E(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){E(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv;this.hasAttribute(`tangent`)===!1&&this.setAttribute(`tangent`,new Nn(new Float32Array(4*n.count),4));let a=this.getAttribute(`tangent`),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new O,s[e]=new O;let c=new O,l=new O,u=new O,d=new Xe,f=new Xe,p=new Xe,m=new O,h=new O;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new O,y=new O,b=new O,x=new O;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0)n=new Nn(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new O,i=new O,a=new O,o=new O,s=new O,c=new O,l=new O,u=new O;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)qn.fromBufferAttribute(e,t),qn.normalize(),e.setXYZ(t,qn.x,qn.y,qn.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new Nn(a,r,i)}if(this.index===null)return T(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:`dispose`})}},Yn=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=ue,this.updateRanges=[],this.version=0,this.uuid=Oe()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Oe()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Oe()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Xn=new O,Zn=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Xn.fromBufferAttribute(this,t),Xn.applyMatrix4(e),this.setXYZ(t,Xn.x,Xn.y,Xn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Xn.fromBufferAttribute(this,t),Xn.applyNormalMatrix(e),this.setXYZ(t,Xn.x,Xn.y,Xn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Xn.fromBufferAttribute(this,t),Xn.transformDirection(e),this.setXYZ(t,Xn.x,Xn.y,Xn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=qe(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=qe(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=qe(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=qe(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=qe(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),r=Je(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),r=Je(r,this.array),i=Je(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){be(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new Nn(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){be(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Qn=0,$n=class extends Ce{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Qn++}),this.uuid=Oe(),this.name=``,this.type=`Material`,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 Qt(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=le,this.stencilZFail=le,this.stencilZPass=le,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.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){T(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){T(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},er=new O,tr=new O,nr=new O,rr=new O,ir=new O,ar=new O,or=new O,sr=class{constructor(e=new O,t=new O(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,er)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=er.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(er.copy(this.origin).addScaledVector(this.direction,t),er.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){tr.copy(e).add(t).multiplyScalar(.5),nr.copy(t).sub(e).normalize(),rr.copy(this.origin).sub(tr);let i=e.distanceTo(t)*.5,a=-this.direction.dot(nr),o=rr.dot(this.direction),s=-rr.dot(nr),c=rr.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(tr).addScaledVector(nr,d),f}intersectSphere(e,t){er.subVectors(e.center,this.origin);let n=er.dot(this.direction),r=er.dot(er)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,er)!==null}intersectTriangle(e,t,n,r,i){ir.subVectors(t,e),ar.subVectors(n,e),or.crossVectors(ir,ar);let a=this.direction.dot(or),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;rr.subVectors(this.origin,e);let s=o*this.direction.dot(ar.crossVectors(rr,ar));if(s<0)return null;let c=o*this.direction.dot(ir.cross(rr));if(c<0||s+c>a)return null;let l=-o*rr.dot(or);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},cr=class extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Qt(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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},lr=new yt,ur=new sr,dr=new Bn,fr=new O,pr=new O,mr=new O,hr=new O,gr=new O,_r=new O,vr=new O,yr=new O,br=class extends Kt{constructor(e=new Jn,t=new cr){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){_r.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(gr.fromBufferAttribute(s,e),a?_r.addScaledVector(gr,r):_r.addScaledVector(gr.sub(t),r))}t.add(_r)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),dr.copy(n.boundingSphere),dr.applyMatrix4(i),ur.copy(e.ray).recast(e.near),!(dr.containsPoint(ur.origin)===!1&&(ur.intersectSphere(dr,fr)===null||ur.origin.distanceToSquared(fr)>Math.pow(e.far-e.near,2)))&&(lr.copy(i).invert(),ur.copy(e.ray).applyMatrix4(lr),!(n.boundingBox!==null&&ur.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ur)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Sr(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Sr(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}else if(s!==void 0)if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Sr(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Sr(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}};function xr(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;yr.copy(s),yr.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(yr);return l<n.near||l>n.far?null:{distance:l,point:yr.clone(),object:e}}function Sr(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,pr),e.getVertexPosition(c,mr),e.getVertexPosition(l,hr);let u=xr(e,t,n,r,pr,mr,hr,vr);if(u){let e=new O;mn.getBarycoord(vr,pr,mr,hr,e),i&&(u.uv=mn.getInterpolatedAttribute(i,s,c,l,e,new Xe)),a&&(u.uv1=mn.getInterpolatedAttribute(a,s,c,l,e,new Xe)),o&&(u.normal=mn.getInterpolatedAttribute(o,s,c,l,e,new O),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new O,materialIndex:0};mn.getNormal(pr,mr,hr,t.normal),u.face=t,u.barycoord=e}return u}var Cr=class extends ht{constructor(e=null,t=1,n=1,r,i,a,o,s,c=f,l=f,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},wr=class extends Nn{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Tr=new O,Er=new O,Dr=new et,Or=class{constructor(e=new O(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Tr.subVectors(n,t).cross(Er.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let n=e.delta(Tr),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Dr.getNormalMatrix(e),r=this.coplanarPoint(Tr).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},kr=class extends ht{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=f,this.minFilter=f,this.generateMipmaps=!1,this.needsUpdate=!0}},Ar=class extends ht{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},jr=class extends ht{constructor(e,t,n=_,r,i,a,o=f,s=f,c,l=x,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new dt(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Mr=class extends jr{constructor(e,t=_,n=301,r,i,a=f,o=f,s,c=x){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Nr=class e extends Jn{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new In(c,3)),this.setAttribute(`normal`,new In(l,3)),this.setAttribute(`uv`,new In(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,ee=g+1,te=0,ne=0,re=new O;for(let a=0;a<ee;a++){let o=a*y-x;for(let s=0;s<C;s++)re[e]=(s*v-b)*r,re[t]=o*i,re[n]=S,c.push(re.x,re.y,re.z),re[e]=0,re[t]=0,re[n]=m>0?1:-1,l.push(re.x,re.y,re.z),u.push(s/h),u.push(1-a/g),te+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),ne+=6}o.addGroup(f,ne,_),f+=ne,d+=te}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},Pr=class e extends Jn{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new In(u,3)),this.setAttribute(`normal`,new In(d,3)),this.setAttribute(`uv`,new In(f,2));function _(){let a=new O,_=new O,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new Xe,m=new O,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Fr=class e extends Jn{constructor(e=[new Xe(0,-.5),new Xe(.5,0),new Xe(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=D(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new O,d=new Xe,f=new O,p=new O,m=new O,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new In(a,3)),this.setAttribute(`uv`,new In(o,2)),this.setAttribute(`normal`,new In(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},Ir=class e extends Jn{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new In(p,3)),this.setAttribute(`normal`,new In(m,3)),this.setAttribute(`uv`,new In(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},Lr=class e extends Jn{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new O,d=new O,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=0;f===0&&a===0?v=.5/t:f===n&&s===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){let s=n/t;u.x=-e*Math.cos(r+s*i)*Math.sin(a+_*o),u.y=e*Math.cos(a+_*o),u.z=e*Math.sin(r+s*i)*Math.sin(a+_*o),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(s+v,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new In(p,3)),this.setAttribute(`normal`,new In(m,3)),this.setAttribute(`uv`,new In(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}};function Rr(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}var zr=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`call to abstract method`)}intervalChanged_(){}},Br=class extends zr{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:re,endingEnd:re}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case ie:i=e,o=2*t-n;break;case ae:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case ie:a=e,s=2*n-t;break;case ae:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},Vr=class extends zr{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},Hr=class extends zr{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Ur=class extends zr{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.settings||this.DefaultSettings_,u=l.inTangents,d=l.outTangents;if(!u||!d){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let f=o*2,p=e-1;for(let l=0;l!==o;++l){let o=a[c+l],m=a[s+l],h=p*f+l*2,g=d[h],_=d[h+1],v=e*f+l*2,y=u[v],b=u[v+1],x=(n-t)/(r-t),S,C,ee,te,ne;for(let e=0;e<8;e++){S=x*x,C=S*x,ee=1-x,te=ee*ee,ne=te*ee;let e=ne*t+3*te*x*g+3*ee*S*y+C*r-n;if(Math.abs(e)<1e-10)break;let i=3*te*(g-t)+6*ee*x*(y-g)+3*S*(r-y);if(Math.abs(i)<1e-10)break;x-=e/i,x=Math.max(0,Math.min(1,x))}i[l]=ne*o+3*te*x*_+3*ee*S*b+C*m}return i}},Wr=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=Rr(t,this.TimeBufferType),this.values=Rr(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Rr(e.times,Array),values:Rr(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Hr(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Vr(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Br(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Ur(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case C:t=this.InterpolantFactoryMethodDiscrete;break;case ee:t=this.InterpolantFactoryMethodLinear;break;case te:t=this.InterpolantFactoryMethodSmooth;break;case ne:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return T(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return C;case this.InterpolantFactoryMethodLinear:return ee;case this.InterpolantFactoryMethodSmooth:return te;case this.InterpolantFactoryMethodBezier:return ne}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(E(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(E(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){E(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){E(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&ge(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){E(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===te,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0]))if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Wr.prototype.ValueTypeName=``,Wr.prototype.TimeBufferType=Float32Array,Wr.prototype.ValueBufferType=Float32Array,Wr.prototype.DefaultInterpolation=ee;var Gr=class extends Wr{constructor(e,t,n){super(e,t,n)}};Gr.prototype.ValueTypeName=`bool`,Gr.prototype.ValueBufferType=Array,Gr.prototype.DefaultInterpolation=C,Gr.prototype.InterpolantFactoryMethodLinear=void 0,Gr.prototype.InterpolantFactoryMethodSmooth=void 0;var Kr=class extends Wr{constructor(e,t,n,r){super(e,t,n,r)}};Kr.prototype.ValueTypeName=`color`;var qr=class extends Wr{constructor(e,t,n,r){super(e,t,n,r)}};qr.prototype.ValueTypeName=`number`;var Jr=class extends zr{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Ze.slerpFlat(i,0,a,c-o,a,c,s);return i}},Yr=class extends Wr{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new Jr(this.times,this.values,this.getValueSize(),e)}};Yr.prototype.ValueTypeName=`quaternion`,Yr.prototype.InterpolantFactoryMethodSmooth=void 0;var Xr=class extends Wr{constructor(e,t,n){super(e,t,n)}};Xr.prototype.ValueTypeName=`string`,Xr.prototype.ValueBufferType=Array,Xr.prototype.DefaultInterpolation=C,Xr.prototype.InterpolantFactoryMethodLinear=void 0,Xr.prototype.InterpolantFactoryMethodSmooth=void 0;var Zr=class extends Wr{constructor(e,t,n,r){super(e,t,n,r)}};Zr.prototype.ValueTypeName=`vector`;var Qr=new class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},$r=class{constructor(e){this.manager=e===void 0?Qr:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};$r.DEFAULT_MATERIAL_NAME=`__DEFAULT`;var ei=new O,ti=new Ze,ni=new O,ri=class extends Kt{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new yt,this.projectionMatrix=new yt,this.projectionMatrixInverse=new yt,this.coordinateSystem=fe,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(ei,ti,ni),ni.x===1&&ni.y===1&&ni.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ei,ti,ni.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(ei,ti,ni),ni.x===1&&ni.y===1&&ni.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ei,ti,ni.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ii=new O,ai=new Xe,oi=new Xe,si=class extends ri{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=De*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ee*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return De*2*Math.atan(Math.tan(Ee*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ii.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ii.x,ii.y).multiplyScalar(-e/ii.z),ii.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ii.x,ii.y).multiplyScalar(-e/ii.z)}getViewSize(e,t){return this.getViewBounds(e,ai,oi),t.subVectors(oi,ai)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ee*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},ci=class extends ri{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},li=class extends Jn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},ui=`\\[\\]\\.:\\/`,di=RegExp(`[\\[\\]\\.:\\/]`,`g`),fi=`[^\\[\\]\\.:\\/]`,pi=`[^`+ui.replace(`\\.`,``)+`]`,mi=`((?:WC+[\\/:])*)`.replace(`WC`,fi),hi=`(WCOD+)?`.replace(`WCOD`,pi),gi=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,fi),_i=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,fi),vi=RegExp(`^`+mi+hi+gi+_i+`$`),yi=[`material`,`materials`,`bones`,`map`],bi=class{constructor(e,t,n){let r=n||xi.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},xi=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(di,``)}static parseTrackName(e){let t=vi.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);yi.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){T(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){E(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){E(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){E(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){E(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){E(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){E(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){E(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;E(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){E(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){E(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};xi.Composite=bi,xi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},xi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},xi.prototype.GetterByBindingType=[xi.prototype._getValue_direct,xi.prototype._getValue_array,xi.prototype._getValue_arrayElement,xi.prototype._getValue_toArray],xi.prototype.SetterByBindingTypeAndVersioning=[[xi.prototype._setValue_direct,xi.prototype._setValue_direct_setNeedsUpdate,xi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xi.prototype._setValue_array,xi.prototype._setValue_array_setNeedsUpdate,xi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xi.prototype._setValue_arrayElement,xi.prototype._setValue_arrayElement_setNeedsUpdate,xi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xi.prototype._setValue_fromArray,xi.prototype._setValue_fromArray_setNeedsUpdate,xi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Si=class extends Yn{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}},Ci=class e{constructor(t,n,r,i){e.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,n,r,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}};typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`183`}})),typeof window<`u`&&(window.__THREE__?T(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`183`);var wi=`alphaMap.alphaTest.anisotropy.anisotropyMap.anisotropyRotation.aoMap.aoMapIntensity.attenuationColor.attenuationDistance.bumpMap.clearcoat.clearcoatMap.clearcoatNormalMap.clearcoatNormalScale.clearcoatRoughness.color.dispersion.displacementMap.emissive.emissiveIntensity.emissiveMap.envMap.envMapIntensity.gradientMap.ior.iridescence.iridescenceIOR.iridescenceMap.iridescenceThicknessMap.lightMap.lightMapIntensity.map.matcap.metalness.metalnessMap.normalMap.normalScale.opacity.roughness.roughnessMap.sheen.sheenColor.sheenColorMap.sheenRoughnessMap.shininess.specular.specularColor.specularColorMap.specularIntensity.specularIntensityMap.specularMap.thickness.transmission.transmissionMap`.split(`.`),Ti=new WeakMap,Ei=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=wi,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has(`velocity`)}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,material:r,object:i}=e;if(t={material:this.getMaterialData(r),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexId:n.index?n.index.id:null,indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:i.matrixWorld.clone()},i.center&&(t.center=i.center.clone()),i.morphTargetInfluences&&(t.morphTargetInfluences=i.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){let{width:n,height:r}=e.context;t.bufferWidth=n,t.bufferHeight=r}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.id,version:r.version}}return t}containsNode(e){let t=e.material;for(let e in t)if(t[e]&&t[e].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getMaterialData(e){let t={};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r==`object`&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r)}return t}equals(e,t){let{object:n,material:r,geometry:i}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(n.matrixWorld)!==!0)return a.worldMatrix.copy(n.matrixWorld),!1;let o=a.material;for(let e in o){let t=o[e],n=r[e];if(t.equals!==void 0){if(t.equals(n)===!1)return t.copy(n),!1}else if(n.isTexture===!0){if(t.id!==n.id||t.version!==n.version)return t.id=n.id,t.version=n.version,!1}else if(t!==n)return o[e]=n,!1}if(o.transmission>0){let{width:t,height:n}=e.context;if(a.bufferWidth!==t||a.bufferHeight!==n)return a.bufferWidth=t,a.bufferHeight=n,!1}let s=a.geometry,c=i.attributes,l=s.attributes,u=Object.keys(l),d=Object.keys(c);if(s.id!==i.id)return s.id=i.id,!1;if(u.length!==d.length)return a.geometry.attributes=this.getAttributesData(c),!1;for(let e of u){let t=l[e],n=c[e];if(n===void 0)return delete l[e],!1;if(t.id!==n.id||t.version!==n.version)return t.id=n.id,t.version=n.version,!1}let f=i.index,p=s.indexId,m=s.indexVersion,h=f?f.id:null,g=f?f.version:null;if(p!==h||m!==g)return s.indexId=h,s.indexVersion=g,!1;if(s.drawRange.start!==i.drawRange.start||s.drawRange.count!==i.drawRange.count)return s.drawRange.start=i.drawRange.start,s.drawRange.count=i.drawRange.count,!1;if(a.morphTargetInfluences){let e=!1;for(let t=0;t<a.morphTargetInfluences.length;t++)a.morphTargetInfluences[t]!==n.morphTargetInfluences[t]&&(a.morphTargetInfluences[t]=n.morphTargetInfluences[t],e=!0);if(e)return!1}if(a.lights){for(let e=0;e<t.length;e++)if(a.lights[e].map!==t[e].map)return!1}return a.center&&a.center.equals(n.center)===!1?(a.center.copy(n.center),!0):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e){let t=[];for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){if(Ti.has(e)){let n=Ti.get(e);if(n.renderId===t)return n.lightsData}let n=this.getLightsData(e.getLights());return Ti.set(e,{renderId:t,lightsData:n}),n}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,i=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||i)return!1;let a=this.getLights(e.lightsNode,n);return this.equals(e,a)!==!0}},Di=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function Oi(e){let t=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return e.split(`
|
|
256
|
+
`).map(e=>{let n=e.match(t);if(!n)return null;let r=n[1]||n[2]||``,i=n[3].split(`?`)[0],a=parseInt(n[4],10),o=parseInt(n[5],10);return{fn:r,file:i.split(`/`).pop(),line:a,column:o}}).filter(e=>e&&!Di.some(t=>t.test(e.file)))}var ki=class{constructor(e=null){this.isStackTrace=!0,this.stack=Oi(e||Error().stack)}getLocation(){if(this.stack.length===0)return`[Unknown location]`;let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:``}"${e.file}:${e.line}"`}getError(e){return this.stack.length===0?e:`${e}\n${this.stack.map(e=>{let t=`${e.file}:${e.line}:${e.column}`;return e.fn?` at ${e.fn} (${t})`:` at ${t}`}).join(`
|
|
257
|
+
`)}`}};function Ai(e,t=0){let n=3735928559^t,r=1103547991^t;if(e instanceof Array)for(let t=0,i;t<e.length;t++)i=e[t],n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);else for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}var ji=e=>Ai(e),Mi=e=>Ai(e),Ni=(...e)=>Ai(e),Pi=new Map([[1,`float`],[2,`vec2`],[3,`vec3`],[4,`vec4`],[9,`mat3`],[16,`mat4`]]),Fi=new WeakMap;function Ii(e){return Pi.get(e)}function Li(e){if(/[iu]?vec\d/.test(e))return e.startsWith(`ivec`)?Int32Array:e.startsWith(`uvec`)?Uint32Array:Float32Array;if(/mat\d/.test(e)||/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function Ri(e){if(/float|int|uint/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 9;if(/mat4/.test(e))return 16;E(`TSL: Unsupported type: ${e}`,new ki)}function zi(e){if(/float|int|uint/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 12;if(/mat4/.test(e))return 16;E(`TSL: Unsupported type: ${e}`,new ki)}function Bi(e){if(/float|int|uint/.test(e))return 4;if(/vec2/.test(e))return 8;if(/vec3/.test(e)||/vec4/.test(e))return 16;if(/mat2/.test(e))return 8;if(/mat3/.test(e)||/mat4/.test(e))return 16;E(`TSL: Unsupported type: ${e}`,new ki)}function Vi(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?`node`:t===`number`?`float`:t===`boolean`?`bool`:t===`string`?`string`:t===`function`?`shader`:e.isVector2===!0?`vec2`:e.isVector3===!0?`vec3`:e.isVector4===!0?`vec4`:e.isMatrix2===!0?`mat2`:e.isMatrix3===!0?`mat3`:e.isMatrix4===!0?`mat4`:e.isColor===!0?`color`:e instanceof ArrayBuffer?`ArrayBuffer`:null}function Hi(e,...t){let n=e?e.slice(-4):void 0;return t.length===1&&(n===`vec2`?t=[t[0],t[0]]:n===`vec3`?t=[t[0],t[0],t[0]]:n===`vec4`&&(t=[t[0],t[0],t[0],t[0]])),e===`color`?new Qt(...t):n===`vec2`?new Xe(...t):n===`vec3`?new O(...t):n===`vec4`?new gt(...t):n===`mat2`?new Ci(...t):n===`mat3`?new et(...t):n===`mat4`?new yt(...t):e===`bool`?t[0]||!1:e===`float`||e===`int`||e===`uint`?t[0]||0:e===`string`?t[0]||``:e===`ArrayBuffer`?Gi(t[0]):null}function Ui(e){let t=Fi.get(e);return t===void 0&&(t={},Fi.set(e,t)),t}function Wi(e){let t=``,n=new Uint8Array(e);for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function Gi(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0)).buffer}var Ki={VERTEX:`vertex`,FRAGMENT:`fragment`},k={NONE:`none`,FRAME:`frame`,RENDER:`render`,OBJECT:`object`},qi={BOOLEAN:`bool`,INTEGER:`int`,FLOAT:`float`,VECTOR2:`vec2`,VECTOR3:`vec3`,VECTOR4:`vec4`,MATRIX2:`mat2`,MATRIX3:`mat3`,MATRIX4:`mat4`},Ji={READ_ONLY:`readOnly`,WRITE_ONLY:`writeOnly`,READ_WRITE:`readWrite`},Yi=[`fragment`,`vertex`],Xi=[`setup`,`analyze`,`generate`],Zi=[...Yi,`compute`],Qi=[`x`,`y`,`z`,`w`],$i={analyze:`setup`,generate:`analyze`},ea=0,A=class e extends Ce{static get type(){return`Node`}constructor(t=null){super(),this.nodeType=t,this.updateType=k.NONE,this.updateBeforeType=k.NONE,this.updateAfterType=k.NONE,this.uuid=Ye.generateUUID(),this.version=0,this.name=``,this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:ea++}),this.stackTrace=null,e.captureStackTrace===!0&&(this.stackTrace=new ki)}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,k.FRAME)}onRenderUpdate(e){return this.onUpdate(e,k.RENDER)}onObjectUpdate(e){return this.onUpdate(e,k.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:`dispose`})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith(`_`)===!0||e.has(r))){if(Array.isArray(r)===!0)for(let e=0;e<r.length;e++){let i=r[e];i&&i.isNode===!0&&t.push({property:n,index:e,childNode:i})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let e in r){if(e.startsWith(`_`)===!0)continue;let i=r[e];i&&i.isNode===!0&&t.push({property:n,index:e,childNode:i})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:i}of this._getChildren(t))n.push(ji(r.slice(0,-4)),i.getCacheKey(e,t));this._cacheKey=Ni(Mi(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return`void`}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e);return e.getNodeFromHash(t)||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let e of this.getChildren())t[`node`+n++]=e;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let n=e.getDataFromNode(this,`any`);n.stages=n.stages||{},n.stages[e.shaderStage]=n.stages[e.shaderStage]||[],n.stages[e.shaderStage].push(t)}if(n===1){let t=e.getNodeProperties(this);for(let n of Object.values(t))n&&n.isNode===!0&&n.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){T(`Abstract function.`)}updateAfter(){T(`Abstract function.`)}update(){T(`Abstract function.`)}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let n=this._beforeNodes;this._beforeNodes=null;for(let r of n)r.build(e,t);this._beforeNodes=n}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let i=$i[e.buildStage];if(i&&r.buildStages[i]!==!0){let t=e.getBuildStage();e.setBuildStage(i),this.build(e),e.setBuildStage(t)}e.addChain(this);let a=null,o=e.getBuildStage();if(o===`setup`){e.addNode(this),this.updateReference(e);let t=e.getNodeProperties(this);if(t.initialized!==!0){t.initialized=!0,t.outputNode=this.setup(e)||t.outputNode||null;for(let n of Object.values(t))if(n&&n.isNode===!0){if(n.parents===!0){let t=e.getNodeProperties(n);t.parents=t.parents||[],t.parents.push(this)}n.build(e)}e.addSequentialNode(this)}a=t.outputNode}else if(o===`analyze`)this.analyze(e,t);else if(o===`generate`){if(this.generate.length<2){let n=this.getNodeType(e),r=e.getDataFromNode(this);a=r.snippet,a===void 0?r.generated===void 0?(r.generated=!0,a=this.generate(e)||``,r.snippet=a):(T(`Node: Recursion detected.`,this),a=`/* Recursion detected. */`):r.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),a=e.format(a,n,t)}else a=this.generate(e,t)||``;a===``&&t!==null&&t!==`void`&&t!==`OutputType`&&(E(`TSL: Invalid generated code, expected a "${t}".`),a=e.generateConst(t))}return e.removeChain(this),a}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:i,childNode:a}of t)i===void 0?n[r]=a.toJSON(e.meta).uuid:(n[r]===void 0&&(n[r]=Number.isInteger(i)?[]:{}),n[r][i]=a.toJSON(e.meta).uuid);Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let i of e.inputNodes[n])r.push(t[i]);this[n]=r}else if(typeof e.inputNodes[n]==`object`){let r={};for(let i in e.inputNodes[n])r[i]=t[e.inputNodes[n][i]];this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e==`string`;r&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];i===void 0&&(i={uuid:t,type:n,meta:e,metadata:{version:4.7,type:`Node`,generator:`Node.toJSON`}},r!==!0&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta);function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(r){let t=a(e.textures),n=a(e.images),r=a(e.nodes);t.length>0&&(i.textures=t),n.length>0&&(i.images=n),r.length>0&&(i.nodes=r)}return i}};A.captureStackTrace=!1;var ta=class extends A{static get type(){return`ArrayElementNode`}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:`uint`)} ]`}},na=class extends A{static get type(){return`ConvertNode`}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split(`|`))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),i=n.build(e,r);return e.format(i,r,t)}},ra=class extends A{static get type(){return`TempNode`}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()===`generate`){let n=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,n,t);if(n!==`void`&&t!==`void`&&this.hasDependencies(e)){let i=super.build(e,n),a=e.getVarFromNode(this,null,n),o=e.getPropertyName(a);return e.addLineFlowCode(`${o} = ${i}`,this),r.snippet=i,r.propertyName=o,e.format(r.propertyName,n,t)}}return super.build(e,t)}},ia=class extends ra{static get type(){return`JoinNode`}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType===null?e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0)):e.getVectorType(this.nodeType)}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),i=this.nodes,a=e.getComponentType(n),o=[],s=0;for(let t of i){if(s>=r){E(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let i=t.getNodeType(e),c=e.getTypeLength(i),l;if(s+c>r&&(E(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),c=r-s,i=e.getTypeFromLength(c)),s+=c,l=t.build(e,i),e.getComponentType(i)!==a){let t=e.getTypeFromLength(c,a);l=e.format(l,i,t)}o.push(l)}let c=`${e.getType(n)}( ${o.join(`, `)} )`;return e.format(c,n,t)}},aa=Qi.join(``),oa=class extends A{static get type(){return`SplitNode`}constructor(e,t=`x`){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(Qi.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),i=null;if(r>1){let a=null;this.getVectorLength()>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let o=n.build(e,a);i=this.components.length===r&&this.components===aa.slice(0,this.components.length)?e.format(o,a,t):e.format(`${o}.${this.components}`,this.getNodeType(e),t)}else i=n.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},sa=class extends ra{static get type(){return`SetNode`}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,i=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),o=e.getTypeFromLength(n.length,a),s=r.build(e,o),c=t.build(e,i),l=e.getTypeLength(i),u=[];for(let e=0;e<l;e++){let t=Qi[e];t===n[0]?(u.push(s),e+=n.length-1):u.push(c+`.`+t)}return`${e.getType(i)}( ${u.join(`, `)} )`}},ca=class extends ra{static get type(){return`FlipNode`}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),i=n.build(e),a=e.getVarFromNode(this),o=e.getPropertyName(a);e.addLineFlowCode(o+` = `+i,this);let s=e.getTypeLength(r),c=[],l=0;for(let e=0;e<s;e++){let n=Qi[e];n===t[l]?(c.push(`1.0 - `+(o+`.`+n)),l++):c.push(o+`.`+n)}return`${e.getType(r)}( ${c.join(`, `)} )`}},la=class extends A{static get type(){return`InputNode`}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Vi(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Vi(this.value),e.nodeType=this.nodeType,e.valueType===`ArrayBuffer`&&(e.value=Wi(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?Hi(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){T(`Abstract function.`)}},ua=/float|u?int/,da=class extends la{static get type(){return`ConstNode`}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return ua.test(n)&&ua.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},fa=class extends A{static get type(){return`MemberNode`}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!==`void`}getNodeType(e){return this.hasMember(e)===!1?`float`:this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return`float`;let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){T(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let t=this.getNodeType(e);return e.generateConst(t)}return this.structNode.build(e)+`.`+this.property}},pa=null,ma=new Map;function j(e,t){if(ma.has(e)){T(`TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!=`function`)throw Error(`THREE.TSL: Node element ${e} is not a function`);ma.set(e,t),e!==`assign`&&(A.prototype[e]=function(...e){return this.isStackNode?this.addToStack(t(...e)):t(this,...e)},A.prototype[e+`Assign`]=function(...e){return this.isStackNode?this.assign(e[0],t(...e)):this.assign(t(this,...e))})}var ha=e=>e.replace(/r|s/g,`x`).replace(/g|t/g,`y`).replace(/b|p/g,`z`).replace(/a|q/g,`w`),ga=e=>ha(e).split(``).sort().join(``);A.prototype.assign=function(...e){if(this.isStackNode!==!0)return pa===null?E(`TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().`,new ki):pa.assign(this,...e),this;{let t=ma.get(`assign`);return this.addToStack(t(...e))}},A.prototype.toVarIntent=function(){return this},A.prototype.get=function(e){return new fa(this,e)};var _a={};function va(e,t,n){_a[e]=_a[t]=_a[n]={get(){this._cache=this._cache||{};let t=this._cache[e];return t===void 0&&(t=new oa(this,e),this._cache[e]=t),t},set(t){this[e].assign(M(t))}};let r=e.toUpperCase(),i=t.toUpperCase(),a=n.toUpperCase();A.prototype[`set`+r]=A.prototype[`set`+i]=A.prototype[`set`+a]=function(t){let n=ga(e);return new sa(this,n,M(t))},A.prototype[`flip`+r]=A.prototype[`flip`+i]=A.prototype[`flip`+a]=function(){let t=ga(e);return new ca(this,t)}}var ya=[`x`,`y`,`z`,`w`],ba=[`r`,`g`,`b`,`a`],xa=[`s`,`t`,`p`,`q`];for(let e=0;e<4;e++){let t=ya[e],n=ba[e],r=xa[e];va(t,n,r);for(let i=0;i<4;i++){t=ya[e]+ya[i],n=ba[e]+ba[i],r=xa[e]+xa[i],va(t,n,r);for(let a=0;a<4;a++){t=ya[e]+ya[i]+ya[a],n=ba[e]+ba[i]+ba[a],r=xa[e]+xa[i]+xa[a],va(t,n,r);for(let o=0;o<4;o++)t=ya[e]+ya[i]+ya[a]+ya[o],n=ba[e]+ba[i]+ba[a]+ba[o],r=xa[e]+xa[i]+xa[a]+xa[o],va(t,n,r)}}}for(let e=0;e<32;e++)_a[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return t===void 0&&(t=new ta(this,new da(e,`uint`)),this._cache[e]=t),t},set(t){this[e].assign(M(t))}};Object.defineProperties(A.prototype,_a);var Sa=new WeakMap,Ca=function(e,t=null){let n=Vi(e);return n===`node`?e:t===null&&(n===`float`||n===`boolean`)||n&&n!==`shader`&&n!==`string`?M(Ha(e,t)):n===`shader`?e.isFn?e:I(e):e},wa=function(e,t=null){for(let n in e)e[n]=M(e[n],t);return e},Ta=function(e,t=null){let n=e.length;for(let r=0;r<n;r++)e[r]=M(e[r],t);return e},Ea=function(e,t=null,n=null,r=null){function i(e){return r===null?e=M(e):(e=M(Object.assign(e,r)),r.intent===!0&&(e=e.toVarIntent())),e}let a,o=t,s,c;function l(t){let n;return n=o?/[a-z]/i.test(o)?o+`()`:o:e.type,s!==void 0&&t.length<s?(E(`TSL: "${n}" parameter length is less than minimum required.`,new ki),t.concat(Array(s-t.length).fill(0))):c!==void 0&&t.length>c?(E(`TSL: "${n}" parameter length exceeds limit.`,new ki),t.slice(0,c)):t}return t===null?a=(...t)=>i(new e(...Ya(l(t)))):n===null?a=(...n)=>i(new e(t,...Ya(l(n)))):(n=M(n),a=(...r)=>i(new e(t,...Ya(l(r)),n))),a.setParameterLength=(...e)=>(e.length===1?s=c=e[0]:e.length===2&&([s,c]=e),a),a.setName=e=>(o=e,a),a},Da=function(e,...t){return new e(...Ya(t))},Oa=class extends A{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),i=e.getClosestSubBuild(t.subBuilds)||``,a=i||`default`;if(r[a])return r[a];let o=e.subBuildFn,s=e.fnCall;e.subBuildFn=i,e.fnCall=this;let c=null;if(t.layout){let r=Sa.get(e.constructor);r===void 0&&(r=new WeakMap,Sa.set(e.constructor,r));let i=r.get(t);i===void 0&&(i=M(e.buildFunctionNode(t)),r.set(t,i)),e.addInclude(i);let a=n?ka(n):null;c=M(i.call(a))}else{let r=new Proxy(e,{get:(e,t,n)=>{let r;return r=Symbol.iterator===t?function*(){yield void 0}:Reflect.get(e,t,n),r}}),i=n?Aa(n):null,a=Array.isArray(n)?n.length>0:n!==null,o=t.jsFunc;c=M(a||o.length>1?o(i,r):o(r))}return e.subBuildFn=o,e.fnCall=s,t.once&&(r[a]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),i=e.getNodeProperties(this),a=e.getSubBuildOutput(this),o=this.getOutputNode(e),s=e.fnCall;if(e.fnCall=this,r===`setup`){let t=e.getSubBuildProperty(`initialized`,this);if(i[t]!==!0&&(i[t]=!0,i[a]=this.getOutputNode(e),i[a].build(e),this.shaderNode.subBuilds))for(let t of e.chaining){let n=e.getDataFromNode(t,`any`);n.subBuilds=n.subBuilds||new Set;for(let e of this.shaderNode.subBuilds)n.subBuilds.add(e)}n=i[a]}else r===`analyze`?o.build(e,t):r===`generate`&&(n=o.build(e,t)||``);return e.fnCall=s,n}};function ka(e){let t;return Ja(e),t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0],t}function Aa(e){let t=0;return Ja(e),new Proxy(e,{get:(n,r,i)=>{let a;if(r===`length`)return a=e.length,a;if(Symbol.iterator===r)a=function*(){for(let t of e)yield M(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){let n=e[0];a=n[r]===void 0?n[t++]:Reflect.get(n,r,i)}else e[0]instanceof A&&(a=e[r]===void 0?e[t++]:Reflect.get(e,r,i));else a=Reflect.get(n,r,i);a=M(a)}return a}})}var ja=class extends A{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new Oa(this,e)}setup(){return this.call()}},Ma=[!1,!0],Na=[0,1,2,3],Pa=[-1,-2],Fa=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Ia=new Map;for(let e of Ma)Ia.set(e,new da(e));var La=new Map;for(let e of Na)La.set(e,new da(e,`uint`));var Ra=new Map([...La].map(e=>new da(e.value,`int`)));for(let e of Pa)Ra.set(e,new da(e,`int`));var za=new Map([...Ra].map(e=>new da(e.value)));for(let e of Fa)za.set(e,new da(e));for(let e of Fa)za.set(-e,new da(-e));var Ba={bool:Ia,uint:La,ints:Ra,float:za},Va=new Map([...Ia,...za]),Ha=(e,t)=>Va.has(e)?Va.get(e):e.isNode===!0?e:new da(e,t),Ua=function(e,t=null){return(...n)=>{for(let t of n)if(t===void 0)return E(`TSL: Invalid parameter for the type "${e}".`,new ki),new da(0,e);if((n.length===0||![`bool`,`float`,`int`,`uint`].includes(e)&&n.every(e=>{let t=typeof e;return t!==`object`&&t!==`function`}))&&(n=[Hi(e,...n)]),n.length===1&&t!==null&&t.has(n[0]))return qa(t.get(n[0]));if(n.length===1){let t=Ha(n[0],e);return t.nodeType===e?qa(t):qa(new na(t,e))}return qa(new ia(n.map(e=>Ha(e)),e))}},Wa=e=>typeof e==`object`&&e?e.value:e,Ga=e=>e==null?null:e.nodeType||e.convertTo||(typeof e==`string`?e:null);function Ka(e,t){return new ja(e,t)}var M=(e,t=null)=>Ca(e,t),qa=(e,t=null)=>M(e,t).toVarIntent(),Ja=(e,t=null)=>new wa(e,t),Ya=(e,t=null)=>new Ta(e,t),N=(e,t=null,n=null,r=null)=>new Ea(e,t,n,r),P=(e,...t)=>new Da(e,...t),F=(e,t=null,n=null,r={})=>new Ea(e,t,n,o(o({},r),{},{intent:!0})),Xa=0,Za=class extends A{constructor(e,t=null){super();let n=null;t!==null&&(typeof t==`object`?n=t.return:(typeof t==`string`?n=t:E(`TSL: Invalid layout type.`,new ki),t=null)),this.shaderNode=new Ka(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!=`object`){let n={name:`fn`+Xa++,type:t,inputs:[]};for(let t in e)t!==`return`&&n.inputs.push({name:t,type:e[t]});e=n}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||`float`}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType===`void`&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return E(`TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".`,this.stackTrace),e.generateConst(t)}};function I(e,t=null){let n=new Za(e,t);return new Proxy(()=>{},{apply(e,t,r){return n.call(...r)},get(e,t,r){return Reflect.get(n,t,r)},set(e,t,r,i){return Reflect.set(n,t,r,i)}})}var Qa=e=>{pa=e},$a=()=>pa,L=(...e)=>pa.If(...e),eo=(...e)=>pa.Switch(...e);function to(e){return pa&&pa.addToStack(e),e}j(`toStack`,to);var no=new Ua(`color`),R=new Ua(`float`,Ba.float),z=new Ua(`int`,Ba.ints),B=new Ua(`uint`,Ba.uint),ro=new Ua(`bool`,Ba.bool),V=new Ua(`vec2`),io=new Ua(`ivec2`),ao=new Ua(`uvec2`),oo=new Ua(`bvec2`),H=new Ua(`vec3`),so=new Ua(`ivec3`),co=new Ua(`uvec3`),lo=new Ua(`bvec3`),U=new Ua(`vec4`),uo=new Ua(`ivec4`),fo=new Ua(`uvec4`),po=new Ua(`bvec4`),mo=new Ua(`mat2`),ho=new Ua(`mat3`),go=new Ua(`mat4`),_o=(e=``)=>new da(e,`string`),vo=e=>new da(e,`ArrayBuffer`);j(`toColor`,no),j(`toFloat`,R),j(`toInt`,z),j(`toUint`,B),j(`toBool`,ro),j(`toVec2`,V),j(`toIVec2`,io),j(`toUVec2`,ao),j(`toBVec2`,oo),j(`toVec3`,H),j(`toIVec3`,so),j(`toUVec3`,co),j(`toBVec3`,lo),j(`toVec4`,U),j(`toIVec4`,uo),j(`toUVec4`,fo),j(`toBVec4`,po),j(`toMat2`,mo),j(`toMat3`,ho),j(`toMat4`,go);var yo=N(ta).setParameterLength(2),bo=(e,t)=>new na(M(e),t),xo=(e,t)=>new oa(M(e),t);j(`element`,yo),j(`convert`,bo);var So=e=>(T(`TSL: append() has been renamed to Stack().`,new ki),to(e));j(`append`,e=>(T(`TSL: .append() has been renamed to .toStack().`,new ki),to(e)));var W=class extends A{static get type(){return`PropertyNode`}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return ji(this.type+`:`+(this.name||``)+`:`+(this.varying?`1`:`0`))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}},Co=(e,t)=>new W(e,t),wo=(e,t)=>new W(e,t,!0),To=P(W,`vec4`,`DiffuseColor`),Eo=P(W,`vec3`,`DiffuseContribution`),Do=P(W,`vec3`,`EmissiveColor`),Oo=P(W,`float`,`Roughness`),ko=P(W,`float`,`Metalness`),Ao=P(W,`float`,`Clearcoat`),jo=P(W,`float`,`ClearcoatRoughness`),Mo=P(W,`vec3`,`Sheen`),No=P(W,`float`,`SheenRoughness`),Po=P(W,`float`,`Iridescence`),Fo=P(W,`float`,`IridescenceIOR`),Io=P(W,`float`,`IridescenceThickness`),Lo=P(W,`float`,`AlphaT`),Ro=P(W,`float`,`Anisotropy`),zo=P(W,`vec3`,`AnisotropyT`),Bo=P(W,`vec3`,`AnisotropyB`),Vo=P(W,`color`,`SpecularColor`),Ho=P(W,`color`,`SpecularColorBlended`),Uo=P(W,`float`,`SpecularF90`),Wo=P(W,`float`,`Shininess`),Go=P(W,`vec4`,`Output`),Ko=P(W,`float`,`dashSize`),qo=P(W,`float`,`gapSize`),Jo=P(W,`float`,`pointWidth`),Yo=P(W,`float`,`IOR`),Xo=P(W,`float`,`Transmission`),Zo=P(W,`float`,`Thickness`),Qo=P(W,`float`,`AttenuationDistance`),$o=P(W,`color`,`AttenuationColor`),es=P(W,`float`,`Dispersion`),ts=class extends A{static get type(){return`UniformGroupNode`}constructor(e,t=!1,n=1){super(`string`),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},ns=e=>new ts(e),rs=(e,t=0)=>new ts(e,!0,t),is=rs(`frame`),G=rs(`render`),as=ns(`object`),os=class extends la{static get type(){return`UniformNode`}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name=``,this.groupNode=as}setName(e){return this.name=e,this}label(e){return T(`TSL: "label()" has been deprecated. Use "setName()" instead.`,new ki),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{let n=e(t,this);n!==void 0&&(this.value=n)},t)}getInputType(e){let t=super.getInputType(e);return t===`bool`&&(t=`uint`),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),i=e.getNodeFromHash(r);i===void 0&&(e.setHashNode(this,r),i=this);let a=i.getInputType(e),o=e.getUniformFromNode(i,a,e.shaderStage,this.name||e.context.nodeName),s=e.getPropertyName(o);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=s;if(n===`bool`){let t=e.getDataFromNode(this),r=t.propertyName;if(r===void 0){let i=e.getVarFromNode(this,null,`bool`);r=e.getPropertyName(i),t.propertyName=r,c=e.format(s,a,n),e.addLineFlowCode(`${r} = ${c}`,this)}c=r}return e.format(c,n,t)}},K=(e,t)=>{let n=Ga(t||e);if(n===e&&(e=Hi(n)),e&&e.isNode===!0){let t=e.value;e.traverse(e=>{e.isConstNode===!0&&(t=e.value)}),e=t}return new os(e,n)},ss=class extends ra{static get type(){return`ArrayNode`}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},cs=(...e)=>{let t;if(e.length===1){let n=e[0];t=new ss(null,n.length,n)}else{let n=e[0],r=e[1];t=new ss(n,r)}return M(t)};j(`toArray`,(e,t)=>cs(Array(t).fill(e)));var ls=N(class extends ra{static get type(){return`AssignNode`}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t===`void`?`void`:this.targetNode.getNodeType(e)}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable(`swizzleAssign`)===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return Qi.join(``).slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),i=e.getDataFromNode(r);i.assign=!0;let a=e.getNodeProperties(this);a.sourceNode=n,a.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),i=this.needsSplitAssign(e),a=n.build(e),o=n.getNodeType(e),s=r.build(e,o),c=r.getNodeType(e),l=e.getDataFromNode(this),u;if(l.initialized===!0)t!==`void`&&(u=a);else if(i){let r=e.getVarFromNode(this,null,o),i=e.getPropertyName(r);e.addLineFlowCode(`${i} = ${s}`,this);let c=n.node,l=c.node.context({assign:!0}).build(e);for(let t=0;t<c.components.length;t++){let n=c.components[t];e.addLineFlowCode(`${l}.${n} = ${i}[ ${t} ]`,this)}t!==`void`&&(u=a)}else u=`${a} = ${s}`,(t===`void`||c===`void`)&&(e.addLineFlowCode(u,this),t!==`void`&&(u=a));return l.initialized=!0,e.format(u,o,t)}}).setParameterLength(2);j(`assign`,ls);var us=class extends ra{static get type(){return`FunctionCallNode`}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),i=this.parameters,a=(t,n)=>{let r=n.type,i=r===`pointer`,a;return a=i?`&`+t.build(e):t.build(e,r),a};if(Array.isArray(i)){if(i.length>r.length)E(`TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'.`),i.length=r.length;else if(i.length<r.length)for(E(`TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.`);i.length<r.length;)i.push(R(0));for(let e=0;e<i.length;e++)t.push(a(i[e],r[e]))}else for(let e of r){let n=i[e.name];n===void 0?(E(`TSL: Input '${e.name}' not found in \'Fn()\'.`),t.push(a(R(0),e))):t.push(a(n,e))}return`${n.build(e,`property`)}( ${t.join(`, `)} )`}},ds=(e,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?Ya(t):Ja(t[0]),new us(M(e),t));j(`call`,ds);var fs={"==":`equal`,"!=":`notEqual`,"<":`lessThan`,">":`greaterThan`,"<=":`lessThanEqual`,">=":`greaterThanEqual`,"%":`mod`},ps=class e extends ra{static get type(){return`OperatorNode`}constructor(t,n,r,...i){if(super(),i.length>0){let a=new e(t,n,r);for(let n=0;n<i.length-1;n++)a=new e(t,a,i[n]);n=a,r=i[i.length-1]}this.op=t,this.aNode=n,this.bNode=r,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(fs[this.op],t)}getNodeType(e,t=null){let n=this.op,r=this.aNode,i=this.bNode,a=r.getNodeType(e),o=i?i.getNodeType(e):null;if(a===`void`||o===`void`)return t||`void`;if(n===`%`)return a;if(n===`~`||n===`&`||n===`|`||n===`^`||n===`>>`||n===`<<`)return e.getIntegerType(a);if(n===`!`||n===`&&`||n===`||`||n===`^^`)return`bool`;if(n===`==`||n===`!=`||n===`<`||n===`>`||n===`<=`||n===`>=`){let t=Math.max(e.getTypeLength(a),e.getTypeLength(o));return t>1?`bvec${t}`:`bool`}else{if(e.isMatrix(a)){if(o===`float`)return a;if(e.isVector(o))return e.getVectorFromMatrix(a);if(e.isMatrix(o))return a}else if(e.isMatrix(o)){if(a===`float`)return o;if(e.isVector(a))return e.getVectorFromMatrix(o)}return e.getTypeLength(o)>e.getTypeLength(a)?o:a}}generate(e,t){let n=this.op,{aNode:r,bNode:i}=this,a=this.getNodeType(e,t),o=null,s=null;a===`void`?o=s=a:(o=r.getNodeType(e),s=i?i.getNodeType(e):null,n===`<`||n===`>`||n===`<=`||n===`>=`||n===`==`||n===`!=`?e.isVector(o)?s=o:e.isVector(s)?o=s:o!==s&&(o=s=`float`):n===`>>`||n===`<<`?(o=a,s=e.changeComponentType(s,`uint`)):n===`%`?(o=a,s=e.isInteger(o)&&e.isInteger(s)?s:o):e.isMatrix(o)?s===`float`?s=`float`:e.isVector(s)?s=e.getVectorFromMatrix(o):e.isMatrix(s)||(o=s=a):o=e.isMatrix(s)?o===`float`?`float`:e.isVector(o)?e.getVectorFromMatrix(s):s=a:s=a);let c=r.build(e,o),l=i?i.build(e,s):null,u=e.getFunctionOperator(n);if(t!==`void`){let r=e.renderer.coordinateSystem===fe;if(n===`==`||n===`!=`||n===`<`||n===`>`||n===`<=`||n===`>=`)return r&&e.isVector(o)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${l} )`,a,t):e.format(`( ${c} ${n} ${l} )`,a,t);if(n===`%`)return e.isInteger(s)?e.format(`( ${c} % ${l} )`,a,t):e.format(`${this.getOperatorMethod(e,a)}( ${c}, ${l} )`,a,t);if(n===`!`||n===`~`)return e.format(`(${n}${c})`,o,t);if(u)return e.format(`${u}( ${c}, ${l} )`,a,t);if(e.isMatrix(o)&&s===`float`)return e.format(`( ${l} ${n} ${c} )`,a,t);if(o===`float`&&e.isMatrix(s))return e.format(`${c} ${n} ${l}`,a,t);{let i=`( ${c} ${n} ${l} )`;return!r&&a===`bool`&&e.isVector(o)&&e.isVector(s)&&(i=`all${i}`),e.format(i,a,t)}}else if(o!==`void`)return u?e.format(`${u}( ${c}, ${l} )`,a,t):e.isMatrix(o)&&s===`float`?e.format(`${l} ${n} ${c}`,a,t):e.format(`${c} ${n} ${l}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},ms=F(ps,`+`).setParameterLength(2,1/0).setName(`add`),q=F(ps,`-`).setParameterLength(2,1/0).setName(`sub`),J=F(ps,`*`).setParameterLength(2,1/0).setName(`mul`),hs=F(ps,`/`).setParameterLength(2,1/0).setName(`div`),gs=F(ps,`%`).setParameterLength(2).setName(`mod`),_s=F(ps,`==`).setParameterLength(2).setName(`equal`),vs=F(ps,`!=`).setParameterLength(2).setName(`notEqual`),ys=F(ps,`<`).setParameterLength(2).setName(`lessThan`),bs=F(ps,`>`).setParameterLength(2).setName(`greaterThan`),xs=F(ps,`<=`).setParameterLength(2).setName(`lessThanEqual`),Ss=F(ps,`>=`).setParameterLength(2).setName(`greaterThanEqual`),Cs=F(ps,`&&`).setParameterLength(2,1/0).setName(`and`),ws=F(ps,`||`).setParameterLength(2,1/0).setName(`or`),Ts=F(ps,`!`).setParameterLength(1).setName(`not`),Es=F(ps,`^^`).setParameterLength(2).setName(`xor`),Ds=F(ps,`&`).setParameterLength(2).setName(`bitAnd`),Os=F(ps,`~`).setParameterLength(1).setName(`bitNot`),ks=F(ps,`|`).setParameterLength(2).setName(`bitOr`),As=F(ps,`^`).setParameterLength(2).setName(`bitXor`),js=F(ps,`<<`).setParameterLength(2).setName(`shiftLeft`),Ms=F(ps,`>>`).setParameterLength(2).setName(`shiftRight`),Ns=I(([e])=>(e.addAssign(1),e)),Ps=I(([e])=>(e.subAssign(1),e)),Fs=I(([e])=>{let t=z(e).toConst();return e.addAssign(1),t}),Is=I(([e])=>{let t=z(e).toConst();return e.subAssign(1),t});j(`add`,ms),j(`sub`,q),j(`mul`,J),j(`div`,hs),j(`mod`,gs),j(`equal`,_s),j(`notEqual`,vs),j(`lessThan`,ys),j(`greaterThan`,bs),j(`lessThanEqual`,xs),j(`greaterThanEqual`,Ss),j(`and`,Cs),j(`or`,ws),j(`not`,Ts),j(`xor`,Es),j(`bitAnd`,Ds),j(`bitNot`,Os),j(`bitOr`,ks),j(`bitXor`,As),j(`shiftLeft`,js),j(`shiftRight`,Ms),j(`incrementBefore`,Ns),j(`decrementBefore`,Ps),j(`increment`,Fs),j(`decrement`,Is);var Ls=(e,t)=>(T(`TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.`,new ki),gs(z(e),z(t)));j(`modInt`,Ls);var Y=class e extends ra{static get type(){return`MathNode`}constructor(t,n,r=null,i=null){if(super(),(t===e.MAX||t===e.MIN)&&arguments.length>3){let a=new e(t,n,r);for(let n=2;n<arguments.length-1;n++)a=new e(t,a,arguments[n]);n=a,r=arguments[arguments.length-1],i=null}this.method=t,this.aNode=n,this.bNode=r,this.cNode=i,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),o=e.isMatrix(r)?0:e.getTypeLength(r);return i>a&&i>o?t:a>o?n:o>i?r:t}getNodeType(t){let n=this.method;return n===e.LENGTH||n===e.DISTANCE||n===e.DOT?`float`:n===e.CROSS?`vec3`:n===e.ALL||n===e.ANY?`bool`:n===e.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),`bool`):this.getInputType(t)}setup(t){let{aNode:n,bNode:r,method:i}=this,a=null;if(i===e.ONE_MINUS)a=q(1,n);else if(i===e.RECIPROCAL)a=hs(1,n);else if(i===e.DIFFERENCE)a=uc(q(n,r));else if(i===e.TRANSFORM_DIRECTION){let e=n,i=r;t.isMatrix(e.getNodeType(t))?i=U(H(i),0):e=U(H(e),0);let o=J(e,i).xyz;a=nc(o)}return a===null?super.setup(t):a}generate(t,n){if(t.getNodeProperties(this).outputNode)return super.generate(t,n);let r=this.method,i=this.getNodeType(t),a=this.getInputType(t),o=this.aNode,s=this.bNode,c=this.cNode,l=t.renderer.coordinateSystem;if(r===e.NEGATE)return t.format(`( - `+o.build(t,a)+` )`,i,n);{let u=[];return r===e.CROSS?u.push(o.build(t,i),s.build(t,i)):l===2e3&&r===e.STEP?u.push(o.build(t,t.getTypeLength(o.getNodeType(t))===1?`float`:a),s.build(t,a)):l===2e3&&(r===e.MIN||r===e.MAX)?u.push(o.build(t,a),s.build(t,t.getTypeLength(s.getNodeType(t))===1?`float`:a)):r===e.REFRACT?u.push(o.build(t,a),s.build(t,a),c.build(t,`float`)):r===e.MIX?u.push(o.build(t,a),s.build(t,a),c.build(t,t.getTypeLength(c.getNodeType(t))===1?`float`:a)):(l===2001&&r===e.ATAN&&s!==null&&(r=`atan2`),t.shaderStage!==`fragment`&&(r===e.DFDX||r===e.DFDY)&&(T(`TSL: '${r}' is not supported in the ${t.shaderStage} stage.`,this.stackTrace),r=`/*`+r+`*/`),u.push(o.build(t,a)),s!==null&&u.push(s.build(t,a)),c!==null&&u.push(c.build(t,a))),t.format(`${t.getMethod(r,i)}( ${u.join(`, `)} )`,i,n)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Y.ALL=`all`,Y.ANY=`any`,Y.RADIANS=`radians`,Y.DEGREES=`degrees`,Y.EXP=`exp`,Y.EXP2=`exp2`,Y.LOG=`log`,Y.LOG2=`log2`,Y.SQRT=`sqrt`,Y.INVERSE_SQRT=`inversesqrt`,Y.FLOOR=`floor`,Y.CEIL=`ceil`,Y.NORMALIZE=`normalize`,Y.FRACT=`fract`,Y.SIN=`sin`,Y.COS=`cos`,Y.TAN=`tan`,Y.ASIN=`asin`,Y.ACOS=`acos`,Y.ATAN=`atan`,Y.ABS=`abs`,Y.SIGN=`sign`,Y.LENGTH=`length`,Y.NEGATE=`negate`,Y.ONE_MINUS=`oneMinus`,Y.DFDX=`dFdx`,Y.DFDY=`dFdy`,Y.ROUND=`round`,Y.RECIPROCAL=`reciprocal`,Y.TRUNC=`trunc`,Y.FWIDTH=`fwidth`,Y.TRANSPOSE=`transpose`,Y.DETERMINANT=`determinant`,Y.INVERSE=`inverse`,Y.EQUALS=`equals`,Y.MIN=`min`,Y.MAX=`max`,Y.STEP=`step`,Y.REFLECT=`reflect`,Y.DISTANCE=`distance`,Y.DIFFERENCE=`difference`,Y.DOT=`dot`,Y.CROSS=`cross`,Y.POW=`pow`,Y.TRANSFORM_DIRECTION=`transformDirection`,Y.MIX=`mix`,Y.CLAMP=`clamp`,Y.REFRACT=`refract`,Y.SMOOTHSTEP=`smoothstep`,Y.FACEFORWARD=`faceforward`;var Rs=R(1e-6),zs=R(1e6),Bs=R(Math.PI),Vs=R(Math.PI*2),Hs=R(Math.PI*2),Us=R(Math.PI*.5),Ws=F(Y,Y.ALL).setParameterLength(1),Gs=F(Y,Y.ANY).setParameterLength(1),Ks=F(Y,Y.RADIANS).setParameterLength(1),qs=F(Y,Y.DEGREES).setParameterLength(1),Js=F(Y,Y.EXP).setParameterLength(1),Ys=F(Y,Y.EXP2).setParameterLength(1),Xs=F(Y,Y.LOG).setParameterLength(1),Zs=F(Y,Y.LOG2).setParameterLength(1),Qs=F(Y,Y.SQRT).setParameterLength(1),$s=F(Y,Y.INVERSE_SQRT).setParameterLength(1),ec=F(Y,Y.FLOOR).setParameterLength(1),tc=F(Y,Y.CEIL).setParameterLength(1),nc=F(Y,Y.NORMALIZE).setParameterLength(1),rc=F(Y,Y.FRACT).setParameterLength(1),ic=F(Y,Y.SIN).setParameterLength(1),ac=F(Y,Y.COS).setParameterLength(1),oc=F(Y,Y.TAN).setParameterLength(1),sc=F(Y,Y.ASIN).setParameterLength(1),cc=F(Y,Y.ACOS).setParameterLength(1),lc=F(Y,Y.ATAN).setParameterLength(1,2),uc=F(Y,Y.ABS).setParameterLength(1),dc=F(Y,Y.SIGN).setParameterLength(1),fc=F(Y,Y.LENGTH).setParameterLength(1),pc=F(Y,Y.NEGATE).setParameterLength(1),mc=F(Y,Y.ONE_MINUS).setParameterLength(1),hc=F(Y,Y.DFDX).setParameterLength(1),gc=F(Y,Y.DFDY).setParameterLength(1),_c=F(Y,Y.ROUND).setParameterLength(1),vc=F(Y,Y.RECIPROCAL).setParameterLength(1),yc=F(Y,Y.TRUNC).setParameterLength(1),bc=F(Y,Y.FWIDTH).setParameterLength(1),xc=F(Y,Y.TRANSPOSE).setParameterLength(1),Sc=F(Y,Y.DETERMINANT).setParameterLength(1),Cc=F(Y,Y.INVERSE).setParameterLength(1),wc=F(Y,Y.MIN).setParameterLength(2,1/0),Tc=F(Y,Y.MAX).setParameterLength(2,1/0),Ec=F(Y,Y.STEP).setParameterLength(2),Dc=F(Y,Y.REFLECT).setParameterLength(2),Oc=F(Y,Y.DISTANCE).setParameterLength(2),kc=F(Y,Y.DIFFERENCE).setParameterLength(2),Ac=F(Y,Y.DOT).setParameterLength(2),jc=F(Y,Y.CROSS).setParameterLength(2),Mc=F(Y,Y.POW).setParameterLength(2),Nc=e=>J(e,e),Pc=e=>J(e,e,e),Fc=e=>J(e,e,e,e),Ic=F(Y,Y.TRANSFORM_DIRECTION).setParameterLength(2),Lc=e=>J(dc(e),Mc(uc(e),1/3)),Rc=e=>Ac(e,e),zc=F(Y,Y.MIX).setParameterLength(3),Bc=(e,t=0,n=1)=>new Y(Y.CLAMP,M(e),M(t),M(n)),Vc=e=>Bc(e),Hc=F(Y,Y.REFRACT).setParameterLength(3),Uc=F(Y,Y.SMOOTHSTEP).setParameterLength(3),Wc=F(Y,Y.FACEFORWARD).setParameterLength(3),Gc=I(([e])=>rc(ic(gs(Ac(e.xy,V(12.9898,78.233)),Bs)).mul(43758.5453))),Kc=(e,t,n)=>zc(t,n,e),qc=(e,t,n)=>Uc(t,n,e),Jc=(e,t)=>Ec(t,e),Yc=Wc,Xc=$s;j(`all`,Ws),j(`any`,Gs),j(`radians`,Ks),j(`degrees`,qs),j(`exp`,Js),j(`exp2`,Ys),j(`log`,Xs),j(`log2`,Zs),j(`sqrt`,Qs),j(`inverseSqrt`,$s),j(`floor`,ec),j(`ceil`,tc),j(`normalize`,nc),j(`fract`,rc),j(`sin`,ic),j(`cos`,ac),j(`tan`,oc),j(`asin`,sc),j(`acos`,cc),j(`atan`,lc),j(`abs`,uc),j(`sign`,dc),j(`length`,fc),j(`lengthSq`,Rc),j(`negate`,pc),j(`oneMinus`,mc),j(`dFdx`,hc),j(`dFdy`,gc),j(`round`,_c),j(`reciprocal`,vc),j(`trunc`,yc),j(`fwidth`,bc),j(`min`,wc),j(`max`,Tc),j(`step`,Jc),j(`reflect`,Dc),j(`distance`,Oc),j(`dot`,Ac),j(`cross`,jc),j(`pow`,Mc),j(`pow2`,Nc),j(`pow3`,Pc),j(`pow4`,Fc),j(`transformDirection`,Ic),j(`mix`,Kc),j(`clamp`,Bc),j(`refract`,Hc),j(`smoothstep`,qc),j(`faceForward`,Wc),j(`difference`,kc),j(`saturate`,Vc),j(`cbrt`,Lc),j(`transpose`,xc),j(`determinant`,Sc),j(`inverse`,Cc),j(`rand`,Gc);var Zc=N(class extends A{static get type(){return`ConditionalNode`}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,`setup`),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let t=n.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(r))return t}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,i=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=i,r!==null&&(e.getDataFromNode(r).parentNodeBlock=i);let a=e.context.uniformFlow,o=e.getNodeProperties(this);o.condNode=t,o.ifNode=a?n:n.context({nodeBlock:n}),o.elseNode=r?a?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:i,ifNode:a,elseNode:o}=e.getNodeProperties(this),s=e.currentFunctionNode,c=t!==`void`,l=c?Co(n).build(e):``;r.nodeProperty=l;let u=i.build(e,`bool`);if(e.context.uniformFlow&&o!==null){let r=a.build(e,n),i=o.build(e,n),s=e.getTernary(u,r,i);return e.format(s,n,t)}e.addFlowCode(`\n${e.tab}if ( ${u} ) {\n\n`).addFlowTab();let d=a.build(e,n);if(d&&(c?d=l+` = `+d+`;`:(d=`return `+d+`;`,s===null&&(T(`TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.`,this.stackTrace),d=`// `+d))),e.removeFlowTab().addFlowCode(e.tab+` `+d+`
|
|
258
|
+
|
|
259
|
+
`+e.tab+`}`),o!==null){e.addFlowCode(` else {
|
|
260
|
+
|
|
261
|
+
`).addFlowTab();let t=o.build(e,n);t&&(c?t=l+` = `+t+`;`:(t=`return `+t+`;`,s===null&&(T(`TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.`,this.stackTrace),t=`// `+t))),e.removeFlowTab().addFlowCode(e.tab+` `+t+`
|
|
262
|
+
|
|
263
|
+
`+e.tab+`}
|
|
264
|
+
|
|
265
|
+
`)}else e.addFlowCode(`
|
|
266
|
+
|
|
267
|
+
`);return e.format(l,n,t)}}).setParameterLength(2,3);j(`select`,Zc);var Qc=class extends A{static get type(){return`ContextNode`}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},$c=(e=null,t={})=>{let n=e;return(n===null||n.isNode!==!0)&&(t=n||t,n=null),new Qc(n,t)},el=e=>$c(e,{uniformFlow:!0}),tl=(e,t)=>$c(e,{nodeName:t});function nl(e,t,n=null){return $c(n,{getShadow:({light:n,shadowColorNode:r})=>t===n?r.mul(e):r})}function rl(e,t=null){return $c(t,{getAO:(t,{material:n})=>n.transparent===!0?t:t===null?e:t.mul(e)})}function il(e,t){return T(`TSL: "label()" has been deprecated. Use "setName()" instead.`),tl(e,t)}j(`context`,$c),j(`label`,il),j(`uniformFlow`,el),j(`setName`,tl),j(`builtinShadowContext`,(e,t,n)=>nl(t,n,e)),j(`builtinAOContext`,(e,t)=>rl(t,e));var al=N(class extends A{static get type(){return`VarNode`}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0];if(this._hasStack(t)===!1&&t.buildStage===`setup`&&(t.context.nodeLoop||t.context.nodeBlock)){let e=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let n=t.getDataFromNode(this);n.forceDeclaration=!0,e=!0}let n=t.getBaseStack();e?n.addToStackBefore(this):n.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:i}=e,a=i.backend.isWebGPUBackend===!0,o=!1,s=!1;r&&(o=e.isDeterministic(t),s=a?r:o);let c=this.getNodeType(e);if(c==`void`)return this.isIntent(e)!==!0&&E(`TSL: ".toVar()" can not be used with void type.`,this.stackTrace),t.build(e);let l=e.getVectorType(c),u=t.build(e,l),d=e.getVarFromNode(this,n,l,void 0,s),f=e.getPropertyName(d),p=f;if(s)if(a)p=o?`const ${f}`:`let ${f}`;else{let n=t.getArrayCount(e);p=`const ${e.getVar(d.type,f,n)}`}return e.addLineFlowCode(`${p} = ${u}`,this),f}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}}),ol=(e,t=null)=>al(e,t).toStack(),sl=(e,t=null)=>al(e,t,!0).toStack(),cl=e=>al(e).setIntent(!0).toStack();j(`toVar`,ol),j(`toConst`,sl),j(`toVarIntent`,cl);var ll=class extends A{static get type(){return`SubBuild`}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},ul=(e,t,n=null)=>new ll(M(e),t,n),dl=N(class extends A{static get type(){return`VaryingNode`}constructor(e,t=null){super(),this.node=ul(e,`VERTEX`),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,i=this.getNodeType(e),a=this.interpolationType,o=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,i,a,o),t.node=ul(this.node,`VERTEX`)}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage===`fragment`),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(Ki.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(Ki.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty(`property`,e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let i=this.getNodeType(e),a=e.getPropertyName(r,Ki.VERTEX);e.flowNodeFromShaderStage(Ki.VERTEX,n.node,i,a),n[t]=a}return e.getPropertyName(r)}}).setParameterLength(1,2),fl=e=>dl(e);j(`toVarying`,dl),j(`toVertexStage`,fl);var pl=I(([e])=>zc(e.mul(.9478672986).add(.0521327014).pow(2.4),e.mul(.0773993808),e.lessThanEqual(.04045))).setLayout({name:`sRGBTransferEOTF`,type:`vec3`,inputs:[{name:`color`,type:`vec3`}]}),ml=I(([e])=>zc(e.pow(.41666).mul(1.055).sub(.055),e.mul(12.92),e.lessThanEqual(.0031308))).setLayout({name:`sRGBTransferOETF`,type:`vec3`,inputs:[{name:`color`,type:`vec3`}]}),hl=`WorkingColorSpace`,gl=`OutputColorSpace`,_l=class extends ra{static get type(){return`ColorSpaceNode`}constructor(e,t,n){super(`vec4`),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===hl?at.workingColorSpace:t===gl?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),i=t;return at.enabled===!1||n===r||!n||!r?i:(at.getTransfer(n)===`srgb`&&(i=U(pl(i.rgb),i.a)),at.getPrimaries(n)!==at.getPrimaries(r)&&(i=U(ho(at._getMatrix(new et,n,r)).mul(i.rgb),i.a)),at.getTransfer(r)===`srgb`&&(i=U(ml(i.rgb),i.a)),i)}},vl=(e,t)=>new _l(M(e),hl,t),yl=(e,t)=>new _l(M(e),t,hl),bl=(e,t,n)=>new _l(M(e),t,n);j(`workingToColorSpace`,vl),j(`colorSpaceToWorking`,yl);var xl=class extends ta{static get type(){return`ReferenceElementNode`}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},Sl=class extends A{static get type(){return`ReferenceBaseNode`}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split(`.`),this.reference=n,this.node=null,this.group=null,this.updateType=k.OBJECT}setGroup(e){return this.group=e,this}element(e){return new xl(this,M(e))}setNodeType(e){let t=K(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let e=1;e<t.length;e++)n=n[t[e]];return n}updateReference(e){return this.reference=this.object===null?e.object:this.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},Cl=class extends Sl{static get type(){return`RendererReferenceNode`}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(G)}updateReference(e){return this.reference=this.renderer===null?e.renderer:this.renderer,this.reference}},wl=(e,t,n=null)=>new Cl(e,t,n),Tl=class extends ra{static get type(){return`ToneMappingNode`}constructor(e,t=Dl,n=null){super(`vec3`),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return Ni(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===0)return t;let r=null,i=e.renderer.library.getToneMappingFunction(n);return i===null?(E(`ToneMappingNode: Unsupported Tone Mapping configuration.`,n),r=t):r=U(i(t.rgb,this.exposureNode),t.a),r}},El=(e,t,n)=>new Tl(e,M(t),M(n)),Dl=wl(`toneMappingExposure`,`float`);j(`toneMapping`,(e,t,n)=>El(t,n,e));var Ol=new WeakMap;function kl(e,t){let n=Ol.get(e);return n===void 0&&(n=new Yn(e,t),Ol.set(e,n)),n}var Al=class extends la{static get type(){return`BufferAttributeNode`}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=ue,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,i=this.bufferStride||n,a=this.bufferOffset,o;o=r.isInterleavedBuffer===!0?r:r.isBufferAttribute===!0?kl(r.array,i):kl(r,i);let s=new Zn(o,n,a);o.setUsage(this.usage),this.attribute=s,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(n),i=null;return e.shaderStage===`vertex`||e.shaderStage===`compute`?(this.name=r,i=r):i=dl(this).build(e,t),i}getInputType(){return`bufferAttribute`}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function jl(e,t=null,n=0,r=0,i=ue,a=!1){return t===`mat3`||t===null&&e.itemSize===9?ho(new Al(e,`vec3`,9,0).setUsage(i).setInstanced(a),new Al(e,`vec3`,9,3).setUsage(i).setInstanced(a),new Al(e,`vec3`,9,6).setUsage(i).setInstanced(a)):t===`mat4`||t===null&&e.itemSize===16?go(new Al(e,`vec4`,16,0).setUsage(i).setInstanced(a),new Al(e,`vec4`,16,4).setUsage(i).setInstanced(a),new Al(e,`vec4`,16,8).setUsage(i).setInstanced(a),new Al(e,`vec4`,16,12).setUsage(i).setInstanced(a)):new Al(e,t,n,r).setUsage(i)}var Ml=(e,t=null,n=0,r=0)=>jl(e,t,n,r),Nl=(e,t=null,n=0,r=0)=>jl(e,t,n,r,de),Pl=(e,t=null,n=0,r=0)=>jl(e,t,n,r,ue,!0),Fl=(e,t=null,n=0,r=0)=>jl(e,t,n,r,de,!0);j(`toAttribute`,e=>Ml(e.value));var Il=class extends A{static get type(){return`ComputeNode`}constructor(e,t){super(`void`),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.version=1,this.name=``,this.updateBeforeType=k.OBJECT,this.onInitFunction=null}setCount(e){return this.count=e,this}getCount(){return this.count}dispose(){this.dispatchEvent({type:`dispose`})}setName(e){return this.name=e,this}label(e){return T(`TSL: "label()" has been deprecated. Use "setName()" instead.`,new ki),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n===`compute`){let t=this.computeNode.build(e,`void`);t!==``&&e.addLineFlowCode(t,this)}else{let n=e.getNodeProperties(this).outputComputeNode;if(n)return n.build(e,t)}}},Ll=(e,t=[64])=>{(t.length===0||t.length>3)&&E(`TSL: compute() workgroupSize must have 1, 2, or 3 elements`,new ki);for(let e=0;e<t.length;e++){let n=t[e];(typeof n!=`number`||n<=0||!Number.isInteger(n))&&E(`TSL: compute() workgroupSize element at index [ ${e} ] must be a positive integer`,new ki)}for(;t.length<3;)t.push(1);return new Il(M(e),t)},Rl=(e,t,n)=>Ll(e,n).setCount(t);j(`compute`,Rl),j(`computeKernel`,Ll);var zl=class extends A{static get type(){return`IsolateNode`}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}getNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let i=this.node.build(e,...t);return e.setCache(n),i}setParent(e){return this.parent=e,this}getParent(){return this.parent}},Bl=e=>new zl(M(e));function Vl(e,t=!0){return T(`TSL: "cache()" has been deprecated. Use "isolate()" instead.`),Bl(e).setParent(t)}j(`cache`,Vl),j(`isolate`,Bl);var Hl=N(class extends A{static get type(){return`BypassNode`}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,`void`);return t!==``&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}).setParameterLength(2);j(`bypass`,Hl);var Ul=class extends A{static get type(){return`RemapNode`}constructor(e,t,n,r=R(0),i=R(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=r,this.outHighNode=i,this.doClamp=!0}setup(){let{node:e,inLowNode:t,inHighNode:n,outLowNode:r,outHighNode:i,doClamp:a}=this,o=e.sub(t).div(n.sub(t));return a===!0&&(o=o.clamp()),o.mul(i.sub(r)).add(r)}},Wl=N(Ul,null,null,{doClamp:!1}).setParameterLength(3,5),Gl=N(Ul).setParameterLength(3,5);j(`remap`,Wl),j(`remapClamp`,Gl);var Kl=N(class extends A{static get type(){return`ExpressionNode`}constructor(e=``,t=`void`){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n===`void`)e.addLineFlowCode(r,this);else return e.format(r,n,t)}}).setParameterLength(1,2),ql=e=>(e?Zc(e,Kl(`discard`)):Kl(`discard`)).toStack(),Jl=()=>Kl(`return`).toStack();j(`discard`,ql);var Yl=class extends ra{static get type(){return`RenderOutputNode`}constructor(e,t,n){super(`vec4`),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color,n=(this._toneMapping===null?e.toneMapping:this._toneMapping)||0,r=(this.outputColorSpace===null?e.outputColorSpace:this.outputColorSpace)||``;return n!==0&&(t=t.toneMapping(n)),r!==``&&r!==at.workingColorSpace&&(t=t.workingToColorSpace(r)),t}},Xl=(e,t=null,n=null)=>new Yl(M(e),t,n);j(`renderOutput`,Xl);var Zl=class extends ra{static get type(){return`DebugNode`}constructor(e,t=null){super(),this.node=e,this.callback=t}getNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let t=`--- TSL debug - `+e.shaderStage+` shader ---`,r=`-`.repeat(t.length),i=``;i+=`// #`+t+`#
|
|
268
|
+
`,i+=e.flow.code.replace(/^\t/gm,``)+`
|
|
269
|
+
`,i+=`/* ... */ `+n+` /* ... */
|
|
270
|
+
`,i+=`// #`+r+`#
|
|
271
|
+
`,be(i)}return n}},Ql=(e,t=null)=>new Zl(M(e),t).toStack();j(`debug`,Ql);var $l=class{constructor(){this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},eu=class extends A{static get type(){return`InspectorNode`}constructor(e,t=``,n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=k.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}getNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==$l&&Se(`TSL: ".toInspector()" is only available with WebGPU.`),t}};function tu(e,t=``,n=null){return e=M(e),e.before(new eu(e,t,n))}j(`toInspector`,tu);function nu(e){T(`TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add`,e)}var ru=class extends A{static get type(){return`AttributeNode`}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t=`float`}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let r=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(r),a=e.getAttribute(t,i);return e.shaderStage===`vertex`?e.format(a.name,i,n):dl(this).build(e,n)}else return T(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},iu=(e,t=null)=>new ru(e,t),au=(e=0)=>iu(`uv`+(e>0?e:``),`vec2`),ou=N(class extends A{static get type(){return`TextureSizeNode`}constructor(e,t=null){super(`uvec2`),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,`property`),r=this.levelNode===null?`0`:this.levelNode.build(e,`int`);return e.format(`${e.getMethod(`textureDimensions`)}( ${n}, ${r} )`,this.getNodeType(e),t)}}).setParameterLength(1,2),su=N(class extends os{static get type(){return`MaxMipLevelNode`}constructor(e){super(0),this._textureNode=e,this.updateType=k.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:e,height:t}=n;this.value=Math.log2(Math.max(e,t))}}}).setParameterLength(1),cu=class extends Error{constructor(e,t=null){super(e),this.name=`NodeError`,this.stackTrace=t}},lu=new ht,uu=class extends os{static get type(){return`TextureNode`}constructor(e=lu,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=k.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?`float`:this.value.type===1014?`uvec4`:this.value.type===1013?`ivec4`:`vec4`}getInputType(){return`texture`}getDefaultUV(){return au(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=K(this.value.matrix)),this._matrixUniform.mul(H(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=K(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(z(ou(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new cu("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=I(()=>{let t=this.uvNode;return(t===null||e.context.forceUVContext===!0)&&e.context.getUV&&(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),this.updateMatrix===!0&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?k.OBJECT:k.NONE,t})(),i=this.levelNode;i===null&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this));let a=null,o=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(me.TEXTURE_COMPARE))a=this.compareNode;else{let e=n.compareFunction;e===null||e===513||e===515||e===516||e===518?o=this.compareNode:(a=this.compareNode,Se(`TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.`))}t.uvNode=r,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=a,t.compareStepNode=o,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?`vec2`:`ivec2`)}generateOffset(e,t){return t.build(e,`ivec2`)}generateSnippet(e,t,n,r,i,a,o,s,c){let l=this.value,u;return u=i?e.generateTextureBias(l,t,n,i,a,c):s?e.generateTextureGrad(l,t,n,s,a,c):o?e.generateTextureCompare(l,t,n,o,a,c):this.sampler===!1?e.generateTextureLoad(l,t,n,r,a,c):r?e.generateTextureLevel(l,t,n,r,a,c):e.generateTexture(l,t,n,a,c),u}generate(e,t){let n=this.value,r=e.getNodeProperties(this),i=super.generate(e,`property`);if(/^sampler/.test(t))return i+`_sampler`;if(e.isReference(t))return i;{let a=e.getDataFromNode(this),o=this.getNodeType(e),s=a.propertyName;if(s===void 0){let{uvNode:t,levelNode:c,biasNode:l,compareNode:u,compareStepNode:d,depthNode:f,gradNode:p,offsetNode:m}=r,h=this.generateUV(e,t),g=c?c.build(e,`float`):null,_=l?l.build(e,`float`):null,v=f?f.build(e,`int`):null,y=u?u.build(e,`float`):null,b=d?d.build(e,`float`):null,x=p?[p[0].build(e,`vec2`),p[1].build(e,`vec2`)]:null,S=m?this.generateOffset(e,m):null,C=e.getVarFromNode(this);s=e.getPropertyName(C);let ee=this.generateSnippet(e,i,h,g,_,v,y,x,S);if(b!==null){let t=n.compareFunction;ee=t===516||t===518?Ec(Kl(ee,o),Kl(b,`float`)).build(e,o):Ec(Kl(b,`float`),Kl(ee,o)).build(e,o)}e.addLineFlowCode(`${s} = ${ee}`,this),a.snippet=ee,a.propertyName=s}let c=s;return e.needsToWorkingColorSpace(n)&&(c=yl(Kl(c,o),n.colorSpace).setup(e).build(e,o)),e.format(c,o,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=M(e),t.referenceNode=this.getBase(),M(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=M(e).mul(su(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===1003||n.magFilter===1003)&&(T(`TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture.`),t.biasNode=null),M(t)}level(e){let t=this.clone();return t.levelNode=M(e),t.referenceNode=this.getBase(),M(t)}size(e){return ou(this,e)}bias(e){let t=this.clone();return t.biasNode=M(e),t.referenceNode=this.getBase(),M(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=M(e),t.referenceNode=this.getBase(),M(t)}grad(e,t){let n=this.clone();return n.gradNode=[M(e),M(t)],n.referenceNode=this.getBase(),M(n)}depth(e){let t=this.clone();return t.depthNode=M(e),t.referenceNode=this.getBase(),M(t)}offset(e){let t=this.clone();return t.offsetNode=M(e),t.referenceNode=this.getBase(),M(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}},du=N(uu).setParameterLength(1,4).setName(`texture`),fu=(e=lu,t=null,n=null,r=null)=>{let i;return e&&e.isTextureNode===!0?(i=M(e.clone()),i.referenceNode=e.getBase(),t!==null&&(i.uvNode=M(t)),n!==null&&(i.levelNode=M(n)),r!==null&&(i.biasNode=M(r))):i=du(e,t,n,r),i},pu=(e=lu)=>fu(e),mu=(...e)=>fu(...e).setSampler(!1),hu=(e,t,n)=>fu(e,t).level(n),gu=e=>(e.isNode===!0?e:fu(e)).convert(`sampler`),_u=e=>(e.isNode===!0?e:fu(e)).convert(`samplerComparison`),vu=class extends os{static get type(){return`BufferNode`}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return`buffer`}},yu=(e,t,n)=>new vu(e,t,n),bu=class extends ta{static get type(){return`UniformArrayElementNode`}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,n)}},xu=class extends vu{static get type(){return`UniformArrayNode`}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Vi(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=k.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t=`vec4`;return e===`mat2`?t=`mat2`:/mat/.test(e)===!0?t=`mat4`:e.charAt(0)===`i`?t=`ivec4`:e.charAt(0)===`u`&&(t=`uvec4`),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n===`float`||n===`int`||n===`uint`)for(let n=0;n<e.length;n++){let r=n*4;t[r]=e[n]}else if(n===`color`)for(let n=0;n<e.length;n++){let r=n*4,i=e[n];t[r]=i.r,t[r+1]=i.g,t[r+2]=i.b||0}else if(n===`mat2`)for(let n=0;n<e.length;n++){let r=n*4,i=e[n];t[r]=i.elements[0],t[r+1]=i.elements[1],t[r+2]=i.elements[2],t[r+3]=i.elements[3]}else if(n===`mat3`)for(let n=0;n<e.length;n++){let r=n*16,i=e[n];t[r]=i.elements[0],t[r+1]=i.elements[1],t[r+2]=i.elements[2],t[r+4]=i.elements[3],t[r+5]=i.elements[4],t[r+6]=i.elements[5],t[r+8]=i.elements[6],t[r+9]=i.elements[7],t[r+10]=i.elements[8],t[r+15]=1}else if(n===`mat4`)for(let n=0;n<e.length;n++){let r=n*16,i=e[n];for(let e=0;e<i.elements.length;e++)t[r+e]=i.elements[e]}else for(let n=0;n<e.length;n++){let r=n*4,i=e[n];t[r]=i.x,t[r+1]=i.y,t[r+2]=i.z||0,t[r+3]=i.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,i=this.paddedType,a=e.getTypeLength(i);return n.charAt(0)===`i`&&(r=Int32Array),n.charAt(0)===`u`&&(r=Uint32Array),this.value=new r(t*a),this.bufferCount=t,this.bufferType=i,this.update(),super.setup(e)}element(e){return new bu(this,M(e))}},Su=(e,t)=>new xu(e,t),Cu=N(class extends A{constructor(e){super(`float`),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}).setParameterLength(1),wu,Tu,Eu=class e extends A{static get type(){return`ScreenNode`}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===e.DPR?`float`:this.scope===e.VIEWPORT?`vec4`:`vec2`}getUpdateType(){let t=k.NONE;return(this.scope===e.SIZE||this.scope===e.VIEWPORT||this.scope===e.DPR)&&(t=k.RENDER),this.updateType=t,t}update({renderer:t}){let n=t.getRenderTarget();this.scope===e.VIEWPORT?n===null?(t.getViewport(Tu),Tu.multiplyScalar(t.getPixelRatio())):Tu.copy(n.viewport):this.scope===e.DPR?this._output.value=t.getPixelRatio():n===null?t.getDrawingBufferSize(wu):(wu.width=n.width,wu.height=n.height)}setup(){let t=this.scope,n=null;return n=t===e.SIZE?K(wu||(wu=new Xe)):t===e.VIEWPORT?K(Tu||(Tu=new gt)):t===e.DPR?K(1):V(Au.div(ku)),this._output=n,n}generate(t){if(this.scope===e.COORDINATE){let e=t.getFragCoord();if(t.isFlipY()){let n=t.getNodeProperties(ku).outputNode.build(t);e=`${t.getType(`vec2`)}( ${e}.x, ${n}.y - ${e}.y )`}return e}return super.generate(t)}};Eu.COORDINATE=`coordinate`,Eu.VIEWPORT=`viewport`,Eu.SIZE=`size`,Eu.UV=`uv`,Eu.DPR=`dpr`;var Du=P(Eu,Eu.DPR),Ou=P(Eu,Eu.UV),ku=P(Eu,Eu.SIZE),Au=P(Eu,Eu.COORDINATE),ju=P(Eu,Eu.VIEWPORT),Mu=ju.zw,Nu=Au.sub(ju.xy),Pu=Nu.div(Mu),Fu=I(()=>(T(`TSL: "viewportResolution" is deprecated. Use "screenSize" instead.`,new ki),ku),`vec2`).once()(),Iu=null,Lu=null,Ru=null,zu=null,Bu=null,Vu=null,Hu=null,Uu=null,Wu=null,Gu=null,Ku=null,qu=null,Ju=null,Yu=null,Xu=K(0,`uint`).setName(`u_cameraIndex`).setGroup(rs(`cameraIndex`)).toVarying(`v_cameraIndex`),Zu=K(`float`).setName(`cameraNear`).setGroup(G).onRenderUpdate(({camera:e})=>e.near),Qu=K(`float`).setName(`cameraFar`).setGroup(G).onRenderUpdate(({camera:e})=>e.far),$u=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t of e.cameras)n.push(t.projectionMatrix);Lu===null?Lu=Su(n).setGroup(G).setName(`cameraProjectionMatrices`):Lu.array=n,t=Lu.element(e.isMultiViewCamera?Cu(`gl_ViewID_OVR`):Xu).toConst(`cameraProjectionMatrix`)}else Iu===null&&(Iu=K(e.projectionMatrix).setName(`cameraProjectionMatrix`).setGroup(G).onRenderUpdate(({camera:e})=>e.projectionMatrix)),t=Iu;return t}).once()(),ed=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t of e.cameras)n.push(t.projectionMatrixInverse);zu===null?zu=Su(n).setGroup(G).setName(`cameraProjectionMatricesInverse`):zu.array=n,t=zu.element(e.isMultiViewCamera?Cu(`gl_ViewID_OVR`):Xu).toConst(`cameraProjectionMatrixInverse`)}else Ru===null&&(Ru=K(e.projectionMatrixInverse).setName(`cameraProjectionMatrixInverse`).setGroup(G).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse)),t=Ru;return t}).once()(),td=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t of e.cameras)n.push(t.matrixWorldInverse);Vu===null?Vu=Su(n).setGroup(G).setName(`cameraViewMatrices`):Vu.array=n,t=Vu.element(e.isMultiViewCamera?Cu(`gl_ViewID_OVR`):Xu).toConst(`cameraViewMatrix`)}else Bu===null&&(Bu=K(e.matrixWorldInverse).setName(`cameraViewMatrix`).setGroup(G).onRenderUpdate(({camera:e})=>e.matrixWorldInverse)),t=Bu;return t}).once()(),nd=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t of e.cameras)n.push(t.matrixWorld);Uu===null?Uu=Su(n).setGroup(G).setName(`cameraWorldMatrices`):Uu.array=n,t=Uu.element(e.isMultiViewCamera?Cu(`gl_ViewID_OVR`):Xu).toConst(`cameraWorldMatrix`)}else Hu===null&&(Hu=K(e.matrixWorld).setName(`cameraWorldMatrix`).setGroup(G).onRenderUpdate(({camera:e})=>e.matrixWorld)),t=Hu;return t}).once()(),rd=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t of e.cameras)n.push(t.normalMatrix);Gu===null?Gu=Su(n).setGroup(G).setName(`cameraNormalMatrices`):Gu.array=n,t=Gu.element(e.isMultiViewCamera?Cu(`gl_ViewID_OVR`):Xu).toConst(`cameraNormalMatrix`)}else Wu===null&&(Wu=K(e.normalMatrix).setName(`cameraNormalMatrix`).setGroup(G).onRenderUpdate(({camera:e})=>e.normalMatrix)),t=Wu;return t}).once()(),id=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t=0,r=e.cameras.length;t<r;t++)n.push(new O);qu===null?qu=Su(n).setGroup(G).setName(`cameraPositions`).onRenderUpdate(({camera:e},t)=>{let n=e.cameras,r=t.array;for(let e=0,t=n.length;e<t;e++)r[e].setFromMatrixPosition(n[e].matrixWorld)}):qu.array=n,t=qu.element(e.isMultiViewCamera?Cu(`gl_ViewID_OVR`):Xu).toConst(`cameraPosition`)}else Ku===null&&(Ku=K(new O).setName(`cameraPosition`).setGroup(G).onRenderUpdate(({camera:e},t)=>t.value.setFromMatrixPosition(e.matrixWorld))),t=Ku;return t}).once()(),ad=I(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let n=[];for(let t of e.cameras)n.push(t.viewport);Yu===null?Yu=Su(n,`vec4`).setGroup(G).setName(`cameraViewports`):Yu.array=n,t=Yu.element(Xu).toConst(`cameraViewport`)}else Ju===null&&(Ju=U(0,0,ku.x,ku.y).toConst(`cameraViewport`)),t=Ju;return t}).once()(),od=new Bn,sd=class e extends A{static get type(){return`Object3DNode`}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=k.OBJECT,this.uniformNode=new os(null)}getNodeType(){let t=this.scope;if(t===e.WORLD_MATRIX)return`mat4`;if(t===e.POSITION||t===e.VIEW_POSITION||t===e.DIRECTION||t===e.SCALE)return`vec3`;if(t===e.RADIUS)return`float`}update(t){let n=this.object3d,r=this.uniformNode,i=this.scope;if(i===e.WORLD_MATRIX)r.value=n.matrixWorld;else if(i===e.POSITION)r.value=r.value||new O,r.value.setFromMatrixPosition(n.matrixWorld);else if(i===e.SCALE)r.value=r.value||new O,r.value.setFromMatrixScale(n.matrixWorld);else if(i===e.DIRECTION)r.value=r.value||new O,n.getWorldDirection(r.value);else if(i===e.VIEW_POSITION){let e=t.camera;r.value=r.value||new O,r.value.setFromMatrixPosition(n.matrixWorld),r.value.applyMatrix4(e.matrixWorldInverse)}else if(i===e.RADIUS){let e=t.object.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),od.copy(e.boundingSphere).applyMatrix4(n.matrixWorld),r.value=od.radius}}generate(t){let n=this.scope;return n===e.WORLD_MATRIX?this.uniformNode.nodeType=`mat4`:n===e.POSITION||n===e.VIEW_POSITION||n===e.DIRECTION||n===e.SCALE?this.uniformNode.nodeType=`vec3`:n===e.RADIUS&&(this.uniformNode.nodeType=`float`),this.uniformNode.build(t)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};sd.WORLD_MATRIX=`worldMatrix`,sd.POSITION=`position`,sd.SCALE=`scale`,sd.VIEW_POSITION=`viewPosition`,sd.DIRECTION=`direction`,sd.RADIUS=`radius`;var cd=N(sd,sd.DIRECTION).setParameterLength(1),ld=N(sd,sd.WORLD_MATRIX).setParameterLength(1),ud=N(sd,sd.POSITION).setParameterLength(1),dd=N(sd,sd.SCALE).setParameterLength(1),fd=N(sd,sd.VIEW_POSITION).setParameterLength(1),pd=N(sd,sd.RADIUS).setParameterLength(1),md=class extends sd{static get type(){return`ModelNode`}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},hd=P(md,md.DIRECTION),gd=P(md,md.WORLD_MATRIX),_d=P(md,md.POSITION),vd=P(md,md.SCALE),yd=P(md,md.VIEW_POSITION),bd=P(md,md.RADIUS),xd=K(new et).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),Sd=K(new yt).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),Cd=I(e=>e.context.modelViewMatrix||wd).once()().toVar(`modelViewMatrix`),wd=td.mul(gd),Td=I(e=>(e.context.isHighPrecisionModelViewMatrix=!0,K(`mat4`).onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar(`highpModelViewMatrix`),Ed=I(e=>{let t=e.context.isHighPrecisionModelViewMatrix;return K(`mat3`).onObjectUpdate(({object:e,camera:n})=>(t!==!0&&e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar(`highpModelNormalViewMatrix`),Dd=I(e=>e.shaderStage===`fragment`?e.context.clipSpace.toVarying(`v_clipSpace`):(Se("TSL: `clipSpace` is only available in fragment stage."),U())).once()(),Od=iu(`position`,`vec3`),kd=Od.toVarying(`positionLocal`),Ad=Od.toVarying(`positionPrevious`),jd=I(e=>gd.mul(kd).xyz.toVarying(e.getSubBuildProperty(`v_positionWorld`)),`vec3`).once([`POSITION`])(),Md=I(()=>kd.transformDirection(gd).toVarying(`v_positionWorldDirection`).normalize().toVar(`positionWorldDirection`),`vec3`).once([`POSITION`])(),Nd=I(e=>{if(e.shaderStage===`fragment`&&e.material.vertexNode){let e=ed.mul(Dd);return e.xyz.div(e.w).toVar(`positionView`)}return e.context.setupPositionView().toVarying(`v_positionView`)},`vec3`).once([`POSITION`,`VERTEX`])(),Pd=I(e=>{let t;return t=e.camera.isOrthographicCamera?H(0,0,1):Nd.negate().toVarying(`v_positionViewDirection`).normalize(),t.toVar(`positionViewDirection`)},`vec3`).once([`POSITION`])(),Fd=P(class extends A{static get type(){return`FrontFacingNode`}constructor(){super(`bool`),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!==`fragment`)return`true`;let{material:t}=e;return t.side===1?`false`:e.getFrontFacing()}}),Id=R(Fd).mul(2).sub(1),Ld=I(([e],{material:t})=>{let n=t.side;return n===1?e=e.mul(-1):n===2&&(e=e.mul(Id)),e}),Rd=iu(`normal`,`vec3`),zd=I(e=>e.geometry.hasAttribute(`normal`)===!1?(T(`TSL: Vertex attribute "normal" not found on geometry.`),H(0,1,0)):Rd,`vec3`).once()().toVar(`normalLocal`),Bd=Nd.dFdx().cross(Nd.dFdy()).normalize().toVar(`normalFlat`),Vd=I(e=>{let t;return t=e.isFlatShading()?Bd:qd(zd).toVarying(`v_normalViewGeometry`).normalize(),t},`vec3`).once()().toVar(`normalViewGeometry`),Hd=I(e=>{let t=Vd.transformDirection(td);return e.isFlatShading()!==!0&&(t=t.toVarying(`v_normalWorldGeometry`)),t.normalize().toVar(`normalWorldGeometry`)},`vec3`).once()(),Ud=I(e=>{let t;return e.subBuildFn===`NORMAL`||e.subBuildFn===`VERTEX`?(t=Vd,e.isFlatShading()!==!0&&(t=Ld(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},`vec3`).once([`NORMAL`,`VERTEX`])().toVar(`normalView`),Wd=Ud.transformDirection(td).toVar(`normalWorld`),Gd=I(({subBuildFn:e,context:t})=>{let n;return n=e===`NORMAL`||e===`VERTEX`?Ud:t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),n},`vec3`).once([`NORMAL`,`VERTEX`])().toVar(`clearcoatNormalView`),Kd=I(([e,t=gd])=>{let n=ho(t),r=e.div(H(n[0].dot(n[0]),n[1].dot(n[1]),n[2].dot(n[2])));return n.mul(r).xyz}),qd=I(([e],t)=>{let n=t.context.modelNormalViewMatrix;if(n)return n.transformDirection(e);let r=xd.mul(e);return td.transformDirection(r)}),Jd=I(()=>(T(`TSL: "transformedNormalView" is deprecated. Use "normalView" instead.`),Ud)).once([`NORMAL`,`VERTEX`])(),Yd=I(()=>(T(`TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.`),Wd)).once([`NORMAL`,`VERTEX`])(),Xd=I(()=>(T(`TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.`),Gd)).once([`NORMAL`,`VERTEX`])(),Zd=new kt,Qd=new yt,$d=K(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),ef=K(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),tf=K(new yt).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){let n=t.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation;return n?(Zd.copy(n),Qd.makeRotationFromEuler(Zd)):Qd.identity(),Qd}),nf=Pd.negate().reflect(Ud),rf=Pd.negate().refract(Ud,$d),af=nf.transformDirection(td).toVar(`reflectVector`),of=rf.transformDirection(td).toVar(`reflectVector`),sf=new Ar,cf=N(class extends uu{static get type(){return`CubeTextureNode`}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?`cubeDepthTexture`:`cubeTexture`}getDefaultUV(){let e=this.value;return e.mapping===301?af:e.mapping===302?of:(E(`CubeTextureNode: Mapping "%s" not supported.`,e.mapping),H(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===2001?H(t.x,t.y.negate(),t.z):t:((e.renderer.coordinateSystem===2001||!n.isRenderTargetTexture)&&(t=H(t.x.negate(),t.yz)),tf.mul(t))}generateUV(e,t){return t.build(e,this.sampler===!0?`vec3`:`ivec3`)}}).setParameterLength(1,4).setName(`cubeTexture`),lf=(e=sf,t=null,n=null,r=null)=>{let i;return e&&e.isCubeTextureNode===!0?(i=M(e.clone()),i.referenceNode=e,t!==null&&(i.uvNode=M(t)),n!==null&&(i.levelNode=M(n)),r!==null&&(i.biasNode=M(r))):i=cf(e,t,n,r),i},uf=(e=sf)=>cf(e),df=class extends ta{static get type(){return`ReferenceElementNode`}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},ff=class extends A{static get type(){return`ReferenceNode`}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split(`.`),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=k.OBJECT}element(e){return new df(this,M(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return T(`TSL: "label()" has been deprecated. Use "setName()" instead.`),this.setName(e)}setNodeType(e){let t=null;t=this.count===null?Array.isArray(this.getValueFromReference())?Su(null,e):e===`texture`?fu(null):e===`cubeTexture`?lf(null):K(null,e):yu(null,e,this.count),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let e=1;e<t.length;e++)n=n[t[e]];return n}updateReference(e){return this.reference=this.object===null?e.object:this.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},pf=(e,t,n)=>new ff(e,t,n),mf=(e,t,n,r)=>new ff(e,t,r,n),hf=class extends ff{static get type(){return`MaterialReferenceNode`}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material===null?e.material:this.material,this.reference}},gf=(e,t,n=null)=>new hf(e,t,n),_f=au(),vf=Nd.dFdx(),yf=Nd.dFdy(),bf=_f.dFdx(),xf=_f.dFdy(),Sf=Ud,Cf=yf.cross(Sf),wf=Sf.cross(vf),Tf=Cf.mul(bf.x).add(wf.mul(xf.x)),Ef=Cf.mul(bf.y).add(wf.mul(xf.y)),Df=Tf.dot(Tf).max(Ef.dot(Ef)),Of=Df.equal(0).select(0,Df.inverseSqrt()),kf=Tf.mul(Of).toVar(`tangentViewFrame`),Af=Ef.mul(Of).toVar(`bitangentViewFrame`),jf=iu(`tangent`,`vec4`),Mf=jf.xyz.toVar(`tangentLocal`),Nf=I(e=>{let t;return t=e.subBuildFn===`VERTEX`||e.geometry.hasAttribute(`tangent`)?Cd.mul(U(Mf,0)).xyz.toVarying(`v_tangentView`).normalize():kf,e.isFlatShading()!==!0&&(t=Ld(t)),t},`vec3`).once([`NORMAL`,`VERTEX`])().toVar(`tangentView`),Pf=Nf.transformDirection(td).toVarying(`v_tangentWorld`).normalize().toVar(`tangentWorld`),Ff=I(([e,t],n)=>{let r=e.mul(jf.w).xyz;return n.subBuildFn===`NORMAL`&&n.isFlatShading()!==!0&&(r=r.toVarying(t)),r}).once([`NORMAL`]),If=Ff(Rd.cross(jf),`v_bitangentGeometry`).normalize().toVar(`bitangentGeometry`),Lf=Ff(zd.cross(Mf),`v_bitangentLocal`).normalize().toVar(`bitangentLocal`),Rf=I(e=>{let t;return t=e.subBuildFn===`VERTEX`||e.geometry.hasAttribute(`tangent`)?Ff(Ud.cross(Nf),`v_bitangentView`).normalize():Af,e.isFlatShading()!==!0&&(t=Ld(t)),t},`vec3`).once([`NORMAL`,`VERTEX`])().toVar(`bitangentView`),zf=Ff(Wd.cross(Pf),`v_bitangentWorld`).normalize().toVar(`bitangentWorld`),Bf=ho(Nf,Rf,Ud).toVar(`TBNViewMatrix`),Vf=Pd.mul(Bf),Hf=(e,t)=>e.sub(Vf.mul(t)),Uf=I(()=>{let e=Bo.cross(Pd);return e=e.cross(Bo).normalize(),e=zc(e,Ud,Ro.mul(Oo.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()(),Wf=e=>M(e).mul(.5).add(.5),Gf=e=>M(e).mul(2).sub(1),Kf=e=>H(e,Qs(Vc(R(1).sub(Ac(e,e))))),qf=N(class extends ra{static get type(){return`NormalMapNode`}constructor(e,t=null){super(`vec3`),this.node=e,this.scaleNode=t,this.normalMapType=0,this.unpackNormalMode=``}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,i=this.node.mul(2).sub(1);if(t===0?r===`rg`?i=Kf(i.xy):r===`ga`?i=Kf(i.yw):r!==``&&console.error(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==``&&console.error(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let t=n;e.isFlatShading()===!0&&(t=Ld(t)),i=H(i.xy.mul(t),i.z)}let a=null;return t===1?a=qd(i):t===0?a=Bf.mul(i).normalize():(E(`NodeMaterial: Unsupported normal map type: ${t}`),a=Ud),a}}).setParameterLength(1,2),Jf=I(({textureNode:e,bumpScale:t})=>{let n=t=>e.isolate().context({getUV:e=>t(e.uvNode||au()),forceUVContext:!0}),r=R(n(e=>e));return V(R(n(e=>e.add(e.dFdx()))).sub(r),R(n(e=>e.add(e.dFdy()))).sub(r)).mul(t)}),Yf=I(e=>{let{surf_pos:t,surf_norm:n,dHdxy:r}=e,i=t.dFdx().normalize(),a=t.dFdy().normalize(),o=n,s=a.cross(o),c=o.cross(i),l=i.dot(s).mul(Id),u=l.sign().mul(r.x.mul(s).add(r.y.mul(c)));return l.abs().mul(n).sub(u).normalize()}),Xf=N(class extends ra{static get type(){return`BumpMapNode`}constructor(e,t=null){super(`vec3`),this.textureNode=e,this.scaleNode=t}setup(){let e=this.scaleNode===null?1:this.scaleNode;return Yf({surf_pos:Nd,surf_norm:Ud,dHdxy:Jf({textureNode:this.textureNode,bumpScale:e})})}}).setParameterLength(1,2),Zf=new Map,X=class e extends A{static get type(){return`MaterialNode`}constructor(e){super(),this.scope=e}getCache(e,t){let n=Zf.get(e);return n===void 0&&(n=gf(e,t),Zf.set(e,n)),n}getFloat(e){return this.getCache(e,`float`)}getColor(e){return this.getCache(e,`color`)}getTexture(e){return this.getCache(e===`map`?`map`:e+`Map`,`texture`)}setup(t){let n=t.context.material,r=this.scope,i=null;if(r===e.COLOR){let e=n.color===void 0?H():this.getColor(r);i=n.map&&n.map.isTexture===!0?e.mul(this.getTexture(`map`)):e}else if(r===e.OPACITY){let e=this.getFloat(r);i=n.alphaMap&&n.alphaMap.isTexture===!0?e.mul(this.getTexture(`alpha`)):e}else if(r===e.SPECULAR_STRENGTH)i=n.specularMap&&n.specularMap.isTexture===!0?this.getTexture(`specular`).r:R(1);else if(r===e.SPECULAR_INTENSITY){let e=this.getFloat(r);i=n.specularIntensityMap&&n.specularIntensityMap.isTexture===!0?e.mul(this.getTexture(r).a):e}else if(r===e.SPECULAR_COLOR){let e=this.getColor(r);i=n.specularColorMap&&n.specularColorMap.isTexture===!0?e.mul(this.getTexture(r).rgb):e}else if(r===e.ROUGHNESS){let e=this.getFloat(r);i=n.roughnessMap&&n.roughnessMap.isTexture===!0?e.mul(this.getTexture(r).g):e}else if(r===e.METALNESS){let e=this.getFloat(r);i=n.metalnessMap&&n.metalnessMap.isTexture===!0?e.mul(this.getTexture(r).b):e}else if(r===e.EMISSIVE){let e=this.getFloat(`emissiveIntensity`),t=this.getColor(r).mul(e);i=n.emissiveMap&&n.emissiveMap.isTexture===!0?t.mul(this.getTexture(r)):t}else if(r===e.NORMAL)n.normalMap?(i=qf(this.getTexture(`normal`),this.getCache(`normalScale`,`vec2`)),i.normalMapType=n.normalMapType,(n.normalMap.format==1030||n.normalMap.format==36285||n.normalMap.format==37490)&&(i.unpackNormalMode=`rg`)):i=n.bumpMap?Xf(this.getTexture(`bump`).r,this.getFloat(`bumpScale`)):Ud;else if(r===e.CLEARCOAT){let e=this.getFloat(r);i=n.clearcoatMap&&n.clearcoatMap.isTexture===!0?e.mul(this.getTexture(r).r):e}else if(r===e.CLEARCOAT_ROUGHNESS){let e=this.getFloat(r);i=n.clearcoatRoughnessMap&&n.clearcoatRoughnessMap.isTexture===!0?e.mul(this.getTexture(r).r):e}else if(r===e.CLEARCOAT_NORMAL)i=n.clearcoatNormalMap?qf(this.getTexture(r),this.getCache(r+`Scale`,`vec2`)):Ud;else if(r===e.SHEEN){let e=this.getColor(`sheenColor`).mul(this.getFloat(`sheen`));i=n.sheenColorMap&&n.sheenColorMap.isTexture===!0?e.mul(this.getTexture(`sheenColor`).rgb):e}else if(r===e.SHEEN_ROUGHNESS){let e=this.getFloat(r);i=n.sheenRoughnessMap&&n.sheenRoughnessMap.isTexture===!0?e.mul(this.getTexture(r).a):e,i=i.clamp(1e-4,1)}else if(r===e.ANISOTROPY)if(n.anisotropyMap&&n.anisotropyMap.isTexture===!0){let e=this.getTexture(r);i=mo(Fp.x,Fp.y,Fp.y.negate(),Fp.x).mul(e.rg.mul(2).sub(V(1)).normalize().mul(e.b))}else i=Fp;else if(r===e.IRIDESCENCE_THICKNESS){let e=pf(`1`,`float`,n.iridescenceThicknessRange);if(n.iridescenceThicknessMap){let t=pf(`0`,`float`,n.iridescenceThicknessRange);i=e.sub(t).mul(this.getTexture(r).g).add(t)}else i=e}else if(r===e.TRANSMISSION){let e=this.getFloat(r);i=n.transmissionMap?e.mul(this.getTexture(r).r):e}else if(r===e.THICKNESS){let e=this.getFloat(r);i=n.thicknessMap?e.mul(this.getTexture(r).g):e}else if(r===e.IOR)i=this.getFloat(r);else if(r===e.LIGHT_MAP)i=this.getTexture(r).rgb.mul(this.getFloat(`lightMapIntensity`));else if(r===e.AO)i=this.getTexture(r).r.sub(1).mul(this.getFloat(`aoMapIntensity`)).add(1);else if(r===e.LINE_DASH_OFFSET)i=n.dashOffset?this.getFloat(r):R(0);else{let e=this.getNodeType(t);i=this.getCache(r,e)}return i}};X.ALPHA_TEST=`alphaTest`,X.COLOR=`color`,X.OPACITY=`opacity`,X.SHININESS=`shininess`,X.SPECULAR=`specular`,X.SPECULAR_STRENGTH=`specularStrength`,X.SPECULAR_INTENSITY=`specularIntensity`,X.SPECULAR_COLOR=`specularColor`,X.REFLECTIVITY=`reflectivity`,X.ROUGHNESS=`roughness`,X.METALNESS=`metalness`,X.NORMAL=`normal`,X.CLEARCOAT=`clearcoat`,X.CLEARCOAT_ROUGHNESS=`clearcoatRoughness`,X.CLEARCOAT_NORMAL=`clearcoatNormal`,X.EMISSIVE=`emissive`,X.ROTATION=`rotation`,X.SHEEN=`sheen`,X.SHEEN_ROUGHNESS=`sheenRoughness`,X.ANISOTROPY=`anisotropy`,X.IRIDESCENCE=`iridescence`,X.IRIDESCENCE_IOR=`iridescenceIOR`,X.IRIDESCENCE_THICKNESS=`iridescenceThickness`,X.IOR=`ior`,X.TRANSMISSION=`transmission`,X.THICKNESS=`thickness`,X.ATTENUATION_DISTANCE=`attenuationDistance`,X.ATTENUATION_COLOR=`attenuationColor`,X.LINE_SCALE=`scale`,X.LINE_DASH_SIZE=`dashSize`,X.LINE_GAP_SIZE=`gapSize`,X.LINE_WIDTH=`linewidth`,X.LINE_DASH_OFFSET=`dashOffset`,X.POINT_SIZE=`size`,X.DISPERSION=`dispersion`,X.LIGHT_MAP=`light`,X.AO=`ao`;var Qf=P(X,X.ALPHA_TEST),$f=P(X,X.COLOR),ep=P(X,X.SHININESS),tp=P(X,X.EMISSIVE),np=P(X,X.OPACITY),rp=P(X,X.SPECULAR),ip=P(X,X.SPECULAR_INTENSITY),ap=P(X,X.SPECULAR_COLOR),op=P(X,X.SPECULAR_STRENGTH),sp=P(X,X.REFLECTIVITY),cp=P(X,X.ROUGHNESS),lp=P(X,X.METALNESS),up=P(X,X.NORMAL),dp=P(X,X.CLEARCOAT),fp=P(X,X.CLEARCOAT_ROUGHNESS),pp=P(X,X.CLEARCOAT_NORMAL),mp=P(X,X.ROTATION),hp=P(X,X.SHEEN),gp=P(X,X.SHEEN_ROUGHNESS),_p=P(X,X.ANISOTROPY),vp=P(X,X.IRIDESCENCE),yp=P(X,X.IRIDESCENCE_IOR),bp=P(X,X.IRIDESCENCE_THICKNESS),xp=P(X,X.TRANSMISSION),Sp=P(X,X.THICKNESS),Cp=P(X,X.IOR),wp=P(X,X.ATTENUATION_DISTANCE),Tp=P(X,X.ATTENUATION_COLOR),Ep=P(X,X.LINE_SCALE),Dp=P(X,X.LINE_DASH_SIZE),Op=P(X,X.LINE_GAP_SIZE),kp=P(X,X.LINE_WIDTH),Ap=P(X,X.LINE_DASH_OFFSET),jp=P(X,X.POINT_SIZE),Mp=P(X,X.DISPERSION),Np=P(X,X.LIGHT_MAP),Pp=P(X,X.AO),Fp=K(new Xe).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),Ip=I(e=>e.context.setupModelViewProjection(),`vec4`).once()().toVarying(`v_modelViewProjection`),Lp=N(class extends ta{static get type(){return`StorageArrayElementNode`}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):`void`}setup(e){return e.isAvailable(`storageBuffer`)===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.context.assign;if(n=e.isAvailable(`storageBuffer`)===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!==`compute`)?e.generatePBO(this):this.node.build(e):super.generate(e),r!==!0){let r=this.getNodeType(e);n=e.format(n,r,t)}return n}}).setParameterLength(2),Rp=class extends vu{static get type(){return`StorageBufferNode`}constructor(e,t=null,n=0){let r,i=null;t&&t.isStruct?(r=`struct`,i=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=Ii(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=i,this.access=Ji.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?`indirectStorageBuffer`:`storageBuffer`}element(e){return Lp(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Ji.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Ml(this.value),this._varying=dl(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable(`storageBuffer`)||e.isAvailable(`indirectStorageBuffer`))return super.getNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode===null?`void`:this.structTypeNode.getMemberType(e,t)}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable(`storageBuffer`)||e.isAvailable(`indirectStorageBuffer`))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},zp=(e,t=null,n=0)=>new Rp(e,t,n),Bp=class e extends A{static get type(){return`IndexNode`}constructor(e){super(`uint`),this.scope=e,this.isIndexNode=!0}generate(t){let n=this.getNodeType(t),r=this.scope,i;if(r===e.VERTEX)i=t.getVertexIndex();else if(r===e.INSTANCE)i=t.getInstanceIndex();else if(r===e.DRAW)i=t.getDrawIndex();else if(r===e.INVOCATION_LOCAL)i=t.getInvocationLocalIndex();else if(r===e.INVOCATION_SUBGROUP)i=t.getInvocationSubgroupIndex();else if(r===e.SUBGROUP)i=t.getSubgroupIndex();else throw Error(`THREE.IndexNode: Unknown scope: `+r);let a;return a=t.shaderStage===`vertex`||t.shaderStage===`compute`?i:dl(this).build(t,n),a}};Bp.VERTEX=`vertex`,Bp.INSTANCE=`instance`,Bp.SUBGROUP=`subgroup`,Bp.INVOCATION_LOCAL=`invocationLocal`,Bp.INVOCATION_SUBGROUP=`invocationSubgroup`,Bp.DRAW=`draw`;var Vp=P(Bp,Bp.VERTEX),Hp=P(Bp,Bp.INSTANCE),Up=P(Bp,Bp.SUBGROUP),Wp=P(Bp,Bp.INVOCATION_SUBGROUP),Gp=P(Bp,Bp.INVOCATION_LOCAL),Kp=P(Bp,Bp.DRAW),qp=class extends A{static get type(){return`InstanceNode`}constructor(e,t,n=null){super(`void`),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=k.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){let{instanceMatrix:e}=this;return e&&e.isStorageInstancedBufferAttribute===!0}get isStorageColor(){let{instanceColor:e}=this;return e&&e.isStorageInstancedBufferAttribute===!0}setup(e){let{instanceMatrixNode:t,instanceColorNode:n}=this;t===null&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);let{instanceColor:r,isStorageColor:i}=this;if(r&&n===null){if(i)n=zp(r,`vec3`,Math.max(r.count,1)).element(Hp);else{let e=new wr(r.array,3),t=r.usage===35048?Fl:Pl;this.bufferColor=e,n=H(t(e,`vec3`,3,0))}this.instanceColorNode=n}let a=t.mul(kd).xyz;if(kd.assign(a),e.needsPreviousData()&&Ad.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute(`normal`)){let e=Kd(zd,t);zd.assign(e)}this.instanceColorNode!==null&&wo(`vec3`,`vInstanceColor`).assign(this.instanceColorNode)}update(e){this.buffer!==null&&this.isStorageMatrix!==!0&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&this.bufferColor!==null&&this.isStorageColor!==!0&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),this.previousInstanceMatrixNode!==null&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){let t=e.object;return this.previousInstanceMatrixNode===null&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(Ad).xyz}_createInstanceMatrixNode(e,t){let n,{instanceMatrix:r}=this,{count:i}=r;if(this.isStorageMatrix)n=zp(r,`mat4`,Math.max(i,1)).element(Hp);else if(i*16*4<=t.getUniformBufferLimit())n=yu(r.array,`mat4`,Math.max(i,1)).element(Hp);else{let t=new Si(r.array,16,1);e===!0&&(this.buffer=t);let i=r.usage===35048?Fl:Pl;n=go(i(t,`vec4`,16,0),i(t,`vec4`,16,4),i(t,`vec4`,16,8),i(t,`vec4`,16,12))}return n}},Jp=N(qp).setParameterLength(2,3),Yp=N(class extends qp{static get type(){return`InstancedMeshNode`}constructor(e){let{count:t,instanceMatrix:n,instanceColor:r}=e;super(t,n,r),this.instancedMesh=e}}).setParameterLength(1),Xp=N(class extends A{static get type(){return`BatchNode`}constructor(e){super(`void`),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=Hp:this.batchingIdNode=Kp);let t=I(([e])=>{let t=z(ou(mu(this.batchMesh._indirectTexture),0).x).toConst(),n=z(e).mod(t).toConst(),r=z(e).div(t).toConst();return mu(this.batchMesh._indirectTexture,io(n,r)).x}).setLayout({name:`getIndirectIndex`,type:`uint`,inputs:[{name:`id`,type:`int`}]})(z(this.batchingIdNode)),n=this.batchMesh._matricesTexture,r=z(ou(mu(n),0).x).toConst(),i=R(t).mul(4).toInt().toConst(),a=i.mod(r).toConst(),o=i.div(r).toConst(),s=go(mu(n,io(a,o)),mu(n,io(a.add(1),o)),mu(n,io(a.add(2),o)),mu(n,io(a.add(3),o))),c=this.batchMesh._colorsTexture;if(c!==null){let e=I(([e])=>{let t=z(ou(mu(c),0).x).toConst(),n=e;return mu(c,io(n.mod(t).toConst(),n.div(t).toConst())).rgb}).setLayout({name:`getBatchingColor`,type:`vec3`,inputs:[{name:`id`,type:`int`}]})(t);wo(`vec3`,`vBatchColor`).assign(e)}let l=ho(s);kd.assign(s.mul(kd));let u=zd.div(H(l[0].dot(l[0]),l[1].dot(l[1]),l[2].dot(l[2]))),d=l.mul(u).xyz;zd.assign(d),e.hasGeometryAttribute(`tangent`)&&Mf.mulAssign(l)}}).setParameterLength(1),Zp=new WeakMap,Qp=class extends A{static get type(){return`SkinningNode`}constructor(e){super(`void`),this.skinnedMesh=e,this.updateType=k.OBJECT,this.skinIndexNode=iu(`skinIndex`,`uvec4`),this.skinWeightNode=iu(`skinWeight`,`vec4`),this.bindMatrixNode=pf(`bindMatrix`,`mat4`),this.bindMatrixInverseNode=pf(`bindMatrixInverse`,`mat4`),this.boneMatricesNode=mf(`skeleton.boneMatrices`,`mat4`,e.skeleton.bones.length),this.positionNode=kd,this.toPositionNode=kd,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){let{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:i,bindMatrixInverseNode:a}=this,o=e.element(n.x),s=e.element(n.y),c=e.element(n.z),l=e.element(n.w),u=i.mul(t),d=ms(o.mul(r.x).mul(u),s.mul(r.y).mul(u),c.mul(r.z).mul(u),l.mul(r.w).mul(u));return a.mul(d).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=zd,n=Mf){let{skinIndexNode:r,skinWeightNode:i,bindMatrixNode:a,bindMatrixInverseNode:o}=this,s=e.element(r.x),c=e.element(r.y),l=e.element(r.z),u=e.element(r.w),d=ms(i.x.mul(s),i.y.mul(c),i.z.mul(l),i.w.mul(u));return d=o.mul(d).mul(a),{skinNormal:d.transformDirection(t).xyz,skinTangent:d.transformDirection(n).xyz}}getPreviousSkinnedPosition(e){let t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=mf(`skeleton.previousBoneMatrices`,`mat4`,t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,Ad)}setup(e){e.needsPreviousData()&&Ad.assign(this.getPreviousSkinnedPosition(e));let t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute(`normal`)){let{skinNormal:t,skinTangent:n}=this.getSkinnedNormalAndTangent();zd.assign(t),e.hasGeometryAttribute(`tangent`)&&Mf.assign(n)}return t}generate(e,t){if(t!==`void`)return super.generate(e,t)}update(e){let t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;Zp.get(t)!==e.frameId&&(Zp.set(t,e.frameId),this.previousBoneMatricesNode!==null&&(t.previousBoneMatrices===null&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}},$p=e=>new Qp(e),em=(e,t=null)=>{let n=new Qp(e);return n.positionNode=zp(new wr(e.geometry.getAttribute(`position`).array,3),`vec3`).setPBO(!0).toReadOnly().element(Hp).toVar(),n.skinIndexNode=zp(new wr(new Uint32Array(e.geometry.getAttribute(`skinIndex`).array),4),`uvec4`).setPBO(!0).toReadOnly().element(Hp).toVar(),n.skinWeightNode=zp(new wr(e.geometry.getAttribute(`skinWeight`).array,4),`vec4`).setPBO(!0).toReadOnly().element(Hp).toVar(),n.bindMatrixNode=K(e.bindMatrix,`mat4`),n.bindMatrixInverseNode=K(e.bindMatrixInverse,`mat4`),n.boneMatricesNode=yu(e.skeleton.boneMatrices,`mat4`,e.skeleton.bones.length),n.toPositionNode=t,M(n)},tm=class extends A{static get type(){return`LoopNode`}constructor(e=[]){super(`void`),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let e=0,t=this.params.length-1;e<t;e++){let t=this.params[e],r=t.isNode!==!0&&t.name||this.getVarName(e);n[r]=Kl(r,t.isNode!==!0&&t.type||`int`)}let r=e.addStack(),i=this.params[this.params.length-1](n);t.returnsNode=i.context({nodeLoop:i}),t.stackNode=r;let a=this.params[0];if(a.isNode!==!0&&typeof a.update==`function`){let e=I(this.params[0].update)(n);t.updateNode=e.context({nodeLoop:e})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let r=0,i=n.length-1;r<i;r++){let i=n[r],a=!1,o=null,s=null,c=null,l=null,u=null,d=null;i.isNode?i.getNodeType(e)===`bool`?(a=!0,l=`bool`,s=i.build(e,l)):(l=`int`,c=this.getVarName(r),o=`0`,s=i.build(e,l),u=`<`):(l=i.type||`int`,c=i.name||this.getVarName(r),o=i.start,s=i.end,u=i.condition,d=i.update,typeof o==`number`?o=e.generateConst(l,o):o&&o.isNode&&(o=o.build(e,l)),typeof s==`number`?s=e.generateConst(l,s):s&&s.isNode&&(s=s.build(e,l)),o!==void 0&&s===void 0?(o+=` - 1`,s=`0`,u=`>=`):s!==void 0&&o===void 0&&(o=`0`,u=`<`),u===void 0&&(u=Number(o)>Number(s)?`>=`:`<`));let f;if(a)f=`while ( ${s} )`;else{let n={start:o,end:s},r=n.start,i=n.end,a,p=()=>u.includes(`<`)?`+=`:`-=`;if(d!=null)switch(typeof d){case`function`:a=e.flowStagesNode(t.updateNode,`void`).code.replace(/\t|;/g,``);break;case`number`:a=c+` `+p()+` `+e.generateConst(l,d);break;case`string`:a=c+` `+d;break;default:d.isNode?a=c+` `+p()+` `+d.build(e):(E(`TSL: 'Loop( { update: ... } )' is not a function, string or number.`,this.stackTrace),a=`break /* invalid update */`)}else d=l===`int`||l===`uint`?u.includes(`<`)?`++`:`--`:p()+` 1.`,a=c+` `+d;f=`for ( ${e.getVar(l,c)+` = `+r}; ${c+` `+u+` `+i}; ${a} )`}e.addFlowCode((r===0?`
|
|
272
|
+
`:``)+e.tab+f+` {
|
|
273
|
+
|
|
274
|
+
`).addFlowTab()}let i=r.build(e,`void`);t.returnsNode.build(e,`void`),e.removeFlowTab().addFlowCode(`
|
|
275
|
+
`+e.tab+i);for(let t=0,n=this.params.length-1;t<n;t++)e.addFlowCode((t===0?``:e.tab)+`}
|
|
276
|
+
|
|
277
|
+
`).removeFlowTab();e.addFlowTab()}},nm=(...e)=>new tm(Ya(e,`int`)).toStack(),rm=()=>Kl(`continue`).toStack(),im=()=>Kl(`break`).toStack(),am=new WeakMap,om=new gt,sm=I(({bufferMap:e,influence:t,stride:n,width:r,depth:i,offset:a})=>{let o=z(Vp).mul(n).add(a),s=o.div(r);return mu(e,io(o.sub(s.mul(r)),s)).depth(i).xyz.mul(t)});function cm(e){let t=e.morphAttributes.position!==void 0,n=e.morphAttributes.normal!==void 0,r=e.morphAttributes.color!==void 0,i=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=i===void 0?0:i.length,o=am.get(e);if(o===void 0||o.count!==a){o!==void 0&&o.texture.dispose();let i=e.morphAttributes.position||[],c=e.morphAttributes.normal||[],l=e.morphAttributes.color||[],u=0;t===!0&&(u=1),n===!0&&(u=2),r===!0&&(u=3);let d=e.attributes.position.count*u,f=1,p=4096;d>p&&(f=Math.ceil(d/p),d=p);let m=new Float32Array(d*f*4*a),h=new vt(m,d,f,a);h.type=v,h.needsUpdate=!0;let g=u*4;for(let e=0;e<a;e++){let a=i[e],o=c[e],s=l[e],u=d*f*4*e;for(let e=0;e<a.count;e++){let i=e*g;t===!0&&(om.fromBufferAttribute(a,e),m[u+i+0]=om.x,m[u+i+1]=om.y,m[u+i+2]=om.z,m[u+i+3]=0),n===!0&&(om.fromBufferAttribute(o,e),m[u+i+4]=om.x,m[u+i+5]=om.y,m[u+i+6]=om.z,m[u+i+7]=0),r===!0&&(om.fromBufferAttribute(s,e),m[u+i+8]=om.x,m[u+i+9]=om.y,m[u+i+10]=om.z,m[u+i+11]=s.itemSize===4?om.w:1)}}o={count:a,texture:h,stride:u,size:new Xe(d,f)},am.set(e,o);function s(){h.dispose(),am.delete(e),e.removeEventListener(`dispose`,s)}e.addEventListener(`dispose`,s)}return o}var lm=N(class extends A{static get type(){return`MorphNode`}constructor(e){super(`void`),this.mesh=e,this.morphBaseInfluence=K(1),this.updateType=k.OBJECT}setup(e){let{geometry:t}=e,n=t.morphAttributes.position!==void 0,r=t.hasAttribute(`normal`)&&t.morphAttributes.normal!==void 0,i=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,a=i===void 0?0:i.length,{texture:o,stride:s,size:c}=cm(t);n===!0&&kd.mulAssign(this.morphBaseInfluence),r===!0&&zd.mulAssign(this.morphBaseInfluence);let l=z(c.width);nm(a,({i:e})=>{let t=R(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?t.assign(mu(this.mesh.morphTexture,io(z(e).add(1),z(Hp))).r):t.assign(pf(`morphTargetInfluences`,`float`).element(e).toVar()),L(t.notEqual(0),()=>{n===!0&&kd.addAssign(sm({bufferMap:o,influence:t,stride:s,width:l,depth:e,offset:z(0)})),r===!0&&zd.addAssign(sm({bufferMap:o,influence:t,stride:s,width:l,depth:e,offset:z(1)}))})})}update(){let e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}).setParameterLength(1),um=class extends A{static get type(){return`LightingNode`}constructor(){super(`vec3`),this.isLightingNode=!0}},dm=class extends um{static get type(){return`AONode`}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},fm=N(class extends Qc{static get type(){return`LightingContextNode`}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){let{backdropNode:e,backdropAlphaNode:t}=this,n={directDiffuse:H().toVar(`directDiffuse`),directSpecular:H().toVar(`directSpecular`),indirectDiffuse:H().toVar(`indirectDiffuse`),indirectSpecular:H().toVar(`indirectSpecular`)};return{radiance:H().toVar(`radiance`),irradiance:H().toVar(`irradiance`),iblIrradiance:H().toVar(`iblIrradiance`),ambientOcclusion:R(1).toVar(`ambientOcclusion`),reflectedLight:n,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}),pm=class extends um{static get type(){return`IrradianceNode`}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},mm=new Xe,hm=class extends uu{static get type(){return`ViewportTextureNode`}constructor(e=Ou,t=null,n=null){let r=null;n===null?(r=new kr,r.minFilter=m,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=k.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer.getRenderTarget();return this.value=this.getTextureForReference(t),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget();n===null?t.getDrawingBufferSize(mm):mm.set(n.width,n.height);let r=this.getTextureForReference(n);(r.image.width!==mm.width||r.image.height!==mm.height)&&(r.image.width=mm.width,r.image.height=mm.height,r.needsUpdate=!0);let i=r.generateMipmaps;r.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(r),r.generateMipmaps=i}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},gm=N(hm).setParameterLength(0,3),_m=N(hm,null,null,{generateMipmaps:!0}).setParameterLength(0,3),vm=_m(),ym=(e=Ou,t=null)=>vm.sample(e,t),bm=null,xm=N(class extends hm{static get type(){return`ViewportDepthTextureNode`}constructor(e=Ou,t=null){bm===null&&(bm=new jr),super(e,t,bm)}getTextureForReference(){return bm}}).setParameterLength(0,2),Sm=class e extends A{static get type(){return`ViewportDepthNode`}constructor(e,t=null){super(`float`),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(t){let{scope:n}=this;return n===e.DEPTH_BASE?t.getFragDepth():super.generate(t)}setup({camera:t}){let{scope:n}=this,r=this.valueNode,i=null;return n===e.DEPTH_BASE?r!==null&&(i=jm().assign(r)):n===e.DEPTH?i=t.isPerspectiveCamera?Em(Nd.z,Zu,Qu):Cm(Nd.z,Zu,Qu):n===e.LINEAR_DEPTH&&(i=r===null?Cm(Nd.z,Zu,Qu):t.isPerspectiveCamera?Cm(Om(r,Zu,Qu),Zu,Qu):r),i}};Sm.DEPTH_BASE=`depthBase`,Sm.DEPTH=`depth`,Sm.LINEAR_DEPTH=`linearDepth`;var Cm=(e,t,n)=>e.add(t).div(t.sub(n)),wm=(e,t,n)=>e.add(n).div(n.sub(t)),Tm=I(([e,t,n],r)=>r.renderer.reversedDepthBuffer===!0?n.sub(t).mul(e).sub(n):t.sub(n).mul(e).sub(t)),Em=(e,t,n)=>t.add(e).mul(n).div(n.sub(t).mul(e)),Dm=(e,t,n)=>t.mul(e.add(n)).div(e.mul(t.sub(n))),Om=I(([e,t,n],r)=>r.renderer.reversedDepthBuffer===!0?t.mul(n).div(t.sub(n).mul(e).sub(t)):t.mul(n).div(n.sub(t).mul(e).sub(n))),km=(e,t,n)=>{t=t.max(1e-6).toVar();let r=Zs(e.negate().div(t)),i=Zs(n.div(t));return r.div(i)},Am=(e,t,n)=>{let r=e.mul(Xs(n.div(t)));return R(Math.E).pow(r).mul(t).negate()},jm=N(Sm,Sm.DEPTH_BASE),Mm=P(Sm,Sm.DEPTH),Nm=N(Sm,Sm.LINEAR_DEPTH).setParameterLength(0,1),Pm=Nm(xm());Mm.assign=e=>jm(e);var Fm=class e extends A{static get type(){return`ClippingNode`}constructor(t=e.DEFAULT){super(),this.scope=t}setup(t){super.setup(t);let{intersectionPlanes:n,unionPlanes:r}=t.clippingContext;return this.hardwareClipping=t.material.hardwareClipping,this.scope===e.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===e.HARDWARE?this.setupHardwareClipping(r,t):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return I(()=>{let n=R().toVar(`distanceToPlane`),r=R().toVar(`distanceToGradient`),i=R(1).toVar(`clipOpacity`),a=t.length;if(this.hardwareClipping===!1&&a>0){let e=Su(t).setGroup(G);nm(a,({i:t})=>{let a=e.element(t);n.assign(Nd.dot(a.xyz).negate().add(a.w)),r.assign(n.fwidth().div(2)),i.mulAssign(Uc(r.negate(),r,n))})}let o=e.length;if(o>0){let t=Su(e).setGroup(G),a=R(1).toVar(`intersectionClipOpacity`);nm(o,({i:e})=>{let i=t.element(e);n.assign(Nd.dot(i.xyz).negate().add(i.w)),r.assign(n.fwidth().div(2)),a.mulAssign(Uc(r.negate(),r,n).oneMinus())}),i.mulAssign(a.oneMinus())}To.a.mulAssign(i),To.a.equal(0).discard()})()}setupDefault(e,t){return I(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let e=Su(t).setGroup(G);nm(n,({i:t})=>{let n=e.element(t);Nd.dot(n.xyz).greaterThan(n.w).discard()})}let r=e.length;if(r>0){let t=Su(e).setGroup(G),n=ro(!0).toVar(`clipped`);nm(r,({i:e})=>{let r=t.element(e);n.assign(Nd.dot(r.xyz).greaterThan(r.w).and(n))}),n.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),I(()=>{let r=Su(e).setGroup(G),i=Cu(t.getClipDistance());nm(n,({i:e})=>{let t=r.element(e),n=Nd.dot(t.xyz).sub(t.w).negate();i.element(e).assign(n)})})()}};Fm.ALPHA_TO_COVERAGE=`alphaToCoverage`,Fm.DEFAULT=`default`,Fm.HARDWARE=`hardware`;var Im=()=>new Fm,Lm=()=>new Fm(Fm.ALPHA_TO_COVERAGE),Rm=()=>new Fm(Fm.HARDWARE),zm=.05,Bm=I(([e])=>rc(J(1e4,ic(J(17,e.x).add(J(.1,e.y)))).mul(ms(.1,uc(ic(J(13,e.y).add(e.x))))))),Vm=I(([e])=>Bm(V(Bm(e.xy),e.z))),Hm=I(([e])=>{let t=Tc(fc(hc(e.xyz)),fc(gc(e.xyz))),n=R(1).div(R(zm).mul(t)).toVar(`pixScale`),r=V(Ys(ec(Zs(n))),Ys(tc(Zs(n)))),i=V(Vm(ec(r.x.mul(e.xyz))),Vm(ec(r.y.mul(e.xyz)))),a=rc(Zs(n)),o=ms(J(a.oneMinus(),i.x),J(a,i.y)),s=wc(a,a.oneMinus()),c=H(o.mul(o).div(J(2,s).mul(q(1,s))),o.sub(J(.5,s)).div(q(1,s)),q(1,q(1,o).mul(q(1,o)).div(J(2,s).mul(q(1,s)))));return Bc(o.lessThan(s.oneMinus()).select(o.lessThan(s).select(c.x,c.y),c.z),1e-6,1)}).setLayout({name:`getAlphaHashThreshold`,type:`float`,inputs:[{name:`position`,type:`vec3`}]}),Um=class extends ru{static get type(){return`VertexColorNode`}constructor(e){super(null,`vec4`),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return`color`+(e>0?e:``)}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return r=n===!0?super.generate(e):e.generateConst(this.nodeType,new gt(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},Wm=(e=0)=>new Um(e),Gm=I(([e,t])=>wc(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:`blendBurn`,type:`vec3`,inputs:[{name:`base`,type:`vec3`},{name:`blend`,type:`vec3`}]}),Km=I(([e,t])=>wc(e.div(t.oneMinus()),1)).setLayout({name:`blendDodge`,type:`vec3`,inputs:[{name:`base`,type:`vec3`},{name:`blend`,type:`vec3`}]}),qm=I(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:`blendScreen`,type:`vec3`,inputs:[{name:`base`,type:`vec3`},{name:`blend`,type:`vec3`}]}),Jm=I(([e,t])=>zc(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),Ec(.5,e))).setLayout({name:`blendOverlay`,type:`vec3`,inputs:[{name:`base`,type:`vec3`},{name:`blend`,type:`vec3`}]}),Ym=I(([e,t])=>{let n=t.a.add(e.a.mul(t.a.oneMinus()));return U(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(n),n)}).setLayout({name:`blendColor`,type:`vec4`,inputs:[{name:`base`,type:`vec4`},{name:`blend`,type:`vec4`}]}),Xm=I(([e])=>U(e.rgb.mul(e.a),e.a),{color:`vec4`,return:`vec4`}),Zm=I(([e])=>(L(e.a.equal(0),()=>U(0)),U(e.rgb.div(e.a),e.a)),{color:`vec4`,return:`vec4`}),Qm=class extends $n{static get type(){return`NodeMaterial`}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith(`_`)===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(ji(t.slice(0,-4)),n.getCacheKey());return this.type+Mi(e)}build(e){this.setup(e)}setupObserver(e){return new Ei(e)}setup(e){e.context.setupNormal=()=>ul(this.setupNormal(e),`NORMAL`,`vec3`),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();t.contextNode.isContextNode===!0?e.context=o(o({},e.context),t.contextNode.getFlowContextData()):E('NodeMaterial: "renderer.contextNode" must be an instance of `context()`.'),this.contextNode!==null&&(this.contextNode.isContextNode===!0?e.context=o(o({},e.context),this.contextNode.getFlowContextData()):E('NodeMaterial: "material.contextNode" must be an instance of `context()`.')),e.addStack();let r=this.setupVertex(e),i=ul(this.vertexNode||r,`VERTEX`);e.context.clipSpace=i,e.stack.outputNode=i,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow(`vertex`,e.removeStack()),e.addStack();let a,s=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n===null?t.depth===!0&&this.setupDepth(e):n.depthBuffer===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);let r=this.setupLighting(e);s!==null&&e.stack.addToStack(s);let i=U(r,To.a).max(0);a=this.setupOutput(e,i),Go.assign(a);let o=this.outputNode!==null;if(o&&(a=this.outputNode),e.context.getOutput&&(a=e.context.getOutput(a,e)),n!==null){let e=t.getMRT(),n=this.mrtNode;e===null?n!==null&&(a=n):(o&&Go.assign(a),a=e,n!==null&&(a=e.merge(n)))}}else{let t=this.fragmentNode;t.isOutputStructNode!==!0&&(t=U(t)),a=this.setupOutput(e,t)}e.stack.outputNode=a,e.addFlow(`fragment`,e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?r=Lm():e.stack.addToStack(Im())}return r}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable(`clipDistance`)&&(e.stack.addToStack(Rm()),this.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let e=t.getMRT();e&&e.has(`depth`)?r=e.get(`depth`):t.logarithmicDepthBuffer===!0&&(r=n.isPerspectiveCamera?km(Nd.z,Zu,Qu):Cm(Nd.z,Zu,Qu))}r!==null&&Mm.assign(r).toStack()}setupPositionView(){return Cd.mul(kd).xyz}setupModelViewProjection(){return $u.mul(Nd)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),Ip}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&lm(t).toStack(),t.isSkinnedMesh===!0&&$p(t).toStack(),this.displacementMap){let e=gf(`displacementMap`,`texture`),t=gf(`displacementScale`,`float`),n=gf(`displacementBias`,`float`);kd.addAssign(zd.normalize().mul(e.x.mul(t).add(n)))}return t.isBatchedMesh&&Xp(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&Yp(t).toStack(),this.positionNode!==null&&kd.assign(ul(this.positionNode,`POSITION`,`vec3`)),kd}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&ro(this.maskNode).not().discard();let r=this.colorNode?U(this.colorNode):$f;this.vertexColors===!0&&n.hasAttribute(`color`)&&(r=r.mul(Wm())),t.instanceColor&&(r=wo(`vec3`,`vInstanceColor`).mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=wo(`vec3`,`vBatchColor`).mul(r)),To.assign(r);let i=this.opacityNode?R(this.opacityNode):np;To.a.assign(To.a.mul(i));let a=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(a=this.alphaTestNode===null?Qf:R(this.alphaTestNode),this.alphaToCoverage===!0?(To.a=Uc(a,a.add(bc(To.a)),To.a),To.a.lessThanEqual(0).discard()):To.a.lessThanEqual(a).discard()),this.alphaHash===!0&&To.a.lessThan(Hm(kd)).discard(),e.isOpaque()&&To.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?H(0):To.rgb}setupNormal(){return this.normalNode?H(this.normalNode):up}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?gf(`envMap`,`cubeTexture`):gf(`envMap`,`texture`)),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new pm(Np)),t}setupLights(e){let t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);r&&r.isLightingNode&&t.push(r);let i=this.aoNode;i===null&&e.material.aoMap&&(i=Pp),e.context.getAO&&(i=e.context.getAO(i,e)),i&&t.push(new dm(i));let a=this.lightsNode||e.lightsNode;return t.length>0&&(a=e.renderer.lighting.createNode([...a.getLights(),...t])),a}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:i}=this,a=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null,o=this.setupOutgoingLight(e);return a&&a.getScope().hasLights?o=fm(a,this.setupLightingModel(e)||null,n,r):n!==null&&(o=H(r===null?n:zc(o,n,r))),(i&&i.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(Do.assign(H(i||tp)),o=o.add(Do)),o}setupFog(e,t){let n=e.fogNode;return n&&(Go.assign(t),t=U(n.toVar())),t}setupPremultipliedAlpha(e,t){return Xm(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let t in e){let n=e[t];this[t]===void 0&&(this[t]=n,n&&n.clone&&(this[t]=n.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let e in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,e)===void 0&&t[e].get!==void 0&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{},nodes:{}});let n=$n.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:t,childNode:r}of this._getNodeChildren())n.inputNodes[t]=r.toJSON(e).uuid;function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images),a=r(e.nodes);t.length>0&&(n.textures=t),i.length>0&&(n.images=i),a.length>0&&(n.nodes=a)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}},$m=I(([e=Md])=>V(e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5))),eh=I(({f0:e,f90:t,dotVH:n})=>{let r=n.mul(-5.55473).sub(6.98316).mul(n).exp2();return e.mul(r.oneMinus()).add(t.mul(r))}),th=I(e=>e.diffuseColor.mul(1/Math.PI)),nh=I(e=>{if(e.geometry.hasAttribute(`normal`)===!1)return R(0);let t=Vd.dFdx().abs().max(Vd.dFdy().abs());return t.x.max(t.y).max(t.z)}),rh=I(e=>{let{roughness:t}=e,n=nh(),r=t.max(.0525);return r=r.add(n),r=r.min(1),r}),ih=I(({alpha:e,dotNL:t,dotNV:n})=>{let r=e.pow2(),i=t.mul(r.add(r.oneMinus().mul(n.pow2())).sqrt()),a=n.mul(r.add(r.oneMinus().mul(t.pow2())).sqrt());return hs(.5,i.add(a).max(Rs))}).setLayout({name:`V_GGX_SmithCorrelated`,type:`float`,inputs:[{name:`alpha`,type:`float`},{name:`dotNL`,type:`float`},{name:`dotNV`,type:`float`}]}),ah=I(({alphaT:e,alphaB:t,dotTV:n,dotBV:r,dotTL:i,dotBL:a,dotNV:o,dotNL:s})=>{let c=s.mul(H(e.mul(n),t.mul(r),o).length()),l=o.mul(H(e.mul(i),t.mul(a),s).length());return hs(.5,c.add(l))}).setLayout({name:`V_GGX_SmithCorrelated_Anisotropic`,type:`float`,inputs:[{name:`alphaT`,type:`float`,qualifier:`in`},{name:`alphaB`,type:`float`,qualifier:`in`},{name:`dotTV`,type:`float`,qualifier:`in`},{name:`dotBV`,type:`float`,qualifier:`in`},{name:`dotTL`,type:`float`,qualifier:`in`},{name:`dotBL`,type:`float`,qualifier:`in`},{name:`dotNV`,type:`float`,qualifier:`in`},{name:`dotNL`,type:`float`,qualifier:`in`}]}),oh=I(({alpha:e,dotNH:t})=>{let n=e.pow2(),r=t.pow2().mul(n.oneMinus()).oneMinus();return n.div(r.pow2()).mul(1/Math.PI)}).setLayout({name:`D_GGX`,type:`float`,inputs:[{name:`alpha`,type:`float`},{name:`dotNH`,type:`float`}]}),sh=R(1/Math.PI),ch=I(({alphaT:e,alphaB:t,dotNH:n,dotTH:r,dotBH:i})=>{let a=e.mul(t),o=H(t.mul(r),e.mul(i),a.mul(n)),s=o.dot(o),c=a.div(s);return sh.mul(a.mul(c.pow2()))}).setLayout({name:`D_GGX_Anisotropic`,type:`float`,inputs:[{name:`alphaT`,type:`float`,qualifier:`in`},{name:`alphaB`,type:`float`,qualifier:`in`},{name:`dotNH`,type:`float`,qualifier:`in`},{name:`dotTH`,type:`float`,qualifier:`in`},{name:`dotBH`,type:`float`,qualifier:`in`}]}),lh=I(({lightDirection:e,f0:t,f90:n,roughness:r,f:i,normalView:a=Ud,USE_IRIDESCENCE:o,USE_ANISOTROPY:s})=>{let c=r.pow2(),l=e.add(Pd).normalize(),u=a.dot(e).clamp(),d=a.dot(Pd).clamp(),f=a.dot(l).clamp(),p=eh({f0:t,f90:n,dotVH:Pd.dot(l).clamp()}),m,h;if(Wa(o)&&(p=Po.mix(p,i)),Wa(s)){let t=zo.dot(e),n=zo.dot(Pd),r=zo.dot(l),i=Bo.dot(e),a=Bo.dot(Pd),o=Bo.dot(l);m=ah({alphaT:Lo,alphaB:c,dotTV:n,dotBV:a,dotTL:t,dotBL:i,dotNV:d,dotNL:u}),h=ch({alphaT:Lo,alphaB:c,dotNH:f,dotTH:r,dotBH:o})}else m=ih({alpha:c,dotNL:u,dotNV:d}),h=oh({alpha:c,dotNH:f});return p.mul(m).mul(h)}),uh=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),dh=null,fh=I(({roughness:e,dotNV:t})=>{dh===null&&(dh=new Cr(uh,16,16,S,y),dh.name=`DFG_LUT`,dh.minFilter=p,dh.magFilter=p,dh.wrapS=u,dh.wrapT=u,dh.generateMipmaps=!1,dh.needsUpdate=!0);let n=V(e,t);return fu(dh,n).rg}),ph=I(({f:e,f90:t,dotVH:n})=>{let r=n.oneMinus().saturate(),i=r.mul(r),a=r.mul(i,i).clamp(0,.9999);return e.sub(H(t).mul(a)).div(a.oneMinus())}).setLayout({name:`Schlick_to_F0`,type:`vec3`,inputs:[{name:`f`,type:`vec3`},{name:`f90`,type:`float`},{name:`dotVH`,type:`float`}]}),mh=1/6,hh=e=>J(mh,J(e,J(e,e.negate().add(3)).sub(3)).add(1)),gh=e=>J(mh,J(e,J(e,J(3,e).sub(6))).add(4)),_h=e=>J(mh,J(e,J(e,J(-3,e).add(3)).add(3)).add(1)),vh=e=>J(mh,Mc(e,3)),yh=e=>hh(e).add(gh(e)),bh=e=>_h(e).add(vh(e)),xh=e=>ms(-1,gh(e).div(hh(e).add(gh(e)))),Sh=e=>ms(1,vh(e).div(_h(e).add(vh(e)))),Ch=(e,t,n)=>{let r=e.uvNode,i=J(r,t.zw).add(.5),a=ec(i),o=rc(i),s=yh(o.x),c=bh(o.x),l=xh(o.x),u=Sh(o.x),d=xh(o.y),f=Sh(o.y),p=V(a.x.add(l),a.y.add(d)).sub(.5).mul(t.xy),m=V(a.x.add(u),a.y.add(d)).sub(.5).mul(t.xy),h=V(a.x.add(l),a.y.add(f)).sub(.5).mul(t.xy),g=V(a.x.add(u),a.y.add(f)).sub(.5).mul(t.xy),_=yh(o.y).mul(ms(s.mul(e.sample(p).level(n)),c.mul(e.sample(m).level(n)))),v=bh(o.y).mul(ms(s.mul(e.sample(h).level(n)),c.mul(e.sample(g).level(n))));return _.add(v)},wh=I(([e,t])=>{let n=V(e.size(z(t))),r=V(e.size(z(t.add(1)))),i=hs(1,n),a=hs(1,r),o=Ch(e,U(i,n),ec(t)),s=Ch(e,U(a,r),tc(t));return rc(t).mix(o,s)}),Th=I(([e,t])=>wh(e,t.mul(su(e))));H(.04),R(1);var Eh=R(1),Dh=R(-2),Oh=R(.8),kh=R(-1),Ah=R(.4),jh=R(2),Mh=R(.305),Nh=R(3),Ph=R(.21),Fh=R(4),Ih=R(4),Lh=R(16),Rh=I(([e])=>{let t=H(uc(e)).toVar(),n=R(-1).toVar();return L(t.x.greaterThan(t.z),()=>{L(t.x.greaterThan(t.y),()=>{n.assign(Zc(e.x.greaterThan(0),0,3))}).Else(()=>{n.assign(Zc(e.y.greaterThan(0),1,4))})}).Else(()=>{L(t.z.greaterThan(t.y),()=>{n.assign(Zc(e.z.greaterThan(0),2,5))}).Else(()=>{n.assign(Zc(e.y.greaterThan(0),1,4))})}),n}).setLayout({name:`getFace`,type:`float`,inputs:[{name:`direction`,type:`vec3`}]}),zh=I(([e,t])=>{let n=V().toVar();return L(t.equal(0),()=>{n.assign(V(e.z,e.y).div(uc(e.x)))}).ElseIf(t.equal(1),()=>{n.assign(V(e.x.negate(),e.z.negate()).div(uc(e.y)))}).ElseIf(t.equal(2),()=>{n.assign(V(e.x.negate(),e.y).div(uc(e.z)))}).ElseIf(t.equal(3),()=>{n.assign(V(e.z.negate(),e.y).div(uc(e.x)))}).ElseIf(t.equal(4),()=>{n.assign(V(e.x.negate(),e.z).div(uc(e.y)))}).Else(()=>{n.assign(V(e.x,e.y).div(uc(e.z)))}),J(.5,n.add(1))}).setLayout({name:`getUV`,type:`vec2`,inputs:[{name:`direction`,type:`vec3`},{name:`face`,type:`float`}]}),Bh=I(([e])=>{let t=R(0).toVar();return L(e.greaterThanEqual(Oh),()=>{t.assign(Eh.sub(e).mul(kh.sub(Dh)).div(Eh.sub(Oh)).add(Dh))}).ElseIf(e.greaterThanEqual(Ah),()=>{t.assign(Oh.sub(e).mul(jh.sub(kh)).div(Oh.sub(Ah)).add(kh))}).ElseIf(e.greaterThanEqual(Mh),()=>{t.assign(Ah.sub(e).mul(Nh.sub(jh)).div(Ah.sub(Mh)).add(jh))}).ElseIf(e.greaterThanEqual(Ph),()=>{t.assign(Mh.sub(e).mul(Fh.sub(Nh)).div(Mh.sub(Ph)).add(Nh))}).Else(()=>{t.assign(R(-2).mul(Zs(J(1.16,e))))}),t}).setLayout({name:`roughnessToMip`,type:`float`,inputs:[{name:`roughness`,type:`float`}]}),Vh=I(([e,t])=>{let n=e.toVar();n.assign(J(2,n).sub(1));let r=H(n,1).toVar();return L(t.equal(0),()=>{r.assign(r.zyx)}).ElseIf(t.equal(1),()=>{r.assign(r.xzy),r.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{r.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{r.assign(r.zyx),r.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{r.assign(r.xzy),r.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{r.z.mulAssign(-1)}),r}).setLayout({name:`getDirection`,type:`vec3`,inputs:[{name:`uv`,type:`vec2`},{name:`face`,type:`float`}]}),Hh=I(([e,t,n,r,i,a])=>{let o=R(n),s=H(t),c=Bc(Bh(o),Dh,a),l=rc(c),u=ec(c),d=H(Uh(e,s,u,r,i,a)).toVar();return L(l.notEqual(0),()=>{let t=H(Uh(e,s,u.add(1),r,i,a)).toVar();d.assign(zc(d,t,l))}),d}),Uh=I(([e,t,n,r,i,a])=>{let o=R(n).toVar(),s=H(t),c=R(Rh(s)).toVar(),l=R(Tc(Ih.sub(o),0)).toVar();o.assign(Tc(o,Ih));let u=R(Ys(o)).toVar(),d=V(zh(s,c).mul(u.sub(2)).add(1)).toVar();return L(c.greaterThan(2),()=>{d.y.addAssign(u),c.subAssign(3)}),d.x.addAssign(c.mul(u)),d.x.addAssign(l.mul(J(3,Lh))),d.y.addAssign(J(4,Ys(a).sub(u))),d.x.mulAssign(r),d.y.mulAssign(i),e.sample(d).grad(V(),V())}),Wh=I(({envMap:e,mipInt:t,outputDirection:n,theta:r,axis:i,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:s})=>{let c=ac(r);return Uh(e,n.mul(c).add(i.cross(n).mul(ic(r))).add(i.mul(i.dot(n).mul(c.oneMinus()))),t,a,o,s)}),Gh=I(({n:e,latitudinal:t,poleAxis:n,outputDirection:r,weights:i,samples:a,dTheta:o,mipInt:s,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d})=>{let f=H(Zc(t,n,jc(n,r))).toVar();L(f.equal(H(0)),()=>{f.assign(H(r.z,0,r.x.negate()))}),f.assign(nc(f));let p=H().toVar();return p.addAssign(i.element(0).mul(Wh({theta:0,axis:f,outputDirection:r,mipInt:s,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d}))),nm({start:z(1),end:e},({i:e})=>{L(e.greaterThanEqual(a),()=>{im()});let t=R(o.mul(R(e))).toVar();p.addAssign(i.element(e).mul(Wh({theta:t.mul(-1),axis:f,outputDirection:r,mipInt:s,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d}))),p.addAssign(i.element(e).mul(Wh({theta:t,axis:f,outputDirection:r,mipInt:s,envMap:c,CUBEUV_TEXEL_WIDTH:l,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d})))}),U(p,1)}),Kh=I(([e])=>{let t=B(e).toVar();return t.assign(t.shiftLeft(B(16)).bitOr(t.shiftRight(B(16)))),t.assign(t.bitAnd(B(1431655765)).shiftLeft(B(1)).bitOr(t.bitAnd(B(2863311530)).shiftRight(B(1)))),t.assign(t.bitAnd(B(858993459)).shiftLeft(B(2)).bitOr(t.bitAnd(B(3435973836)).shiftRight(B(2)))),t.assign(t.bitAnd(B(252645135)).shiftLeft(B(4)).bitOr(t.bitAnd(B(4042322160)).shiftRight(B(4)))),t.assign(t.bitAnd(B(16711935)).shiftLeft(B(8)).bitOr(t.bitAnd(B(4278255360)).shiftRight(B(8)))),R(t).mul(23283064365386963e-26)}),qh=I(([e,t])=>V(R(e).div(R(t)),Kh(e))),Jh=I(([e,t,n])=>{let r=n.mul(n).toConst(),i=H(1,0,0).toConst(),a=jc(t,i).toConst(),o=Qs(e.x).toConst(),s=J(2,3.14159265359).mul(e.y).toConst(),c=o.mul(ac(s)).toConst(),l=o.mul(ic(s)).toVar(),u=J(.5,t.z.add(1)).toConst();l.assign(u.oneMinus().mul(Qs(c.mul(c).oneMinus())).add(u.mul(l)));let d=i.mul(c).add(a.mul(l)).add(t.mul(Qs(Tc(0,c.mul(c).add(l.mul(l)).oneMinus()))));return nc(H(r.mul(d.x),r.mul(d.y),Tc(0,d.z)))}),Yh=I(({roughness:e,mipInt:t,envMap:n,N_immutable:r,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:s})=>{let c=H(r).toVar(),l=H(0).toVar(),u=R(0).toVar();return L(e.lessThan(.001),()=>{l.assign(Uh(n,c,t,a,o,s))}).Else(()=>{let r=nc(jc(Zc(uc(c.z).lessThan(.999),H(0,0,1),H(1,0,0)),c)).toVar(),d=jc(c,r).toVar();nm({start:B(0),end:i},({i:f})=>{let p=Jh(qh(f,i),H(0,0,1),e),m=nc(r.mul(p.x).add(d.mul(p.y)).add(c.mul(p.z))),h=nc(m.mul(Ac(c,m).mul(2)).sub(c)),g=Tc(Ac(c,h),0);L(g.greaterThan(0),()=>{let e=Uh(n,h,t,a,o,s);l.addAssign(e.mul(g)),u.addAssign(g)})}),L(u.greaterThan(0),()=>{l.assign(l.div(u))})}),U(l,1)}),Xh=4,Zh=[.125,.215,.35,.446,.526,.582],Qh=20,$h=512,eg=new ci(-1,1,1,-1,0,1),tg=new si(90,1),ng=new Qt,rg=null,ig=0,ag=0,og=new O,sg=new WeakMap,cg=[3,1,5,0,4,2],lg=Vh(au(),iu(`faceIndex`)).normalize(),ug=H(lg.x,lg.y,lg.z),dg=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=og,renderTarget:s=null}=i;if(this._setSize(a),this._hasInitialized===!1){T(`PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.`);let a=s||this._allocateTarget();return i.renderTarget=a,this.fromSceneAsync(e,t,n,r,i),a}rg=this._renderer.getRenderTarget(),ig=this._renderer.getActiveCubeFace(),ag=this._renderer.getActiveMipmapLevel();let c=s||this._allocateTarget();return c.depthBuffer=!0,this._init(c),this._sceneToCubeUV(e,n,r,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromSceneAsync(e){var t=this;return c(function*(e,n=0,r=.1,i=100,a={}){return Se(`PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.`),yield t._renderer.init(),t.fromScene(e,n,r,i,a)}).apply(this,arguments)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){T(`PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.`),this._setSizeFromTexture(e);let n=t||this._allocateTarget();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}fromEquirectangularAsync(e,t=null){var n=this;return c(function*(){return Se(`PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.`),yield n._renderer.init(),n._fromTexture(e,t)})()}fromCubemap(e,t=null){if(this._hasInitialized===!1){T(`PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead.`),this._setSizeFromTexture(e);let n=t||this._allocateTarget();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}fromCubemapAsync(e,t=null){var n=this;return c(function*(){return Se(`PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.`),yield n._renderer.init(),n._fromTexture(e,t)})()}compileCubemapShader(){var e=this;return c(function*(){e._cubemapMaterial===null&&(e._cubemapMaterial=vg(),yield e._compileMaterial(e._cubemapMaterial))})()}compileEquirectangularShader(){var e=this;return c(function*(){e._equirectMaterial===null&&(e._equirectMaterial=yg(),yield e._compileMaterial(e._equirectMaterial))})()}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(rg,ig,ag),e.scissorTest=!1,mg(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),rg=this._renderer.getRenderTarget(),ig=this._renderer.getActiveCubeFace(),ag=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget();return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(){return pg(3*Math.max(this._cubeSize,112),4*this._cubeSize)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=pg(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=fg(t)),this._blurMaterial=gg(t,e.width,e.height),this._ggxMaterial=_g(t,e.width,e.height)}}_compileMaterial(e){var t=this;return c(function*(){let n=new br(new Jn,e);yield t._renderer.compile(n,eg)})()}_sceneToCubeUV(e,t,n,r,i){let a=tg;a.near=t,a.far=n;let o=[1,1,1,1,-1,1],s=[1,-1,1,-1,1,-1],c=this._renderer,l=c.autoClear;c.getClearColor(ng),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new br(new Nr,new cr({name:`PMREM.Background`,side:1,depthWrite:!1,depthTest:!1})));let u=this._backgroundBox,d=u.material,f=!1,p=e.background;p?p.isColor&&(d.color.copy(p),e.background=null,f=!0):(d.color.copy(ng),f=!0),c.setRenderTarget(r),c.clear(),f&&c.render(u,a);for(let t=0;t<6;t++){let n=t%3;n===0?(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+s[t],i.y,i.z)):n===1?(a.up.set(0,0,o[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+s[t],i.z)):(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+s[t]));let l=this._cubeSize;mg(r,n*l,t>2?l:0,l,l),c.render(e,a)}c.autoClear=l,e.background=p}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?this._cubemapMaterial===null&&(this._cubemapMaterial=vg(e)):this._equirectMaterial===null&&(this._equirectMaterial=yg(e));let i=r?this._cubemapMaterial:this._equirectMaterial;i.fragmentNode.value=e;let a=this._lodMeshes[0];a.material=i;let o=this._cubeSize;mg(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,eg)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,i=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let s=sg.get(a),c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l)*(0+c*1.25),{_lodMax:d}=this,f=this._sizeLods[n],p=3*f*(n>d-Xh?n-d+Xh:0),m=4*(this._cubeSize-f);e.texture.frame=(e.texture.frame||0)+1,s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,mg(i,p,m,3*f,2*f),r.setRenderTarget(i),r.render(o,eg),i.texture.frame=(i.texture.frame||0)+1,s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,mg(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,eg)}_blur(e,t,n,r,i){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)}_halfBlur(e,t,n,r,i,a,o){let s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&E(`blur direction must be either latitudinal or longitudinal!`);let l=this._lodMeshes[r];l.material=c;let u=sg.get(c),d=this._sizeLods[n]-1,f=isFinite(i)?Math.PI/(2*d):2*Math.PI/(2*Qh-1),p=i/f,m=isFinite(i)?1+Math.floor(3*p):Qh;m>Qh&&T(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Qh}`);let h=[],g=0;for(let e=0;e<Qh;++e){let t=e/p,n=Math.exp(-t*t/2);h.push(n),e===0?g+=n:e<m&&(g+=2*n)}for(let e=0;e<h.length;e++)h[e]=h[e]/g;e.texture.frame=(e.texture.frame||0)+1,u.envMap.value=e.texture,u.samples.value=m,u.weights.array=h,u.latitudinal.value=+(a===`latitudinal`),o&&(u.poleAxis.value=o);let{_lodMax:_}=this;u.dTheta.value=f,u.mipInt.value=_-n;let v=this._sizeLods[r];mg(t,3*v*(r>_-Xh?r-_+Xh:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,eg)}};function fg(e){let t=[],n=[],r=[],i=e,a=e-Xh+1+Zh.length;for(let o=0;o<a;o++){let a=Math.pow(2,i);t.push(a);let s=1/a;o>e-Xh?s=Zh[o-e+Xh-1]:o===0&&(s=0),n.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0],i=cg[e];f.set(r,18*i),p.set(d,12*i);let a=[i,i,i,i,i,i];m.set(a,6*i)}let h=new Jn;h.setAttribute(`position`,new Nn(f,3)),h.setAttribute(`uv`,new Nn(p,2)),h.setAttribute(`faceIndex`,new Nn(m,1)),r.push(new br(h,null)),i>Xh&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}function pg(e,t){let n=new _t(e,t,{magFilter:p,minFilter:p,generateMipmaps:!1,type:y,format:b,colorSpace:oe});return n.texture.mapping=306,n.texture.name=`PMREM.cubeUv`,n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function mg(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function hg(e){let t=new Qm;return t.depthTest=!1,t.depthWrite=!1,t.blending=0,t.name=`PMREM_${e}`,t}function gg(e,t,n){let r=Su(Array(Qh).fill(0)),i=K(new O(0,1,0)),a=K(0),s=R(Qh),c=K(0),l={n:s,latitudinal:c,weights:r,poleAxis:i,outputDirection:ug,dTheta:a,samples:K(1),envMap:fu(),mipInt:K(0),CUBEUV_TEXEL_WIDTH:R(1/t),CUBEUV_TEXEL_HEIGHT:R(1/n),CUBEUV_MAX_MIP:R(e)},u=hg(`blur`);return u.fragmentNode=Gh(o(o({},l),{},{latitudinal:c.equal(1)})),sg.set(u,l),u}function _g(e,t,n){let r={envMap:fu(),roughness:K(0),mipInt:K(0),CUBEUV_TEXEL_WIDTH:R(1/t),CUBEUV_TEXEL_HEIGHT:R(1/n),CUBEUV_MAX_MIP:R(e)},i=hg(`ggx`);return i.fragmentNode=Yh(o(o({},r),{},{N_immutable:ug,GGX_SAMPLES:B($h)})),sg.set(i,r),i}function vg(e){let t=hg(`cubemap`);return t.fragmentNode=lf(e,ug),t}function yg(e){let t=hg(`equirect`);return t.fragmentNode=fu(e,$m(ug),0),t}var bg=new WeakMap;function xg(e){let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Sg(e,t,n){let r=Cg(t),i=r.get(e);if((i===void 0?-1:i.pmremVersion)!==e.pmremVersion){let t=e.image;if(e.isCubeTexture)if(Tg(t))i=n.fromCubemap(e,i);else return null;else if(Eg(t))i=n.fromEquirectangular(e,i);else return null;i.pmremVersion=e.pmremVersion,r.set(e,i)}return i.texture}function Cg(e){let t=bg.get(e);return t===void 0&&(t=new WeakMap,bg.set(e,t)),t}var wg=class extends ra{static get type(){return`PMREMNode`}constructor(e,t=null,n=null){super(`vec3`),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new ht;r.isRenderTargetTexture=!0,this._texture=fu(r),this._width=K(0),this._height=K(0),this._maxMip=K(0),this.updateBeforeType=k.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=xg(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(t=r.isPMREMTexture===!0?r:Sg(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new dg(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=tf.mul(H(t.x,t.y.negate(),t.z));let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),Hh(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function Tg(e){if(e==null)return!1;let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function Eg(e){return e==null?!1:e.height>0}var Dg=N(wg).setParameterLength(1,3),Og=I(()=>{let e=H(Pd.z,0,Pd.x.negate()).normalize(),t=Pd.cross(e);return V(e.dot(Ud),t.dot(Ud)).mul(.495).add(.5)}).once([`NORMAL`,`VERTEX`])().toVar(`matcapUV`),kg=N(class extends ra{static get type(){return`RotateNode`}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)===`vec2`){let e=t.cos(),r=t.sin();return mo(e,r,r.negate(),e).mul(n)}else{let e=t,r=go(U(1,0,0,0),U(0,ac(e.x),ic(e.x).negate(),0),U(0,ic(e.x),ac(e.x),0),U(0,0,0,1)),i=go(U(ac(e.y),0,ic(e.y),0),U(0,1,0,0),U(ic(e.y).negate(),0,ac(e.y),0),U(0,0,0,1)),a=go(U(ac(e.z),ic(e.z).negate(),0,0),U(ic(e.z),ac(e.z),0,0),U(0,0,1,0),U(0,0,0,1));return r.mul(i).mul(a).mul(U(n,1)).xyz}}}).setParameterLength(2);Co(`vec3`),Co(`vec3`),Co(`vec3`);var Ag=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let t=0;t<e.length-1;t++){let r=e[t];n.has(r)===!1&&n.set(r,new WeakMap),n=n.get(r)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},jg=class extends W{static get type(){return`ParameterNode`}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),i;return r===null?(E(`TSL: Member "${t}" not found in struct "${n}".`,new ki),i=`float`):i=r.getMemberType(e,t),i}getHash(){return this.uuid}generate(){return this.name}},Mg=(e,t)=>new jg(e,t),Ng=N(class extends A{static get type(){return`StackNode`}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this.isStackNode=!0}getElementType(e){return this.hasOutput(e)?this.outputNode.getElementType(e):`void`}getNodeType(e){return this.hasOutput(e)?this.outputNode.getNodeType(e):`void`}getMemberType(e,t){return this.hasOutput(e)?this.outputNode.getMemberType(e,t):`void`}addToStack(e,t=this.nodes.length){return e.isNode===!0?(this.nodes.splice(t,0,e),this):(E(`TSL: Invalid node added to stack.`,new ki),this)}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new Ka(t);return this._currentCond=Zc(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=Zc(e,new Ka(t));return this._currentCond.elseNode=n,this._currentCond=n,this}Else(e){return this._currentCond.elseNode=new Ka(e),this}Switch(e){return this._expressionNode=M(e),this}Case(...e){let t=[];if(e.length>=2)for(let n=0;n<e.length-1;n++)t.push(this._expressionNode.equal(M(e[n])));else E(`TSL: Invalid parameter length. Case() requires at least two parameters.`,new ki);let n=e[e.length-1],r=new Ka(n),i=t[0];for(let e=1;e<t.length;e++)i=i.or(t[e]);let a=Zc(i,r);return this._currentCond===null?(this._currentCond=a,this.addToStack(this._currentCond)):(this._currentCond.elseNode=a,this._currentCond=a,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t[`node`+n++]=r);return t.outputNode||null}hasOutput(e){return this.outputNode&&this.outputNode.isNode&&this.outputNode.getNodeType(e)!==`void`}build(e,...t){let n=$a(),r=e.buildStage;Qa(this),e.setActiveStack(this);let i=t=>{if(this._currentNode=t,!(t.isVarNode&&t.isIntent(e)&&t.isAssign(e)!==!0)){if(r===`setup`)t.build(e);else if(r===`analyze`)t.build(e,this);else if(r===`generate`){let n=e.getDataFromNode(t,`any`).stages,r=n&&n[e.shaderStage];if(t.isVarNode&&r&&r.length===1&&r[0]&&r[0].isStackNode)return;t.build(e,`void`)}}},a=[...this.nodes];for(let e of a)i(e);this._currentNode=null;let o=this.nodes.filter(e=>a.indexOf(e)===-1);for(let e of o)i(e);let s;return s=this.hasOutput(e)?this.outputNode.build(e,...t):super.build(e,...t),Qa(n),e.removeActiveStack(this),s}}).setParameterLength(0,1);function Pg(e){return Object.entries(e).map(([e,t])=>typeof t==`string`?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var Fg=class extends A{static get type(){return`StructTypeNode`}constructor(e,t=null){super(`struct`),this.membersLayout=Pg(e),this.name=t,this.isStructLayoutNode=!0}getLength(){let e=Float32Array.BYTES_PER_ELEMENT,t=1,n=0;for(let r of this.membersLayout){let i=r.type,a=zi(i),o=Bi(i)/e;t=Math.max(t,o);let s=n%t%o;s!==0&&(n+=o-s),n+=a}return Math.ceil(n/t)*t}getMemberType(e,t){let n=this.membersLayout.find(e=>e.name===t);return n?n.type:`void`}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},Ig=class extends A{static get type(){return`StructNode`}constructor(e,t){super(`vec3`),this.structTypeNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(e=>e.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},Lg=(e,t=null)=>{let n=new Fg(e,t),r=(...t)=>{let r=null;if(t.length>0)if(t[0].isNode){r={};let n=Object.keys(e);for(let e=0;e<t.length;e++)r[n[e]]=t[e]}else r=t[0];return new Ig(n,r)};return r.layout=n,r.isStruct=!0,r},Rg=class extends A{static get type(){return`OutputStructNode`}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(){return`OutputType`}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let n=this.members,r=[];for(let t=0;t<n.length;t++){let i=`m`+t,a=n[t].getNodeType(e);r.push({name:i,type:a,index:t})}t.membersLayout=r,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,i=n===``?``:n+`.`;for(let t=0;t<r.length;t++){let n=r[t].build(e);e.addLineFlowCode(`${i}m${t} = ${n}`,this)}return n}},zg=N(Rg),Bg=class{constructor(e=1){this.blending=e,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},Vg=new Bg(0),Hg=new Bg(6);function Ug(e,t){for(let n=0;n<e.length;n++)if(e[n].name===t)return n;return-1}var Wg=N(class extends Rg{static get type(){return`MRTNode`}constructor(e){super(),this.outputNodes=e,this.blendModes={output:Hg},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||Vg}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t=o(o({},this.outputNodes),e.outputNodes),n=o(o({},this.blendModes),e.blendModes),r=Wg(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],i=n.textures;for(let e in t){let n=Ug(i,e);r[n]=U(t[e])}return this.members=r,super.setup(e)}}),Gg=class extends ra{static get type(){return`BitcastNode`}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}getNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n=``;if(this.inputType!==null){let t=this.valueNode.getNodeType(e);n=e.getTypeLength(t)===1?this.inputType:e.changeComponentType(t,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},Kg=F(Gg).setParameterLength(2),qg=e=>new Gg(e,`int`,`float`),Jg=e=>new Gg(e,`uint`,`float`),Yg=e=>new Gg(e,`float`,`int`),Xg=e=>new Gg(e,`float`,`uint`),Zg={},Qg=class e extends Y{static get type(){return`BitcountNode`}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n===`int`?t.assign(Kg(e,`uint`)):t.assign(e)}_returnDataNode(e){switch(e){case`uint`:return B;case`int`:return z;case`uvec2`:return ao;case`uvec3`:return co;case`uvec4`:return fo;case`ivec2`:return io;case`ivec3`:return so;case`ivec4`:return uo}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return I(([e])=>{let r=B(0);return this._resolveElementType(e,r,t),n(Jg(R(r.bitAnd(pc(r)))).shiftRight(23).sub(127))}).setLayout({name:e,type:t,inputs:[{name:`value`,type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return I(([e])=>{L(e.equal(B(0)),()=>B(32));let r=B(0),i=B(0);return this._resolveElementType(e,r,t),L(r.shiftRight(16).equal(0),()=>{i.addAssign(16),r.shiftLeftAssign(16)}),L(r.shiftRight(24).equal(0),()=>{i.addAssign(8),r.shiftLeftAssign(8)}),L(r.shiftRight(28).equal(0),()=>{i.addAssign(4),r.shiftLeftAssign(4)}),L(r.shiftRight(30).equal(0),()=>{i.addAssign(2),r.shiftLeftAssign(2)}),L(r.shiftRight(31).equal(0),()=>{i.addAssign(1)}),n(i)}).setLayout({name:e,type:t,inputs:[{name:`value`,type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return I(([e])=>{let r=B(0);return this._resolveElementType(e,r,t),r.assign(r.sub(r.shiftRight(B(1)).bitAnd(B(1431655765)))),r.assign(r.bitAnd(B(858993459)).add(r.shiftRight(B(2)).bitAnd(B(858993459)))),n(r.add(r.shiftRight(B(4))).bitAnd(B(252645135)).mul(B(16843009)).shiftRight(B(24)))}).setLayout({name:e,type:t,inputs:[{name:`value`,type:t}]})}_createMainLayout(e,t,n,r){let i=this._returnDataNode(t);return I(([e])=>{if(n===1)return i(r(e));{let t=i(0),a=[`x`,`y`,`z`,`w`];for(let i=0;i<n;i++){let n=a[i];t[n].assign(r(e[n]))}return t}}).setLayout({name:e,type:t,inputs:[{name:`value`,type:t}]})}setup(t){let{method:n,aNode:r}=this,{renderer:i}=t;if(i.backend.isWebGPUBackend)return super.setup(t);let a=this.getInputType(t),o=t.getElementType(a),s=t.getTypeLength(a),c=`${n}_base_${o}`,l=`${n}_${a}`,u=Zg[c];if(u===void 0){switch(n){case e.COUNT_LEADING_ZEROS:u=this._createLeadingZerosBaseLayout(c,o);break;case e.COUNT_TRAILING_ZEROS:u=this._createTrailingZerosBaseLayout(c,o);break;case e.COUNT_ONE_BITS:u=this._createOneBitsBaseLayout(c,o);break}Zg[c]=u}let d=Zg[l];return d===void 0&&(d=this._createMainLayout(l,a,s,u),Zg[l]=d),I(()=>d(r))()}};Qg.COUNT_TRAILING_ZEROS=`countTrailingZeros`,Qg.COUNT_LEADING_ZEROS=`countLeadingZeros`,Qg.COUNT_ONE_BITS=`countOneBits`;var $g=F(Qg,Qg.COUNT_TRAILING_ZEROS).setParameterLength(1),e_=F(Qg,Qg.COUNT_LEADING_ZEROS).setParameterLength(1),t_=F(Qg,Qg.COUNT_ONE_BITS).setParameterLength(1),n_=I(([e])=>{let t=e.toUint().mul(747796405).add(2891336453),n=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return n.shiftRight(22).bitXor(n).toFloat().mul(1/Math.pow(2,32))}),r_=(e,t)=>Mc(J(4,e.mul(q(1,e))),t),i_=(e,t)=>e.lessThan(.5)?r_(e.mul(2),t).div(2):q(1,r_(J(q(1,e),2),t).div(2)),a_=(e,t,n)=>Mc(hs(Mc(e,t),ms(Mc(e,t),Mc(q(1,e),n))),1/t),o_=(e,t)=>ic(Bs.mul(t.mul(e).sub(1))).div(Bs.mul(t.mul(e).sub(1))),s_=class extends ra{static get type(){return`PackFloatNode`}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}getNodeType(){return`uint`}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},c_=F(s_,`snorm`).setParameterLength(1),l_=F(s_,`unorm`).setParameterLength(1),u_=F(s_,`float16`).setParameterLength(1),d_=class extends ra{static get type(){return`UnpackFloatNode`}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}getNodeType(){return`vec2`}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},f_=F(d_,`snorm`).setParameterLength(1),p_=F(d_,`unorm`).setParameterLength(1),m_=F(d_,`float16`).setParameterLength(1),h_=I(([e])=>e.fract().sub(.5).abs()).setLayout({name:`tri`,type:`float`,inputs:[{name:`x`,type:`float`}]}),g_=I(([e])=>H(h_(e.z.add(h_(e.y.mul(1)))),h_(e.z.add(h_(e.x.mul(1)))),h_(e.y.add(h_(e.x.mul(1)))))).setLayout({name:`tri3`,type:`vec3`,inputs:[{name:`p`,type:`vec3`}]}),__=I(([e,t,n])=>{let r=H(e).toVar(),i=R(1.4).toVar(),a=R(0).toVar(),o=H(r).toVar();return nm({start:R(0),end:R(3),type:`float`,condition:`<=`},()=>{let e=H(g_(o.mul(2))).toVar();r.addAssign(e.add(n.mul(R(.1).mul(t)))),o.mulAssign(1.8),i.mulAssign(1.5),r.mulAssign(1.2);let s=R(h_(r.z.add(h_(r.x.add(h_(r.y)))))).toVar();a.addAssign(s.div(i)),o.addAssign(.14)}),a}).setLayout({name:`triNoise3D`,type:`float`,inputs:[{name:`position`,type:`vec3`},{name:`speed`,type:`float`},{name:`time`,type:`float`}]}),v_=N(class extends A{static get type(){return`FunctionOverloadingNode`}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}getNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,i=-1;for(let n of this.functionNodes){let a=n.shaderNode.layout;if(a===null)throw Error(`FunctionOverloadingNode: FunctionNode must be a layout.`);let o=a.inputs;if(t.length===o.length){let a=0;for(let n=0;n<t.length;n++){let r=t[n],i=o[n];r.getNodeType(e)===i.type&&a++}a>i&&(r=n,i=a)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}),y_=e=>(...t)=>v_(e,...t),b_=K(0).setGroup(G).onRenderUpdate(e=>e.time),x_=K(0).setGroup(G).onRenderUpdate(e=>e.deltaTime),S_=K(0,`uint`).setGroup(G).onRenderUpdate(e=>e.frameId),C_=(e=b_)=>e.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),w_=(e=b_)=>e.fract().round(),T_=(e=b_)=>e.add(.5).fract().mul(2).sub(1).abs(),E_=(e=b_)=>e.fract();function D_(e,t=null){return $c(t,{getUV:typeof e==`function`?e:()=>e})}var O_=I(([e,t,n=V(.5)])=>kg(e.sub(n),t).add(n)),k_=I(([e,t,n=V(.5)])=>{let r=e.sub(n),i=r.dot(r),a=i.mul(i).mul(t);return e.add(r.mul(a))}),A_=I(({position:e=null,horizontal:t=!0,vertical:n=!1})=>{let r;e===null?r=gd:(r=gd.toVar(),r[3][0]=e.x,r[3][1]=e.y,r[3][2]=e.z);let i=td.mul(r);return Wa(t)&&(i[0][0]=gd[0].length(),i[0][1]=0,i[0][2]=0),Wa(n)&&(i[1][0]=0,i[1][1]=gd[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,$u.mul(i).mul(kd)}),j_=I(([e=null])=>{let t=Nm();return Nm(xm(e)).sub(t).lessThan(0).select(Ou,e)}),M_=I(([e,t=au(),n=R(0)])=>{let r=e.x,i=e.y,a=n.mod(r.mul(i)).floor(),o=a.mod(r),s=i.sub(a.add(1).div(r).ceil()),c=e.reciprocal(),l=V(o,s);return t.add(l).mul(c)}),N_=I(([e,t=null,n=null,r=R(1),i=kd,a=zd])=>{let o=a.abs().normalize();o=o.div(o.dot(H(1)));let s=i.yz.mul(r),c=i.zx.mul(r),l=i.xy.mul(r),u=e.value,d=t===null?u:t.value,f=n===null?u:n.value;return ms(fu(u,s).mul(o.x),fu(d,c).mul(o.y),fu(f,l).mul(o.z))}),P_=(...e)=>N_(...e),F_=new Or,I_=new O,L_=new O,R_=new O,z_=new yt,B_=new O(0,0,-1),V_=new gt,H_=new O,U_=new O,W_=new gt,G_=new Xe,K_=new _t,q_=Ou.flipX();K_.depthTexture=new jr(1,1);var J_=!1,Y_=class e extends uu{static get type(){return`ReflectorNode`}constructor(e={}){super(e.defaultTexture||K_.texture,q_),this._reflectorBaseNode=e.reflector||new X_(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw Error(`THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. `);this._depthNode=new e({defaultTexture:K_.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},X_=class extends A{static get type(){return`ReflectorBaseNode`}constructor(e,t={}){super();let{target:n=new Kt,resolutionScale:r=1,generateMipmaps:i=!1,bounces:a=!0,depth:o=!1,samples:s=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(Se(`ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".`),this.resolutionScale=t.resolution),this.generateMipmaps=i,this.bounces=a,this.depth=o,this.samples=s,this.updateBeforeType=a?k.RENDER:k.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(G_),e.setSize(Math.round(G_.width*n),Math.round(G_.height*n))}setup(e){return this._updateResolution(K_,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new _t(0,0,{type:y,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=h,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new jr),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&J_)return!1;J_=!0;let{scene:t,camera:n,renderer:r,material:i}=e,{target:a}=this,o=this.getVirtualCamera(n),s=this.getRenderTarget(o);r.getDrawingBufferSize(G_),this._updateResolution(s,r),L_.setFromMatrixPosition(a.matrixWorld),R_.setFromMatrixPosition(n.matrixWorld),z_.extractRotation(a.matrixWorld),I_.set(0,0,1),I_.applyMatrix4(z_),H_.subVectors(L_,R_);let c=H_.dot(I_)>0,l=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){J_=!1;return}l=!0}H_.reflect(I_).negate(),H_.add(L_),z_.extractRotation(n.matrixWorld),B_.set(0,0,-1),B_.applyMatrix4(z_),B_.add(R_),U_.subVectors(L_,B_),U_.reflect(I_).negate(),U_.add(L_),o.coordinateSystem=n.coordinateSystem,o.position.copy(H_),o.up.set(0,1,0),o.up.applyMatrix4(z_),o.up.reflect(I_),o.lookAt(U_),o.near=n.near,o.far=n.far,o.updateMatrixWorld(),o.projectionMatrix.copy(n.projectionMatrix),F_.setFromNormalAndCoplanarPoint(I_,L_),F_.applyMatrix4(o.matrixWorldInverse),V_.set(F_.normal.x,F_.normal.y,F_.normal.z,F_.constant);let u=o.projectionMatrix;W_.x=(Math.sign(V_.x)+u.elements[8])/u.elements[0],W_.y=(Math.sign(V_.y)+u.elements[9])/u.elements[5],W_.z=-1,W_.w=(1+u.elements[10])/u.elements[14],V_.multiplyScalar(1/V_.dot(W_)),u.elements[2]=V_.x,u.elements[6]=V_.y,u.elements[10]=r.coordinateSystem===2001?V_.z-0:V_.z+1-0,u.elements[14]=V_.w,this.textureNode.value=s.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=s.depthTexture),i.visible=!1;let d=r.getRenderTarget(),f=r.getMRT(),p=r.autoClear;r.setMRT(null),r.setRenderTarget(s),r.autoClear=!0;let m=t.name;t.name=(t.name||`Scene`)+` [ Reflector ]`,l?(r.clear(),this.hasOutput=!1):(r.render(t,o),this.hasOutput=!0),t.name=m,r.setMRT(f),r.setRenderTarget(d),r.autoClear=p,i.visible=!0,J_=!1,this.forceUpdate=!1}get resolution(){return Se(`ReflectorNode: The "resolution" property has been renamed to "resolutionScale".`),this.resolutionScale}set resolution(e){Se(`ReflectorNode: The "resolution" property has been renamed to "resolutionScale".`),this.resolutionScale=e}},Z_=e=>new Y_(e),Q_=new ci(-1,1,1,-1,0,1),$_=new class extends Jn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute(`position`,new In([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(`uv`,new In(t,2))}},ev=class extends br{constructor(e=null){super($_,e),this.camera=Q_,this.isQuadMesh=!0}renderAsync(e){var t=this;return c(function*(){Se(`QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.`),yield e.init(),e.render(t,Q_)})()}render(e){e.render(this,Q_)}},tv=new Xe,nv=class extends uu{static get type(){return`RTTNode`}constructor(e,t=null,n=null,r={type:y}){let i=new _t(t,n,r);super(i.texture,au()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=i,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new ev(new Qm),this.updateBeforeType=k.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name=`RTT`,this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;let n=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoResize===!0){let t=e.getPixelRatio(),n=e.getSize(tv),r=Math.floor(n.width*t),i=Math.floor(n.height*t);(r!==this.renderTarget.width||i!==this.renderTarget.height)&&(this.renderTarget.setSize(r,i),this.textureNeedsUpdate=!0)}let t=`RTT`;this.node.name&&(t=this.node.name+` [ `+t+` ]`),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;let n=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(n)}clone(){let e=new uu(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},rv=(e,...t)=>new nv(M(e),...t),iv=(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():rv(e,...t),av=I(([e,t,n],r)=>{let i;r.renderer.coordinateSystem===2001?(e=V(e.x,e.y.oneMinus()).mul(2).sub(1),i=U(H(e,t),1)):i=U(H(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);let a=U(n.mul(i));return a.xyz.div(a.w)}),ov=I(([e,t])=>{let n=t.mul(U(e,1)),r=n.xy.div(n.w).mul(.5).add(.5).toVar();return V(r.x,r.y.oneMinus())}),sv=I(([e,t,n])=>{let r=ou(mu(t)),i=io(e.mul(r)).toVar(),a=mu(t,i).toVar(),o=mu(t,i.sub(io(2,0))).toVar(),s=mu(t,i.sub(io(1,0))).toVar(),c=mu(t,i.add(io(1,0))).toVar(),l=mu(t,i.add(io(2,0))).toVar(),u=mu(t,i.add(io(0,2))).toVar(),d=mu(t,i.add(io(0,1))).toVar(),f=mu(t,i.sub(io(0,1))).toVar(),p=mu(t,i.sub(io(0,2))).toVar(),m=uc(q(R(2).mul(s).sub(o),a)).toVar(),h=uc(q(R(2).mul(c).sub(l),a)).toVar(),g=uc(q(R(2).mul(d).sub(u),a)).toVar(),_=uc(q(R(2).mul(f).sub(p),a)).toVar(),v=av(e,a,n).toVar();return nc(jc(m.lessThan(h).select(v.sub(av(e.sub(V(R(1).div(r.x),0)),s,n)),v.negate().add(av(e.add(V(R(1).div(r.x),0)),c,n))),g.lessThan(_).select(v.sub(av(e.add(V(0,R(1).div(r.y))),d,n)),v.negate().add(av(e.sub(V(0,R(1).div(r.y))),f,n)))))}),cv=I(([e])=>rc(R(52.9829189).mul(rc(Ac(e,V(.06711056,.00583715)))))).setLayout({name:`interleavedGradientNoise`,type:`float`,inputs:[{name:`position`,type:`vec2`}]}),lv=I(([e,t,n])=>{let r=R(2.399963229728653),i=Qs(R(e).add(.5).div(R(t))),a=R(e).mul(r).add(n);return V(ac(a),ic(a)).mul(i)}).setLayout({name:`vogelDiskSample`,type:`vec2`,inputs:[{name:`sampleIndex`,type:`int`},{name:`samplesCount`,type:`int`},{name:`phi`,type:`float`}]}),uv=class extends A{static get type(){return`SampleNode`}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(au())}sample(e){return this.callback(e)}},dv=(e,t=null)=>new uv(e,M(t)),fv=class e extends A{static get type(){return`EventNode`}constructor(t,n){super(`void`),this.eventType=t,this.callback=n,t===e.OBJECT?this.updateType=k.OBJECT:t===e.MATERIAL?this.updateType=k.RENDER:t===e.BEFORE_OBJECT?this.updateBeforeType=k.OBJECT:t===e.BEFORE_MATERIAL&&(this.updateBeforeType=k.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};fv.OBJECT=`object`,fv.MATERIAL=`material`,fv.BEFORE_OBJECT=`beforeObject`,fv.BEFORE_MATERIAL=`beforeMaterial`;var pv=(e,t)=>new fv(e,t).toStack(),mv=e=>pv(fv.OBJECT,e),hv=e=>pv(fv.MATERIAL,e),gv=e=>pv(fv.BEFORE_OBJECT,e),_v=e=>pv(fv.BEFORE_MATERIAL,e),vv=class extends wr{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},yv=class extends Nn{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},bv=(e,t=`float`)=>{let n,r;return t.isStruct===!0?(n=t.layout.getLength(),r=Li(`float`)):(n=Ri(t),r=Li(t)),zp(new yv(e,n,r),t,e)},xv=(e,t=`float`)=>{let n,r;t.isStruct===!0?(n=t.layout.getLength(),r=Li(`float`)):(n=Ri(t),r=Li(t));let i=new vv(e,n,r);return zp(i,t,i.count)},Sv=P(class extends A{static get type(){return`PointUVNode`}constructor(){super(`vec2`),this.isPointUVNode=!0}generate(){return`vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )`}}),Cv=new kt,wv=new yt,Tv=K(0).setGroup(G).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),Ev=K(1).setGroup(G).onRenderUpdate(({scene:e})=>e.backgroundIntensity),Dv=K(new yt).setGroup(G).onRenderUpdate(({scene:e})=>{let t=e.background;return t!==null&&t.isTexture&&t.mapping!==300?(Cv.copy(e.backgroundRotation),Cv.x*=-1,Cv.y*=-1,Cv.z*=-1,wv.makeRotationFromEuler(Cv)):wv.identity(),wv}),Ov=N(class extends uu{static get type(){return`StorageTextureNode`}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Ji.WRITE_ONLY}getInputType(){return`storageTexture`}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){let n;return n=this.storeNode===null?super.generate(e,t):this.generateStore(e),n}generateSnippet(e,t,n,r,i,a,o,s,c){let l=this.value;return e.generateStorageTextureLoad(l,t,n,r,a,c)}toReadWrite(){return this.setAccess(Ji.READ_WRITE)}toReadOnly(){return this.setAccess(Ji.READ_ONLY)}toWriteOnly(){return this.setAccess(Ji.WRITE_ONLY)}generateStore(e){let{uvNode:t,storeNode:n,depthNode:r}=e.getNodeProperties(this),i=super.generate(e,`property`),a=t.build(e,this.value.is3DTexture===!0?`uvec3`:`uvec2`),o=n.build(e,`vec4`),s=r?r.build(e,`int`):null,c=e.generateTextureStore(e,i,a,s,o);e.addLineFlowCode(c,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}).setParameterLength(1,3),kv=(e,t,n)=>{let r;return e.isStorageTextureNode===!0?(r=e.clone(),r.uvNode=t,r.storeNode=n):r=Ov(e,t,n),n!==null&&r.toStack(),r},Av=I(({texture:e,uv:t})=>{let n=1e-4,r=H().toVar();return L(t.x.lessThan(n),()=>{r.assign(H(1,0,0))}).ElseIf(t.y.lessThan(n),()=>{r.assign(H(0,1,0))}).ElseIf(t.z.lessThan(n),()=>{r.assign(H(0,0,1))}).ElseIf(t.x.greaterThan(1-n),()=>{r.assign(H(-1,0,0))}).ElseIf(t.y.greaterThan(1-n),()=>{r.assign(H(0,-1,0))}).ElseIf(t.z.greaterThan(1-n),()=>{r.assign(H(0,0,-1))}).Else(()=>{let n=.01,i=e.sample(t.add(H(-.01,0,0))).r.sub(e.sample(t.add(H(n,0,0))).r),a=e.sample(t.add(H(0,-.01,0))).r.sub(e.sample(t.add(H(0,n,0))).r),o=e.sample(t.add(H(0,0,-.01))).r.sub(e.sample(t.add(H(0,0,n))).r);r.assign(H(i,a,o))}),r.normalize()}),jv=N(class extends uu{static get type(){return`Texture3DNode`}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return`texture3D`}getDefaultUV(){return H(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?`vec3`:`ivec3`)}generateOffset(e,t){return t.build(e,`ivec3`)}normal(e){return Av({texture:this,uv:e})}}).setParameterLength(1,3),Mv=(...e)=>jv(...e).setSampler(!1),Nv=(e,t,n)=>jv(e,t).level(n),Pv=class extends ff{static get type(){return`UserDataNode`}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData===null?e.object.userData:this.userData,this.reference}},Fv=(e,t,n)=>new Pv(e,t,n),Iv=new WeakMap,Lv=class extends ra{static get type(){return`VelocityNode`}constructor(){super(`vec2`),this.projectionMatrix=null,this.updateType=k.OBJECT,this.updateAfterType=k.OBJECT,this.previousModelWorldMatrix=K(new yt),this.previousProjectionMatrix=K(new yt).setGroup(G),this.previousCameraViewMatrix=K(new yt)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=zv(n);this.previousModelWorldMatrix.value.copy(r);let i=Rv(t);i.frameId!==e&&(i.frameId=e,i.previousProjectionMatrix===void 0?(i.previousProjectionMatrix=new yt,i.previousCameraViewMatrix=new yt,i.currentProjectionMatrix=new yt,i.currentCameraViewMatrix=new yt,i.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}updateAfter({object:e}){zv(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?$u:K(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Cd).mul(kd),r=this.previousProjectionMatrix.mul(t).mul(Ad);return q(n.xy.div(n.w),r.xy.div(r.w))}};function Rv(e){let t=Iv.get(e);return t===void 0&&(t={},Iv.set(e,t)),t}function zv(e,t=0){let n=Rv(e),r=n[t];return r===void 0&&(n[t]=r=new yt,n[t].copy(e.matrixWorld)),r}var Bv=P(Lv),Vv=I(([e])=>Gv(e.rgb)),Hv=I(([e,t=R(1)])=>t.mix(Gv(e.rgb),e.rgb)),Uv=I(([e,t=R(1)])=>{let n=ms(e.r,e.g,e.b).div(3),r=e.r.max(e.g.max(e.b)),i=r.sub(n).mul(t).mul(-3);return zc(e.rgb,r,i)}),Wv=I(([e,t=R(1)])=>{let n=H(.57735,.57735,.57735),r=t.cos();return H(e.rgb.mul(r).add(n.cross(e.rgb).mul(t.sin()).add(n.mul(Ac(n,e.rgb).mul(r.oneMinus())))))}),Gv=(e,t=H(at.getLuminanceCoefficients(new O)))=>Ac(e,t),Kv=I(([e,t=H(1),n=H(0),r=H(1),i=R(1),a=H(at.getLuminanceCoefficients(new O,oe))])=>{let o=e.rgb.dot(H(a)),s=Tc(e.rgb.mul(t).add(n),0).toVar(),c=s.pow(r).toVar();return L(s.r.greaterThan(0),()=>{s.r.assign(c.r)}),L(s.g.greaterThan(0),()=>{s.g.assign(c.g)}),L(s.b.greaterThan(0),()=>{s.b.assign(c.b)}),s.assign(o.add(s.sub(o).mul(i))),U(s.rgb,e.a)}),qv=I(([e,t])=>e.mul(t).floor().div(t)),Jv=null,Yv=N(class extends hm{static get type(){return`ViewportSharedTextureNode`}constructor(e=Ou,t=null){Jv===null&&(Jv=new kr),super(e,t,Jv)}getTextureForReference(){return Jv}updateReference(){return this}}).setParameterLength(0,2),Xv=new Xe,Zv=class extends uu{static get type(){return`PassTextureNode`}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},Qv=class extends Zv{static get type(){return`PassMultipleTextureNode`}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}},$v=class e extends ra{static get type(){return`PassNode`}constructor(e,t,n,r={}){super(`vec4`),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;let i=new jr;i.isRenderTargetTexture=!0,i.name=`depth`;let a=new _t(this._width*this._pixelRatio,this._height*this._pixelRatio,o({type:y},r));a.texture.name=`output`,a.depthTexture=i,this.renderTarget=a,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:a.texture,depth:i},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=K(0),this._cameraFar=K(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=k.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return T(`PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead.`),this.setResolutionScale(e)}getResolution(){return T(`PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead.`),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e=`output`){let t=this._textureNodes[e];return t===void 0&&(t=new Qv(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e=`output`){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new Qv(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e=`depth`){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=Om(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e=`depth`){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=Cm(i,n,r)}return t}compileAsync(e){var t=this;return c(function*(){let n=e.getRenderTarget(),r=e.getMRT();e.setRenderTarget(t.renderTarget),e.setMRT(t._mrt),yield e.compileAsync(t.scene,t.camera),e.setRenderTarget(n),e.setMRT(r)})()}setup({renderer:t}){return this.renderTarget.samples=this.options.samples===void 0?t.samples:this.options.samples,this.renderTarget.texture.type=t.getOutputBufferType(),this.scope===e.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,i,a=t.getOutputRenderTarget();a&&a.isXRRenderTarget===!0?(i=1,r=t.xr.getCamera(),t.xr.updateCamera(r),Xv.set(a.width,a.height)):(r=this.camera,i=t.getPixelRatio(),t.getSize(Xv)),this._pixelRatio=i,this.setSize(Xv.width,Xv.height);let s=t.getRenderTarget(),c=t.getMRT(),l=t.autoClear,u=t.transparent,d=t.opaque,f=r.layers.mask,p=t.contextNode,m=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let e in this._previousTextures)this.toggleTexture(e);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:$c(o(o({},t.contextNode.getFlowContextData()),this.contextNode.getFlowContextData()))}),t.contextNode=this._contextNodeCache.context);let h=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=h,n.overrideMaterial=m,t.setRenderTarget(s),t.setMRT(c),t.autoClear=l,t.transparent=u,t.opaque=d,t.contextNode=p,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._pixelRatio*this._resolutionScale),r=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null&&this.renderTarget.scissor.copy(this._scissor),this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new gt),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r),this._scissor.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new gt),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r),this._viewport.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}};$v.COLOR=`color`,$v.DEPTH=`depth`;var ey=(e,t,n)=>new $v($v.COLOR,e,t,n),ty=(e,t)=>new Zv(e,t),ny=(e,t,n)=>new $v($v.DEPTH,e,t,n),ry=class extends $v{static get type(){return`ToonOutlinePassNode`}constructor(e,t,n,r,i){super($v.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=i,this._materialCache=new WeakMap,this.name=`Outline Pass`}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((e,n,r,i,a,o,s,c)=>{if((a.isMeshToonMaterial||a.isMeshToonNodeMaterial)&&a.wireframe===!1){let l=this._getOutlineMaterial(a);t.renderObject(e,n,r,i,l,o,s,c)}t.renderObject(e,n,r,i,a,o,s,c)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Qm;e.isMeshToonOutlineMaterial=!0,e.name=`Toon_Outline`,e.side=1;let t=zd.negate(),n=$u.mul(Cd),r=R(1),i=n.mul(U(kd,1)),a=n.mul(U(kd.add(t),1)),o=nc(i.sub(a));return e.vertexNode=i.add(o.mul(this.thicknessNode).mul(i.w).mul(r)),e.colorNode=U(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},iy=(e,t,n=new Qt(0,0,0),r=.003,i=1)=>new ry(e,t,M(n),M(r),M(i)),ay=I(([e,t])=>e.mul(t).clamp()).setLayout({name:`linearToneMapping`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`exposure`,type:`float`}]}),oy=I(([e,t])=>(e=e.mul(t),e.div(e.add(1)).clamp())).setLayout({name:`reinhardToneMapping`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`exposure`,type:`float`}]}),sy=I(([e,t])=>{e=e.mul(t),e=e.sub(.004).max(0);let n=e.mul(e.mul(6.2).add(.5)),r=e.mul(e.mul(6.2).add(1.7)).add(.06);return n.div(r).pow(2.2)}).setLayout({name:`cineonToneMapping`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`exposure`,type:`float`}]}),cy=I(([e])=>{let t=e.mul(e.add(.0245786)).sub(90537e-9),n=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(n)}),ly=I(([e,t])=>{let n=ho(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),r=ho(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=n.mul(e),e=cy(e),e=r.mul(e),e.clamp()}).setLayout({name:`acesFilmicToneMapping`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`exposure`,type:`float`}]}),uy=ho(H(1.6605,-.1246,-.0182),H(-.5876,1.1329,-.1006),H(-.0728,-.0083,1.1187)),dy=ho(H(.6274,.0691,.0164),H(.3293,.9195,.088),H(.0433,.0113,.8956)),fy=I(([e])=>{let t=H(e).toVar(),n=H(t.mul(t)).toVar(),r=H(n.mul(n)).toVar();return R(15.5).mul(r.mul(n)).sub(J(40.14,r.mul(t))).add(J(31.96,r).sub(J(6.868,n.mul(t))).add(J(.4298,n).add(J(.1191,t).sub(.00232))))}),py=I(([e,t])=>{let n=H(e).toVar(),r=ho(H(.856627153315983,.137318972929847,.11189821299995),H(.0951212405381588,.761241990602591,.0767994186031903),H(.0482516061458583,.101439036467562,.811302368396859)),i=ho(H(1.1271005818144368,-.1413297634984383,-.14132976349843826),H(-.11060664309660323,1.157823702216272,-.11060664309660294),H(-.016493938717834573,-.016493938717834257,1.2519364065950405)),a=R(-12.47393),o=R(4.026069);return n.mulAssign(t),n.assign(dy.mul(n)),n.assign(r.mul(n)),n.assign(Tc(n,1e-10)),n.assign(Zs(n)),n.assign(n.sub(a).div(o.sub(a))),n.assign(Bc(n,0,1)),n.assign(fy(n)),n.assign(i.mul(n)),n.assign(Mc(Tc(H(0),n),H(2.2))),n.assign(uy.mul(n)),n.assign(Bc(n,0,1)),n}).setLayout({name:`agxToneMapping`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`exposure`,type:`float`}]}),my=I(([e,t])=>{let n=R(.76),r=R(.15);e=e.mul(t);let i=wc(e.r,wc(e.g,e.b)),a=Zc(i.lessThan(.08),i.sub(J(6.25,i.mul(i))),.04);e.subAssign(a);let o=Tc(e.r,Tc(e.g,e.b));L(o.lessThan(n),()=>e);let s=q(1,n),c=q(1,s.mul(s).div(o.add(s.sub(n))));e.mulAssign(c.div(o));let l=q(1,hs(1,r.mul(o.sub(c)).add(1)));return zc(e,H(c),l)}).setLayout({name:`neutralToneMapping`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`exposure`,type:`float`}]}),hy=class extends A{static get type(){return`CodeNode`}constructor(e=``,t=[],n=``){super(`code`),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let n of t)n.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},gy=N(hy).setParameterLength(1,3),_y=(e,t)=>gy(e,t,`js`),vy=(e,t)=>gy(e,t,`wgsl`),yy=(e,t)=>gy(e,t,`glsl`),by=class extends hy{static get type(){return`FunctionNode`}constructor(e=``,t=[],n=``){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,i=n.type,a=e.getCodeFromNode(this,i);r!==``&&(a.name=r);let o=e.getPropertyName(a);return a.code=this.getNodeFunction(e).getCode(o)+`
|
|
278
|
+
`,t===`property`?o:e.format(`${o}()`,i,t)}},xy=(e,t=[],n=``)=>{for(let e=0;e<t.length;e++){let n=t[e];typeof n==`function`&&(t[e]=n.functionNode)}let r=new by(e,t,n),i=(...e)=>r.call(...e);return i.functionNode=r,i},Sy=(e,t)=>xy(e,t,`glsl`),Cy=(e,t)=>xy(e,t,`wgsl`);function wy(e){let t,n=e.context.getViewZ;return n!==void 0&&(t=n(this)),(t||Nd.z).negate()}var Ty=I(([e,t],n)=>Uc(e,t,wy(n))),Ey=I(([e],t)=>{let n=wy(t);return e.mul(e,n,n).negate().exp().oneMinus()}),Dy=I(([e,t],n)=>{let r=wy(n),i=t.sub(jd.y).max(0).toConst().mul(r).toConst();return e.mul(e,i,i).negate().exp().oneMinus()}),Oy=I(([e,t])=>U(t.toFloat().mix(Go.rgb,e.toVec3()),Go.a)),ky=null,Ay=null,jy=N(class extends A{static get type(){return`RangeNode`}constructor(e=R(),t=R()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(Vi(t.value)),i=e.getTypeLength(Vi(n.value));return r>i?r:i}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):`float`}getConstNode(e){let t=null;if(e.traverse(e=>{e.isConstNode===!0&&(t=e)}),t===null)throw new cu(`THREE.TSL: No "ConstNode" found in node graph.`,this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),i=this.getConstNode(this.maxNode),a=r.value,o=i.value,s=e.getTypeLength(Vi(a)),c=e.getTypeLength(Vi(o));ky=ky||new gt,Ay=Ay||new gt,ky.setScalar(0),Ay.setScalar(0),s===1?ky.setScalar(a):a.isColor?ky.set(a.r,a.g,a.b,1):ky.set(a.x,a.y,a.z||0,a.w||0),c===1?Ay.setScalar(o):o.isColor?Ay.set(o.r,o.g,o.b,1):Ay.set(o.x,o.y,o.z||0,o.w||0);let l=4*t.count,u=new Float32Array(l);for(let e=0;e<l;e++){let t=e%4,n=ky.getComponent(t),r=Ay.getComponent(t);u[e]=Ye.lerp(n,r,Math.random())}let d=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=yu(u,`vec4`,t.count).element(Hp).convert(d);else{let t=new wr(u,4);e.geometry.setAttribute(`__range`+this.id,t),n=Pl(t).convert(d)}}else n=R(0);return n}}).setParameterLength(2),My=class extends A{static get type(){return`ComputeBuiltinNode`}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage===`compute`?e.format(n,r,t):(T(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},Ny=(e,t)=>new My(e,t),Py=Ny(`numWorkgroups`,`uvec3`),Fy=Ny(`workgroupId`,`uvec3`),Iy=Ny(`globalId`,`uvec3`),Ly=Ny(`localId`,`uvec3`),Ry=Ny(`subgroupSize`,`uint`),zy=N(class extends A{constructor(e){super(),this.scope=e}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}}),By=()=>zy(`workgroup`).toStack(),Vy=()=>zy(`storage`).toStack(),Hy=()=>zy(`texture`).toStack(),Uy=class extends ta{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.context.assign;if(n=super.generate(e),r!==!0){let r=this.getNodeType(e);n=e.format(n,r,t)}return n}},Wy=class extends A{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=``}setName(e){return this.name=e,this}label(e){return T(`TSL: "label()" has been deprecated. Use "setName()" instead.`,new ki),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new Uy(this,e)}generate(e){let t=this.name===``?`${this.scope}Array_${this.id}`:this.name;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},Gy=(e,t)=>new Wy(`Workgroup`,e,t),Ky=class extends A{static get type(){return`AtomicFunctionNode`}constructor(e,t,n){super(`uint`),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,i=this.getNodeType(e),a=this.getInputType(e),o=this.pointerNode,s=this.valueNode,c=[];c.push(`&${o.build(e,a)}`),s!==null&&c.push(s.build(e,a));let l=`${e.getMethod(r,i)}( ${c.join(`, `)} )`;if(n&&n.length===1&&n[0].isStackNode===!0)e.addLineFlowCode(l,this);else return t.constNode===void 0&&(t.constNode=Kl(l,i).toConst()),t.constNode.build(e)}};Ky.ATOMIC_LOAD=`atomicLoad`,Ky.ATOMIC_STORE=`atomicStore`,Ky.ATOMIC_ADD=`atomicAdd`,Ky.ATOMIC_SUB=`atomicSub`,Ky.ATOMIC_MAX=`atomicMax`,Ky.ATOMIC_MIN=`atomicMin`,Ky.ATOMIC_AND=`atomicAnd`,Ky.ATOMIC_OR=`atomicOr`,Ky.ATOMIC_XOR=`atomicXor`;var qy=N(Ky),Jy=(e,t,n)=>qy(e,t,n).toStack(),Yy=e=>Jy(Ky.ATOMIC_LOAD,e,null),Xy=(e,t)=>Jy(Ky.ATOMIC_STORE,e,t),Zy=(e,t)=>Jy(Ky.ATOMIC_ADD,e,t),Qy=(e,t)=>Jy(Ky.ATOMIC_SUB,e,t),$y=(e,t)=>Jy(Ky.ATOMIC_MAX,e,t),eb=(e,t)=>Jy(Ky.ATOMIC_MIN,e,t),tb=(e,t)=>Jy(Ky.ATOMIC_AND,e,t),nb=(e,t)=>Jy(Ky.ATOMIC_OR,e,t),rb=(e,t)=>Jy(Ky.ATOMIC_XOR,e,t),Z=class e extends ra{static get type(){return`SubgroupFunctionNode`}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(n)?0:e.getTypeLength(n))?t:n}getNodeType(t){let n=this.method;return n===e.SUBGROUP_ELECT?`bool`:n===e.SUBGROUP_BALLOT?`uvec4`:this.getInputType(t)}generate(t,n){let r=this.method,i=this.getNodeType(t),a=this.getInputType(t),o=this.aNode,s=this.bNode,c=[];if(r===e.SUBGROUP_BROADCAST||r===e.SUBGROUP_SHUFFLE||r===e.QUAD_BROADCAST){let e=s.getNodeType(t);c.push(o.build(t,i),s.build(t,e===`float`?`int`:i))}else r===e.SUBGROUP_SHUFFLE_XOR||r===e.SUBGROUP_SHUFFLE_DOWN||r===e.SUBGROUP_SHUFFLE_UP?c.push(o.build(t,i),s.build(t,`uint`)):(o!==null&&c.push(o.build(t,a)),s!==null&&c.push(s.build(t,a)));let l=c.length===0?`()`:`( ${c.join(`, `)} )`;return t.format(`${t.getMethod(r,i)}${l}`,i,n)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Z.SUBGROUP_ELECT=`subgroupElect`,Z.SUBGROUP_BALLOT=`subgroupBallot`,Z.SUBGROUP_ADD=`subgroupAdd`,Z.SUBGROUP_INCLUSIVE_ADD=`subgroupInclusiveAdd`,Z.SUBGROUP_EXCLUSIVE_AND=`subgroupExclusiveAdd`,Z.SUBGROUP_MUL=`subgroupMul`,Z.SUBGROUP_INCLUSIVE_MUL=`subgroupInclusiveMul`,Z.SUBGROUP_EXCLUSIVE_MUL=`subgroupExclusiveMul`,Z.SUBGROUP_AND=`subgroupAnd`,Z.SUBGROUP_OR=`subgroupOr`,Z.SUBGROUP_XOR=`subgroupXor`,Z.SUBGROUP_MIN=`subgroupMin`,Z.SUBGROUP_MAX=`subgroupMax`,Z.SUBGROUP_ALL=`subgroupAll`,Z.SUBGROUP_ANY=`subgroupAny`,Z.SUBGROUP_BROADCAST_FIRST=`subgroupBroadcastFirst`,Z.QUAD_SWAP_X=`quadSwapX`,Z.QUAD_SWAP_Y=`quadSwapY`,Z.QUAD_SWAP_DIAGONAL=`quadSwapDiagonal`,Z.SUBGROUP_BROADCAST=`subgroupBroadcast`,Z.SUBGROUP_SHUFFLE=`subgroupShuffle`,Z.SUBGROUP_SHUFFLE_XOR=`subgroupShuffleXor`,Z.SUBGROUP_SHUFFLE_UP=`subgroupShuffleUp`,Z.SUBGROUP_SHUFFLE_DOWN=`subgroupShuffleDown`,Z.QUAD_BROADCAST=`quadBroadcast`;var ib=F(Z,Z.SUBGROUP_ELECT).setParameterLength(0),ab=F(Z,Z.SUBGROUP_BALLOT).setParameterLength(1),ob=F(Z,Z.SUBGROUP_ADD).setParameterLength(1),sb=F(Z,Z.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),cb=F(Z,Z.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),lb=F(Z,Z.SUBGROUP_MUL).setParameterLength(1),ub=F(Z,Z.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),db=F(Z,Z.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),fb=F(Z,Z.SUBGROUP_AND).setParameterLength(1),pb=F(Z,Z.SUBGROUP_OR).setParameterLength(1),mb=F(Z,Z.SUBGROUP_XOR).setParameterLength(1),hb=F(Z,Z.SUBGROUP_MIN).setParameterLength(1),gb=F(Z,Z.SUBGROUP_MAX).setParameterLength(1),_b=F(Z,Z.SUBGROUP_ALL).setParameterLength(0),vb=F(Z,Z.SUBGROUP_ANY).setParameterLength(0),yb=F(Z,Z.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),bb=F(Z,Z.QUAD_SWAP_X).setParameterLength(1),xb=F(Z,Z.QUAD_SWAP_Y).setParameterLength(1),Sb=F(Z,Z.QUAD_SWAP_DIAGONAL).setParameterLength(1),Cb=F(Z,Z.SUBGROUP_BROADCAST).setParameterLength(2),wb=F(Z,Z.SUBGROUP_SHUFFLE).setParameterLength(2),Tb=F(Z,Z.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),Eb=F(Z,Z.SUBGROUP_SHUFFLE_UP).setParameterLength(2),Db=F(Z,Z.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),Ob=F(Z,Z.QUAD_BROADCAST).setParameterLength(1),kb;function Ab(e){kb=kb||new WeakMap;let t=kb.get(e);return t===void 0&&kb.set(e,t={}),t}function jb(e){let t=Ab(e);return t.shadowMatrix||(t.shadowMatrix=K(`mat4`).setGroup(G).onRenderUpdate(t=>((e.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function Mb(e,t=jd){let n=jb(e).mul(t);return n.xyz.div(n.w)}function Nb(e){let t=Ab(e);return t.position||(t.position=K(new O).setGroup(G).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.matrixWorld)))}function Pb(e){let t=Ab(e);return t.targetPosition||(t.targetPosition=K(new O).setGroup(G).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.target.matrixWorld)))}function Fb(e){let t=Ab(e);return t.viewPosition||(t.viewPosition=K(new O).setGroup(G).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new O,n.value.setFromMatrixPosition(e.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var Ib=e=>td.transformDirection(Nb(e).sub(Pb(e))),Lb=e=>e.sort((e,t)=>e.id-t.id),Rb=(e,t)=>{for(let n of t)if(n.isAnalyticLightNode&&n.light.id===e)return n;return null},zb=new WeakMap,Bb=[],Vb=class extends A{static get type(){return`LightsNode`}constructor(){super(`vec3`),this.totalDiffuseNode=Co(`vec3`,`totalDiffuse`),this.totalSpecularNode=Co(`vec3`,`totalSpecular`),this.outgoingLightNode=Co(`vec3`,`outgoingLight`),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){let e=this._lights;for(let t=0;t<e.length;t++){let n=e[t];if(Bb.push(n.id),Bb.push(+!!n.castShadow),n.isSpotLight===!0){let e=n.map===null?-1:n.map.id,t=n.colorNode?n.colorNode.getCacheKey():-1;Bb.push(e,t)}}let t=Mi(Bb);return Bb.length=0,t}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);let t=[];for(let e of this._lightNodes)t.push(e.getHash());this._lightNodesHash=`lights-`+t.join(`,`)}return this._lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=[],n=this._lightNodes,r=Lb(this._lights),i=e.renderer.library;for(let e of r)if(e.isNode)t.push(M(e));else{let r=null;if(n!==null&&(r=Rb(e.id,n)),r===null){let n=i.getLightNodeClass(e.constructor);if(n===null){T(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}let r=null;zb.has(e)?r=zb.get(e):(r=new n(e),zb.set(e,r)),t.push(r)}}this._lightNodes=t}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:i}=e.context;r.direct(o(o({},n),{},{lightNode:t,reflectedLight:i}),e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:i}=e.context;r.directRectArea(o(o({},n),{},{lightNode:t,reflectedLight:i}),e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){return this._lightNodes===null&&this.setupLightsNode(e),this._lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,i=r.lightingModel,a=e.getNodeProperties(this);if(i){let{totalDiffuseNode:t,totalSpecularNode:o}=this;r.outgoingLight=n,a.nodes=e.addStack().nodes,i.start(e);let{backdrop:s,backdropAlpha:c}=r,{directDiffuse:l,directSpecular:u,indirectDiffuse:d,indirectSpecular:f}=r.reflectedLight,p=l.add(d);s!==null&&(p=H(c===null?s:c.mix(p,s))),t.assign(p),o.assign(u.add(f)),n.assign(t.add(o)),i.finish(e),n=n.bypass(e.removeStack())}else a.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},Hb=(e=[])=>new Vb().setLights(e),Ub=class extends A{static get type(){return`ShadowBaseNode`}constructor(e){super(),this.light=e,this.updateBeforeType=k.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){Wb.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||jd)}},Wb=Co(`vec3`,`shadowPositionWorld`);function Gb(e,t={}){return t.toneMapping=e.toneMapping,t.toneMappingExposure=e.toneMappingExposure,t.outputColorSpace=e.outputColorSpace,t.renderTarget=e.getRenderTarget(),t.activeCubeFace=e.getActiveCubeFace(),t.activeMipmapLevel=e.getActiveMipmapLevel(),t.renderObjectFunction=e.getRenderObjectFunction(),t.pixelRatio=e.getPixelRatio(),t.mrt=e.getMRT(),t.clearColor=e.getClearColor(t.clearColor||new Qt),t.clearAlpha=e.getClearAlpha(),t.autoClear=e.autoClear,t.scissorTest=e.getScissorTest(),t}function Kb(e,t){return t=Gb(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function qb(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function Jb(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function Yb(e,t){return t=Jb(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function Xb(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function Zb(e,t,n){return n=Kb(e,n),n=Yb(t,n),n}function Qb(e,t,n){qb(e,n),Xb(t,n)}var $b=new WeakMap,ex=I(({depthTexture:e,shadowCoord:t,depthLayer:n})=>{let r=fu(e,t.xy).setName(`t_basic`);return e.isArrayTexture&&(r=r.depth(n)),r.compare(t.z)}),tx=I(({depthTexture:e,shadowCoord:t,shadow:n,depthLayer:r})=>{let i=(t,n)=>{let i=fu(e,t);return e.isArrayTexture&&(i=i.depth(r)),i.compare(n)},a=pf(`mapSize`,`vec2`,n).setGroup(G),o=pf(`radius`,`float`,n).setGroup(G),s=V(1).div(a),c=o.mul(s.x),l=cv(Au.xy).mul(6.28318530718);return ms(i(t.xy.add(lv(0,5,l).mul(c)),t.z),i(t.xy.add(lv(1,5,l).mul(c)),t.z),i(t.xy.add(lv(2,5,l).mul(c)),t.z),i(t.xy.add(lv(3,5,l).mul(c)),t.z),i(t.xy.add(lv(4,5,l).mul(c)),t.z)).mul(1/5)}),nx=I(({depthTexture:e,shadowCoord:t,shadow:n,depthLayer:r})=>{let i=(t,n)=>{let i=fu(e,t);return e.isArrayTexture&&(i=i.depth(r)),i.compare(n)},a=pf(`mapSize`,`vec2`,n).setGroup(G),o=V(1).div(a),s=o.x,c=o.y,l=t.xy,u=rc(l.mul(a).add(.5));return l.subAssign(u.mul(o)),ms(i(l,t.z),i(l.add(V(s,0)),t.z),i(l.add(V(0,c)),t.z),i(l.add(o),t.z),zc(i(l.add(V(s.negate(),0)),t.z),i(l.add(V(s.mul(2),0)),t.z),u.x),zc(i(l.add(V(s.negate(),c)),t.z),i(l.add(V(s.mul(2),c)),t.z),u.x),zc(i(l.add(V(0,c.negate())),t.z),i(l.add(V(0,c.mul(2))),t.z),u.y),zc(i(l.add(V(s,c.negate())),t.z),i(l.add(V(s,c.mul(2))),t.z),u.y),zc(zc(i(l.add(V(s.negate(),c.negate())),t.z),i(l.add(V(s.mul(2),c.negate())),t.z),u.x),zc(i(l.add(V(s.negate(),c.mul(2))),t.z),i(l.add(V(s.mul(2),c.mul(2))),t.z),u.x),u.y)).mul(1/9)}),rx=I(({depthTexture:e,shadowCoord:t,depthLayer:n},r)=>{let i=fu(e).sample(t.xy);e.isArrayTexture&&(i=i.depth(n)),i=i.rg;let a=i.x,o=Tc(1e-7,i.y.mul(i.y)),s=r.renderer.reversedDepthBuffer?Ec(a,t.z):Ec(t.z,a),c=R(1).toVar();return L(s.notEqual(1),()=>{let e=t.z.sub(a),n=o.div(o.add(e.mul(e)));n=Bc(q(n,.3).div(.65)),c.assign(Tc(s,n))}),c}),ix=e=>{let t=$b.get(e);return t===void 0&&(t=new Qm,t.colorNode=U(0,0,0,1),t.isShadowPassMaterial=!0,t.name=`ShadowMaterial`,t.blending=0,t.fog=!1,$b.set(e,t)),t},ax=e=>{let t=$b.get(e);t!==void 0&&(t.dispose(),$b.delete(e))},ox=new Ag,sx=[],cx=(e,t,n,r)=>{sx[0]=e,sx[1]=t;let i=ox.get(sx);return(i===void 0||i.shadowType!==n||i.useVelocity!==r)&&(i=(i,a,o,s,c,l,...u)=>{(i.castShadow===!0||i.receiveShadow&&n===3)&&(r&&(Ui(i).useVelocity=!0),i.onBeforeShadow(e,i,o,t.camera,s,a.overrideMaterial,l),e.renderObject(i,a,o,s,c,l,...u),i.onAfterShadow(e,i,o,t.camera,s,a.overrideMaterial,l))},i.shadowType=n,i.useVelocity=r,ox.set(sx,i)),sx[0]=null,sx[1]=null,i},lx=I(({samples:e,radius:t,size:n,shadowPass:r,depthLayer:i})=>{let a=R(0).toVar(`meanVertical`),o=R(0).toVar(`squareMeanVertical`),s=e.lessThanEqual(R(1)).select(R(0),R(2).div(e.sub(1))),c=e.lessThanEqual(R(1)).select(R(0),R(-1));return nm({start:z(0),end:z(e),type:`int`,condition:`<`},({i:e})=>{let l=c.add(R(e).mul(s)),u=r.sample(ms(Au.xy,V(0,l).mul(t)).div(n));r.value.isArrayTexture&&(u=u.depth(i)),u=u.x,a.addAssign(u),o.addAssign(u.mul(u))}),a.divAssign(e),o.divAssign(e),V(a,Qs(o.sub(a.mul(a)).max(0)))}),ux=I(({samples:e,radius:t,size:n,shadowPass:r,depthLayer:i})=>{let a=R(0).toVar(`meanHorizontal`),o=R(0).toVar(`squareMeanHorizontal`),s=e.lessThanEqual(R(1)).select(R(0),R(2).div(e.sub(1))),c=e.lessThanEqual(R(1)).select(R(0),R(-1));return nm({start:z(0),end:z(e),type:`int`,condition:`<`},({i:e})=>{let l=c.add(R(e).mul(s)),u=r.sample(ms(Au.xy,V(l,0).mul(t)).div(n));r.value.isArrayTexture&&(u=u.depth(i)),a.addAssign(u.x),o.addAssign(ms(u.y.mul(u.y),u.x.mul(u.x)))}),a.divAssign(e),o.divAssign(e),V(a,Qs(o.sub(a.mul(a)).max(0)))}),dx=[ex,tx,nx,rx],fx,px=new ev,mx=class extends Ub{static get type(){return`ShadowNode`}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:i,depthLayer:a}){let o=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),s=t({depthTexture:n,shadowCoord:r,shadow:i,depthLayer:a});return o.select(s,R(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,i=n.biasNode||pf(`bias`,`float`,n).setGroup(G),a=t,o;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)a=a.xyz.div(a.w),o=a.z;else{let e=a.w;a=a.xy.div(e);let t=pf(`near`,`float`,n.camera).setGroup(G),r=pf(`far`,`float`,n.camera).setGroup(G);o=km(e.negate(),t,r)}return a=H(a.x,a.y.oneMinus(),r.reversedDepthBuffer?o.sub(i):o.add(i)),a}getShadowFilterFn(e){return dx[e]}setupRenderTarget(e,t){let n=new jr(e.mapSize.width,e.mapSize.height);n.name=`ShadowDepthTexture`,n.compareFunction=t.renderer.reversedDepthBuffer?518:515;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name=`ShadowMap`,r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:i}=this,{depthTexture:a,shadowMap:o}=this.setupRenderTarget(i,e),s=t.shadowMap.type,c=t.hasCompatibility(me.TEXTURE_COMPARE);if((s===1||s===2)&&c?(a.minFilter=p,a.magFilter=p):(a.minFilter=f,a.magFilter=f),i.camera.coordinateSystem=n.coordinateSystem,i.camera.updateProjectionMatrix(),s===3&&i.isPointLightShadow!==!0){a.compareFunction=null,o.depth>1?(o._vsmShadowMapVertical||(o._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:S,type:y,depth:o.depth,depthBuffer:!1}),o._vsmShadowMapVertical.texture.name=`VSMVertical`),this.vsmShadowMapVertical=o._vsmShadowMapVertical,o._vsmShadowMapHorizontal||(o._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:S,type:y,depth:o.depth,depthBuffer:!1}),o._vsmShadowMapHorizontal.texture.name=`VSMHorizontal`),this.vsmShadowMapHorizontal=o._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:S,type:y,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:S,type:y,depthBuffer:!1}));let t=fu(a);a.isArrayTexture&&(t=t.depth(this.depthLayer));let n=fu(this.vsmShadowMapVertical.texture);a.isArrayTexture&&(n=n.depth(this.depthLayer));let r=pf(`blurSamples`,`float`,i).setGroup(G),s=pf(`radius`,`float`,i).setGroup(G),c=pf(`mapSize`,`vec2`,i).setGroup(G),l=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Qm);l.fragmentNode=lx({samples:r,radius:s,size:c,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name=`VSMVertical`,l=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Qm),l.fragmentNode=ux({samples:r,radius:s,size:c,shadowPass:n,depthLayer:this.depthLayer}).context(e.getSharedContext()),l.name=`VSMHorizontal`}let l=pf(`intensity`,`float`,i).setGroup(G),u=pf(`normalBias`,`float`,i).setGroup(G),d=jb(r).mul(Wb.add(Wd.mul(u))),m=this.setupShadowCoord(e,d),h=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(h===null)throw Error(`THREE.WebGPURenderer: Shadow map type not supported yet.`);let g=s===3&&i.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:a,_=this.setupShadowFilter(e,{filterFn:h,shadowTexture:o.texture,depthTexture:g,shadowCoord:m,shadow:i,depthLayer:this.depthLayer}),v;t.shadowMap.transmitted===!0&&(o.texture.isCubeTexture?v=lf(o.texture,m.xyz):(v=fu(o.texture,m),a.isArrayTexture&&(v=v.depth(this.depthLayer))));let b;b=v?zc(1,_.rgb.mix(v,1),l.mul(v.a)).toVar():zc(1,_,l).toVar(),this.shadowMap=o,this.shadow.map=o;let x=`${this.light.type} Shadow [ ${this.light.name||`ID: `+this.light.id} ]`;return v&&b.toInspector(`${x} / Color`,()=>this.shadowMap.texture.isCubeTexture?lf(this.shadowMap.texture):fu(this.shadowMap.texture)),b.toInspector(`${x} / Depth`,()=>this.shadowMap.texture.isCubeTexture?lf(this.shadowMap.texture).r.oneMinus():mu(this.shadowMap.depthTexture,au().mul(ou(fu(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(e.renderer.shadowMap.enabled!==!1)return I(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:i,scene:a}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let o=a.name;a.name=`Shadow Map [ ${r.name||`ID: `+r.id} ]`,i.render(a,t.camera),a.name=o}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:i,scene:a,camera:o}=e,s=i.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let l=r.camera.layers.mask;r.camera.layers.mask&4294967294||(r.camera.layers.mask=o.layers.mask);let u=i.getRenderObjectFunction(),d=i.getMRT(),f=d?d.has(`velocity`):!1;fx=Zb(i,a,fx),a.overrideMaterial=ix(n),i.setRenderObjectFunction(cx(i,r,s,f)),i.setClearColor(0,0),i.setRenderTarget(t),this.renderShadow(e),i.setRenderObjectFunction(u),s===3&&r.isPointLightShadow!==!0&&this.vsmPass(i),r.camera.layers.mask=l,Qb(i,a,fx)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),px.material=this.vsmMaterialVertical,px.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),px.material=this.vsmMaterialHorizontal,px.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,ax(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},hx=(e,t)=>new mx(e,t),gx=new Qt,_x=new yt,vx=new O,yx=new O,bx=[new O(1,0,0),new O(-1,0,0),new O(0,-1,0),new O(0,1,0),new O(0,0,1),new O(0,0,-1)],xx=[new O(0,-1,0),new O(0,-1,0),new O(0,0,-1),new O(0,0,1),new O(0,-1,0),new O(0,-1,0)],Sx=[new O(1,0,0),new O(-1,0,0),new O(0,1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1)],Cx=[new O(0,-1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1),new O(0,-1,0),new O(0,-1,0)],wx=I(({depthTexture:e,bd3D:t,dp:n})=>lf(e,t).compare(n)),Tx=I(({depthTexture:e,bd3D:t,dp:n,shadow:r})=>{let i=pf(`radius`,`float`,r).setGroup(G),a=pf(`mapSize`,`vec2`,r).setGroup(G),o=i.div(a.x),s=uc(t),c=nc(jc(t,s.x.greaterThan(s.z).select(H(0,1,0),H(1,0,0)))),l=jc(t,c),u=cv(Au.xy).mul(6.28318530718),d=lv(0,5,u),f=lv(1,5,u),p=lv(2,5,u),m=lv(3,5,u),h=lv(4,5,u);return lf(e,t.add(c.mul(d.x).add(l.mul(d.y)).mul(o))).compare(n).add(lf(e,t.add(c.mul(f.x).add(l.mul(f.y)).mul(o))).compare(n)).add(lf(e,t.add(c.mul(p.x).add(l.mul(p.y)).mul(o))).compare(n)).add(lf(e,t.add(c.mul(m.x).add(l.mul(m.y)).mul(o))).compare(n)).add(lf(e,t.add(c.mul(h.x).add(l.mul(h.y)).mul(o))).compare(n)).mul(1/5)}),Ex=I(({filterFn:e,depthTexture:t,shadowCoord:n,shadow:r},i)=>{let a=n.xyz.toConst(),o=a.abs().toConst(),s=o.x.max(o.y).max(o.z),c=K(`float`).setGroup(G).onRenderUpdate(()=>r.camera.near),l=K(`float`).setGroup(G).onRenderUpdate(()=>r.camera.far),u=pf(`bias`,`float`,r).setGroup(G),d=R(1).toVar();return L(s.sub(l).lessThanEqual(0).and(s.sub(c).greaterThanEqual(0)),()=>{let n;i.renderer.reversedDepthBuffer?(n=Dm(s.negate(),c,l),n.subAssign(u)):(n=Em(s.negate(),c,l),n.addAssign(u));let o=a.normalize();d.assign(e({depthTexture:t,bd3D:o,dp:n,shadow:r}))}),d}),Dx=class extends mx{static get type(){return`PointShadowNode`}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===0?wx:Tx}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:i}){return Ex({filterFn:t,depthTexture:n,shadowCoord:r,shadow:i})}setupRenderTarget(e,t){let n=new Mr(e.mapSize.width);n.name=`PointShadowDepthTexture`,n.compareFunction=t.renderer.reversedDepthBuffer?518:515;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name=`PointShadowMap`,r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:i,scene:a}=e,o=t.camera,s=t.matrix,c=i.coordinateSystem===pe,l=c?bx:Sx,u=c?xx:Cx;n.setSize(t.mapSize.width,t.mapSize.width);let d=i.autoClear,f=i.getClearColor(gx),p=i.getClearAlpha();i.autoClear=!1,i.setClearColor(t.clearColor,t.clearAlpha);for(let e=0;e<6;e++){i.setRenderTarget(n,e),i.clear();let c=r.distance||o.far;c!==o.far&&(o.far=c,o.updateProjectionMatrix()),vx.setFromMatrixPosition(r.matrixWorld),o.position.copy(vx),yx.copy(o.position),yx.add(l[e]),o.up.copy(u[e]),o.lookAt(yx),o.updateMatrixWorld(),s.makeTranslation(-vx.x,-vx.y,-vx.z),_x.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),t._frustum.setFromProjectionMatrix(_x,o.coordinateSystem,o.reversedDepth);let d=a.name;a.name=`Point Light Shadow [ ${r.name||`ID: `+r.id} ] - Face ${e+1}`,i.render(a,o),a.name=d}i.autoClear=d,i.setClearColor(f,p)}},Ox=(e,t)=>new Dx(e,t),kx=I(({lightDistance:e,cutoffDistance:t,decayExponent:n})=>{let r=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(r.mul(e.div(t).pow4().oneMinus().clamp().pow2()),r)}),Ax=({color:e,lightVector:t,cutoffDistance:n,decayExponent:r})=>{let i=t.normalize(),a=kx({lightDistance:t.length(),cutoffDistance:n,decayExponent:r});return{lightDirection:i,lightColor:e.mul(a)}},jx=I(([e=au()])=>{let t=e.mul(2),n=t.x.floor(),r=t.y.floor();return n.add(r).mod(2).sign()}),Mx=I(([e=au()],{renderer:t,material:n})=>{let r=Rc(e.mul(2).sub(1)),i;if(n.alphaToCoverage&&t.currentSamples>0){let e=R(r.fwidth()).toVar();i=Uc(e.oneMinus(),e.add(1),r).oneMinus()}else i=Zc(r.greaterThan(1),0,1);return i}),Nx=I(([e,t,n])=>{let r=R(n).toVar(),i=R(t).toVar();return Zc(ro(e).toVar(),i,r)}).setLayout({name:`mx_select`,type:`float`,inputs:[{name:`b`,type:`bool`},{name:`t`,type:`float`},{name:`f`,type:`float`}]}),Px=I(([e,t])=>{let n=ro(t).toVar(),r=R(e).toVar();return Zc(n,r.negate(),r)}).setLayout({name:`mx_negate_if`,type:`float`,inputs:[{name:`val`,type:`float`},{name:`b`,type:`bool`}]}),Fx=I(([e])=>z(ec(R(e).toVar()))).setLayout({name:`mx_floor`,type:`int`,inputs:[{name:`x`,type:`float`}]}),Ix=I(([e,t])=>{let n=R(e).toVar();return t.assign(Fx(n)),n.sub(R(t))}),Lx=y_([I(([e,t,n,r,i,a])=>{let o=R(a).toVar(),s=R(i).toVar(),c=R(r).toVar(),l=R(n).toVar(),u=R(t).toVar(),d=R(e).toVar(),f=R(q(1,s)).toVar();return q(1,o).mul(d.mul(f).add(u.mul(s))).add(o.mul(l.mul(f).add(c.mul(s))))}).setLayout({name:`mx_bilerp_0`,type:`float`,inputs:[{name:`v0`,type:`float`},{name:`v1`,type:`float`},{name:`v2`,type:`float`},{name:`v3`,type:`float`},{name:`s`,type:`float`},{name:`t`,type:`float`}]}),I(([e,t,n,r,i,a])=>{let o=R(a).toVar(),s=R(i).toVar(),c=H(r).toVar(),l=H(n).toVar(),u=H(t).toVar(),d=H(e).toVar(),f=R(q(1,s)).toVar();return q(1,o).mul(d.mul(f).add(u.mul(s))).add(o.mul(l.mul(f).add(c.mul(s))))}).setLayout({name:`mx_bilerp_1`,type:`vec3`,inputs:[{name:`v0`,type:`vec3`},{name:`v1`,type:`vec3`},{name:`v2`,type:`vec3`},{name:`v3`,type:`vec3`},{name:`s`,type:`float`},{name:`t`,type:`float`}]})]),Rx=y_([I(([e,t,n,r,i,a,o,s,c,l,u])=>{let d=R(u).toVar(),f=R(l).toVar(),p=R(c).toVar(),m=R(s).toVar(),h=R(o).toVar(),g=R(a).toVar(),_=R(i).toVar(),v=R(r).toVar(),y=R(n).toVar(),b=R(t).toVar(),x=R(e).toVar(),S=R(q(1,p)).toVar(),C=R(q(1,f)).toVar();return R(q(1,d)).toVar().mul(C.mul(x.mul(S).add(b.mul(p))).add(f.mul(y.mul(S).add(v.mul(p))))).add(d.mul(C.mul(_.mul(S).add(g.mul(p))).add(f.mul(h.mul(S).add(m.mul(p))))))}).setLayout({name:`mx_trilerp_0`,type:`float`,inputs:[{name:`v0`,type:`float`},{name:`v1`,type:`float`},{name:`v2`,type:`float`},{name:`v3`,type:`float`},{name:`v4`,type:`float`},{name:`v5`,type:`float`},{name:`v6`,type:`float`},{name:`v7`,type:`float`},{name:`s`,type:`float`},{name:`t`,type:`float`},{name:`r`,type:`float`}]}),I(([e,t,n,r,i,a,o,s,c,l,u])=>{let d=R(u).toVar(),f=R(l).toVar(),p=R(c).toVar(),m=H(s).toVar(),h=H(o).toVar(),g=H(a).toVar(),_=H(i).toVar(),v=H(r).toVar(),y=H(n).toVar(),b=H(t).toVar(),x=H(e).toVar(),S=R(q(1,p)).toVar(),C=R(q(1,f)).toVar();return R(q(1,d)).toVar().mul(C.mul(x.mul(S).add(b.mul(p))).add(f.mul(y.mul(S).add(v.mul(p))))).add(d.mul(C.mul(_.mul(S).add(g.mul(p))).add(f.mul(h.mul(S).add(m.mul(p))))))}).setLayout({name:`mx_trilerp_1`,type:`vec3`,inputs:[{name:`v0`,type:`vec3`},{name:`v1`,type:`vec3`},{name:`v2`,type:`vec3`},{name:`v3`,type:`vec3`},{name:`v4`,type:`vec3`},{name:`v5`,type:`vec3`},{name:`v6`,type:`vec3`},{name:`v7`,type:`vec3`},{name:`s`,type:`float`},{name:`t`,type:`float`},{name:`r`,type:`float`}]})]),zx=y_([I(([e,t,n])=>{let r=R(n).toVar(),i=R(t).toVar(),a=B(B(e).toVar().bitAnd(B(7))).toVar(),o=R(Nx(a.lessThan(B(4)),i,r)).toVar(),s=R(J(2,Nx(a.lessThan(B(4)),r,i))).toVar();return Px(o,ro(a.bitAnd(B(1)))).add(Px(s,ro(a.bitAnd(B(2)))))}).setLayout({name:`mx_gradient_float_0`,type:`float`,inputs:[{name:`hash`,type:`uint`},{name:`x`,type:`float`},{name:`y`,type:`float`}]}),I(([e,t,n,r])=>{let i=R(r).toVar(),a=R(n).toVar(),o=R(t).toVar(),s=B(B(e).toVar().bitAnd(B(15))).toVar(),c=R(Nx(s.lessThan(B(8)),o,a)).toVar(),l=R(Nx(s.lessThan(B(4)),a,Nx(s.equal(B(12)).or(s.equal(B(14))),o,i))).toVar();return Px(c,ro(s.bitAnd(B(1)))).add(Px(l,ro(s.bitAnd(B(2)))))}).setLayout({name:`mx_gradient_float_1`,type:`float`,inputs:[{name:`hash`,type:`uint`},{name:`x`,type:`float`},{name:`y`,type:`float`},{name:`z`,type:`float`}]})]),Bx=y_([I(([e,t,n])=>{let r=R(n).toVar(),i=R(t).toVar(),a=co(e).toVar();return H(zx(a.x,i,r),zx(a.y,i,r),zx(a.z,i,r))}).setLayout({name:`mx_gradient_vec3_0`,type:`vec3`,inputs:[{name:`hash`,type:`uvec3`},{name:`x`,type:`float`},{name:`y`,type:`float`}]}),I(([e,t,n,r])=>{let i=R(r).toVar(),a=R(n).toVar(),o=R(t).toVar(),s=co(e).toVar();return H(zx(s.x,o,a,i),zx(s.y,o,a,i),zx(s.z,o,a,i))}).setLayout({name:`mx_gradient_vec3_1`,type:`vec3`,inputs:[{name:`hash`,type:`uvec3`},{name:`x`,type:`float`},{name:`y`,type:`float`},{name:`z`,type:`float`}]})]),Vx=I(([e])=>J(.6616,R(e).toVar())).setLayout({name:`mx_gradient_scale2d_0`,type:`float`,inputs:[{name:`v`,type:`float`}]}),Hx=I(([e])=>J(.982,R(e).toVar())).setLayout({name:`mx_gradient_scale3d_0`,type:`float`,inputs:[{name:`v`,type:`float`}]}),Ux=y_([Vx,I(([e])=>J(.6616,H(e).toVar())).setLayout({name:`mx_gradient_scale2d_1`,type:`vec3`,inputs:[{name:`v`,type:`vec3`}]})]),Wx=y_([Hx,I(([e])=>J(.982,H(e).toVar())).setLayout({name:`mx_gradient_scale3d_1`,type:`vec3`,inputs:[{name:`v`,type:`vec3`}]})]),Gx=I(([e,t])=>{let n=z(t).toVar(),r=B(e).toVar();return r.shiftLeft(n).bitOr(r.shiftRight(z(32).sub(n)))}).setLayout({name:`mx_rotl32`,type:`uint`,inputs:[{name:`x`,type:`uint`},{name:`k`,type:`int`}]}),Kx=I(([e,t,n])=>{e.subAssign(n),e.bitXorAssign(Gx(n,z(4))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(Gx(e,z(6))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(Gx(t,z(8))),t.addAssign(e),e.subAssign(n),e.bitXorAssign(Gx(n,z(16))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(Gx(e,z(19))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(Gx(t,z(4))),t.addAssign(e)}),qx=I(([e,t,n])=>{let r=B(n).toVar(),i=B(t).toVar(),a=B(e).toVar();return r.bitXorAssign(i),r.subAssign(Gx(i,z(14))),a.bitXorAssign(r),a.subAssign(Gx(r,z(11))),i.bitXorAssign(a),i.subAssign(Gx(a,z(25))),r.bitXorAssign(i),r.subAssign(Gx(i,z(16))),a.bitXorAssign(r),a.subAssign(Gx(r,z(4))),i.bitXorAssign(a),i.subAssign(Gx(a,z(14))),r.bitXorAssign(i),r.subAssign(Gx(i,z(24))),r}).setLayout({name:`mx_bjfinal`,type:`uint`,inputs:[{name:`a`,type:`uint`},{name:`b`,type:`uint`},{name:`c`,type:`uint`}]}),Jx=I(([e])=>R(B(e).toVar()).div(R(B(z(4294967295))))).setLayout({name:`mx_bits_to_01`,type:`float`,inputs:[{name:`bits`,type:`uint`}]}),Yx=I(([e])=>{let t=R(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:`mx_fade`,type:`float`,inputs:[{name:`t`,type:`float`}]}),Xx=y_([I(([e])=>{let t=z(e).toVar(),n=B(B(1)).toVar(),r=B(B(z(3735928559)).add(n.shiftLeft(B(2))).add(B(13))).toVar();return qx(r.add(B(t)),r,r)}).setLayout({name:`mx_hash_int_0`,type:`uint`,inputs:[{name:`x`,type:`int`}]}),I(([e,t])=>{let n=z(t).toVar(),r=z(e).toVar(),i=B(B(2)).toVar(),a=B().toVar(),o=B().toVar(),s=B().toVar();return a.assign(o.assign(s.assign(B(z(3735928559)).add(i.shiftLeft(B(2))).add(B(13))))),a.addAssign(B(r)),o.addAssign(B(n)),qx(a,o,s)}).setLayout({name:`mx_hash_int_1`,type:`uint`,inputs:[{name:`x`,type:`int`},{name:`y`,type:`int`}]}),I(([e,t,n])=>{let r=z(n).toVar(),i=z(t).toVar(),a=z(e).toVar(),o=B(B(3)).toVar(),s=B().toVar(),c=B().toVar(),l=B().toVar();return s.assign(c.assign(l.assign(B(z(3735928559)).add(o.shiftLeft(B(2))).add(B(13))))),s.addAssign(B(a)),c.addAssign(B(i)),l.addAssign(B(r)),qx(s,c,l)}).setLayout({name:`mx_hash_int_2`,type:`uint`,inputs:[{name:`x`,type:`int`},{name:`y`,type:`int`},{name:`z`,type:`int`}]}),I(([e,t,n,r])=>{let i=z(r).toVar(),a=z(n).toVar(),o=z(t).toVar(),s=z(e).toVar(),c=B(B(4)).toVar(),l=B().toVar(),u=B().toVar(),d=B().toVar();return l.assign(u.assign(d.assign(B(z(3735928559)).add(c.shiftLeft(B(2))).add(B(13))))),l.addAssign(B(s)),u.addAssign(B(o)),d.addAssign(B(a)),Kx(l,u,d),l.addAssign(B(i)),qx(l,u,d)}).setLayout({name:`mx_hash_int_3`,type:`uint`,inputs:[{name:`x`,type:`int`},{name:`y`,type:`int`},{name:`z`,type:`int`},{name:`xx`,type:`int`}]}),I(([e,t,n,r,i])=>{let a=z(i).toVar(),o=z(r).toVar(),s=z(n).toVar(),c=z(t).toVar(),l=z(e).toVar(),u=B(B(5)).toVar(),d=B().toVar(),f=B().toVar(),p=B().toVar();return d.assign(f.assign(p.assign(B(z(3735928559)).add(u.shiftLeft(B(2))).add(B(13))))),d.addAssign(B(l)),f.addAssign(B(c)),p.addAssign(B(s)),Kx(d,f,p),d.addAssign(B(o)),f.addAssign(B(a)),qx(d,f,p)}).setLayout({name:`mx_hash_int_4`,type:`uint`,inputs:[{name:`x`,type:`int`},{name:`y`,type:`int`},{name:`z`,type:`int`},{name:`xx`,type:`int`},{name:`yy`,type:`int`}]})]),Zx=y_([I(([e,t])=>{let n=z(t).toVar(),r=B(Xx(z(e).toVar(),n)).toVar(),i=co().toVar();return i.x.assign(r.bitAnd(z(255))),i.y.assign(r.shiftRight(z(8)).bitAnd(z(255))),i.z.assign(r.shiftRight(z(16)).bitAnd(z(255))),i}).setLayout({name:`mx_hash_vec3_0`,type:`uvec3`,inputs:[{name:`x`,type:`int`},{name:`y`,type:`int`}]}),I(([e,t,n])=>{let r=z(n).toVar(),i=z(t).toVar(),a=B(Xx(z(e).toVar(),i,r)).toVar(),o=co().toVar();return o.x.assign(a.bitAnd(z(255))),o.y.assign(a.shiftRight(z(8)).bitAnd(z(255))),o.z.assign(a.shiftRight(z(16)).bitAnd(z(255))),o}).setLayout({name:`mx_hash_vec3_1`,type:`uvec3`,inputs:[{name:`x`,type:`int`},{name:`y`,type:`int`},{name:`z`,type:`int`}]})]),Qx=y_([I(([e])=>{let t=V(e).toVar(),n=z().toVar(),r=z().toVar(),i=R(Ix(t.x,n)).toVar(),a=R(Ix(t.y,r)).toVar(),o=R(Yx(i)).toVar(),s=R(Yx(a)).toVar();return Ux(R(Lx(zx(Xx(n,r),i,a),zx(Xx(n.add(z(1)),r),i.sub(1),a),zx(Xx(n,r.add(z(1))),i,a.sub(1)),zx(Xx(n.add(z(1)),r.add(z(1))),i.sub(1),a.sub(1)),o,s)).toVar())}).setLayout({name:`mx_perlin_noise_float_0`,type:`float`,inputs:[{name:`p`,type:`vec2`}]}),I(([e])=>{let t=H(e).toVar(),n=z().toVar(),r=z().toVar(),i=z().toVar(),a=R(Ix(t.x,n)).toVar(),o=R(Ix(t.y,r)).toVar(),s=R(Ix(t.z,i)).toVar(),c=R(Yx(a)).toVar(),l=R(Yx(o)).toVar(),u=R(Yx(s)).toVar();return Wx(R(Rx(zx(Xx(n,r,i),a,o,s),zx(Xx(n.add(z(1)),r,i),a.sub(1),o,s),zx(Xx(n,r.add(z(1)),i),a,o.sub(1),s),zx(Xx(n.add(z(1)),r.add(z(1)),i),a.sub(1),o.sub(1),s),zx(Xx(n,r,i.add(z(1))),a,o,s.sub(1)),zx(Xx(n.add(z(1)),r,i.add(z(1))),a.sub(1),o,s.sub(1)),zx(Xx(n,r.add(z(1)),i.add(z(1))),a,o.sub(1),s.sub(1)),zx(Xx(n.add(z(1)),r.add(z(1)),i.add(z(1))),a.sub(1),o.sub(1),s.sub(1)),c,l,u)).toVar())}).setLayout({name:`mx_perlin_noise_float_1`,type:`float`,inputs:[{name:`p`,type:`vec3`}]})]),$x=y_([I(([e])=>{let t=V(e).toVar(),n=z().toVar(),r=z().toVar(),i=R(Ix(t.x,n)).toVar(),a=R(Ix(t.y,r)).toVar(),o=R(Yx(i)).toVar(),s=R(Yx(a)).toVar();return Ux(H(Lx(Bx(Zx(n,r),i,a),Bx(Zx(n.add(z(1)),r),i.sub(1),a),Bx(Zx(n,r.add(z(1))),i,a.sub(1)),Bx(Zx(n.add(z(1)),r.add(z(1))),i.sub(1),a.sub(1)),o,s)).toVar())}).setLayout({name:`mx_perlin_noise_vec3_0`,type:`vec3`,inputs:[{name:`p`,type:`vec2`}]}),I(([e])=>{let t=H(e).toVar(),n=z().toVar(),r=z().toVar(),i=z().toVar(),a=R(Ix(t.x,n)).toVar(),o=R(Ix(t.y,r)).toVar(),s=R(Ix(t.z,i)).toVar(),c=R(Yx(a)).toVar(),l=R(Yx(o)).toVar(),u=R(Yx(s)).toVar();return Wx(H(Rx(Bx(Zx(n,r,i),a,o,s),Bx(Zx(n.add(z(1)),r,i),a.sub(1),o,s),Bx(Zx(n,r.add(z(1)),i),a,o.sub(1),s),Bx(Zx(n.add(z(1)),r.add(z(1)),i),a.sub(1),o.sub(1),s),Bx(Zx(n,r,i.add(z(1))),a,o,s.sub(1)),Bx(Zx(n.add(z(1)),r,i.add(z(1))),a.sub(1),o,s.sub(1)),Bx(Zx(n,r.add(z(1)),i.add(z(1))),a,o.sub(1),s.sub(1)),Bx(Zx(n.add(z(1)),r.add(z(1)),i.add(z(1))),a.sub(1),o.sub(1),s.sub(1)),c,l,u)).toVar())}).setLayout({name:`mx_perlin_noise_vec3_1`,type:`vec3`,inputs:[{name:`p`,type:`vec3`}]})]),eS=y_([I(([e])=>Jx(Xx(z(Fx(R(e).toVar())).toVar()))).setLayout({name:`mx_cell_noise_float_0`,type:`float`,inputs:[{name:`p`,type:`float`}]}),I(([e])=>{let t=V(e).toVar();return Jx(Xx(z(Fx(t.x)).toVar(),z(Fx(t.y)).toVar()))}).setLayout({name:`mx_cell_noise_float_1`,type:`float`,inputs:[{name:`p`,type:`vec2`}]}),I(([e])=>{let t=H(e).toVar();return Jx(Xx(z(Fx(t.x)).toVar(),z(Fx(t.y)).toVar(),z(Fx(t.z)).toVar()))}).setLayout({name:`mx_cell_noise_float_2`,type:`float`,inputs:[{name:`p`,type:`vec3`}]}),I(([e])=>{let t=U(e).toVar();return Jx(Xx(z(Fx(t.x)).toVar(),z(Fx(t.y)).toVar(),z(Fx(t.z)).toVar(),z(Fx(t.w)).toVar()))}).setLayout({name:`mx_cell_noise_float_3`,type:`float`,inputs:[{name:`p`,type:`vec4`}]})]),tS=y_([I(([e])=>{let t=z(Fx(R(e).toVar())).toVar();return H(Jx(Xx(t,z(0))),Jx(Xx(t,z(1))),Jx(Xx(t,z(2))))}).setLayout({name:`mx_cell_noise_vec3_0`,type:`vec3`,inputs:[{name:`p`,type:`float`}]}),I(([e])=>{let t=V(e).toVar(),n=z(Fx(t.x)).toVar(),r=z(Fx(t.y)).toVar();return H(Jx(Xx(n,r,z(0))),Jx(Xx(n,r,z(1))),Jx(Xx(n,r,z(2))))}).setLayout({name:`mx_cell_noise_vec3_1`,type:`vec3`,inputs:[{name:`p`,type:`vec2`}]}),I(([e])=>{let t=H(e).toVar(),n=z(Fx(t.x)).toVar(),r=z(Fx(t.y)).toVar(),i=z(Fx(t.z)).toVar();return H(Jx(Xx(n,r,i,z(0))),Jx(Xx(n,r,i,z(1))),Jx(Xx(n,r,i,z(2))))}).setLayout({name:`mx_cell_noise_vec3_2`,type:`vec3`,inputs:[{name:`p`,type:`vec3`}]}),I(([e])=>{let t=U(e).toVar(),n=z(Fx(t.x)).toVar(),r=z(Fx(t.y)).toVar(),i=z(Fx(t.z)).toVar(),a=z(Fx(t.w)).toVar();return H(Jx(Xx(n,r,i,a,z(0))),Jx(Xx(n,r,i,a,z(1))),Jx(Xx(n,r,i,a,z(2))))}).setLayout({name:`mx_cell_noise_vec3_3`,type:`vec3`,inputs:[{name:`p`,type:`vec4`}]})]),nS=I(([e,t,n,r])=>{let i=R(r).toVar(),a=R(n).toVar(),o=z(t).toVar(),s=H(e).toVar(),c=R(0).toVar(),l=R(1).toVar();return nm(o,()=>{c.addAssign(l.mul(Qx(s))),l.mulAssign(i),s.mulAssign(a)}),c}).setLayout({name:`mx_fractal_noise_float`,type:`float`,inputs:[{name:`p`,type:`vec3`},{name:`octaves`,type:`int`},{name:`lacunarity`,type:`float`},{name:`diminish`,type:`float`}]}),rS=I(([e,t,n,r])=>{let i=R(r).toVar(),a=R(n).toVar(),o=z(t).toVar(),s=H(e).toVar(),c=H(0).toVar(),l=R(1).toVar();return nm(o,()=>{c.addAssign(l.mul($x(s))),l.mulAssign(i),s.mulAssign(a)}),c}).setLayout({name:`mx_fractal_noise_vec3`,type:`vec3`,inputs:[{name:`p`,type:`vec3`},{name:`octaves`,type:`int`},{name:`lacunarity`,type:`float`},{name:`diminish`,type:`float`}]}),iS=I(([e,t,n,r])=>{let i=R(r).toVar(),a=R(n).toVar(),o=z(t).toVar(),s=H(e).toVar();return V(nS(s,o,a,i),nS(s.add(H(z(19),z(193),z(17))),o,a,i))}).setLayout({name:`mx_fractal_noise_vec2`,type:`vec2`,inputs:[{name:`p`,type:`vec3`},{name:`octaves`,type:`int`},{name:`lacunarity`,type:`float`},{name:`diminish`,type:`float`}]}),aS=I(([e,t,n,r])=>{let i=R(r).toVar(),a=R(n).toVar(),o=z(t).toVar(),s=H(e).toVar();return U(H(rS(s,o,a,i)).toVar(),R(nS(s.add(H(z(19),z(193),z(17))),o,a,i)).toVar())}).setLayout({name:`mx_fractal_noise_vec4`,type:`vec4`,inputs:[{name:`p`,type:`vec3`},{name:`octaves`,type:`int`},{name:`lacunarity`,type:`float`},{name:`diminish`,type:`float`}]}),oS=y_([I(([e,t,n,r,i,a,o])=>{let s=z(o).toVar(),c=R(a).toVar(),l=z(i).toVar(),u=z(r).toVar(),d=z(n).toVar(),f=z(t).toVar(),p=V(e).toVar(),m=H(tS(V(f.add(u),d.add(l)))).toVar(),h=V(m.x,m.y).toVar();h.subAssign(.5),h.mulAssign(c),h.addAssign(.5);let g=V(V(V(R(f),R(d)).add(h)).toVar().sub(p)).toVar();return L(s.equal(z(2)),()=>uc(g.x).add(uc(g.y))),L(s.equal(z(3)),()=>Tc(uc(g.x),uc(g.y))),Ac(g,g)}).setLayout({name:`mx_worley_distance_0`,type:`float`,inputs:[{name:`p`,type:`vec2`},{name:`x`,type:`int`},{name:`y`,type:`int`},{name:`xoff`,type:`int`},{name:`yoff`,type:`int`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]}),I(([e,t,n,r,i,a,o,s,c])=>{let l=z(c).toVar(),u=R(s).toVar(),d=z(o).toVar(),f=z(a).toVar(),p=z(i).toVar(),m=z(r).toVar(),h=z(n).toVar(),g=z(t).toVar(),_=H(e).toVar(),v=H(tS(H(g.add(p),h.add(f),m.add(d)))).toVar();v.subAssign(.5),v.mulAssign(u),v.addAssign(.5);let y=H(H(H(R(g),R(h),R(m)).add(v)).toVar().sub(_)).toVar();return L(l.equal(z(2)),()=>uc(y.x).add(uc(y.y)).add(uc(y.z))),L(l.equal(z(3)),()=>Tc(uc(y.x),uc(y.y),uc(y.z))),Ac(y,y)}).setLayout({name:`mx_worley_distance_1`,type:`float`,inputs:[{name:`p`,type:`vec3`},{name:`x`,type:`int`},{name:`y`,type:`int`},{name:`z`,type:`int`},{name:`xoff`,type:`int`},{name:`yoff`,type:`int`},{name:`zoff`,type:`int`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]})]),sS=I(([e,t,n])=>{let r=z(n).toVar(),i=R(t).toVar(),a=V(e).toVar(),o=z().toVar(),s=z().toVar(),c=V(Ix(a.x,o),Ix(a.y,s)).toVar(),l=R(1e6).toVar();return nm({start:-1,end:z(1),name:`x`,condition:`<=`},({x:e})=>{nm({start:-1,end:z(1),name:`y`,condition:`<=`},({y:t})=>{let n=R(oS(c,e,t,o,s,i,r)).toVar();l.assign(wc(l,n))})}),L(r.equal(z(0)),()=>{l.assign(Qs(l))}),l}).setLayout({name:`mx_worley_noise_float_0`,type:`float`,inputs:[{name:`p`,type:`vec2`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]}),cS=I(([e,t,n])=>{let r=z(n).toVar(),i=R(t).toVar(),a=V(e).toVar(),o=z().toVar(),s=z().toVar(),c=V(Ix(a.x,o),Ix(a.y,s)).toVar(),l=V(1e6,1e6).toVar();return nm({start:-1,end:z(1),name:`x`,condition:`<=`},({x:e})=>{nm({start:-1,end:z(1),name:`y`,condition:`<=`},({y:t})=>{let n=R(oS(c,e,t,o,s,i,r)).toVar();L(n.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(n)}).ElseIf(n.lessThan(l.y),()=>{l.y.assign(n)})})}),L(r.equal(z(0)),()=>{l.assign(Qs(l))}),l}).setLayout({name:`mx_worley_noise_vec2_0`,type:`vec2`,inputs:[{name:`p`,type:`vec2`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]}),lS=I(([e,t,n])=>{let r=z(n).toVar(),i=R(t).toVar(),a=V(e).toVar(),o=z().toVar(),s=z().toVar(),c=V(Ix(a.x,o),Ix(a.y,s)).toVar(),l=H(1e6,1e6,1e6).toVar();return nm({start:-1,end:z(1),name:`x`,condition:`<=`},({x:e})=>{nm({start:-1,end:z(1),name:`y`,condition:`<=`},({y:t})=>{let n=R(oS(c,e,t,o,s,i,r)).toVar();L(n.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(n)}).ElseIf(n.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(n)}).ElseIf(n.lessThan(l.z),()=>{l.z.assign(n)})})}),L(r.equal(z(0)),()=>{l.assign(Qs(l))}),l}).setLayout({name:`mx_worley_noise_vec3_0`,type:`vec3`,inputs:[{name:`p`,type:`vec2`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]}),uS=y_([sS,I(([e,t,n])=>{let r=z(n).toVar(),i=R(t).toVar(),a=H(e).toVar(),o=z().toVar(),s=z().toVar(),c=z().toVar(),l=H(Ix(a.x,o),Ix(a.y,s),Ix(a.z,c)).toVar(),u=R(1e6).toVar();return nm({start:-1,end:z(1),name:`x`,condition:`<=`},({x:e})=>{nm({start:-1,end:z(1),name:`y`,condition:`<=`},({y:t})=>{nm({start:-1,end:z(1),name:`z`,condition:`<=`},({z:n})=>{let a=R(oS(l,e,t,n,o,s,c,i,r)).toVar();u.assign(wc(u,a))})})}),L(r.equal(z(0)),()=>{u.assign(Qs(u))}),u}).setLayout({name:`mx_worley_noise_float_1`,type:`float`,inputs:[{name:`p`,type:`vec3`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]})]),dS=y_([cS,I(([e,t,n])=>{let r=z(n).toVar(),i=R(t).toVar(),a=H(e).toVar(),o=z().toVar(),s=z().toVar(),c=z().toVar(),l=H(Ix(a.x,o),Ix(a.y,s),Ix(a.z,c)).toVar(),u=V(1e6,1e6).toVar();return nm({start:-1,end:z(1),name:`x`,condition:`<=`},({x:e})=>{nm({start:-1,end:z(1),name:`y`,condition:`<=`},({y:t})=>{nm({start:-1,end:z(1),name:`z`,condition:`<=`},({z:n})=>{let a=R(oS(l,e,t,n,o,s,c,i,r)).toVar();L(a.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(a)}).ElseIf(a.lessThan(u.y),()=>{u.y.assign(a)})})})}),L(r.equal(z(0)),()=>{u.assign(Qs(u))}),u}).setLayout({name:`mx_worley_noise_vec2_1`,type:`vec2`,inputs:[{name:`p`,type:`vec3`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]})]),fS=y_([lS,I(([e,t,n])=>{let r=z(n).toVar(),i=R(t).toVar(),a=H(e).toVar(),o=z().toVar(),s=z().toVar(),c=z().toVar(),l=H(Ix(a.x,o),Ix(a.y,s),Ix(a.z,c)).toVar(),u=H(1e6,1e6,1e6).toVar();return nm({start:-1,end:z(1),name:`x`,condition:`<=`},({x:e})=>{nm({start:-1,end:z(1),name:`y`,condition:`<=`},({y:t})=>{nm({start:-1,end:z(1),name:`z`,condition:`<=`},({z:n})=>{let a=R(oS(l,e,t,n,o,s,c,i,r)).toVar();L(a.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(a)}).ElseIf(a.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(a)}).ElseIf(a.lessThan(u.z),()=>{u.z.assign(a)})})})}),L(r.equal(z(0)),()=>{u.assign(Qs(u))}),u}).setLayout({name:`mx_worley_noise_vec3_1`,type:`vec3`,inputs:[{name:`p`,type:`vec3`},{name:`jitter`,type:`float`},{name:`metric`,type:`int`}]})]),pS=I(([e,t,n,r,i,a,o,s,c,l,u])=>{let d=z(e).toVar(),f=V(t).toVar(),p=V(n).toVar(),m=V(r).toVar(),h=R(i).toVar(),g=R(a).toVar(),_=R(o).toVar(),v=ro(s).toVar(),y=z(c).toVar(),b=R(l).toVar(),x=R(u).toVar(),S=f.mul(p).add(m),C=R(0).toVar();return L(d.equal(z(0)),()=>{C.assign($x(S))}),L(d.equal(z(1)),()=>{C.assign(tS(S))}),L(d.equal(z(2)),()=>{C.assign(fS(S,h,z(0)))}),L(d.equal(z(3)),()=>{C.assign(rS(H(S,0),y,b,x))}),C.assign(C.mul(_.sub(g)).add(g)),L(v,()=>{C.assign(Bc(C,g,_))}),C}).setLayout({name:`mx_unifiednoise2d`,type:`float`,inputs:[{name:`noiseType`,type:`int`},{name:`texcoord`,type:`vec2`},{name:`freq`,type:`vec2`},{name:`offset`,type:`vec2`},{name:`jitter`,type:`float`},{name:`outmin`,type:`float`},{name:`outmax`,type:`float`},{name:`clampoutput`,type:`bool`},{name:`octaves`,type:`int`},{name:`lacunarity`,type:`float`},{name:`diminish`,type:`float`}]}),mS=I(([e,t,n,r,i,a,o,s,c,l,u])=>{let d=z(e).toVar(),f=H(t).toVar(),p=H(n).toVar(),m=H(r).toVar(),h=R(i).toVar(),g=R(a).toVar(),_=R(o).toVar(),v=ro(s).toVar(),y=z(c).toVar(),b=R(l).toVar(),x=R(u).toVar(),S=f.mul(p).add(m),C=R(0).toVar();return L(d.equal(z(0)),()=>{C.assign($x(S))}),L(d.equal(z(1)),()=>{C.assign(tS(S))}),L(d.equal(z(2)),()=>{C.assign(fS(S,h,z(0)))}),L(d.equal(z(3)),()=>{C.assign(rS(S,y,b,x))}),C.assign(C.mul(_.sub(g)).add(g)),L(v,()=>{C.assign(Bc(C,g,_))}),C}).setLayout({name:`mx_unifiednoise3d`,type:`float`,inputs:[{name:`noiseType`,type:`int`},{name:`position`,type:`vec3`},{name:`freq`,type:`vec3`},{name:`offset`,type:`vec3`},{name:`jitter`,type:`float`},{name:`outmin`,type:`float`},{name:`outmax`,type:`float`},{name:`clampoutput`,type:`bool`},{name:`octaves`,type:`int`},{name:`lacunarity`,type:`float`},{name:`diminish`,type:`float`}]}),hS=I(([e])=>{let t=e.y,n=e.z,r=H().toVar();return L(t.lessThan(1e-4),()=>{r.assign(H(n,n,n))}).Else(()=>{let i=e.x;i=i.sub(ec(i)).mul(6).toVar();let a=z(yc(i)),o=i.sub(R(a)),s=n.mul(t.oneMinus()),c=n.mul(t.mul(o).oneMinus()),l=n.mul(t.mul(o.oneMinus()).oneMinus());L(a.equal(z(0)),()=>{r.assign(H(n,l,s))}).ElseIf(a.equal(z(1)),()=>{r.assign(H(c,n,s))}).ElseIf(a.equal(z(2)),()=>{r.assign(H(s,n,l))}).ElseIf(a.equal(z(3)),()=>{r.assign(H(s,c,n))}).ElseIf(a.equal(z(4)),()=>{r.assign(H(l,s,n))}).Else(()=>{r.assign(H(n,s,c))})}),r}).setLayout({name:`mx_hsvtorgb`,type:`vec3`,inputs:[{name:`hsv`,type:`vec3`}]}),gS=I(([e])=>{let t=H(e).toVar(),n=R(t.x).toVar(),r=R(t.y).toVar(),i=R(t.z).toVar(),a=R(wc(n,wc(r,i))).toVar(),o=R(Tc(n,Tc(r,i))).toVar(),s=R(o.sub(a)).toVar(),c=R().toVar(),l=R().toVar(),u=R().toVar();return u.assign(o),L(o.greaterThan(0),()=>{l.assign(s.div(o))}).Else(()=>{l.assign(0)}),L(l.lessThanEqual(0),()=>{c.assign(0)}).Else(()=>{L(n.greaterThanEqual(o),()=>{c.assign(r.sub(i).div(s))}).ElseIf(r.greaterThanEqual(o),()=>{c.assign(ms(2,i.sub(n).div(s)))}).Else(()=>{c.assign(ms(4,n.sub(r).div(s)))}),c.mulAssign(1/6),L(c.lessThan(0),()=>{c.addAssign(1)})}),H(c,l,u)}).setLayout({name:`mx_rgbtohsv`,type:`vec3`,inputs:[{name:`c`,type:`vec3`}]}),_S=I(([e])=>{let t=H(e).toVar(),n=lo(bs(t,H(.04045))).toVar();return zc(H(t.div(12.92)).toVar(),H(Mc(Tc(t.add(H(.055)),H(0)).div(1.055),H(2.4))).toVar(),n)}).setLayout({name:`mx_srgb_texture_to_lin_rec709`,type:`vec3`,inputs:[{name:`color`,type:`vec3`}]}),vS=(e,t)=>{e=R(e),t=R(t);let n=V(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return Uc(e.sub(n),e.add(n),t)},yS=(e,t,n,r)=>zc(e,t,n[r].clamp()),bS=(e,t,n=au())=>yS(e,t,n,`x`),xS=(e,t,n=au())=>yS(e,t,n,`y`),SS=(e,t,n,r,i=au())=>{let a=i.x.clamp(),o=i.y.clamp();return zc(zc(e,t,a),zc(n,r,a),o)},CS=(e,t,n,r,i)=>zc(e,t,vS(n,r[i])),Q=Object.freeze({__proto__:null,BRDF_GGX:lh,BRDF_Lambert:th,BasicPointShadowFilter:wx,BasicShadowFilter:ex,Break:im,Const:sl,Continue:rm,DFGLUT:fh,D_GGX:oh,Discard:ql,EPSILON:Rs,F_Schlick:eh,Fn:I,HALF_PI:Us,INFINITY:zs,If:L,Loop:nm,NodeAccess:Ji,NodeShaderStage:Ki,NodeType:qi,NodeUpdateType:k,OnBeforeMaterialUpdate:_v,OnBeforeObjectUpdate:gv,OnMaterialUpdate:hv,OnObjectUpdate:mv,PCFShadowFilter:tx,PCFSoftShadowFilter:nx,PI:Bs,PI2:Vs,PointShadowFilter:Tx,Return:Jl,Schlick_to_F0:ph,ShaderNode:Ka,Stack:to,Switch:eo,TBNViewMatrix:Bf,TWO_PI:Hs,VSMShadowFilter:rx,V_GGX_SmithCorrelated:ih,Var:ol,VarIntent:cl,abs:uc,acesFilmicToneMapping:ly,acos:cc,add:ms,addMethodChaining:j,addNodeElement:nu,agxToneMapping:py,all:Ws,alphaT:Lo,and:Cs,anisotropy:Ro,anisotropyB:Bo,anisotropyT:zo,any:Gs,append:So,array:cs,arrayBuffer:vo,asin:sc,assign:ls,atan:lc,atomicAdd:Zy,atomicAnd:tb,atomicFunc:Jy,atomicLoad:Yy,atomicMax:$y,atomicMin:eb,atomicOr:nb,atomicStore:Xy,atomicSub:Qy,atomicXor:rb,attenuationColor:$o,attenuationDistance:Qo,attribute:iu,attributeArray:bv,backgroundBlurriness:Tv,backgroundIntensity:Ev,backgroundRotation:Dv,batch:Xp,bentNormalView:Uf,billboarding:A_,bitAnd:Ds,bitNot:Os,bitOr:ks,bitXor:As,bitangentGeometry:If,bitangentLocal:Lf,bitangentView:Rf,bitangentWorld:zf,bitcast:Kg,blendBurn:Gm,blendColor:Ym,blendDodge:Km,blendOverlay:Jm,blendScreen:qm,blur:Gh,bool:ro,buffer:yu,bufferAttribute:Ml,builtin:Cu,builtinAOContext:rl,builtinShadowContext:nl,bumpMap:Xf,bvec2:oo,bvec3:lo,bvec4:po,bypass:Hl,cache:Vl,call:ds,cameraFar:Qu,cameraIndex:Xu,cameraNear:Zu,cameraNormalMatrix:rd,cameraPosition:id,cameraProjectionMatrix:$u,cameraProjectionMatrixInverse:ed,cameraViewMatrix:td,cameraViewport:ad,cameraWorldMatrix:nd,cbrt:Lc,cdl:Kv,ceil:tc,checker:jx,cineonToneMapping:sy,clamp:Bc,clearcoat:Ao,clearcoatNormalView:Gd,clearcoatRoughness:jo,clipSpace:Dd,code:gy,color:no,colorSpaceToWorking:yl,colorToDirection:Gf,compute:Rl,computeKernel:Ll,computeSkinning:em,context:$c,convert:bo,convertColorSpace:bl,convertToTexture:iv,cos:ac,countLeadingZeros:e_,countOneBits:t_,countTrailingZeros:$g,cross:jc,cubeTexture:lf,cubeTextureBase:cf,dFdx:hc,dFdy:gc,dashSize:Ko,debug:Ql,decrement:Is,decrementBefore:Ps,defaultBuildStages:Xi,defaultShaderStages:Yi,defined:Wa,degrees:qs,deltaTime:x_,densityFogFactor:Ey,depth:Mm,depthPass:ny,determinant:Sc,difference:kc,diffuseColor:To,diffuseContribution:Eo,directPointLight:Ax,directionToColor:Wf,directionToFaceDirection:Ld,dispersion:es,disposeShadowMaterial:ax,distance:Oc,div:hs,dot:Ac,drawIndex:Kp,dynamicBufferAttribute:Nl,element:yo,emissive:Do,equal:_s,equirectUV:$m,exp:Js,exp2:Ys,exponentialHeightFogFactor:Dy,expression:Kl,faceDirection:Id,faceForward:Wc,faceforward:Yc,float:R,floatBitsToInt:qg,floatBitsToUint:Jg,floor:ec,fog:Oy,fract:rc,frameGroup:is,frameId:S_,frontFacing:Fd,fwidth:bc,gain:i_,gapSize:qo,getConstNodeType:Ga,getCurrentStack:$a,getDirection:Vh,getDistanceAttenuation:kx,getGeometryRoughness:nh,getNormalFromDepth:sv,getParallaxCorrectNormal:I(([e,t,n])=>{let r=nc(e).toVar(),i=q(R(.5).mul(t.sub(n)),jd).div(r).toVar(),a=q(R(-.5).mul(t.sub(n)),jd).div(r).toVar(),o=H().toVar();o.x=r.x.greaterThan(R(0)).select(i.x,a.x),o.y=r.y.greaterThan(R(0)).select(i.y,a.y),o.z=r.z.greaterThan(R(0)).select(i.z,a.z);let s=wc(o.x,o.y,o.z).toVar();return jd.add(r.mul(s)).toVar().sub(n)}),getRoughness:rh,getScreenPosition:ov,getShIrradianceAt:I(([e,t])=>{let n=e.x,r=e.y,i=e.z,a=t.element(0).mul(.886227);return a=a.add(t.element(1).mul(2*.511664).mul(r)),a=a.add(t.element(2).mul(2*.511664).mul(i)),a=a.add(t.element(3).mul(2*.511664).mul(n)),a=a.add(t.element(4).mul(2*.429043).mul(n).mul(r)),a=a.add(t.element(5).mul(2*.429043).mul(r).mul(i)),a=a.add(t.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),a=a.add(t.element(7).mul(2*.429043).mul(n).mul(i)),a=a.add(t.element(8).mul(.429043).mul(J(n,n).sub(J(r,r)))),a}),getShadowMaterial:ix,getShadowRenderObjectFunction:cx,getTextureIndex:Ug,getViewPosition:av,ggxConvolution:Yh,globalId:Iy,glsl:yy,glslFn:Sy,grayscale:Vv,greaterThan:bs,greaterThanEqual:Ss,hash:n_,highpModelNormalViewMatrix:Ed,highpModelViewMatrix:Td,hue:Wv,increment:Fs,incrementBefore:Ns,inspector:tu,instance:Jp,instanceIndex:Hp,instancedArray:xv,instancedBufferAttribute:Pl,instancedDynamicBufferAttribute:Fl,instancedMesh:Yp,int:z,intBitsToFloat:Yg,interleavedGradientNoise:cv,inverse:Cc,inverseSqrt:$s,inversesqrt:Xc,invocationLocalIndex:Gp,invocationSubgroupIndex:Wp,ior:Yo,iridescence:Po,iridescenceIOR:Fo,iridescenceThickness:Io,isolate:Bl,ivec2:io,ivec3:so,ivec4:uo,js:_y,label:il,length:fc,lengthSq:Rc,lessThan:ys,lessThanEqual:xs,lightPosition:Nb,lightProjectionUV:Mb,lightShadowMatrix:jb,lightTargetDirection:Ib,lightTargetPosition:Pb,lightViewPosition:Fb,lightingContext:fm,lights:Hb,linearDepth:Nm,linearToneMapping:ay,localId:Ly,log:Xs,log2:Zs,logarithmicDepthToViewZ:Am,luminance:Gv,mat2:mo,mat3:ho,mat4:go,matcapUV:Og,materialAO:Pp,materialAlphaTest:Qf,materialAnisotropy:_p,materialAnisotropyVector:Fp,materialAttenuationColor:Tp,materialAttenuationDistance:wp,materialClearcoat:dp,materialClearcoatNormal:pp,materialClearcoatRoughness:fp,materialColor:$f,materialDispersion:Mp,materialEmissive:tp,materialEnvIntensity:ef,materialEnvRotation:tf,materialIOR:Cp,materialIridescence:vp,materialIridescenceIOR:yp,materialIridescenceThickness:bp,materialLightMap:Np,materialLineDashOffset:Ap,materialLineDashSize:Dp,materialLineGapSize:Op,materialLineScale:Ep,materialLineWidth:kp,materialMetalness:lp,materialNormal:up,materialOpacity:np,materialPointSize:jp,materialReference:gf,materialReflectivity:sp,materialRefractionRatio:$d,materialRotation:mp,materialRoughness:cp,materialSheen:hp,materialSheenRoughness:gp,materialShininess:ep,materialSpecular:rp,materialSpecularColor:ap,materialSpecularIntensity:ip,materialSpecularStrength:op,materialThickness:Sp,materialTransmission:xp,max:Tc,maxMipLevel:su,mediumpModelViewMatrix:wd,metalness:ko,min:wc,mix:zc,mixElement:Kc,mod:gs,modInt:Ls,modelDirection:hd,modelNormalMatrix:xd,modelPosition:_d,modelRadius:bd,modelScale:vd,modelViewMatrix:Cd,modelViewPosition:yd,modelViewProjection:Ip,modelWorldMatrix:gd,modelWorldMatrixInverse:Sd,morphReference:lm,mrt:Wg,mul:J,mx_aastep:vS,mx_add:(e,t=R(0))=>ms(e,t),mx_atan2:(e=R(0),t=R(1))=>lc(e,t),mx_cell_noise_float:(e=au())=>eS(e.convert(`vec2|vec3`)),mx_contrast:(e,t=1,n=.5)=>R(e).sub(n).mul(t).add(n),mx_divide:(e,t=R(1))=>hs(e,t),mx_fractal_noise_float:(e=au(),t=3,n=2,r=.5,i=1)=>nS(e,z(t),n,r).mul(i),mx_fractal_noise_vec2:(e=au(),t=3,n=2,r=.5,i=1)=>iS(e,z(t),n,r).mul(i),mx_fractal_noise_vec3:(e=au(),t=3,n=2,r=.5,i=1)=>rS(e,z(t),n,r).mul(i),mx_fractal_noise_vec4:(e=au(),t=3,n=2,r=.5,i=1)=>aS(e,z(t),n,r).mul(i),mx_frame:()=>S_,mx_heighttonormal:(e,t)=>(e=H(e),t=R(t),Xf(e,t)),mx_hsvtorgb:hS,mx_ifequal:(e,t,n,r)=>e.equal(t).mix(n,r),mx_ifgreater:(e,t,n,r)=>e.greaterThan(t).mix(n,r),mx_ifgreatereq:(e,t,n,r)=>e.greaterThanEqual(t).mix(n,r),mx_invert:(e,t=R(1))=>q(t,e),mx_modulo:(e,t=R(1))=>gs(e,t),mx_multiply:(e,t=R(1))=>J(e,t),mx_noise_float:(e=au(),t=1,n=0)=>Qx(e.convert(`vec2|vec3`)).mul(t).add(n),mx_noise_vec3:(e=au(),t=1,n=0)=>$x(e.convert(`vec2|vec3`)).mul(t).add(n),mx_noise_vec4:(e=au(),t=1,n=0)=>(e=e.convert(`vec2|vec3`),U($x(e),Qx(e.add(V(19,73)))).mul(t).add(n)),mx_place2d:(e,t=V(.5,.5),n=V(1,1),r=R(0),i=V(0,0))=>{let a=e;if(t&&(a=a.sub(t)),n&&(a=a.mul(n)),r){let e=r.mul(Math.PI/180),t=e.cos(),n=e.sin();a=V(a.x.mul(t).sub(a.y.mul(n)),a.x.mul(n).add(a.y.mul(t)))}return t&&(a=a.add(t)),i&&(a=a.add(i)),a},mx_power:(e,t=R(1))=>Mc(e,t),mx_ramp4:SS,mx_ramplr:bS,mx_ramptb:xS,mx_rgbtohsv:gS,mx_rotate2d:(e,t)=>{e=V(e),t=R(t);let n=t.mul(Math.PI/180);return kg(e,n)},mx_rotate3d:(e,t,n)=>{e=H(e),t=R(t),n=H(n);let r=t.mul(Math.PI/180),i=n.normalize(),a=r.cos(),o=r.sin(),s=R(1).sub(a);return e.mul(a).add(i.cross(e).mul(o)).add(i.mul(i.dot(e)).mul(s))},mx_safepower:(e,t=1)=>(e=R(e),e.abs().pow(t).mul(e.sign())),mx_separate:(e,t=null)=>{if(typeof t==`string`){let n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},r=t.replace(/^out/,``).toLowerCase();if(n[r]!==void 0)return e.element(n[r])}if(typeof t==`number`)return e.element(t);if(typeof t==`string`&&t.length===1){let n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(n[t]!==void 0)return e.element(n[t])}return e},mx_splitlr:(e,t,n,r=au())=>CS(e,t,n,r,`x`),mx_splittb:(e,t,n,r=au())=>CS(e,t,n,r,`y`),mx_srgb_texture_to_lin_rec709:_S,mx_subtract:(e,t=R(0))=>q(e,t),mx_timer:()=>b_,mx_transform_uv:(e=1,t=0,n=au())=>n.mul(e).add(t),mx_unifiednoise2d:(e,t=au(),n=V(1,1),r=V(0,0),i=1,a=0,o=1,s=!1,c=1,l=2,u=.5)=>pS(e,t.convert(`vec2|vec3`),n,r,i,a,o,s,c,l,u),mx_unifiednoise3d:(e,t=au(),n=V(1,1),r=V(0,0),i=1,a=0,o=1,s=!1,c=1,l=2,u=.5)=>mS(e,t.convert(`vec2|vec3`),n,r,i,a,o,s,c,l,u),mx_worley_noise_float:(e=au(),t=1)=>uS(e.convert(`vec2|vec3`),t,z(1)),mx_worley_noise_vec2:(e=au(),t=1)=>dS(e.convert(`vec2|vec3`),t,z(1)),mx_worley_noise_vec3:(e=au(),t=1)=>fS(e.convert(`vec2|vec3`),t,z(1)),negate:pc,neutralToneMapping:my,nodeArray:Ya,nodeImmutable:P,nodeObject:M,nodeObjectIntent:qa,nodeObjects:Ja,nodeProxy:N,nodeProxyIntent:F,normalFlat:Bd,normalGeometry:Rd,normalLocal:zd,normalMap:qf,normalView:Ud,normalViewGeometry:Vd,normalWorld:Wd,normalWorldGeometry:Hd,normalize:nc,not:Ts,notEqual:vs,numWorkgroups:Py,objectDirection:cd,objectGroup:as,objectPosition:ud,objectRadius:pd,objectScale:dd,objectViewPosition:fd,objectWorldMatrix:ld,oneMinus:mc,or:ws,orthographicDepthToViewZ:Tm,oscSawtooth:E_,oscSine:C_,oscSquare:w_,oscTriangle:T_,output:Go,outputStruct:zg,overloadingFn:y_,packHalf2x16:u_,packSnorm2x16:c_,packUnorm2x16:l_,parabola:r_,parallaxDirection:Vf,parallaxUV:Hf,parameter:Mg,pass:ey,passTexture:ty,pcurve:a_,perspectiveDepthToViewZ:Om,pmremTexture:Dg,pointShadow:Ox,pointUV:Sv,pointWidth:Jo,positionGeometry:Od,positionLocal:kd,positionPrevious:Ad,positionView:Nd,positionViewDirection:Pd,positionWorld:jd,positionWorldDirection:Md,posterize:qv,pow:Mc,pow2:Nc,pow3:Pc,pow4:Fc,premultiplyAlpha:Xm,property:Co,quadBroadcast:Ob,quadSwapDiagonal:Sb,quadSwapX:bb,quadSwapY:xb,radians:Ks,rand:Gc,range:jy,rangeFogFactor:Ty,reciprocal:vc,reference:pf,referenceBuffer:mf,reflect:Dc,reflectVector:af,reflectView:nf,reflector:Z_,refract:Hc,refractVector:of,refractView:rf,reinhardToneMapping:oy,remap:Wl,remapClamp:Gl,renderGroup:G,renderOutput:Xl,rendererReference:wl,replaceDefaultUV:D_,rotate:kg,rotateUV:O_,roughness:Oo,round:_c,rtt:rv,sRGBTransferEOTF:pl,sRGBTransferOETF:ml,sample:dv,sampler:gu,samplerComparison:_u,saturate:Vc,saturation:Hv,screenCoordinate:Au,screenDPR:Du,screenSize:ku,screenUV:Ou,select:Zc,setCurrentStack:Qa,setName:tl,shaderStages:Zi,shadow:hx,shadowPositionWorld:Wb,shapeCircle:Mx,sharedUniformGroup:rs,sheen:Mo,sheenRoughness:No,shiftLeft:js,shiftRight:Ms,shininess:Wo,sign:dc,sin:ic,sinc:o_,skinning:$p,smoothstep:Uc,smoothstepElement:qc,specularColor:Vo,specularColorBlended:Ho,specularF90:Uo,spherizeUV:k_,split:xo,spritesheetUV:M_,sqrt:Qs,stack:Ng,step:Ec,stepElement:Jc,storage:zp,storageBarrier:Vy,storageTexture:Ov,string:_o,struct:Lg,sub:q,subBuild:ul,subgroupAdd:ob,subgroupAll:_b,subgroupAnd:fb,subgroupAny:vb,subgroupBallot:ab,subgroupBroadcast:Cb,subgroupBroadcastFirst:yb,subgroupElect:ib,subgroupExclusiveAdd:cb,subgroupExclusiveMul:db,subgroupInclusiveAdd:sb,subgroupInclusiveMul:ub,subgroupIndex:Up,subgroupMax:gb,subgroupMin:hb,subgroupMul:lb,subgroupOr:pb,subgroupShuffle:wb,subgroupShuffleDown:Db,subgroupShuffleUp:Eb,subgroupShuffleXor:Tb,subgroupSize:Ry,subgroupXor:mb,tan:oc,tangentGeometry:jf,tangentLocal:Mf,tangentView:Nf,tangentWorld:Pf,texture:fu,texture3D:jv,texture3DLevel:Nv,texture3DLoad:Mv,textureBarrier:Hy,textureBicubic:Th,textureBicubicLevel:wh,textureCubeUV:Hh,textureLevel:hu,textureLoad:mu,textureSize:ou,textureStore:kv,thickness:Zo,time:b_,toneMapping:El,toneMappingExposure:Dl,toonOutlinePass:iy,transformDirection:Ic,transformNormal:Kd,transformNormalToView:qd,transformedClearcoatNormalView:Xd,transformedNormalView:Jd,transformedNormalWorld:Yd,transmission:Xo,transpose:xc,triNoise3D:__,triplanarTexture:P_,triplanarTextures:N_,trunc:yc,uint:B,uintBitsToFloat:Xg,uniform:K,uniformArray:Su,uniformCubeTexture:uf,uniformFlow:el,uniformGroup:ns,uniformTexture:pu,unpackHalf2x16:m_,unpackNormal:Kf,unpackSnorm2x16:f_,unpackUnorm2x16:p_,unpremultiplyAlpha:Zm,userData:Fv,uv:au,uvec2:ao,uvec3:co,uvec4:fo,varying:dl,varyingProperty:wo,vec2:V,vec3:H,vec4:U,vectorComponents:Qi,velocity:Bv,vertexColor:Wm,vertexIndex:Vp,vertexStage:fl,vibrance:Uv,viewZToLogarithmicDepth:km,viewZToOrthographicDepth:Cm,viewZToPerspectiveDepth:Em,viewZToReversedOrthographicDepth:wm,viewZToReversedPerspectiveDepth:Dm,viewport:ju,viewportCoordinate:Nu,viewportDepthTexture:xm,viewportLinearDepth:Pm,viewportMipTexture:_m,viewportOpaqueMipTexture:ym,viewportResolution:Fu,viewportSafeUV:j_,viewportSharedTexture:Yv,viewportSize:Mu,viewportTexture:gm,viewportUV:Pu,vogelDiskSample:lv,wgsl:vy,wgslFn:Cy,workgroupArray:Gy,workgroupBarrier:By,workgroupId:Fy,workingToColorSpace:vl,xor:Es}),wS=class{constructor(e,t,n=null,r=``,i=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=i}};wS.isNodeFunctionInput=!0;var TS=class{constructor(e,t,n=``,r=``){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){T(`Abstract function.`)}};TS.isNodeFunction=!0,new hy(`uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }`),new hy(`uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }`);var ES=typeof self<`u`&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4};Ji.READ_ONLY,Ji.WRITE_ONLY,Ji.READ_WRITE,ES.VERTEX,ES.FRAGMENT,ES.COMPUTE,new hy(`fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }`),new hy(`fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }`),new hy(`fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }`),new hy(`fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }`),new hy(`fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }`),new hy(`fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }`),new hy(`fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }`),new hy(`fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }`),new hy(`fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }`),new hy(`fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }`),new hy(`fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }`),new hy(`fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }`),new hy(`
|
|
279
|
+
fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {
|
|
280
|
+
|
|
281
|
+
let res = vec2f( iRes );
|
|
282
|
+
|
|
283
|
+
let uvScaled = coord * res;
|
|
284
|
+
let uvWrapping = ( ( uvScaled % res ) + res ) % res;
|
|
285
|
+
|
|
286
|
+
// https://www.shadertoy.com/view/WtyXRy
|
|
287
|
+
|
|
288
|
+
let uv = uvWrapping - 0.5;
|
|
289
|
+
let iuv = floor( uv );
|
|
290
|
+
let f = fract( uv );
|
|
291
|
+
|
|
292
|
+
let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );
|
|
293
|
+
let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );
|
|
294
|
+
let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );
|
|
295
|
+
let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );
|
|
296
|
+
|
|
297
|
+
return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
`),new hy(`
|
|
301
|
+
fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {
|
|
302
|
+
|
|
303
|
+
let res = vec2f( iRes );
|
|
304
|
+
|
|
305
|
+
let uvScaled = coord * res;
|
|
306
|
+
let uvWrapping = ( ( uvScaled % res ) + res ) % res;
|
|
307
|
+
|
|
308
|
+
// https://www.shadertoy.com/view/WtyXRy
|
|
309
|
+
|
|
310
|
+
let uv = uvWrapping - 0.5;
|
|
311
|
+
let iuv = floor( uv );
|
|
312
|
+
let f = fract( uv );
|
|
313
|
+
|
|
314
|
+
let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level );
|
|
315
|
+
let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level );
|
|
316
|
+
let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level );
|
|
317
|
+
let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level );
|
|
318
|
+
|
|
319
|
+
return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
`);var DS=``;(typeof navigator<`u`&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(DS+=`diagnostic( off, derivative_uniformity );
|
|
323
|
+
`);var OS=new Map([[Int8Array,[`sint8`,`snorm8`]],[Uint8Array,[`uint8`,`unorm8`]],[Int16Array,[`sint16`,`snorm16`]],[Uint16Array,[`uint16`,`unorm16`]],[Int32Array,[`sint32`,`snorm32`]],[Uint32Array,[`uint32`,`unorm32`]],[Float32Array,[`float32`]]]);typeof Float16Array<`u`&&OS.set(Float16Array,[`float16`]),Q.BRDF_GGX,Q.BRDF_Lambert,Q.BasicPointShadowFilter,Q.BasicShadowFilter,Q.Break,Q.Const,Q.Continue,Q.DFGLUT,Q.D_GGX;var kS=Q.Discard;Q.EPSILON,Q.F_Schlick;var AS=Q.Fn;Q.INFINITY;var jS=Q.If;Q.Loop,Q.NodeAccess,Q.NodeShaderStage,Q.NodeType,Q.NodeUpdateType,Q.PCFShadowFilter,Q.PCFSoftShadowFilter,Q.PI,Q.PI2,Q.TWO_PI,Q.HALF_PI,Q.PointShadowFilter,Q.Return,Q.Schlick_to_F0,Q.ShaderNode,Q.Stack,Q.Switch,Q.TBNViewMatrix,Q.VSMShadowFilter,Q.V_GGX_SmithCorrelated,Q.Var,Q.VarIntent;var MS=Q.abs;Q.acesFilmicToneMapping,Q.acos,Q.add,Q.addMethodChaining,Q.addNodeElement,Q.agxToneMapping,Q.all,Q.alphaT,Q.and,Q.anisotropy,Q.anisotropyB,Q.anisotropyT,Q.any,Q.append,Q.array,Q.arrayBuffer,Q.asin,Q.assign,Q.atan,Q.atomicAdd,Q.atomicAnd,Q.atomicFunc,Q.atomicLoad,Q.atomicMax,Q.atomicMin,Q.atomicOr,Q.atomicStore,Q.atomicSub,Q.atomicXor,Q.attenuationColor,Q.attenuationDistance;var NS=Q.attribute;Q.attributeArray,Q.backgroundBlurriness,Q.backgroundIntensity,Q.backgroundRotation,Q.batch,Q.bentNormalView,Q.billboarding,Q.bitAnd,Q.bitNot,Q.bitOr,Q.bitXor,Q.bitangentGeometry,Q.bitangentLocal,Q.bitangentView,Q.bitangentWorld,Q.bitcast,Q.blendBurn,Q.blendColor,Q.blendDodge,Q.blendOverlay,Q.blendScreen,Q.blur,Q.bool,Q.buffer,Q.bufferAttribute,Q.bumpMap,Q.builtin,Q.builtinAOContext,Q.builtinShadowContext,Q.bvec2,Q.bvec3,Q.bvec4,Q.bypass,Q.cache,Q.call,Q.cameraFar,Q.cameraIndex,Q.cameraNear,Q.cameraNormalMatrix,Q.cameraPosition;var PS=Q.cameraProjectionMatrix;Q.cameraProjectionMatrixInverse,Q.cameraViewMatrix,Q.cameraViewport,Q.cameraWorldMatrix,Q.cbrt,Q.cdl,Q.ceil,Q.checker,Q.cineonToneMapping;var FS=Q.clamp;Q.clearcoat,Q.clearcoatNormalView,Q.clearcoatRoughness,Q.clipSpace,Q.code,Q.color,Q.colorSpaceToWorking,Q.colorToDirection,Q.compute,Q.computeKernel,Q.computeSkinning,Q.context,Q.convert,Q.convertColorSpace,Q.convertToTexture,Q.countLeadingZeros,Q.countOneBits,Q.countTrailingZeros;var IS=Q.cos;Q.cross,Q.cubeTexture,Q.cubeTextureBase,Q.dFdx,Q.dFdy,Q.dashSize,Q.debug,Q.decrement,Q.decrementBefore,Q.defaultBuildStages,Q.defaultShaderStages,Q.defined,Q.degrees,Q.deltaTime,Q.densityFog,Q.densityFogFactor,Q.depth,Q.depthPass,Q.determinant,Q.difference,Q.diffuseColor,Q.directPointLight,Q.directionToColor,Q.directionToFaceDirection,Q.dispersion;var LS=Q.distance;Q.div;var RS=Q.dot;Q.drawIndex,Q.dynamicBufferAttribute,Q.element,Q.emissive,Q.equal,Q.equirectUV,Q.exp,Q.exp2,Q.exponentialHeightFogFactor,Q.expression,Q.faceDirection,Q.faceForward,Q.faceforward;var $=Q.float;Q.floatBitsToInt,Q.floatBitsToUint;var zS=Q.floor;Q.fog,Q.fract,Q.frameGroup,Q.frameId,Q.frontFacing,Q.fwidth,Q.gain,Q.gapSize,Q.getConstNodeType,Q.getCurrentStack,Q.getDirection,Q.getDistanceAttenuation,Q.getGeometryRoughness,Q.getNormalFromDepth,Q.interleavedGradientNoise,Q.vogelDiskSample,Q.getParallaxCorrectNormal,Q.getRoughness,Q.getScreenPosition,Q.getShIrradianceAt,Q.getShadowMaterial,Q.getShadowRenderObjectFunction,Q.getTextureIndex,Q.getViewPosition,Q.globalId,Q.glsl,Q.glslFn,Q.grayscale,Q.greaterThan,Q.greaterThanEqual,Q.hash,Q.highpModelNormalViewMatrix,Q.highpModelViewMatrix,Q.hue,Q.increment,Q.incrementBefore,Q.instance,Q.instanceIndex,Q.instancedArray,Q.instancedBufferAttribute,Q.instancedDynamicBufferAttribute,Q.instancedMesh,Q.int,Q.intBitsToFloat,Q.inverse,Q.inverseSqrt,Q.inversesqrt,Q.invocationLocalIndex,Q.invocationSubgroupIndex,Q.ior,Q.iridescence,Q.iridescenceIOR,Q.iridescenceThickness,Q.ivec2,Q.ivec3,Q.ivec4,Q.js,Q.label,Q.length,Q.lengthSq,Q.lessThan,Q.lessThanEqual,Q.lightPosition,Q.lightProjectionUV,Q.lightShadowMatrix,Q.lightTargetDirection,Q.lightTargetPosition,Q.lightViewPosition,Q.lightingContext,Q.lights,Q.linearDepth,Q.linearToneMapping,Q.localId,Q.log,Q.log2,Q.logarithmicDepthToViewZ,Q.luminance,Q.mat2,Q.mat3,Q.mat4,Q.matcapUV,Q.materialAO,Q.materialAlphaTest,Q.materialAnisotropy,Q.materialAnisotropyVector,Q.materialAttenuationColor,Q.materialAttenuationDistance,Q.materialClearcoat,Q.materialClearcoatNormal,Q.materialClearcoatRoughness,Q.materialColor,Q.materialDispersion,Q.materialEmissive,Q.materialEnvIntensity,Q.materialEnvRotation,Q.materialIOR,Q.materialIridescence,Q.materialIridescenceIOR,Q.materialIridescenceThickness,Q.materialLightMap,Q.materialLineDashOffset,Q.materialLineDashSize,Q.materialLineGapSize,Q.materialLineScale,Q.materialLineWidth,Q.materialMetalness,Q.materialNormal,Q.materialOpacity,Q.materialPointSize,Q.materialReference,Q.materialReflectivity,Q.materialRefractionRatio,Q.materialRotation,Q.materialRoughness,Q.materialSheen,Q.materialSheenRoughness,Q.materialShininess,Q.materialSpecular,Q.materialSpecularColor,Q.materialSpecularIntensity,Q.materialSpecularStrength,Q.materialThickness,Q.materialTransmission;var BS=Q.max;Q.maxMipLevel,Q.mediumpModelViewMatrix,Q.metalness,Q.min;var VS=Q.mix;Q.mixElement;var HS=Q.mod;Q.modInt,Q.modelDirection,Q.modelNormalMatrix,Q.modelPosition,Q.modelRadius,Q.modelScale;var US=Q.modelViewMatrix;Q.modelViewPosition,Q.modelViewProjection,Q.modelWorldMatrix,Q.modelWorldMatrixInverse,Q.morphReference,Q.mrt,Q.mul,Q.mx_aastep,Q.mx_add,Q.mx_atan2,Q.mx_cell_noise_float,Q.mx_contrast,Q.mx_divide,Q.mx_fractal_noise_float,Q.mx_fractal_noise_vec2,Q.mx_fractal_noise_vec3,Q.mx_fractal_noise_vec4,Q.mx_frame,Q.mx_heighttonormal,Q.mx_hsvtorgb,Q.mx_ifequal,Q.mx_ifgreater,Q.mx_ifgreatereq,Q.mx_invert,Q.mx_modulo,Q.mx_multiply,Q.mx_noise_float,Q.mx_noise_vec3,Q.mx_noise_vec4,Q.mx_place2d,Q.mx_power,Q.mx_ramp4,Q.mx_ramplr,Q.mx_ramptb,Q.mx_rgbtohsv,Q.mx_rotate2d,Q.mx_rotate3d,Q.mx_safepower,Q.mx_separate,Q.mx_splitlr,Q.mx_splittb,Q.mx_srgb_texture_to_lin_rec709,Q.mx_subtract,Q.mx_timer,Q.mx_transform_uv,Q.mx_unifiednoise2d,Q.mx_unifiednoise3d,Q.mx_worley_noise_float,Q.mx_worley_noise_vec2,Q.mx_worley_noise_vec3,Q.negate,Q.neutralToneMapping,Q.nodeArray,Q.nodeImmutable,Q.nodeObject,Q.nodeObjectIntent,Q.nodeObjects,Q.nodeProxy,Q.nodeProxyIntent,Q.normalFlat,Q.normalGeometry;var WS=Q.normalLocal;Q.normalMap,Q.normalView,Q.normalViewGeometry,Q.normalWorld,Q.normalWorldGeometry,Q.normalize,Q.not,Q.notEqual,Q.numWorkgroups,Q.objectDirection,Q.objectGroup,Q.objectPosition,Q.objectRadius,Q.objectScale,Q.objectViewPosition,Q.objectWorldMatrix,Q.OnBeforeObjectUpdate,Q.OnBeforeMaterialUpdate,Q.OnObjectUpdate,Q.OnMaterialUpdate,Q.oneMinus,Q.or,Q.orthographicDepthToViewZ,Q.oscSawtooth,Q.oscSine,Q.oscSquare,Q.oscTriangle,Q.output,Q.outputStruct,Q.overloadingFn,Q.packHalf2x16,Q.packSnorm2x16,Q.packUnorm2x16,Q.parabola,Q.parallaxDirection,Q.parallaxUV,Q.parameter,Q.pass,Q.passTexture,Q.pcurve,Q.perspectiveDepthToViewZ,Q.pmremTexture,Q.pointShadow,Q.pointUV,Q.pointWidth;var GS=Q.positionGeometry;Q.positionLocal,Q.positionPrevious,Q.positionView,Q.positionViewDirection;var KS=Q.positionWorld;Q.positionWorldDirection,Q.posterize;var qS=Q.pow;Q.pow2,Q.pow3,Q.pow4,Q.premultiplyAlpha,Q.property,Q.radians,Q.rand,Q.range,Q.rangeFog,Q.rangeFogFactor,Q.reciprocal,Q.reference,Q.referenceBuffer,Q.reflect,Q.reflectVector,Q.reflectView,Q.reflector,Q.refract,Q.refractVector,Q.refractView,Q.reinhardToneMapping,Q.remap,Q.remapClamp,Q.renderGroup,Q.renderOutput,Q.rendererReference,Q.replaceDefaultUV,Q.rotate,Q.rotateUV,Q.roughness,Q.round,Q.rtt;var JS=Q.sRGBTransferEOTF;Q.sRGBTransferOETF,Q.sample,Q.sampler,Q.samplerComparison,Q.saturate,Q.saturation,Q.screen,Q.screenCoordinate,Q.screenDPR,Q.screenSize,Q.screenUV,Q.select,Q.setCurrentStack,Q.setName,Q.shaderStages,Q.shadow,Q.shadowPositionWorld,Q.shapeCircle,Q.sharedUniformGroup,Q.sheen,Q.sheenRoughness,Q.shiftLeft,Q.shiftRight,Q.shininess,Q.sign;var YS=Q.sin;Q.sinc,Q.skinning,Q.smoothstep,Q.smoothstepElement,Q.specularColor,Q.specularF90,Q.spherizeUV,Q.split,Q.spritesheetUV,Q.sqrt,Q.stack;var XS=Q.step;Q.stepElement,Q.storage,Q.storageBarrier,Q.storageTexture,Q.string,Q.struct,Q.sub,Q.subgroupAdd,Q.subgroupAll,Q.subgroupAnd,Q.subgroupAny,Q.subgroupBallot,Q.subgroupBroadcast,Q.subgroupBroadcastFirst,Q.subBuild,Q.subgroupElect,Q.subgroupExclusiveAdd,Q.subgroupExclusiveMul,Q.subgroupInclusiveAdd,Q.subgroupInclusiveMul,Q.subgroupIndex,Q.subgroupMax,Q.subgroupMin,Q.subgroupMul,Q.subgroupOr,Q.subgroupShuffle,Q.subgroupShuffleDown,Q.subgroupShuffleUp,Q.subgroupShuffleXor,Q.subgroupSize,Q.subgroupXor,Q.tan,Q.tangentGeometry,Q.tangentLocal,Q.tangentView,Q.tangentWorld;var ZS=Q.texture;Q.texture3D,Q.textureBarrier,Q.textureBicubic,Q.textureBicubicLevel,Q.textureCubeUV,Q.textureLoad,Q.textureSize,Q.textureLevel,Q.textureStore,Q.thickness,Q.time,Q.toneMapping,Q.toneMappingExposure,Q.toonOutlinePass,Q.transformDirection,Q.transformNormal;var QS=Q.transformNormalToView;Q.transformedClearcoatNormalView,Q.transformedNormalView,Q.transformedNormalWorld,Q.transmission,Q.transpose,Q.triNoise3D,Q.triplanarTexture,Q.triplanarTextures,Q.trunc,Q.uint,Q.uintBitsToFloat;var $S=Q.uniform;Q.uniformArray,Q.uniformCubeTexture,Q.uniformGroup,Q.uniformFlow,Q.uniformTexture,Q.unpackHalf2x16,Q.unpackSnorm2x16,Q.unpackUnorm2x16,Q.unpremultiplyAlpha,Q.userData,Q.uv,Q.uvec2,Q.uvec3,Q.uvec4,Q.varying;var eC=Q.varyingProperty,tC=Q.vec2,nC=Q.vec3,rC=Q.vec4;Q.vectorComponents,Q.velocity,Q.vertexColor,Q.vertexIndex,Q.vertexStage,Q.vibrance,Q.viewZToLogarithmicDepth,Q.viewZToOrthographicDepth,Q.viewZToPerspectiveDepth,Q.viewZToReversedOrthographicDepth,Q.viewZToReversedPerspectiveDepth,Q.viewport,Q.viewportCoordinate,Q.viewportDepthTexture,Q.viewportLinearDepth,Q.viewportMipTexture,Q.viewportOpaqueMipTexture,Q.viewportResolution,Q.viewportSafeUV,Q.viewportSharedTexture,Q.viewportSize,Q.viewportTexture,Q.viewportUV,Q.wgsl,Q.wgslFn,Q.workgroupArray,Q.workgroupBarrier,Q.workgroupId,Q.workingToColorSpace,Q.xor;var iC=AS(([e])=>HS(e.mul(34).add(1).mul(e),289)),aC=AS(([e])=>zS(HS(e.mul(34).add(1).mul(e),289))),oC=AS(([e])=>$(1.79284291400159).sub(e.mul(.85373472095314))),sC=AS(([e])=>$(1.79284291400159).sub(e.mul(.85373472095314))),cC=AS(([e,t])=>{let n=rC(1,1,1,-1),r=rC(0,0,0,0).toVar();r.xyz=zS(nC(e,e,e).mul(t.xyz).fract().mul(7)).mul(t.z).sub(1);let i=MS(r.xyz);r.w=$(1.5).sub(RS(i,n.xyz));let a=$(1).sub(XS(rC(0,0,0,0),r));return r.xyz=r.xyz.add(a.xyz.mul(2).sub(1).mul(a.www)),r}),lC=AS(([e])=>{let t=tC(.1381966011250105,.30901699437494745),n=zS(e.add(RS(e,t.yyyy))).toVar(),r=e.sub(n).add(RS(n,t.xxxx)).toVar(),i=rC(0,0,0,0).toVar(),a=XS(r.yzw,r.xxx),o=XS(r.zww,r.yyz);i.x=a.x.add(a.y).add(a.z),i.yzw=$(1).sub(a),i.y=i.y.add(o.x).add(o.y),i.zw=i.zw.add($(1).sub(o.xy)),i.z=i.z.add(o.z),i.w=i.w.add($(1).sub(o.z));let s=i.clamp(0,1),c=i.sub(1).clamp(0,1),l=i.sub(2).clamp(0,1),u=r.sub(l).add(t.xxxx.mul(1)),d=r.sub(c).add(t.xxxx.mul(2)),f=r.sub(s).add(t.xxxx.mul(3)),p=r.sub(1).add(t.xxxx.mul(4)),m=HS(n,289),h=aC(aC(aC(aC(m.w).add(m.z)).add(m.y)).add(m.x)),g=iC(iC(iC(iC(m.w.add(rC(l.w,c.w,s.w,1))).add(m.z).add(rC(l.z,c.z,s.z,1))).add(m.y).add(rC(l.y,c.y,s.y,1))).add(m.x).add(rC(l.x,c.x,s.x,1))),_=rC(1/294,1/49,1/7,0),v=cC(h,_).toVar(),y=cC(g.x,_).toVar(),b=cC(g.y,_).toVar(),x=cC(g.z,_).toVar(),S=cC(g.w,_).toVar(),C=oC(rC(RS(v,v),RS(y,y),RS(b,b),RS(x,x)));v.assign(v.mul(C.x)),y.assign(y.mul(C.y)),b.assign(b.mul(C.z)),x.assign(x.mul(C.w)),S.assign(S.mul(sC(RS(S,S))));let ee=BS($(.6).sub(nC(RS(r,r),RS(u,u),RS(d,d))),nC(0,0,0)),te=BS($(.6).sub(tC(RS(f,f),RS(p,p))),tC(0,0)),ne=ee.mul(ee),re=te.mul(te);return $(49).mul(RS(ne.mul(ne),nC(RS(v,r),RS(y,u),RS(b,d))).add(RS(re.mul(re),tC(RS(x,f),RS(S,p)))))}),uC=new Lr(1,300,300),dC=[];for(let e=0;e<2;e++)dC.push(new Xe(Math.sin(e)/2+1,e*2-.8));var fC=new Fr(dC,300);function pC(e,t,n,r,i){return e.sub(t).mul((i-r)/(n-t)).add(r)}function mC(e,t,n){let r=eC(`float`,`flNoise`),i=eC(`vec3`,`flPosition`),a=Math.max(1,Math.round(n)),o=AS(()=>{let t=GS;i.assign(t);let n=rC(t.div(e.uNoise).sub(nC(0,e.uTime.mul(e.uSpeed),0)),0),o=$(0),s=.5;for(let e=0;e<a;e++)o=o.add(lC(n).mul(s)),n=n.mul(2).add(100),s*=.5;return r.assign(pC(o,-1,1,0,1)),t}),s=AS(()=>{let t=i.y,n=VS($(0),$(1),t.add(1.75)),a=$(1).sub(n.mul(.3).step(r)),o=VS($(.3),$(1),t.add(.5)),s=FS(a.mul(o.mul(10)),0,1),c=VS(e.uColor2,e.uColor1,t.add(.5)),l=c.y.mul($(1).add(n.mul(r)));return rC(JS(nC(c.x,l,c.z)),s.mul(e.uOpacity))}),c=new Qm;return c.positionNode=o(),c.fragmentNode=s(),c.transparent=!0,c.depthWrite=!1,c.side=t,c}var hC=class extends qt{constructor(e){super(),this.needsRender=!0,e instanceof Jn?this.geometry=e:e===`ring`?this.geometry=fC:this.geometry=uC,this._color1=new Qt(`rgb(255, 177, 20)`).convertLinearToSRGB(),this._color2=new Qt(`rgb(255, 0, 0)`).convertLinearToSRGB(),this.u={uTime:$S(0),uColor1:$S(new O(this._color1.r,this._color1.g,this._color1.b)),uColor2:$S(new O(this._color2.r,this._color2.g,this._color2.b)),uNoise:$S(1.2),uSpeed:$S(1),uOpacity:$S(1)},this._fragmentationDegree=2,this.innerMesh=new br(this.geometry,mC(this.u,1,this._fragmentationDegree)),this.outerMesh=new br(this.geometry,mC(this.u,0,this._fragmentationDegree)),this.innerMesh.scale.setScalar(.1),this.outerMesh.scale.setScalar(.1),this.add(this.innerMesh),this.add(this.outerMesh)}setTime(e){this.startTime===void 0&&(this.startTime=e),this.u.uTime.value=(e-this.startTime)/1e3,this.needsRender=!0}set color1(e){this._color1=e.clone().convertLinearToSRGB(),this.u.uColor1.value.set(e.r,e.g,e.b),this.needsRender=!0}get color1(){return this._color1}set color2(e){this._color2=e.clone().convertLinearToSRGB(),this.u.uColor2.value.set(e.r,e.g,e.b),this.needsRender=!0}get color2(){return this._color2}set speed(e){this.u.uSpeed.value=e,this.needsRender=!0}get speed(){return this.u.uSpeed.value}set noise(e){this.u.uNoise.value=e,this.needsRender=!0}get noise(){return this.u.uNoise.value}set opacity(e){this.u.uOpacity.value=e,this.needsRender=!0}get opacity(){return this.u.uOpacity.value}set fragmentationDegree(e){e!==this._fragmentationDegree&&(this._fragmentationDegree=e,this.innerMesh.material.dispose(),this.outerMesh.material.dispose(),this.innerMesh.material=mC(this.u,1,e),this.outerMesh.material=mC(this.u,0,e),this.needsRender=!0)}get fragmentationDegree(){return this._fragmentationDegree}};function gC(e,t,n,r,i){return e.sub(t).mul((i-r)/(n-t)).add(r)}function _C(){let e={uTime:$S(0),uAttenuation:$S(0),uAnglePower:$S(2),uSpotPosition:$S(new O),uLightColor:$S(new Qt(16777215))},t=eC(`vec3`,`slWorldPosition`),n=eC(`vec3`,`slNormal`),r=eC(`float`,`slNoise`),i=AS(()=>{n.assign(QS(WS).normalize()),t.assign(KS);let i=lC(rC(GS.sub(nC(0,e.uTime.mul(.4),0)),0));return r.assign(gC(i,-1,1,.5,1)),GS}),a=AS(()=>{let i=LS(t,e.uSpotPosition).div(e.uAttenuation);i=$(1).sub(FS(i,.1,1));let a=nC(n.x,n.y,MS(n.z)),o=$(e.uAnglePower).mul(r),s=qS(RS(a,nC(0,0,1)),o);return i=i.mul(s).mul(r),rC(e.uLightColor,i)}),o=new Qm;return o.positionNode=i(),o.fragmentNode=a(),o.transparent=!0,o.side=0,o.depthWrite=!1,{material:o,u:e}}var vC=class extends qt{constructor(e=1,t=.1,n=.2){super(),this.needsRender=!0;let{material:r,u:i}=_C();this.u=i,this.u.uAttenuation.value=e*.9,this.u.uSpotPosition.value.copy(this.position);let a=new Pr(t,n,e,64,20,!0);a.applyMatrix4(new yt().makeTranslation(0,-e/2,0)),a.applyMatrix4(new yt().makeRotationX(-Math.PI/2));let o=new br(a,r);this.add(o)}setTime(e){this.startTime===void 0&&(this.startTime=e),this.u.uTime.value=(e-this.startTime)/1e3,this.u.uSpotPosition.value.copy(this.position),this.needsRender=!0}set attenuation(e){this.u.uAttenuation.value=e,this.needsRender=!0}get attenuation(){return this.u.uAttenuation.value}set anglePower(e){this.u.uAnglePower.value=e,this.needsRender=!0}get anglePower(){return this.u.uAnglePower.value}set color(e){this.u.uLightColor.value=e,this.needsRender=!0}get color(){return this.u.uLightColor.value}},yC=new Ir(1,1,200,200);yC.translate(0,-.5,0);function bC(e,t,n,r,i){return e.sub(t).mul((i-r)/(n-t)).add(r)}function xC(e){let t={uTime:$S(0),uSpeed:$S(e.speed),uScale:$S(e.scale),uExpand:$S(e.expand),uColor:$S(e.color),uOpacity:$S(e.opacity)},n=eC(`float`,`afNoise`),r=eC(`vec3`,`afPosition`),i=AS(()=>{let e=GS;r.assign(e);let i=lC(rC(e.x.mul(t.uScale),e.y.add(t.uTime.mul(t.uSpeed)),0,0));n.assign(bC(i,0,1,.5,1));let a=$(1).add(e.y.abs().mul(t.uExpand.sub(1)));return nC(e.x.mul(a),e.y,e.z)}),a=AS(()=>{let e=VS($(0),$(1),$(1).add(r.y)),i=n.mul(e).mul(t.uOpacity);return rC(t.uColor,i)}),o=new Qm;return o.positionNode=i(),o.fragmentNode=a(),o.transparent=!0,o.side=2,o.depthWrite=!1,{material:o,u:t}}var SC=class extends qt{constructor(){super(),this.needsRender=!0;let e=xC({speed:.75,scale:2,expand:1.2,color:new Qt(.5,.5,.9),opacity:1}),t=xC({speed:2,scale:20,expand:1.2,color:new Qt(1,1,1),opacity:.1});this.outerU=e.u,this.innerU=t.u;let n=new br(yC,e.material),r=new br(yC,t.material);n.rotateX(-Math.PI/2),r.rotateX(-Math.PI/2),this.add(n),this.add(r)}setTime(e){this.startTime===void 0&&(this.startTime=e);let t=(e-this.startTime)/1e3;this.innerU.uTime.value=t,this.outerU.uTime.value=t,this.needsRender=!0}get expand(){return this.outerU.uExpand.value}set expand(e){this.outerU.uExpand.value=e,this.innerU.uExpand.value=e,this.needsRender=!0}get speed(){return this.innerU.uSpeed.value}set speed(e){this.innerU.uSpeed.value=e,this.needsRender=!0}get color(){return this.outerU.uColor.value}set color(e){this.outerU.uColor.value=e,this.needsRender=!0}get flowColor(){return this.innerU.uColor.value}set flowColor(e){this.innerU.uColor.value=e,this.needsRender=!0}};function CC(e,t){return e+t*(Math.random()-.5)}function wC(e,t){let n=new O(Math.random()-.5,Math.random()-.5,Math.random()-.5);return new O().addVectors(e,new O().multiplyVectors(t,n))}function TC(e,t,n){return e*n+t*n*n/2}function EC(e,t,n){return new O(TC(e.x,t.x,n),TC(e.y,t.y,n),TC(e.z,t.z,n))}function DC(e,t){let n=e.times.length,r=0;for(;r<n&&t>e.times[r];)r++;if(r==0)return e.values[0];if(r==n)return e.values[n-1];let i=(t-e.times[r-1])/(e.times[r]-e.times[r-1]),a=e.values[r-1],o=e.values[r];return typeof e.values[0]==`number`?a+i*(o-a):a.clone().lerp(o,i)}var OC=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){this.birthTime=e,this.deathAge=t,this.position=n.clone(),this.velocity=r.clone(),this.acceleration=i.clone(),this.angle=a,this.angleVelocity=o,this.angleAcceleration=s,this.color=c,this.colorTween=l,this.size=u,this.sizeTween=d,this.opacity=f,this.opacityTween=p}getAlive(e){return this.deathAge>e-this.birthTime}getState(e){let t=this.getAlive(e),n=Math.min(this.deathAge,e-this.birthTime),r=EC(this.velocity,this.acceleration,n).add(this.position),i=TC(this.angleVelocity,this.angleAcceleration,n)+this.angle,a=(this.sizeTween?DC(this.sizeTween,n):0)+this.size,o=(this.colorTween?DC(this.colorTween,n):new O).add(this.color);return{alive:t,age:n,position:r,angle:i,size:a,color:new Qt().setHSL(o.x,o.y,o.z).convertLinearToSRGB(),opacity:(this.opacityTween?DC(this.opacityTween,n):0)+this.opacity}}},kC=class extends br{constructor(e){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,ne,re,ie,ae,w,oe,se,ce,le,ue,de,fe,pe;let me=new Ir(1,1,1,1),he=new li;he.index=me.index,he.attributes=me.attributes,he.instanceCount=0;let ge=(t=e.texture)==null?null:t;ge&&(ge.colorSpace=``);let _e={map:ZS(ge==null?new ht:ge),useMap:$S(+!!ge),resolution:$S(new Xe(1,1))},ve=AC(_e);ve.blending=(n=e.blending)==null?1:n,ve.transparent=!0,ve.depthWrite=!1,super(he,ve),this.instances=[],this.capacity=0,this.instGeometry=he,this.particleMaterial=ve,this.u=_e,this._texture=ge,this.frustumCulled=!1,this.needsRender=!0,this.birthTime=Date.now()/1e3,this.disposed=!1,this.paused=!1,this.positionBase=(i=(r=e.positionBase)==null?void 0:r.clone())==null?new O:i,this.positionStyle=(a=e.positionStyle)==null?`CUBE`:a,this.positionCubeSpread=(s=(o=e.positionCubeSpread)==null?void 0:o.clone())==null?new O:s,this.positionSphereSpread=(c=e.positionSphereSpread)==null?0:c,this.velocityStyle=(l=e.velocityStyle)==null?`CUBE`:l,this.velocityCubeBase=(d=(u=e.velocityCubeBase)==null?void 0:u.clone())==null?new O:d,this.velocityCubeSpread=(p=(f=e.velocityCubeSpread)==null?void 0:f.clone())==null?new O:p,this.velocitySphereBase=(m=e.velocitySphereBase)==null?0:m,this.velocitySphereSpread=(h=e.velocitySphereSpread)==null?0:h,this.accelerationBase=(_=(g=e.accelerationBase)==null?void 0:g.clone())==null?new O:_,this.accelerationSpread=(y=(v=e.accelerationSpread)==null?void 0:v.clone())==null?new O:y,this.angleBase=(b=e.angleBase)==null?0:b,this.angleSpread=(x=e.angleSpread)==null?0:x,this.angleVelocityBase=(S=e.angleVelocityBase)==null?0:S,this.angleVelocitySpread=(C=e.angleVelocitySpread)==null?0:C,this.angleAccelerationBase=(ee=e.angleAccelerationBase)==null?0:ee,this.angleAccelerationSpread=(te=e.angleAccelerationSpread)==null?0:te,this.sizeBase=(ne=e.sizeBase)==null?.1:ne,this.sizeSpread=(re=e.sizeSpread)==null?0:re,this.sizeTween=(ie=e.sizeTween)==null?null:ie,this.colorBase=(w=(ae=e.colorBase)==null?void 0:ae.clone())==null?new O:w,this.colorSpread=(se=(oe=e.colorSpread)==null?void 0:oe.clone())==null?new O:se,this.colorTween=(ce=e.colorTween)==null?null:ce,this.opacityBase=((le=e.opacityBase)==null?e.opacityTween:le)?0:1,this.opacitySpread=(ue=e.opacitySpread)==null?0:ue,this.opacityTween=(de=e.opacityTween)==null?null:de,this.particlesPerSecond=(fe=e.particlesPerSecond)==null?60:fe,this.particleDeathAge=(pe=e.particleDeathAge)==null?1:pe}get texture(){return this._texture}set texture(e){this._texture=e,this.u.map.value=e==null?new ht:e,this.u.useMap.value=+!!e,this.needsRender=!0}get blending(){return this.particleMaterial.blending}set blending(e){this.particleMaterial.blending=e}ensureCapacity(e){if(this.capacity>=e)return;let t=(t,n)=>{let r=new Float32Array(e*n);return t&&r.set(t,0),r};this.arrPosition=t(this.arrPosition,3),this.arrColor=t(this.arrColor,3),this.arrOpacity=t(this.arrOpacity,1),this.arrSize=t(this.arrSize,1),this.arrAngle=t(this.arrAngle,1),this.arrAlive=t(this.arrAlive,1),this.capacity=e,this.instGeometry.setAttribute(`iPosition`,new wr(this.arrPosition,3)),this.instGeometry.setAttribute(`iColor`,new wr(this.arrColor,3)),this.instGeometry.setAttribute(`iOpacity`,new wr(this.arrOpacity,1)),this.instGeometry.setAttribute(`iSize`,new wr(this.arrSize,1)),this.instGeometry.setAttribute(`iAngle`,new wr(this.arrAngle,1)),this.instGeometry.setAttribute(`iAlive`,new wr(this.arrAlive,1))}createInstance(e){let t=this.positionBase.clone();switch(this.positionStyle){case`CUBE`:t=wC(this.positionBase,this.positionCubeSpread);break;case`SPHERE`:{let e=2*Math.random()-1,n=Math.PI*2*Math.random(),r=Math.sqrt(1-e*e),i=new O(r*Math.cos(n),r*Math.sin(n),e);t=new O().addVectors(this.positionBase,i.multiplyScalar(this.positionSphereSpread));break}}let n=new O;switch(this.velocityStyle){case`CUBE`:n=wC(this.velocityCubeBase,this.velocityCubeSpread);break;case`SPHERE`:{let e=new O().subVectors(t,this.positionBase),r=CC(this.velocitySphereBase,this.velocitySphereSpread);n=e.normalize().multiplyScalar(r);break}}return new OC(e,this.particleDeathAge,t,n,wC(this.accelerationBase,this.accelerationSpread),CC(this.angleBase,this.angleSpread),CC(this.angleVelocityBase,this.angleVelocitySpread),CC(this.angleAccelerationBase,this.angleAccelerationSpread),wC(this.colorBase,this.colorSpread),this.colorTween,CC(this.sizeBase,this.sizeSpread),this.sizeTween,CC(this.opacityBase,this.opacitySpread),this.opacityTween)}pause(){this.paused!==!0&&(this.paused=!0,this.birthTime=Date.now()/1e3)}play(){this.paused!==!1&&(this.paused=!1,this.birthTime=Date.now()/1e3)}setTime(e){if(this.disposed)return;e/=1e3;let t=e-this.birthTime,n=Math.ceil(this.particlesPerSecond*this.particleDeathAge);this.ensureCapacity(n),this.instances.length<n&&(this.instances.length=n),this.instGeometry.instanceCount=n;for(let r=0;r<this.instances.length;r++){let i=this.instances[r];if(r<n&&this.paused===!1&&(i===void 0||i.getAlive(e)===!1)){let a=this.particleDeathAge/n*r;if(t>a){let n=e-(t-a)%this.particleDeathAge;this.instances[r]=i=this.createInstance(n)}}if(i){let{position:t,alive:n,color:a,opacity:o,size:s,angle:c}=i.getState(e);this.arrPosition[r*3]=t.x,this.arrPosition[r*3+1]=t.y,this.arrPosition[r*3+2]=t.z,this.arrColor[r*3]=a.r,this.arrColor[r*3+1]=a.g,this.arrColor[r*3+2]=a.b,this.arrOpacity[r]=o,this.arrSize[r]=s,this.arrAngle[r]=c,this.arrAlive[r]=+!!n}}this.instGeometry.getAttribute(`iPosition`).needsUpdate=!0,this.instGeometry.getAttribute(`iColor`).needsUpdate=!0,this.instGeometry.getAttribute(`iOpacity`).needsUpdate=!0,this.instGeometry.getAttribute(`iSize`).needsUpdate=!0,this.instGeometry.getAttribute(`iAngle`).needsUpdate=!0,this.instGeometry.getAttribute(`iAlive`).needsUpdate=!0,this.needsRender=!0}setResolution(e,t){this.u.resolution.value.set(e,t)}dispose(){var e;this.disposed=!0,this.instGeometry.dispose(),(e=this._texture)==null||e.dispose(),this.particleMaterial.dispose()}};function AC(e){let t=eC(`vec4`,`pColor`),n=eC(`float`,`pAngle`),r=AS(()=>{let r=NS(`iPosition`,`vec3`),i=NS(`iColor`,`vec3`),a=NS(`iOpacity`,`float`),o=NS(`iSize`,`float`),s=NS(`iAngle`,`float`),c=NS(`iAlive`,`float`),l=GS.xy,u=a.mul(c);t.assign(rC(i,u)),n.assign(s);let d=US.mul(rC(r,1)),f=PS.element(1).y,p=BS($(.5).mul(e.resolution.y).mul(f),1e-4),m=o.mul(300).div(p).div(2),h=rC(l.mul(m),0,0),g=d.add(h);return PS.mul(g)}),i=AS(()=>{jS(t.a.lessThanEqual(0),()=>{kS()});let r=tC(GS.x,GS.y),i=IS(n),a=YS(n),o=i.mul(r.x).add(a.mul(r.y)).add(.5),s=i.mul(r.y).sub(a.mul(r.x)).add(.5),c=e.map.sample(tC(o,s)),l=t.mul(c),u=t.rgb.mul($(1).sub(e.useMap)).add(l.rgb.mul(e.useMap)),d=t.a.mul($(1).sub(e.useMap)).add(l.a.mul(e.useMap));return rC(JS(u),d)}),a=new Qm;return a.vertexNode=r(),a.fragmentNode=i(),a}function jC(e,t){return e+t*(Math.random()-.5)}function MC(e,t){let n=new O(Math.random()-.5,Math.random()-.5,Math.random()-.5);return new O().addVectors(e,new O().multiplyVectors(t,n))}var NC=class extends br{constructor(e){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,ne,re,ie,ae,w,oe,se,ce,le;let ue=Math.ceil(((t=e.particlesPerSecond)==null?60:t)*((n=e.particleDeathAge)==null?1:n)),de=new Float32Array(ue*4),fe=new Float32Array(ue*4),pe=new Float32Array(ue*4),me=new Float32Array(ue*4),he=new Float32Array(ue*4);for(let t=0;t<ue;t++){let n=t*4,oe=((r=e.particleDeathAge)==null?1:r)/ue*t,se=(i=e.particleDeathAge)==null?1:i,ce=(o=(a=e.positionBase)==null?void 0:a.clone())==null?new O:o;switch((s=e.positionStyle)==null?`CUBE`:s){case`CUBE`:ce=MC((c=e.positionBase)==null?new O:c,(l=e.positionCubeSpread)==null?new O:l);break;case`SPHERE`:{let t=2*Math.random()-1,n=Math.PI*2*Math.random(),r=Math.sqrt(1-t*t),i=new O(r*Math.cos(n),r*Math.sin(n),t);ce=new O().addVectors((u=e.positionBase)==null?new O:u,i.multiplyScalar((d=e.positionSphereSpread)==null?0:d));break}}let le=new O;switch((f=e.velocityStyle)==null?`CUBE`:f){case`CUBE`:le=MC((p=e.velocityCubeBase)==null?new O:p,(m=e.velocityCubeSpread)==null?new O:m);break;case`SPHERE`:{let t=new O().subVectors(ce,(h=e.positionBase)==null?new O:h),n=jC((g=e.velocitySphereBase)==null?0:g,(_=e.velocitySphereSpread)==null?0:_);le=t.normalize().multiplyScalar(n);break}}let ge=MC((v=e.accelerationBase)==null?new O:v,(y=e.accelerationSpread)==null?new O:y),_e=jC((b=e.sizeBase)==null?.1:b,(x=e.sizeSpread)==null?0:x),ve=(S=e.sizeGrowth)==null?0:S,ye=MC(new O().setFromColor(new Qt().setFromVector3((C=e.colorBase)==null?new O:C).convertLinearToSRGB()),new O().setFromColor(new Qt().setFromVector3((ee=e.colorSpread)==null?new O:ee).convertLinearToSRGB())),be=jC((te=e.opacityBase)==null?1:te,(ne=e.opacitySpread)==null?0:ne),xe=jC((re=e.angleBase)==null?0:re,(ie=e.angleSpread)==null?0:ie),T=jC((ae=e.angleVelocityBase)==null?0:ae,(w=e.angleVelocitySpread)==null?0:w);de[n]=ce.x,de[n+1]=ce.y,de[n+2]=ce.z,de[n+3]=oe,fe[n]=le.x,fe[n+1]=le.y,fe[n+2]=le.z,fe[n+3]=se,pe[n]=ge.x,pe[n+1]=ge.y,pe[n+2]=ge.z,pe[n+3]=_e,me[n]=ye.x,me[n+1]=ye.y,me[n+2]=ye.z,me[n+3]=ve,he[n]=be,he[n+1]=xe,he[n+2]=T,he[n+3]=0}let ge=new Ir(1,1,1,1),_e=new li;_e.index=ge.index,_e.attributes=ge.attributes,_e.instanceCount=ue,_e.setAttribute(`iPack0`,new wr(de,4)),_e.setAttribute(`iPack1`,new wr(fe,4)),_e.setAttribute(`iPack2`,new wr(pe,4)),_e.setAttribute(`iPack3`,new wr(me,4)),_e.setAttribute(`iPack4`,new wr(he,4));let ve=(oe=e.texture)==null?null:oe;ve&&(ve.colorSpace=``);let ye={map:ZS(ve==null?new ht:ve),useMap:$S(+!!ve),uTime:$S(0),resolution:$S(new Xe(1,1))},be=FC(ye);be.blending=(se=e.blending)==null?1:se,be.transparent=!0,be.depthWrite=!1,super(_e,be),this.particleMaterial=be,this.u=ye,this._texture=ve,this.frustumCulled=!1,this.needsRender=!0,this.startTime=Date.now()/1e3,this.disposed=!1,this.paused=!1,this.particleCount=ue,this.particlesPerSecond=(ce=e.particlesPerSecond)==null?60:ce,this.particleDeathAge=(le=e.particleDeathAge)==null?1:le}get texture(){return this._texture}set texture(e){this._texture=e,e&&(e.colorSpace=``),this.u.map.value=e==null?new ht:e,this.u.useMap.value=+!!e,this.needsRender=!0}get blending(){return this.particleMaterial.blending}set blending(e){this.particleMaterial.blending=e}pause(){this.paused!==!0&&(this.paused=!0,this.startTime=Date.now()/1e3)}play(){this.paused!==!1&&(this.paused=!1,this.startTime=Date.now()/1e3)}setTime(e){if(this.disposed||this.paused)return;let t=e/1e3-this.startTime;this.u.uTime.value=t,this.needsRender=!0}setResolution(e,t){this.u.resolution.value.set(e,t)}dispose(){var e;this.disposed=!0,this.geometry.dispose(),(e=this._texture)==null||e.dispose(),this.particleMaterial.dispose()}};function PC(e){let t=FS(HS(e.x.mul(6).add(nC(0,4,2)),6).sub(3).abs().sub(1),0,1);return e.z.add(e.y.mul(t.sub(.5)).mul($(1).sub(e.z.mul(2).sub(1).abs())))}function FC(e){let t=eC(`vec4`,`gpColor`),n=eC(`float`,`gpAngle`),r=AS(()=>{let r=(e,t)=>NS(e,t),i=r(`iPack0`,`vec4`),a=r(`iPack1`,`vec4`),o=r(`iPack2`,`vec4`),s=r(`iPack3`,`vec4`),c=r(`iPack4`,`vec4`),l=i.xyz,u=i.w,d=a.xyz,f=a.w,p=o.xyz,m=o.w,h=s.xyz,g=s.w,_=c.x,v=c.y,y=c.z,b=GS.xy,x=HS(e.uTime.add(u),f),S=FS(x.div(f),0,1),C=d.add(p.mul(x)),ee=l.add(C.mul(x)),te=m.add(g.mul(S));n.assign(v.add(y.mul(x)));let ne=S.div(.1),re=$(1).sub(S).div(.2),ie=_.mul(S.lessThan(.1).select(FS(ne,0,1),S.greaterThan(.8).select(FS(re,0,1),$(1)))),ae=PC(h);t.assign(rC(ae,ie));let w=US.mul(rC(ee,1)),oe=PS.element(1).y,se=BS($(.5).mul(e.resolution.y).mul(oe),1e-4),ce=te.mul(300).div(se).div(2),le=rC(b.mul(ce),0,0),ue=w.add(le);return PS.mul(ue)}),i=AS(()=>{jS(t.a.lessThanEqual(0),()=>{kS()});let r=tC(GS.x,GS.y.negate()),i=IS(n),a=YS(n),o=i.mul(r.x).add(a.mul(r.y)).add(.5),s=i.mul(r.y).sub(a.mul(r.x)).add(.5),c=e.map.sample(tC(o,s)),l=t.mul(c),u=t.rgb.mul($(1).sub(e.useMap)).add(l.rgb.mul(e.useMap)),d=t.a.mul($(1).sub(e.useMap)).add(l.a.mul(e.useMap));return rC(JS(u),d)}),a=new Qm;return a.vertexNode=r(),a.fragmentNode=i(),a}e.Airflow=SC,e.Flame=hC,e.Particle=kC,e.ParticleGPU=NC,e.SpotLight=vC});
|