archgine 1.0.78 → 2.0.2
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/lib/animations/animation-action.d.ts +1 -0
- package/lib/animations/animation-action.d.ts.map +1 -0
- package/lib/animations/animation-clip.d.ts +1 -0
- package/lib/animations/animation-clip.d.ts.map +1 -0
- package/lib/animations/animation-mixer.d.ts +3 -1
- package/lib/animations/animation-mixer.d.ts.map +1 -0
- package/lib/animations/animation-utils.d.ts +1 -0
- package/lib/animations/animation-utils.d.ts.map +1 -0
- package/lib/animations/keyframe-track.d.ts +1 -0
- package/lib/animations/keyframe-track.d.ts.map +1 -0
- package/lib/animations/property-binding.d.ts +1 -0
- package/lib/animations/property-binding.d.ts.map +1 -0
- package/lib/animations/property-mixer.d.ts +1 -0
- package/lib/animations/property-mixer.d.ts.map +1 -0
- package/lib/animations/tracks/boolean-keyframe-track.d.ts +1 -0
- package/lib/animations/tracks/boolean-keyframe-track.d.ts.map +1 -0
- package/lib/animations/tracks/color-keyframe-track.d.ts +1 -0
- package/lib/animations/tracks/color-keyframe-track.d.ts.map +1 -0
- package/lib/animations/tracks/number-keyframe-track.d.ts +1 -0
- package/lib/animations/tracks/number-keyframe-track.d.ts.map +1 -0
- package/lib/animations/tracks/string-keyframe-track.d.ts +1 -0
- package/lib/animations/tracks/string-keyframe-track.d.ts.map +1 -0
- package/lib/animations/tracks/vector1-keyframe-track.d.ts +1 -0
- package/lib/animations/tracks/vector1-keyframe-track.d.ts.map +1 -0
- package/lib/animations/tracks/vector2-keyframe-track.d.ts +1 -0
- package/lib/animations/tracks/vector2-keyframe-track.d.ts.map +1 -0
- package/lib/applications/app2-offscreen.d.ts +92 -0
- package/lib/applications/app2-offscreen.d.ts.map +1 -0
- package/lib/applications/app2.d.ts +111 -0
- package/lib/applications/app2.d.ts.map +1 -0
- package/lib/applications/app3-director.d.ts +18 -0
- package/lib/applications/app3-director.d.ts.map +1 -0
- package/lib/applications/app3-offscreen.d.ts +27 -0
- package/lib/applications/app3-offscreen.d.ts.map +1 -0
- package/lib/applications/app3.d.ts +59 -0
- package/lib/applications/app3.d.ts.map +1 -0
- package/lib/controls/drag-controller.d.ts +1 -0
- package/lib/controls/drag-controller.d.ts.map +1 -0
- package/lib/controls/el-proxy-hammer.d.ts +32 -0
- package/lib/controls/el-proxy-hammer.d.ts.map +1 -0
- package/lib/controls/el-proxy.d.ts +54 -0
- package/lib/controls/el-proxy.d.ts.map +1 -0
- package/lib/controls/handler.d.ts +63 -0
- package/lib/controls/handler.d.ts.map +1 -0
- package/lib/controls/orbit-controller.d.ts +2 -0
- package/lib/controls/orbit-controller.d.ts.map +1 -0
- package/lib/controls/orbit-controls.d.ts +3 -2
- package/lib/controls/orbit-controls.d.ts.map +1 -0
- package/lib/controls/orbit-controls2.d.ts +162 -0
- package/lib/controls/orbit-controls2.d.ts.map +1 -0
- package/lib/core/camera2.d.ts +3 -2
- package/lib/core/camera2.d.ts.map +1 -0
- package/lib/core/clock.d.ts +1 -0
- package/lib/core/clock.d.ts.map +1 -0
- package/lib/core/event-dispatcher.d.ts +1 -0
- package/lib/core/event-dispatcher.d.ts.map +1 -0
- package/lib/core/global.d.ts +92 -1
- package/lib/core/global.d.ts.map +1 -0
- package/lib/{objects → core}/group2.d.ts +2 -1
- package/lib/core/group2.d.ts.map +1 -0
- package/lib/core/lights3.d.ts +11 -0
- package/lib/core/lights3.d.ts.map +1 -0
- package/lib/core/monitor.d.ts +1 -0
- package/lib/core/monitor.d.ts.map +1 -0
- package/lib/core/object2.d.ts +6 -3
- package/lib/core/object2.d.ts.map +1 -0
- package/lib/core/queue.d.ts +1 -0
- package/lib/core/queue.d.ts.map +1 -0
- package/lib/core/ray-caster.d.ts +7 -1
- package/lib/core/ray-caster.d.ts.map +1 -0
- package/lib/core/texture.d.ts +20 -0
- package/lib/core/texture.d.ts.map +1 -0
- package/lib/core/tic.d.ts +3 -1
- package/lib/core/tic.d.ts.map +1 -0
- package/lib/core/transformable2.d.ts +27 -0
- package/lib/core/transformable2.d.ts.map +1 -0
- package/lib/core/{view.d.ts → view2.d.ts} +20 -12
- package/lib/core/view2.d.ts.map +1 -0
- package/lib/core/view3.d.ts +70 -0
- package/lib/core/view3.d.ts.map +1 -0
- package/lib/dummies/dummy2-point.d.ts +9 -0
- package/lib/dummies/dummy2-point.d.ts.map +1 -0
- package/lib/dummies/dummy2-rect.d.ts +9 -0
- package/lib/dummies/dummy2-rect.d.ts.map +1 -0
- package/lib/dummies/dummy2.d.ts +21 -0
- package/lib/dummies/dummy2.d.ts.map +1 -0
- package/lib/editor/editor.d.ts +67 -0
- package/lib/editor/editor.d.ts.map +1 -0
- package/lib/editor/interfaces.d.ts +61 -0
- package/lib/editor/interfaces.d.ts.map +1 -0
- package/lib/editor/tool-manager.d.ts +45 -0
- package/lib/editor/tool-manager.d.ts.map +1 -0
- package/lib/editor/tools/base-tool.d.ts +20 -0
- package/lib/editor/tools/base-tool.d.ts.map +1 -0
- package/lib/editor/tools/distribution-tool.d.ts +20 -0
- package/lib/editor/tools/distribution-tool.d.ts.map +1 -0
- package/lib/editor/tools/drag-tool.d.ts +27 -0
- package/lib/editor/tools/drag-tool.d.ts.map +1 -0
- package/lib/editor/tools/draw-point-tool.d.ts +10 -0
- package/lib/editor/tools/draw-point-tool.d.ts.map +1 -0
- package/lib/editor/tools/dummy-tool.d.ts +57 -0
- package/lib/editor/tools/dummy-tool.d.ts.map +1 -0
- package/lib/editor/tools/hover-tool.d.ts +20 -0
- package/lib/editor/tools/hover-tool.d.ts.map +1 -0
- package/lib/editor/tools/index.d.ts +3 -0
- package/lib/editor/tools/index.d.ts.map +1 -0
- package/lib/editor/tools/linker-tool.d.ts +19 -0
- package/lib/editor/tools/linker-tool.d.ts.map +1 -0
- package/lib/editor/tools/select-tool.d.ts +32 -0
- package/lib/editor/tools/select-tool.d.ts.map +1 -0
- package/lib/editor/tools/selector-rect-tool.d.ts +21 -0
- package/lib/editor/tools/selector-rect-tool.d.ts.map +1 -0
- package/lib/editor/tools/tips-tool.d.ts +13 -0
- package/lib/editor/tools/tips-tool.d.ts.map +1 -0
- package/lib/effects/clear-pass.d.ts +1 -0
- package/lib/effects/clear-pass.d.ts.map +1 -0
- package/lib/effects/debounce-pass.d.ts +2 -0
- package/lib/effects/debounce-pass.d.ts.map +1 -0
- package/lib/effects/debounce-pass2.d.ts +29 -0
- package/lib/effects/debounce-pass2.d.ts.map +1 -0
- package/lib/effects/debounce-pass3.d.ts +38 -0
- package/lib/effects/debounce-pass3.d.ts.map +1 -0
- package/lib/effects/dynamic-pass3.d.ts +11 -0
- package/lib/effects/dynamic-pass3.d.ts.map +1 -0
- package/lib/effects/effect-composer.d.ts +2 -1
- package/lib/effects/effect-composer.d.ts.map +1 -0
- package/lib/effects/effect-director.d.ts +7 -3
- package/lib/effects/effect-director.d.ts.map +1 -0
- package/lib/effects/final-pass.d.ts +3 -2
- package/lib/effects/final-pass.d.ts.map +1 -0
- package/lib/effects/final-pass3.d.ts +6 -0
- package/lib/effects/final-pass3.d.ts.map +1 -0
- package/lib/effects/output-pass.d.ts +1 -0
- package/lib/effects/output-pass.d.ts.map +1 -0
- package/lib/effects/paper-pass.d.ts +5 -0
- package/lib/effects/paper-pass.d.ts.map +1 -0
- package/lib/effects/pass.d.ts +1 -0
- package/lib/effects/pass.d.ts.map +1 -0
- package/lib/effects/render-cached-pass.d.ts +1 -0
- package/lib/effects/render-cached-pass.d.ts.map +1 -0
- package/lib/effects/render-pass.d.ts +1 -0
- package/lib/effects/render-pass.d.ts.map +1 -0
- package/lib/effects/save-pass.d.ts +1 -0
- package/lib/effects/save-pass.d.ts.map +1 -0
- package/lib/effects/shadow-pass3.d.ts +16 -0
- package/lib/effects/shadow-pass3.d.ts.map +1 -0
- package/lib/effects/texture-pass.d.ts +3 -2
- package/lib/effects/texture-pass.d.ts.map +1 -0
- package/lib/env/conf.zh.d.ts +1 -0
- package/lib/env/conf.zh.d.ts.map +1 -0
- package/lib/env/constants.d.ts +1 -0
- package/lib/env/constants.d.ts.map +1 -0
- package/lib/env/default-config.d.ts +99 -0
- package/lib/env/default-config.d.ts.map +1 -0
- package/lib/env/enums.d.ts +3 -0
- package/lib/env/enums.d.ts.map +1 -0
- package/lib/env/index.d.ts +1 -0
- package/lib/env/index.d.ts.map +1 -0
- package/lib/environment.worker.js +2 -4296
- package/lib/environment.worker.js.map +1 -0
- package/lib/extras/adapter2.d.ts +44 -0
- package/lib/extras/adapter2.d.ts.map +1 -0
- package/lib/extras/adapter3.d.ts +28 -0
- package/lib/extras/adapter3.d.ts.map +1 -0
- package/lib/extras/drag.d.ts +1 -0
- package/lib/extras/drag.d.ts.map +1 -0
- package/lib/extras/dummy-point.d.ts +2 -1
- package/lib/extras/dummy-point.d.ts.map +1 -0
- package/lib/extras/dummy-rect.d.ts +2 -1
- package/lib/extras/dummy-rect.d.ts.map +1 -0
- package/lib/extras/dynamic-draw-rect.d.ts +2 -1
- package/lib/extras/dynamic-draw-rect.d.ts.map +1 -0
- package/lib/extras/interfaces.d.ts +3 -2
- package/lib/extras/interfaces.d.ts.map +1 -0
- package/lib/extras/label.d.ts +2 -1
- package/lib/extras/label.d.ts.map +1 -0
- package/lib/extras/svg-app.d.ts +52 -6
- package/lib/extras/svg-app.d.ts.map +1 -0
- package/lib/extras/svg-chef.d.ts +3 -4
- package/lib/extras/svg-chef.d.ts.map +1 -0
- package/lib/extras/svg-dummies.d.ts +1 -0
- package/lib/extras/svg-dummies.d.ts.map +1 -0
- package/lib/extras/svg-multi-selector.d.ts +2 -1
- package/lib/extras/svg-multi-selector.d.ts.map +1 -0
- package/lib/extras/svg-painter.d.ts +1 -0
- package/lib/extras/svg-painter.d.ts.map +1 -0
- package/lib/extras/svg-view.d.ts +6 -5
- package/lib/extras/svg-view.d.ts.map +1 -0
- package/lib/extras/tooltip.d.ts +1 -0
- package/lib/extras/tooltip.d.ts.map +1 -0
- package/lib/helpers/axes-helper3.d.ts +20 -0
- package/lib/helpers/axes-helper3.d.ts.map +1 -0
- package/lib/helpers/cache.d.ts +1 -0
- package/lib/helpers/cache.d.ts.map +1 -0
- package/lib/helpers/canvas-helper.d.ts +7 -14
- package/lib/helpers/canvas-helper.d.ts.map +1 -0
- package/lib/helpers/geo-helper.d.ts +15 -11
- package/lib/helpers/geo-helper.d.ts.map +1 -0
- package/lib/helpers/geo3-helper.d.ts +5 -0
- package/lib/helpers/geo3-helper.d.ts.map +1 -0
- package/lib/helpers/loading-manager.d.ts +1 -0
- package/lib/helpers/loading-manager.d.ts.map +1 -0
- package/lib/helpers/mtl-helper.d.ts +11 -0
- package/lib/helpers/mtl-helper.d.ts.map +1 -0
- package/lib/helpers/obj3-helper.d.ts +4 -0
- package/lib/helpers/obj3-helper.d.ts.map +1 -0
- package/lib/helpers/sax-helper.d.ts +1 -0
- package/lib/helpers/sax-helper.d.ts.map +1 -0
- package/lib/helpers/shape2-helper.d.ts +27 -0
- package/lib/helpers/shape2-helper.d.ts.map +1 -0
- package/lib/helpers/shape3-helper.d.ts +11 -0
- package/lib/helpers/shape3-helper.d.ts.map +1 -0
- package/lib/helpers/sprite-helper.d.ts +10 -0
- package/lib/helpers/sprite-helper.d.ts.map +1 -0
- package/lib/helpers/svg-helper.d.ts +69 -51
- package/lib/helpers/svg-helper.d.ts.map +1 -0
- package/lib/helpers/texture-helper.d.ts +26 -27
- package/lib/helpers/texture-helper.d.ts.map +1 -0
- package/lib/helpers/texture3-helper.d.ts +15 -0
- package/lib/helpers/texture3-helper.d.ts.map +1 -0
- package/lib/index.d.ts +14 -7
- package/lib/index.d.ts.map +1 -0
- package/lib/index.mjs +17 -18637
- package/lib/index.mjs.map +1 -0
- package/lib/index.umd.js +1 -152
- package/lib/index.umd.js.map +1 -0
- package/lib/interfaces.d.ts +386 -132
- package/lib/interfaces.d.ts.map +1 -0
- package/lib/loaders/file-loader.d.ts +1 -0
- package/lib/loaders/file-loader.d.ts.map +1 -0
- package/lib/loaders/image-loader.d.ts +1 -0
- package/lib/loaders/image-loader.d.ts.map +1 -0
- package/lib/loaders/loader.d.ts +1 -0
- package/lib/loaders/loader.d.ts.map +1 -0
- package/lib/loaders/svg-loader.d.ts +1 -0
- package/lib/loaders/svg-loader.d.ts.map +1 -0
- package/lib/loaders/svg-loader3.d.ts +15 -0
- package/lib/loaders/svg-loader3.d.ts.map +1 -0
- package/lib/main.d.ts +1 -0
- package/lib/main.d.ts.map +1 -0
- package/lib/math/box2.d.ts +13 -13
- package/lib/math/box2.d.ts.map +1 -0
- package/lib/math/box3.d.ts +13 -0
- package/lib/math/box3.d.ts.map +1 -0
- package/lib/math/color.d.ts +4 -2
- package/lib/math/color.d.ts.map +1 -0
- package/lib/math/cubic-interpolant.d.ts +1 -0
- package/lib/math/cubic-interpolant.d.ts.map +1 -0
- package/lib/math/curve.d.ts +16 -0
- package/lib/math/curve.d.ts.map +1 -0
- package/lib/math/discrete-interpolant.d.ts +1 -0
- package/lib/math/discrete-interpolant.d.ts.map +1 -0
- package/lib/math/improved-noise.d.ts +1 -0
- package/lib/math/improved-noise.d.ts.map +1 -0
- package/lib/math/interpolant.d.ts +1 -0
- package/lib/math/interpolant.d.ts.map +1 -0
- package/lib/math/linear-interpolant.d.ts +1 -0
- package/lib/math/linear-interpolant.d.ts.map +1 -0
- package/lib/math/matrix3.d.ts +12 -2
- package/lib/math/matrix3.d.ts.map +1 -0
- package/lib/math/matrix4.d.ts +8 -0
- package/lib/math/matrix4.d.ts.map +1 -0
- package/lib/math/utils.d.ts +1 -0
- package/lib/math/utils.d.ts.map +1 -0
- package/lib/math/vector2.d.ts +13 -4
- package/lib/math/vector2.d.ts.map +1 -0
- package/lib/math/vector3.d.ts +10 -5
- package/lib/math/vector3.d.ts.map +1 -0
- package/lib/math/vector4.d.ts +1 -0
- package/lib/math/vector4.d.ts.map +1 -0
- package/lib/renderer2.worker.js +16 -0
- package/lib/renderer2.worker.js.map +1 -0
- package/lib/renderer3.worker.js +22 -0
- package/lib/renderer3.worker.js.map +1 -0
- package/lib/renderers/binding-states.d.ts +8 -10
- package/lib/renderers/binding-states.d.ts.map +1 -0
- package/lib/renderers/buffer-renderer.d.ts +18 -20
- package/lib/renderers/buffer-renderer.d.ts.map +1 -0
- package/lib/renderers/cvs-renderer.d.ts +34 -16
- package/lib/renderers/cvs-renderer.d.ts.map +1 -0
- package/lib/renderers/render-lists.d.ts +3 -2
- package/lib/renderers/render-lists.d.ts.map +1 -0
- package/lib/renderers/render-states.d.ts +1 -0
- package/lib/renderers/render-states.d.ts.map +1 -0
- package/lib/renderers/render-target.d.ts +1 -0
- package/lib/renderers/render-target.d.ts.map +1 -0
- package/lib/{renders → renderers}/svg-renderer.d.ts +1 -0
- package/lib/renderers/svg-renderer.d.ts.map +1 -0
- package/lib/renderers/web-g-l-renderer3.d.ts +1 -0
- package/lib/renderers/web-g-l-renderer3.d.ts.map +1 -0
- package/lib/routes.d.ts +1 -0
- package/lib/routes.d.ts.map +1 -0
- package/lib/scenes/animate-scene2.d.ts +27 -0
- package/lib/scenes/animate-scene2.d.ts.map +1 -0
- package/lib/scenes/animate-scene3.d.ts +15 -0
- package/lib/scenes/animate-scene3.d.ts.map +1 -0
- package/lib/scenes/drawing-scene2.d.ts +43 -0
- package/lib/scenes/drawing-scene2.d.ts.map +1 -0
- package/lib/scenes/drawing-scene3.d.ts +20 -0
- package/lib/scenes/drawing-scene3.d.ts.map +1 -0
- package/lib/scenes/dynamic-scene.d.ts +1 -0
- package/lib/scenes/dynamic-scene.d.ts.map +1 -0
- package/lib/scenes/empty-scene2.d.ts +27 -0
- package/lib/scenes/empty-scene2.d.ts.map +1 -0
- package/lib/scenes/empty-scene3.d.ts +16 -0
- package/lib/scenes/empty-scene3.d.ts.map +1 -0
- package/lib/scenes/{loading-scene.d.ts → loading-scene2.d.ts} +9 -8
- package/lib/scenes/loading-scene2.d.ts.map +1 -0
- package/lib/scenes/loading-scene3.d.ts +17 -0
- package/lib/scenes/loading-scene3.d.ts.map +1 -0
- package/lib/scenes/scene.d.ts +4 -2
- package/lib/scenes/scene.d.ts.map +1 -0
- package/lib/scenes/shadow-scene3.d.ts +15 -0
- package/lib/scenes/shadow-scene3.d.ts.map +1 -0
- package/lib/scenes/static-scene.d.ts +1 -0
- package/lib/scenes/static-scene.d.ts.map +1 -0
- package/lib/scenes/svg-empty-scene.d.ts +1 -0
- package/lib/scenes/svg-empty-scene.d.ts.map +1 -0
- package/lib/scenes/svg-loading-scene.d.ts +1 -0
- package/lib/scenes/svg-loading-scene.d.ts.map +1 -0
- package/lib/scenes/svg-scene.d.ts +2 -1
- package/lib/scenes/svg-scene.d.ts.map +1 -0
- package/lib/shaders/final.shader.d.ts +13 -0
- package/lib/shaders/final.shader.d.ts.map +1 -0
- package/lib/shaders/loading-circles.shader.d.ts +14 -0
- package/lib/shaders/loading-circles.shader.d.ts.map +1 -0
- package/lib/shaders/projection.shader.d.ts +33 -0
- package/lib/shaders/projection.shader.d.ts.map +1 -0
- package/lib/shaders/shadow.shader.d.ts +16 -0
- package/lib/shaders/shadow.shader.d.ts.map +1 -0
- package/lib/shaders/smoke.shader.d.ts +12 -0
- package/lib/shaders/smoke.shader.d.ts.map +1 -0
- package/lib/shaders/textures-box.shader.d.ts +12 -0
- package/lib/shaders/textures-box.shader.d.ts.map +1 -0
- package/lib/shapes/arrow.d.ts +6 -4
- package/lib/shapes/arrow.d.ts.map +1 -0
- package/lib/shapes/axes.d.ts +14 -16
- package/lib/shapes/axes.d.ts.map +1 -0
- package/lib/shapes/circle.d.ts +5 -4
- package/lib/shapes/circle.d.ts.map +1 -0
- package/lib/shapes/geo/a-geo.d.ts +31 -0
- package/lib/shapes/geo/a-geo.d.ts.map +1 -0
- package/lib/shapes/geo/cmd.d.ts +11 -0
- package/lib/shapes/geo/cmd.d.ts.map +1 -0
- package/lib/shapes/geo/geo-circle.d.ts +14 -0
- package/lib/shapes/geo/geo-circle.d.ts.map +1 -0
- package/lib/shapes/geo/geo-line.d.ts +13 -0
- package/lib/shapes/geo/geo-line.d.ts.map +1 -0
- package/lib/shapes/geo/geo-polygon.d.ts +9 -0
- package/lib/shapes/geo/geo-polygon.d.ts.map +1 -0
- package/lib/shapes/geo/geo-polyline.d.ts +22 -0
- package/lib/shapes/geo/geo-polyline.d.ts.map +1 -0
- package/lib/shapes/geo/geo-rect.d.ts +14 -0
- package/lib/shapes/geo/geo-rect.d.ts.map +1 -0
- package/lib/shapes/geo/geo-shape.d.ts +22 -0
- package/lib/shapes/geo/geo-shape.d.ts.map +1 -0
- package/lib/{geometries → shapes/geo}/path-polyfill.d.ts +2 -1
- package/lib/shapes/geo/path-polyfill.d.ts.map +1 -0
- package/lib/shapes/geo/path-proxy.d.ts +74 -0
- package/lib/shapes/geo/path-proxy.d.ts.map +1 -0
- package/lib/shapes/line.d.ts +10 -0
- package/lib/shapes/line.d.ts.map +1 -0
- package/lib/{materials/text-material2.d.ts → shapes/mtl/mtl-text.d.ts} +8 -9
- package/lib/shapes/mtl/mtl-text.d.ts.map +1 -0
- package/lib/shapes/mtl/mtl.d.ts +30 -0
- package/lib/shapes/mtl/mtl.d.ts.map +1 -0
- package/lib/shapes/mtl/utils.d.ts +3 -0
- package/lib/shapes/mtl/utils.d.ts.map +1 -0
- package/lib/shapes/polygon.d.ts +2 -3
- package/lib/shapes/polygon.d.ts.map +1 -0
- package/lib/shapes/polyline.d.ts +9 -0
- package/lib/shapes/polyline.d.ts.map +1 -0
- package/lib/shapes/rect.d.ts +14 -0
- package/lib/shapes/rect.d.ts.map +1 -0
- package/lib/shapes/shape.d.ts +27 -0
- package/lib/shapes/shape.d.ts.map +1 -0
- package/lib/shapes/skinned-shape.d.ts +10 -0
- package/lib/shapes/skinned-shape.d.ts.map +1 -0
- package/lib/shapes/sprite.d.ts +9 -0
- package/lib/shapes/sprite.d.ts.map +1 -0
- package/lib/shapes/svg.d.ts +10 -0
- package/lib/shapes/svg.d.ts.map +1 -0
- package/lib/shapes/text.d.ts +10 -12
- package/lib/shapes/text.d.ts.map +1 -0
- package/lib/svg/editor/svg-editor.d.ts +60 -0
- package/lib/svg/editor/svg-editor.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-base-tool.d.ts +29 -0
- package/lib/svg/editor/tools/svg-base-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-drag-tool.d.ts +26 -0
- package/lib/svg/editor/tools/svg-drag-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-draw-base-tool.d.ts +59 -0
- package/lib/svg/editor/tools/svg-draw-base-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-draw-point-tool.d.ts +16 -0
- package/lib/svg/editor/tools/svg-draw-point-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-draw-polylgon-tool.d.ts +20 -0
- package/lib/svg/editor/tools/svg-draw-polylgon-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-draw-polyline-tool.d.ts +29 -0
- package/lib/svg/editor/tools/svg-draw-polyline-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-draw-text-tool.d.ts +21 -0
- package/lib/svg/editor/tools/svg-draw-text-tool.d.ts.map +1 -0
- package/lib/svg/editor/tools/svg-hover-tool.d.ts +17 -0
- package/lib/svg/editor/tools/svg-hover-tool.d.ts.map +1 -0
- package/lib/svg/utils.d.ts +10 -1
- package/lib/svg/utils.d.ts.map +1 -0
- package/lib/utils/coords.d.ts +4 -0
- package/lib/utils/coords.d.ts.map +1 -0
- package/lib/utils/dom-utils.d.ts +1 -0
- package/lib/utils/dom-utils.d.ts.map +1 -0
- package/lib/utils/md5.d.ts +2 -1
- package/lib/utils/md5.d.ts.map +1 -0
- package/lib/utils/request-anim-frame.d.ts +1 -0
- package/lib/utils/request-anim-frame.d.ts.map +1 -0
- package/lib/utils/svg.d.ts +5 -2
- package/lib/utils/svg.d.ts.map +1 -0
- package/lib/utils/three-utils.d.ts +4 -0
- package/lib/utils/three-utils.d.ts.map +1 -0
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/uuid.d.ts +1 -0
- package/lib/utils/uuid.d.ts.map +1 -0
- package/lib/utils/validates.d.ts +1 -0
- package/lib/utils/validates.d.ts.map +1 -0
- package/lib/workers/environment.worker.d.ts +1 -0
- package/lib/workers/environment.worker.d.ts.map +1 -0
- package/lib/workers/renderer2.worker.d.ts +2 -0
- package/lib/workers/renderer2.worker.d.ts.map +1 -0
- package/lib/workers/renderer3.worker.d.ts +2 -0
- package/lib/workers/renderer3.worker.d.ts.map +1 -0
- package/package.json +8 -3
- package/lib/applications/app-cvs.d.ts +0 -61
- package/lib/applications/app-director.d.ts +0 -22
- package/lib/applications/app-offscreen.d.ts +0 -58
- package/lib/applications/application.d.ts +0 -71
- package/lib/controls/interactive-controls.d.ts +0 -12
- package/lib/core/ope-view.d.ts +0 -45
- package/lib/extras/adapter.d.ts +0 -46
- package/lib/extras/app.d.ts +0 -0
- package/lib/extras/chef.d.ts +0 -23
- package/lib/geometries/circle-geo2.d.ts +0 -15
- package/lib/geometries/circle-geometry2.d.ts +0 -22
- package/lib/geometries/geo2.d.ts +0 -33
- package/lib/geometries/geometry2.d.ts +0 -50
- package/lib/geometries/line-geometry2.d.ts +0 -29
- package/lib/geometries/path.d.ts +0 -40
- package/lib/geometries/polygon-geo2.d.ts +0 -5
- package/lib/geometries/polygon-geometry2.d.ts +0 -13
- package/lib/geometries/polyline-geo2.d.ts +0 -21
- package/lib/geometries/rect-geometry2.d.ts +0 -18
- package/lib/geometries/text-geometry2.d.ts +0 -13
- package/lib/helpers/axes-helper.d.ts +0 -18
- package/lib/helpers/axes-helper2.d.ts +0 -21
- package/lib/helpers/dummy-helper.d.ts +0 -4
- package/lib/helpers/dxf-helper.d.ts +0 -2
- package/lib/helpers/mat-helper.d.ts +0 -11
- package/lib/helpers/merge-helper.d.ts +0 -11
- package/lib/index.cjs.js +0 -152
- package/lib/materials/line-material2.d.ts +0 -8
- package/lib/materials/mat2.d.ts +0 -35
- package/lib/materials/material2.d.ts +0 -38
- package/lib/materials/text-mat2.d.ts +0 -53
- package/lib/objects/mesh2.d.ts +0 -18
- package/lib/objects/node2.d.ts +0 -24
- package/lib/objects/shape.d.ts +0 -57
- package/lib/objects/shape2.d.ts +0 -32
- package/lib/renderer.worker.js +0 -19115
- package/lib/renderers/renderer.d.ts +0 -26
- package/lib/renders/binding-states.d.ts +0 -35
- package/lib/renders/buffer-renderer.d.ts +0 -19
- package/lib/renders/render-lists.d.ts +0 -29
- package/lib/renders/render-states.d.ts +0 -18
- package/lib/renders/render-target.d.ts +0 -26
- package/lib/renders/renderer2.d.ts +0 -52
- package/lib/renders/t-svg-renderer.d.ts +0 -35
- package/lib/scenes/animate-scene.d.ts +0 -17
- package/lib/scenes/loading-text-scene.d.ts +0 -19
- package/lib/scenes/main-scene.d.ts +0 -34
- package/lib/shapes2/actor.d.ts +0 -24
- package/lib/shapes2/arrow.d.ts +0 -6
- package/lib/shapes2/axes.d.ts +0 -35
- package/lib/shapes2/circle.d.ts +0 -10
- package/lib/shapes2/dummy.d.ts +0 -19
- package/lib/shapes2/polygon.d.ts +0 -9
- package/lib/shapes2/svg.d.ts +0 -18
- package/lib/shapes2/text.d.ts +0 -21
- package/lib/svg/circle-element.d.ts +0 -9
- package/lib/svg/defs-element.d.ts +0 -6
- package/lib/svg/element.d.ts +0 -32
- package/lib/svg/elements.d.ts +0 -25
- package/lib/svg/g-element.d.ts +0 -6
- package/lib/svg/interfaces.d.ts +0 -46
- package/lib/svg/path-element.d.ts +0 -33
- package/lib/svg/property.d.ts +0 -25
- package/lib/svg/style-element.d.ts +0 -6
- package/lib/svg/svg-element.d.ts +0 -10
- package/lib/svg/symbol-element.d.ts +0 -6
- package/lib/svg/text-element.d.ts +0 -10
- package/lib/svg/unknown-element.d.ts +0 -6
- package/lib/svg/use-element.d.ts +0 -8
- package/lib/svg/view-element.d.ts +0 -6
- package/lib/textures/texture.d.ts +0 -45
- package/lib/workers/app-offscreen.worker.d.ts +0 -0
- package/lib/workers/renderer.worker.d.ts +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var t,e,n=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=(t,e,i)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,h=(t,e)=>{for(var n in e||(e={}))o.call(e,n)&&c(t,n,e[n]);if(a)for(var n of a(e))l.call(e,n)&&c(t,n,e[n]);return t},u=(t,e)=>i(t,r(e)),d=(t,e,n)=>c(t,"symbol"!=typeof e?e+"":e,n),p=(t,e,n)=>new Promise(((i,r)=>{var s=t=>{try{o(n.next(t))}catch(t){r(t)}},a=t=>{try{o(n.throw(t))}catch(t){r(t)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(s,a);o((n=n.apply(t,e)).next())})),f=(t={"renderer3.worker.js"(t){
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2010-2025 Three.js Authors
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
const e="176",n=0,i=1,r=2,s=0,a=1,o=2,l=3,c=0,f=1,m=2,g=100,v=101,_=102,y=200,x=201,b=202,M=203,S=204,E=205,w=206,T=207,A=208,C=209,R=210,P=211,I=212,N=213,D=214,L=0,U=1,O=2,F=3,B=4,z=5,k=6,V=7,H=301,G=302,W=306,q=1e3,j=1001,X=1002,Y=1003,Z=1004,K=1005,J=1006,$=1007,Q=1008,tt=1009,et=1010,nt=1011,it=1012,rt=1013,st=1014,at=1015,ot=1016,lt=1017,ct=1018,ht=1020,ut=35902,dt=1023,pt=1026,ft=1027,mt=1028,gt=1029,vt=1031,_t=1033,yt=33776,xt=33777,bt=33778,Mt=33779,St=35840,Et=35841,wt=35842,Tt=35843,At=36196,Ct=37492,Rt=37496,Pt=37808,It=37809,Nt=37810,Dt=37811,Lt=37812,Ut=37813,Ot=37814,Ft=37815,Bt=37816,zt=37817,kt=37818,Vt=37819,Ht=37820,Gt=37821,Wt=36492,qt=36494,jt=36495,Xt=36284,Yt=36285,Zt=36286,Kt=2300,Jt=2301,$t=2302,Qt=2400,te=2401,ee=2402,ne=2500,ie="",re="srgb",se="srgb-linear",ae="linear",oe="srgb",le=7680,ce=512,he=513,ue=514,de=515,pe=516,fe=517,me=518,ge=519,ve="300 es",_e=2e3,ye=2001;let xe=class{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){const n=this._listeners;return void 0!==n&&void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){const n=this._listeners;if(void 0===n)return;const i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,i=e.length;n<i;n++)e[n].call(this,t);t.target=null}}};const be=["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"],Me=Math.PI/180,Se=180/Math.PI;function Ee(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(be[255&t]+be[t>>8&255]+be[t>>16&255]+be[t>>24&255]+"-"+be[255&e]+be[e>>8&255]+"-"+be[e>>16&15|64]+be[e>>24&255]+"-"+be[63&n|128]+be[n>>8&255]+"-"+be[n>>16&255]+be[n>>24&255]+be[255&i]+be[i>>8&255]+be[i>>16&255]+be[i>>24&255]).toLowerCase()}function we(t,e,n){return Math.max(e,Math.min(n,t))}function Te(t,e,n){return(1-n)*t+n*e}function Ae(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ce(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Re=Me;let Pe=class t{constructor(e=0,n=0){t.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=we(this.x,t.x,e.x),this.y=we(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=we(this.x,t,e),this.y=we(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(we(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(we(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ie=class t{constructor(e,n,i,r,s,a,o,l,c){t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,n,i,r,s,a,o,l,c)}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],y=i[7],x=i[2],b=i[5],M=i[8];return r[0]=s*f+a*v+o*x,r[3]=s*m+a*_+o*b,r[6]=s*g+a*y+o*M,r[1]=l*f+c*v+h*x,r[4]=l*m+c*_+h*b,r[7]=l*g+c*y+h*M,r[2]=u*f+d*v+p*x,r[5]=u*m+d*_+p*b,r[8]=u*g+d*y+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(a*n-i*s)*f,t[3]=u*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-a*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(s*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Ne.makeScale(t,e)),this}rotate(t){return this.premultiply(Ne.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ne.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}};const Ne=new Ie;function De(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Le(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ue(){const t=Le("canvas");return t.style.display="block",t}const Oe={};function Fe(t){t in Oe||(Oe[t]=!0)}const Be=(new Ie).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ze=(new Ie).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ke(){const t={enabled:!0,workingColorSpace:se,spaces:{},convert:function(t,e,n){return!1!==this.enabled&&e!==n&&e&&n?(this.spaces[e].transfer===oe&&(t.r=He(t.r),t.g=He(t.g),t.b=He(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===oe&&(t.r=Ge(t.r),t.g=Ge(t.g),t.b=Ge(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===ie?ae:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[se]:{primaries:e,whitePoint:i,transfer:ae,toXYZ:Be,fromXYZ:ze,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:re},outputColorSpaceConfig:{drawingBufferColorSpace:re}},[re]:{primaries:e,whitePoint:i,transfer:oe,toXYZ:Be,fromXYZ:ze,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:re}}}),t}const Ve=ke();function He(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ge(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let We;class qe{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{void 0===We&&(We=Le("canvas")),We.width=t.width,We.height=t.height;const e=We.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),n=We}return n.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Le("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*He(r[t]/255);return n.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*He(e[t]/255)):e[t]=He(e[t]);return{data:e,width:t.width,height:t.height}}return t}}let je=0;class Xe{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:je++}),this.uuid=Ee(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Ye(i[e].image)):t.push(Ye(i[e]))}else t=Ye(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Ye(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?qe.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let Ze=0;class Ke extends xe{constructor(t=Ke.DEFAULT_IMAGE,e=Ke.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=1009,l=Ke.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ze++}),this.uuid=Ee(),this.name="",this.source=new Xe(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Pe(0,0),this.repeat=new Pe(1,1),this.center=new Pe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ie,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case q:t.x=t.x-Math.floor(t.x);break;case j:t.x=t.x<0?0:1;break;case X:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case q:t.y=t.y-Math.floor(t.y);break;case j:t.y=t.y<0?0:1;break;case X:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Ke.DEFAULT_IMAGE=null,Ke.DEFAULT_MAPPING=300,Ke.DEFAULT_ANISOTROPY=1;class Je{constructor(t=0,e=0,n=0,i=1){Je.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-u)<s&&Math.abs(h-f)<s&&Math.abs(p-m)<s){if(Math.abs(c+u)<a&&Math.abs(h+f)<a&&Math.abs(p+m)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(d+1)/2,v=(g+1)/2,_=(c+u)/4,y=(h+f)/4,x=(p+m)/4;return t>o&&t>v?t<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=_/n,r=y/n):o>v?o<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=_/i,r=x/i):v<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(v),n=y/r,i=x/r),this.set(n,i,r,e),this}let v=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(u-c)*(u-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(h-f)/v,this.z=(u-c)/v,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=we(this.x,t.x,e.x),this.y=we(this.y,t.y,e.y),this.z=we(this.z,t.z,e.z),this.w=we(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=we(this.x,t,e),this.y=we(this.y,t,e),this.z=we(this.z,t,e),this.w=we(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(we(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class $e extends xe{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth?n.depth:1,this.scissor=new Je(0,0,t,e),this.scissorTest=!1,this.viewport=new Je(0,0,t,e);const i={width:t,height:e,depth:this.depth};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:J,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},n);const r=new Ke(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let t=0;t<s;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;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}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const n=Object.assign({},t.textures[e].image);this.textures[e].source=new Xe(n)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Qe extends $e{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class tn extends Ke{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Y,this.minFilter=Y,this.wrapR=j,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class en extends Ke{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Y,this.minFilter=Y,this.wrapR=j,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nn{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,s,a){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[s+0],d=r[s+1],p=r[s+2],f=r[s+3];if(0===a)return t[e+0]=o,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===a)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||o!==u||l!==d||c!==p){let t=1-a;const e=o*u+l*d+c*p+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(we(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}let rn=class t{constructor(e=0,n=0,i=0){t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(an.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(an.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=2*(s*i-a*n),c=2*(a*e-r*i),h=2*(r*n-s*e);return this.x=e+o*l+s*h-a*c,this.y=n+o*c+a*l-r*h,this.z=i+o*h+r*c-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=we(this.x,t.x,e.x),this.y=we(this.y,t.y,e.y),this.z=we(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=we(this.x,t,e),this.y=we(this.y,t,e),this.z=we(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(we(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return sn.copy(this).projectOnVector(t),this.sub(sn)}reflect(t){return this.sub(sn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(we(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const sn=new rn,an=new nn;let on=class{constructor(t=new rn(1/0,1/0,1/0),e=new rn(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(cn.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(cn.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=cn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;e<n;e++)!0===t.isMesh?t.getVertexPosition(e,cn):cn.fromBufferAttribute(i,e),cn.applyMatrix4(t.matrixWorld),this.expandByPoint(cn);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),hn.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),hn.copy(n.boundingBox)),hn.applyMatrix4(t.matrixWorld),this.union(hn)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,cn),cn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(vn),_n.subVectors(this.max,vn),un.subVectors(t.a,vn),dn.subVectors(t.b,vn),pn.subVectors(t.c,vn),fn.subVectors(dn,un),mn.subVectors(pn,dn),gn.subVectors(un,pn);let e=[0,-fn.z,fn.y,0,-mn.z,mn.y,0,-gn.z,gn.y,fn.z,0,-fn.x,mn.z,0,-mn.x,gn.z,0,-gn.x,-fn.y,fn.x,0,-mn.y,mn.x,0,-gn.y,gn.x,0];return!!bn(e,un,dn,pn,_n)&&(e=[1,0,0,0,1,0,0,0,1],!!bn(e,un,dn,pn,_n)&&(yn.crossVectors(fn,mn),e=[yn.x,yn.y,yn.z],bn(e,un,dn,pn,_n)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,cn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(cn).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ln)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const ln=[new rn,new rn,new rn,new rn,new rn,new rn,new rn,new rn],cn=new rn,hn=new on,un=new rn,dn=new rn,pn=new rn,fn=new rn,mn=new rn,gn=new rn,vn=new rn,_n=new rn,yn=new rn,xn=new rn;function bn(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){xn.fromArray(t,s);const a=r.x*Math.abs(xn.x)+r.y*Math.abs(xn.y)+r.z*Math.abs(xn.z),o=e.dot(xn),l=n.dot(xn),c=i.dot(xn);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const Mn=new on,Sn=new rn,En=new rn;class wn{constructor(t=new rn,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Mn.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Sn.subVectors(t,this.center);const e=Sn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(Sn,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(En.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Sn.copy(t.center).add(En)),this.expandByPoint(Sn.copy(t.center).sub(En))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Tn=new rn,An=new rn,Cn=new rn,Rn=new rn,Pn=new rn,In=new rn,Nn=new rn;class Dn{constructor(t=new rn,e=new rn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Tn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Tn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Tn.copy(this.origin).addScaledVector(this.direction,e),Tn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){An.copy(t).add(e).multiplyScalar(.5),Cn.copy(e).sub(t).normalize(),Rn.copy(this.origin).sub(An);const r=.5*t.distanceTo(e),s=-this.direction.dot(Cn),a=Rn.dot(this.direction),o=-Rn.dot(Cn),l=Rn.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(An).addScaledVector(Cn,u),d}intersectSphere(t,e){Tn.subVectors(t.center,this.origin);const n=Tn.dot(this.direction),i=Tn.dot(Tn)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Tn)}intersectTriangle(t,e,n,i,r){Pn.subVectors(e,t),In.subVectors(n,t),Nn.crossVectors(Pn,In);let s,a=this.direction.dot(Nn);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Rn.subVectors(this.origin,t);const o=s*this.direction.dot(In.crossVectors(Rn,In));if(o<0)return null;const l=s*this.direction.dot(Pn.cross(Rn));if(l<0)return null;if(o+l>a)return null;const c=-s*Rn.dot(Nn);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}let Ln=class t{constructor(e,n,i,r,s,a,o,l,c,h,u,d,p,f,m,g){t.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,n,i,r,s,a,o,l,c,h,u,d,p,f,m,g)}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 t).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Un.setFromMatrixColumn(t,0).length(),r=1/Un.setFromMatrixColumn(t,1).length(),s=1/Un.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Fn,t,Bn)}lookAt(t,e,n){const i=this.elements;return Vn.subVectors(t,e),0===Vn.lengthSq()&&(Vn.z=1),Vn.normalize(),zn.crossVectors(n,Vn),0===zn.lengthSq()&&(1===Math.abs(n.z)?Vn.x+=1e-4:Vn.z+=1e-4,Vn.normalize(),zn.crossVectors(n,Vn)),zn.normalize(),kn.crossVectors(Vn,zn),i[0]=zn.x,i[4]=kn.x,i[8]=Vn.x,i[1]=zn.y,i[5]=kn.y,i[9]=Vn.y,i[2]=zn.z,i[6]=kn.z,i[10]=Vn.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],y=n[11],x=n[15],b=i[0],M=i[4],S=i[8],E=i[12],w=i[1],T=i[5],A=i[9],C=i[13],R=i[2],P=i[6],I=i[10],N=i[14],D=i[3],L=i[7],U=i[11],O=i[15];return r[0]=s*b+a*w+o*R+l*D,r[4]=s*M+a*T+o*P+l*L,r[8]=s*S+a*A+o*I+l*U,r[12]=s*E+a*C+o*N+l*O,r[1]=c*b+h*w+u*R+d*D,r[5]=c*M+h*T+u*P+d*L,r[9]=c*S+h*A+u*I+d*U,r[13]=c*E+h*C+u*N+d*O,r[2]=p*b+f*w+m*R+g*D,r[6]=p*M+f*T+m*P+g*L,r[10]=p*S+f*A+m*I+g*U,r[14]=p*E+f*C+m*N+g*O,r[3]=v*b+_*w+y*R+x*D,r[7]=v*M+_*T+y*P+x*L,r[11]=v*S+_*A+y*I+x*U,r[15]=v*E+_*C+y*N+x*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*u*l+f*o*d-a*m*d-h*o*g+a*u*g,_=p*u*l-c*m*l-p*o*d+s*m*d+c*o*g-s*u*g,y=c*f*l-p*h*l+p*a*d-s*f*d-c*a*g+s*h*g,x=p*h*o-c*f*o-p*a*u+s*f*u+c*a*m-s*h*m,b=e*v+n*_+i*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return t[0]=v*M,t[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*M,t[2]=(a*m*r-f*o*r+f*i*l-n*m*l-a*i*g+n*o*g)*M,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*M,t[4]=_*M,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*M,t[6]=(p*o*r-s*m*r-p*i*l+e*m*l+s*i*g-e*o*g)*M,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*M,t[8]=y*M,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*M,t[10]=(s*f*r-p*a*r+p*n*l-e*f*l-s*n*g+e*a*g)*M,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*M,t[12]=x*M,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*M,t[14]=(p*a*i-s*f*i-p*n*o+e*f*o+s*n*m-e*a*m)*M,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*M,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=a*h,v=o*l,_=o*c,y=o*h,x=n.x,b=n.y,M=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+y)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(u+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+_)*M,i[9]=(m-v)*M,i[10]=(1-(u+f))*M,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Un.set(i[0],i[1],i[2]).length();const s=Un.set(i[4],i[5],i[6]).length(),a=Un.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],On.copy(this);const o=1/r,l=1/s,c=1/a;return On.elements[0]*=o,On.elements[1]*=o,On.elements[2]*=o,On.elements[4]*=l,On.elements[5]*=l,On.elements[6]*=l,On.elements[8]*=c,On.elements[9]*=c,On.elements[10]*=c,e.setFromRotationMatrix(On),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s,a=2e3){const o=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(a===_e)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(a!==ye)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-r),p=-s*r/(s-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s,a=2e3){const o=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,f;if(a===_e)p=(s+r)*h,f=-2*h;else{if(a!==ye)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*h,f=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}};const Un=new rn,On=new Ln,Fn=new rn(0,0,0),Bn=new rn(1,1,1),zn=new rn,kn=new rn,Vn=new rn,Hn=new Ln,Gn=new nn;class Wn{constructor(t=0,e=0,n=0,i=Wn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(we(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-we(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(we(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-we(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(we(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-we(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Hn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Hn,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Gn.setFromEuler(this),this.setFromQuaternion(Gn,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Wn.DEFAULT_ORDER="XYZ";class qn{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let jn=0;const Xn=new rn,Yn=new nn,Zn=new Ln,Kn=new rn,Jn=new rn,$n=new rn,Qn=new nn,ti=new rn(1,0,0),ei=new rn(0,1,0),ni=new rn(0,0,1),ii={type:"added"},ri={type:"removed"},si={type:"childadded",child:null},ai={type:"childremoved",child:null};class oi extends xe{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jn++}),this.uuid=Ee(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=oi.DEFAULT_UP.clone();const t=new rn,e=new Wn,n=new nn,i=new rn(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ln},normalMatrix:{value:new Ie}}),this.matrix=new Ln,this.matrixWorld=new Ln,this.matrixAutoUpdate=oi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=oi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qn,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.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Yn.setFromAxisAngle(t,e),this.quaternion.multiply(Yn),this}rotateOnWorldAxis(t,e){return Yn.setFromAxisAngle(t,e),this.quaternion.premultiply(Yn),this}rotateX(t){return this.rotateOnAxis(ti,t)}rotateY(t){return this.rotateOnAxis(ei,t)}rotateZ(t){return this.rotateOnAxis(ni,t)}translateOnAxis(t,e){return Xn.copy(t).applyQuaternion(this.quaternion),this.position.add(Xn.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(ti,t)}translateY(t){return this.translateOnAxis(ei,t)}translateZ(t){return this.translateOnAxis(ni,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Zn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Kn.copy(t):Kn.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Jn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zn.lookAt(Jn,Kn,this.up):Zn.lookAt(Kn,Jn,this.up),this.quaternion.setFromRotationMatrix(Zn),i&&(Zn.extractRotation(i.matrixWorld),Yn.setFromRotationMatrix(Zn),this.quaternion.premultiply(Yn.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(ii),si.child=t,this.dispatchEvent(si),si.child=null),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(ri),ai.child=t,this.dispatchEvent(ai),ai.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Zn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Zn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Zn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(ii),si.child=t,this.dispatchEvent(si),si.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jn,t,$n),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jn,Qn,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((t=>u(h({},t),{boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),i.instanceInfo=this._instanceInfo.map((t=>h({},t))),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=s(t.geometries),i=s(t.materials),r=s(t.textures),a=s(t.images),o=s(t.shapes),l=s(t.skeletons),c=s(t.animations),h=s(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}oi.DEFAULT_UP=new rn(0,1,0),oi.DEFAULT_MATRIX_AUTO_UPDATE=!0,oi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const li=new rn,ci=new rn,hi=new rn,ui=new rn,di=new rn,pi=new rn,fi=new rn,mi=new rn,gi=new rn,vi=new rn,_i=new Je,yi=new Je,xi=new Je;class bi{constructor(t=new rn,e=new rn,n=new rn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),li.subVectors(t,e),i.cross(li);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){li.subVectors(i,e),ci.subVectors(n,e),hi.subVectors(t,e);const s=li.dot(li),a=li.dot(ci),o=li.dot(hi),l=ci.dot(ci),c=ci.dot(hi),h=s*l-a*a;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,ui)&&ui.x>=0&&ui.y>=0&&ui.x+ui.y<=1}static getInterpolation(t,e,n,i,r,s,a,o){return null===this.getBarycoord(t,e,n,i,ui)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,ui.x),o.addScaledVector(s,ui.y),o.addScaledVector(a,ui.z),o)}static getInterpolatedAttribute(t,e,n,i,r,s){return _i.setScalar(0),yi.setScalar(0),xi.setScalar(0),_i.fromBufferAttribute(t,e),yi.fromBufferAttribute(t,n),xi.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(_i,r.x),s.addScaledVector(yi,r.y),s.addScaledVector(xi,r.z),s}static isFrontFacing(t,e,n,i){return li.subVectors(n,e),ci.subVectors(t,e),li.cross(ci).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return li.subVectors(this.c,this.b),ci.subVectors(this.a,this.b),.5*li.cross(ci).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return bi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return bi.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return bi.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return bi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return bi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;di.subVectors(i,n),pi.subVectors(r,n),mi.subVectors(t,n);const o=di.dot(mi),l=pi.dot(mi);if(o<=0&&l<=0)return e.copy(n);gi.subVectors(t,i);const c=di.dot(gi),h=pi.dot(gi);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(di,s);vi.subVectors(t,r);const d=di.dot(vi),p=pi.dot(vi);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(pi,a);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return fi.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(fi,a);const g=1/(m+f+u);return s=f*g,a=u*g,e.copy(n).addScaledVector(di,s).addScaledVector(pi,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Mi={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},Si={h:0,s:0,l:0},Ei={h:0,s:0,l:0};function wi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class Ti{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=re){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ve.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Ve.workingColorSpace){return this.r=t,this.g=e,this.b=n,Ve.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Ve.workingColorSpace){var r;if(t=(t%(r=1)+r)%r,e=we(e,0,1),n=we(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=wi(r,i,t+1/3),this.g=wi(r,i,t),this.b=wi(r,i,t-1/3)}return Ve.toWorkingColorSpace(this,i),this}setStyle(t,e=re){function n(t){void 0!==t&&parseFloat(t)}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.setRGB(parseInt(t.charAt(0),16)/15,parseInt(t.charAt(1),16)/15,parseInt(t.charAt(2),16)/15,e);if(6===n)return this.setHex(parseInt(t,16),e)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=re){const n=Mi[t.toLowerCase()];return void 0!==n&&this.setHex(n,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=He(t.r),this.g=He(t.g),this.b=He(t.b),this}copyLinearToSRGB(t){return this.r=Ge(t.r),this.g=Ge(t.g),this.b=Ge(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=re){return Ve.fromWorkingColorSpace(Ai.copy(this),t),65536*Math.round(we(255*Ai.r,0,255))+256*Math.round(we(255*Ai.g,0,255))+Math.round(we(255*Ai.b,0,255))}getHexString(t=re){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ve.workingColorSpace){Ve.fromWorkingColorSpace(Ai.copy(this),e);const n=Ai.r,i=Ai.g,r=Ai.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c<=.5?t/(s+a):t/(2-s-a),s){case n:o=(i-r)/t+(i<r?6:0);break;case i:o=(r-n)/t+2;break;case r:o=(n-i)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e=Ve.workingColorSpace){return Ve.fromWorkingColorSpace(Ai.copy(this),e),t.r=Ai.r,t.g=Ai.g,t.b=Ai.b,t}getStyle(t=re){Ve.fromWorkingColorSpace(Ai.copy(this),t);const e=Ai.r,n=Ai.g,i=Ai.b;return t!==re?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(Si),this.setHSL(Si.h+t,Si.s+e,Si.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Si),t.getHSL(Ei);const n=Te(Si.h,Ei.h,e),i=Te(Si.s,Ei.s,e),r=Te(Si.l,Ei.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ai=new Ti;Ti.NAMES=Mi;let Ci=0;class Ri extends xe{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ci++}),this.uuid=Ee(),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=g,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ti(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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n)continue;const i=this[e];void 0!==i&&(i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==g&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==le&&(n.stencilFail=this.stencilFail),this.stencilZFail!==le&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==le&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Pi extends Ri{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ti(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 Wn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Ii=new rn,Ni=new Pe;let Di=0;class Li{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Di++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=at,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ni.fromBufferAttribute(this,e),Ni.applyMatrix3(t),this.setXY(e,Ni.x,Ni.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ii.fromBufferAttribute(this,e),Ii.applyMatrix3(t),this.setXYZ(e,Ii.x,Ii.y,Ii.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Ii.fromBufferAttribute(this,e),Ii.applyMatrix4(t),this.setXYZ(e,Ii.x,Ii.y,Ii.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ii.fromBufferAttribute(this,e),Ii.applyNormalMatrix(t),this.setXYZ(e,Ii.x,Ii.y,Ii.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ii.fromBufferAttribute(this,e),Ii.transformDirection(t),this.setXYZ(e,Ii.x,Ii.y,Ii.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ae(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Ce(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ae(e,this.array)),e}setX(t,e){return this.normalized&&(e=Ce(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ae(e,this.array)),e}setY(t,e){return this.normalized&&(e=Ce(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ae(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Ce(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ae(e,this.array)),e}setW(t,e){return this.normalized&&(e=Ce(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Ce(e,this.array),n=Ce(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Ce(e,this.array),n=Ce(n,this.array),i=Ce(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Ce(e,this.array),n=Ce(n,this.array),i=Ce(i,this.array),r=Ce(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class Ui extends Li{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Oi extends Li{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Fi extends Li{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Bi=0;const zi=new Ln,ki=new oi,Vi=new rn,Hi=new on,Gi=new on,Wi=new rn;class qi extends xe{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Bi++}),this.uuid=Ee(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(De(t)?Oi:Ui)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Ie).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return zi.makeRotationFromQuaternion(t),this.applyMatrix4(zi),this}rotateX(t){return zi.makeRotationX(t),this.applyMatrix4(zi),this}rotateY(t){return zi.makeRotationY(t),this.applyMatrix4(zi),this}rotateZ(t){return zi.makeRotationZ(t),this.applyMatrix4(zi),this}translate(t,e,n){return zi.makeTranslation(t,e,n),this.applyMatrix4(zi),this}scale(t,e,n){return zi.makeScale(t,e,n),this.applyMatrix4(zi),this}lookAt(t){return ki.lookAt(t),ki.updateMatrix(),this.applyMatrix4(ki.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Vi).negate(),this.translate(Vi.x,Vi.y,Vi.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Fi(e,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length,e.count,e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new on);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new rn(-1/0,-1/0,-1/0),new rn(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Hi.setFromBufferAttribute(n),this.morphTargetsRelative?(Wi.addVectors(this.boundingBox.min,Hi.min),this.boundingBox.expandByPoint(Wi),Wi.addVectors(this.boundingBox.max,Hi.max),this.boundingBox.expandByPoint(Wi)):(this.boundingBox.expandByPoint(Hi.min),this.boundingBox.expandByPoint(Hi.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new wn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new rn,1/0);else if(t){const n=this.boundingSphere.center;if(Hi.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Gi.setFromBufferAttribute(n),this.morphTargetsRelative?(Wi.addVectors(Hi.min,Gi.min),Hi.expandByPoint(Wi),Wi.addVectors(Hi.max,Gi.max),Hi.expandByPoint(Wi)):(Hi.expandByPoint(Gi.min),Hi.expandByPoint(Gi.max))}Hi.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)Wi.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(Wi));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],a=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Wi.fromBufferAttribute(s,e),a&&(Vi.fromBufferAttribute(t,e),Wi.add(Vi)),i=Math.max(i,n.distanceToSquared(Wi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;const n=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Li(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<n.count;t++)a[t]=new rn,o[t]=new rn;const l=new rn,c=new rn,h=new rn,u=new Pe,d=new Pe,p=new Pe,f=new rn,m=new rn;function g(t,e,i){l.fromBufferAttribute(n,t),c.fromBufferAttribute(n,e),h.fromBufferAttribute(n,i),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),d.sub(u),p.sub(u);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(f.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(s),m.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(s),a[t].add(f),a[e].add(f),a[i].add(f),o[t].add(m),o[e].add(m),o[i].add(m))}let v=this.groups;0===v.length&&(v=[{start:0,count:t.count}]);for(let e=0,n=v.length;e<n;++e){const n=v[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const _=new rn,y=new rn,x=new rn,b=new rn;function M(t){x.fromBufferAttribute(i,t),b.copy(x);const e=a[t];_.copy(e),_.sub(x.multiplyScalar(x.dot(e))).normalize(),y.crossVectors(b,e);const n=y.dot(o[t])<0?-1:1;s.setXYZW(t,_.x,_.y,_.z,n)}for(let e=0,n=v.length;e<n;++e){const n=v[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)M(t.getX(e+0)),M(t.getX(e+1)),M(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new Li(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new rn,r=new rn,s=new rn,a=new rn,o=new rn,l=new rn,c=new rn,h=new rn;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,f),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),a.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),a.add(c),o.add(c),l.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Wi.fromBufferAttribute(t,e),Wi.normalize(),t.setXYZ(e,Wi.x,Wi.y,Wi.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let a=0,o=0;for(let r=0,l=e.length;r<l;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)s[o++]=n[a++]}return new Li(s,i,r)}if(null===this.index)return this;const e=new qi,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],a=r[i];for(let e=0,i=a.length;e<i;e++){const i=t(a[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone());const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ji=new Ln,Xi=new Dn,Yi=new wn,Zi=new rn,Ki=new rn,Ji=new rn,$i=new rn,Qi=new rn,tr=new rn,er=new rn,nr=new rn;class ir extends oi{constructor(t=new qi,e=new Pi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const a=this.morphTargetInfluences;if(r&&a){tr.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=a[n],o=r[n];0!==i&&(Qi.fromBufferAttribute(o,t),s?tr.addScaledVector(Qi,i):tr.addScaledVector(Qi.sub(e),i))}e.add(tr)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Yi.copy(n.boundingSphere),Yi.applyMatrix4(r),Xi.copy(t.ray).recast(t.near),!1===Yi.containsPoint(Xi.origin)){if(null===Xi.intersectSphere(Yi,Zi))return;if(Xi.origin.distanceToSquared(Zi)>(t.far-t.near)**2)return}ji.copy(r).invert(),Xi.copy(t.ray).applyMatrix4(ji),null!==n.boundingBox&&!1===Xi.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,Xi)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let r=0,o=u.length;r<o;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3)i=rr(this,p,t,n,l,c,h,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3)i=rr(this,s,t,n,l,c,h,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i));else if(void 0!==o)if(Array.isArray(s))for(let r=0,a=u.length;r<a;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3)i=rr(this,p,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3)i=rr(this,s,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}function rr(t,e,n,i,r,s,a,o,l,c){t.getVertexPosition(o,Ki),t.getVertexPosition(l,Ji),t.getVertexPosition(c,$i);const h=function(t,e,n,i,r,s,a,o){let l;if(l=1===e.side?i.intersectTriangle(a,s,r,!0,o):i.intersectTriangle(r,s,a,0===e.side,o),null===l)return null;nr.copy(o),nr.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(nr);return c<n.near||c>n.far?null:{distance:c,point:nr.clone(),object:t}}(t,e,n,i,Ki,Ji,$i,er);if(h){const t=new rn;bi.getBarycoord(er,Ki,Ji,$i,t),r&&(h.uv=bi.getInterpolatedAttribute(r,o,l,c,t,new Pe)),s&&(h.uv1=bi.getInterpolatedAttribute(s,o,l,c,t,new Pe)),a&&(h.normal=bi.getInterpolatedAttribute(a,o,l,c,t,new rn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c:c,normal:new rn,materialIndex:0};bi.getNormal(Ki,Ji,$i,e.normal),h.face=e,h.barycoord=t}return h}class sr extends qi{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,f,m,g,v){const _=s/m,y=p/g,x=s/2,b=p/2,M=f/2,S=m+1,E=g+1;let w=0,T=0;const A=new rn;for(let s=0;s<E;s++){const a=s*y-b;for(let o=0;o<S;o++){const u=o*_-x;A[t]=u*i,A[e]=a*r,A[n]=M,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(o/m),h.push(1-s/g),w+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=u+e+S*t,i=u+e+S*(t+1),r=u+(e+1)+S*(t+1),s=u+(e+1)+S*t;o.push(n,i,s),o.push(i,r,s),T+=6}a.addGroup(d,T,v),d+=T,u+=w}p("z","y","x",-1,-1,n,e,t,s,r,0),p("z","y","x",1,-1,n,e,-t,s,r,1),p("x","z","y",1,1,t,n,e,i,s,2),p("x","z","y",1,-1,t,n,-e,i,s,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new Fi(l,3)),this.setAttribute("normal",new Fi(c,3)),this.setAttribute("uv",new Fi(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sr(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function ar(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?e[n][i]=null:e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function or(t){const e={};for(let n=0;n<t.length;n++){const i=ar(t[n]);for(const t in i)e[t]=i[t]}return e}function lr(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Ve.workingColorSpace}const cr={clone:ar,merge:or};class hr extends Ri{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ar(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class ur extends oi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ln,this.projectionMatrix=new Ln,this.projectionMatrixInverse=new Ln,this.coordinateSystem=_e}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const dr=new rn,pr=new Pe,fr=new Pe;class mr extends ur{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Se*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Me*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Se*Math.atan(Math.tan(.5*Me*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){dr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(dr.x,dr.y).multiplyScalar(-t/dr.z),dr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(dr.x,dr.y).multiplyScalar(-t/dr.z)}getViewSize(t,e){return this.getViewBounds(t,pr,fr),e.subVectors(fr,pr)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Me*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const gr=-90;class vr extends oi{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new mr(gr,1,t,e);i.layers=this.layers,this.add(i);const r=new mr(gr,1,t,e);r.layers=this.layers,this.add(r);const s=new mr(gr,1,t,e);s.layers=this.layers,this.add(s);const a=new mr(gr,1,t,e);a.layers=this.layers,this.add(a);const o=new mr(gr,1,t,e);o.layers=this.layers,this.add(o);const l=new mr(gr,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,a,o]=e;for(const t of e)this.remove(t);if(t===_e)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==ye)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,a),t.setRenderTarget(n,3,i),t.render(e,o),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=f,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class _r extends Ke{constructor(t=[],e=301,n,i,r,s,a,o,l,c){super(t,e,n,i,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class yr extends Qe{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new _r(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:J}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new sr(5,5,5),r=new hr({name:"CubemapFromEquirect",uniforms:ar(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new ir(i,r),a=e.minFilter;return e.minFilter===Q&&(e.minFilter=J),new vr(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e=!0,n=!0,i=!0){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}let xr=class extends oi{constructor(){super(),this.isGroup=!0,this.type="Group"}};const br={type:"move"};class Mr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new xr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new xr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new rn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new rn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new xr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new rn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new rn),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(l,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(br)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new xr;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class Sr extends oi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Wn,this.environmentIntensity=1,this.environmentRotation=new Wn,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Er extends Ke{constructor(t=null,e=1,n=1,i,r,s,a,o,l=1003,c=1003,h,u){super(null,s,a,o,l,c,i,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class wr extends Li{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Tr=new Ln,Ar=new Ln,Cr=[],Rr=new on,Pr=new Ln,Ir=new ir,Nr=new wn;class Dr extends ir{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new wr(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<n;t++)this.setMatrixAt(t,Pr)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new on),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Tr),Rr.copy(t.boundingBox).applyMatrix4(Tr),this.boundingBox.union(Rr)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new wn),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Tr),Nr.copy(t.boundingSphere).applyMatrix4(Tr),this.boundingSphere.union(Nr)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(n.length+1)+1;for(let t=0;t<n.length;t++)n[t]=i[r+t]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Ir.geometry=this.geometry,Ir.material=this.material,void 0!==Ir.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Nr.copy(this.boundingSphere),Nr.applyMatrix4(n),!1!==t.ray.intersectsSphere(Nr)))for(let r=0;r<i;r++){this.getMatrixAt(r,Tr),Ar.multiplyMatrices(n,Tr),Ir.matrixWorld=Ar,Ir.raycast(t,Cr);for(let t=0,n=Cr.length;t<n;t++){const n=Cr[t];n.instanceId=r,n.object=this,e.push(n)}Cr.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new wr(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Er(new Float32Array(i*this.count),i,this.count,mt,at));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<n.length;t++)s+=n[t];const a=this.geometry.morphTargetsRelative?1:1-s,o=i*t;r[o]=a,r.set(n,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Lr=new rn,Ur=new rn,Or=new Ie;class Fr{constructor(t=new rn(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Lr.subVectors(n,e).cross(Ur.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Lr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Or.getNormalMatrix(t),i=this.coplanarPoint(Lr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Br=new wn,zr=new rn;class kr{constructor(t=new Fr,e=new Fr,n=new Fr,i=new Fr,r=new Fr,s=new Fr){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],_=i[14],y=i[15];if(n[0].setComponents(o-r,u-l,m-d,y-g).normalize(),n[1].setComponents(o+r,u+l,m+d,y+g).normalize(),n[2].setComponents(o+s,u+c,m+p,y+v).normalize(),n[3].setComponents(o-s,u-c,m-p,y-v).normalize(),n[4].setComponents(o-a,u-h,m-f,y-_).normalize(),e===_e)n[5].setComponents(o+a,u+h,m+f,y+_).normalize();else{if(e!==ye)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(a,h,f,_).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Br.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Br.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Br)}intersectsSprite(t){return Br.center.set(0,0,0),Br.radius=.7071067811865476,Br.applyMatrix4(t.matrixWorld),this.intersectsSphere(Br)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(zr.x=i.normal.x>0?t.max.x:t.min.x,zr.y=i.normal.y>0?t.max.y:t.min.y,zr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(zr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Vr extends Ri{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ti(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Hr=new rn,Gr=new rn,Wr=new Ln,qr=new Dn,jr=new wn,Xr=new rn,Yr=new rn;class Zr extends oi{constructor(t=new qi,e=new Vr){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)Hr.fromBufferAttribute(e,t-1),Gr.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Hr.distanceTo(Gr);t.setAttribute("lineDistance",new Fi(n,1))}return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),jr.copy(n.boundingSphere),jr.applyMatrix4(i),jr.radius+=r,!1===t.ray.intersectsSphere(jr))return;Wr.copy(i).invert(),qr.copy(t.ray).applyMatrix4(Wr);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=Kr(this,t,qr,o,n,i,r);s&&e.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),a=Kr(this,t,qr,o,r,s,i-1);a&&e.push(a)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=Kr(this,t,qr,o,r,r+1,r);n&&e.push(n)}if(this.isLineLoop){const r=Kr(this,t,qr,o,i-1,n,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Kr(t,e,n,i,r,s,a){const o=t.geometry.attributes.position;if(Hr.fromBufferAttribute(o,r),Gr.fromBufferAttribute(o,s),n.distanceSqToSegment(Hr,Gr,Xr,Yr)>i)return;Xr.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(Xr);return l<e.near||l>e.far?void 0:{distance:l,point:Yr.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const Jr=new rn,$r=new rn;class Qr extends Zr{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)Jr.fromBufferAttribute(e,t),$r.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Jr.distanceTo($r);t.setAttribute("lineDistance",new Fi(n,1))}return this}}class ts extends Ke{constructor(t,e,n=1014,i,r,s,a=1003,o=1003,l,c=1026){if(c!==pt&&c!==ft)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,i,r,s,a,o,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new Xe(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class es extends qi{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=t.clone().lerp(n,i/r),o=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(o(s[t][n+1]),o(s[t+1][n]),o(s[t][n])):(o(s[t][n+1]),o(s[t+1][n+1]),o(s[t+1][n]))}}function o(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function c(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new rn,i=new rn,r=new rn;for(let s=0;s<e.length;s+=3)l(e[s+0],n),l(e[s+1],i),l(e[s+2],r),a(n,i,r,t)}(i),function(t){const e=new rn;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new rn;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,a=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(i,1-a)}var e;(function(){const t=new rn,e=new rn,n=new rn,i=new rn,a=new Pe,o=new Pe,l=new Pe;for(let u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),a.set(s[d+0],s[d+1]),o.set(s[d+2],s[d+3]),l.set(s[d+4],s[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);c(a,d+0,t,p),c(o,d+2,e,p),c(l,d+4,n,p)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),a=Math.min(e,n,i);r>.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Fi(r,3)),this.setAttribute("normal",new Fi(r.slice(),3)),this.setAttribute("uv",new Fi(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new es(t.vertices,t.indices,t.radius,t.details)}}class ns{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Pe:new rn);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){const n=new rn,i=[],r=[],s=[],a=new rn,o=new Ln;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new rn)}r[0]=new rn,s[0]=new rn;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(we(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(we(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class is extends ns{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new Pe){const n=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const a=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=o-this.aX,i=l-this.aY;o=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function rs(){let t=0,e=0,n=0,i=0;function r(r,s,a,o){t=r,e=a,n=-3*r+3*s-2*a-o,i=2*r-2*s+a+o}return{initCatmullRom:function(t,e,n,i,s){r(e,n,s*(n-t),s*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,s,a,o){let l=(e-t)/s-(n-t)/(s+a)+(n-e)/a,c=(n-e)/a-(i-e)/(a+o)+(i-n)/o;l*=a,c*=a,r(e,n,l,c)},calc:function(r){const s=r*r;return t+e*r+n*s+i*(s*r)}}}const ss=new rn,as=new rs,os=new rs,ls=new rs;function cs(t,e,n,i,r){const s=.5*(i-e),a=.5*(r-n),o=t*t;return(2*n-2*i+s+a)*(t*o)+(-3*n+3*i-2*s-a)*o+s*t+n}function hs(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function us(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class ds extends ns{constructor(t=new Pe,e=new Pe,n=new Pe,i=new Pe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Pe){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(us(t,i.x,r.x,s.x,a.x),us(t,i.y,r.y,s.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class ps extends ns{constructor(t=new Pe,e=new Pe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Pe){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Pe){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class fs extends ns{constructor(t=new Pe,e=new Pe,n=new Pe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Pe){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(hs(t,i.x,r.x,s.x),hs(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ms extends ns{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Pe){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(cs(a,o.x,l.x,c.x,h.x),cs(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Pe).fromArray(n))}return this}}var gs=Object.freeze({__proto__:null,ArcCurve:class extends is{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends ns{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new rn){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let a,o,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(ss.subVectors(i[0],i[1]).add(i[0]),a=ss);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2<r?o=i[(l+2)%r]:(ss.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=ss),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(o),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),as.initNonuniformCatmullRom(a.x,h.x,u.x,o.x,e,n,i),os.initNonuniformCatmullRom(a.y,h.y,u.y,o.y,e,n,i),ls.initNonuniformCatmullRom(a.z,h.z,u.z,o.z,e,n,i)}else"catmullrom"===this.curveType&&(as.initCatmullRom(a.x,h.x,u.x,o.x,this.tension),os.initCatmullRom(a.y,h.y,u.y,o.y,this.tension),ls.initCatmullRom(a.z,h.z,u.z,o.z,this.tension));return n.set(as.calc(c),os.calc(c),ls.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new rn).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:ds,CubicBezierCurve3:class extends ns{constructor(t=new rn,e=new rn,n=new rn,i=new rn){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new rn){const n=e,i=this.v0,r=this.v1,s=this.v2,a=this.v3;return n.set(us(t,i.x,r.x,s.x,a.x),us(t,i.y,r.y,s.y,a.y),us(t,i.z,r.z,s.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:is,LineCurve:ps,LineCurve3:class extends ns{constructor(t=new rn,e=new rn){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new rn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new rn){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:fs,QuadraticBezierCurve3:class extends ns{constructor(t=new rn,e=new rn,n=new rn){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new rn){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(hs(t,i.x,r.x,s.x),hs(t,i.y,r.y,s.y),hs(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:ms});class vs extends ns{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new gs[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let t=0;t<o.length;t++){const i=o[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new gs[n.type]).fromJSON(n))}return this}}class _s extends vs{constructor(t){super(),this.type="Path",this.currentPoint=new Pe,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new ps(this.currentPoint.clone(),new Pe(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new fs(this.currentPoint.clone(),new Pe(t,e),new Pe(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const a=new ds(this.currentPoint.clone(),new Pe(t,e),new Pe(n,i),new Pe(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new ms(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,a,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,s,a,o),this}absellipse(t,e,n,i,r,s,a,o){const l=new is(t,e,n,i,r,s,a,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class ys extends _s{constructor(t){super(t),this.uuid=Ee(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new _s).fromJSON(n))}return this}}function xs(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=bs(t,0,r,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(i&&(s=function(t,e,n,i){const r=[];for(let n=0,s=e.length;n<s;n++){const a=bs(t,e[n]*i,n<s-1?e[n+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),r.push(Ns(a))}r.sort(Cs);for(let t=0;t<r.length;t++)n=Rs(r[t],n);return n}(t,e,s,n)),t.length>80*n){o=1/0,l=1/0;let e=-1/0,i=-1/0;for(let s=n;s<r;s+=n){const n=t[s],r=t[s+1];n<o&&(o=n),r<l&&(l=r),n>e&&(e=n),r>i&&(i=r)}c=Math.max(e-o,i-l),c=0!==c?32767/c:0}return Ss(s,a,n,o,l,c,0),a}function bs(t,e,n,i,r){let s;if(r===function(t,e,n,i){let r=0;for(let s=e,a=n-i;s<n;s+=i)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}(t,e,n,i)>0)for(let r=e;r<n;r+=i)s=Gs(r/i|0,t[r],t[r+1],s);else for(let r=n-i;r>=e;r-=i)s=Gs(r/i|0,t[r],t[r+1],s);return s&&Fs(s,s.next)&&(Ws(s),s=s.next),s}function Ms(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Fs(i,i.next)&&0!==Os(i.prev,i,i.next))i=i.next;else{if(Ws(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Ss(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Is(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n=1;do{let i,r=t;t=null;let s=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t<n&&(o++,a=a.nextZ,a);t++);let l=n;for(;o>0||l>0&&a;)0!==o&&(0===l||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=a}s.nextZ=null,n*=2}while(e>1)}(r)}(t,i,r,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?ws(t,i,r,s):Es(t))e.push(l.i,t.i,c.i),Ws(t),t=c.next,o=c.next;else if((t=c)===o){a?1===a?Ss(t=Ts(Ms(t),e),e,n,i,r,s,2):2===a&&As(t,e,n,i,r,s):Ss(Ms(t),e,n,i,r,s,1);break}}}function Es(t){const e=t.prev,n=t,i=t.next;if(Os(e,n,i)>=0)return!1;const r=e.x,s=n.x,a=i.x,o=e.y,l=n.y,c=i.y,h=Math.min(r,s,a),u=Math.min(o,l,c),d=Math.max(r,s,a),p=Math.max(o,l,c);let f=i.next;for(;f!==e;){if(f.x>=h&&f.x<=d&&f.y>=u&&f.y<=p&&Ls(r,o,s,l,a,c,f.x,f.y)&&Os(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ws(t,e,n,i){const r=t.prev,s=t,a=t.next;if(Os(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,u=s.y,d=a.y,p=Math.min(o,l,c),f=Math.min(h,u,d),m=Math.max(o,l,c),g=Math.max(h,u,d),v=Is(p,f,e,n,i),_=Is(m,g,e,n,i);let y=t.prevZ,x=t.nextZ;for(;y&&y.z>=v&&x&&x.z<=_;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&Ls(o,h,l,u,c,d,y.x,y.y)&&Os(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&Ls(o,h,l,u,c,d,x.x,x.y)&&Os(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;y&&y.z>=v;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&Ls(o,h,l,u,c,d,y.x,y.y)&&Os(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&Ls(o,h,l,u,c,d,x.x,x.y)&&Os(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ts(t,e){let n=t;do{const i=n.prev,r=n.next.next;!Fs(i,r)&&Bs(i,n,n.next,r)&&Vs(i,r)&&Vs(r,i)&&(e.push(i.i,n.i,r.i),Ws(n),Ws(n.next),n=t=r),n=n.next}while(n!==t);return Ms(n)}function As(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Us(a,t)){let o=Hs(a,t);return a=Ms(a,a.next),o=Ms(o,o.next),Ss(a,e,n,i,r,s,0),void Ss(o,e,n,i,r,s,0)}t=t.next}a=a.next}while(a!==t)}function Cs(t,e){let n=t.x-e.x;return 0===n&&(n=t.y-e.y,0===n)&&(n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),n}function Rs(t,e){const n=function(t,e){let n=e;const i=t.x,r=t.y;let s,a=-1/0;if(Fs(t,n))return n;do{if(Fs(t,n.next))return n.next;if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>a&&(a=t,s=n.x<n.next.x?n:n.next,t===i))return s}n=n.next}while(n!==e);if(!s)return null;const o=s,l=s.x,c=s.y;let h=1/0;n=s;do{if(i>=n.x&&n.x>=l&&i!==n.x&&Ds(r<c?i:a,r,l,c,r<c?a:i,r,n.x,n.y)){const e=Math.abs(r-n.y)/(i-n.x);Vs(n,t)&&(e<h||e===h&&(n.x>s.x||n.x===s.x&&Ps(s,n)))&&(s=n,h=e)}n=n.next}while(n!==o);return s}(t,e);if(!n)return e;const i=Hs(n,t);return Ms(i,i.next),Ms(n,n.next)}function Ps(t,e){return Os(t.prev,t,e.prev)<0&&Os(e.next,t,t.next)<0}function Is(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ns(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Ds(t,e,n,i,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(i-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function Ls(t,e,n,i,r,s,a,o){return!(t===a&&e===o)&&Ds(t,e,n,i,r,s,a,o)}function Us(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Bs(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Vs(t,e)&&Vs(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(Os(t.prev,t,e.prev)||Os(t,e.prev,e))||Fs(t,e)&&Os(t.prev,t,t.next)>0&&Os(e.prev,e,e.next)>0)}function Os(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Fs(t,e){return t.x===e.x&&t.y===e.y}function Bs(t,e,n,i){const r=ks(Os(t,e,n)),s=ks(Os(t,e,i)),a=ks(Os(n,i,t)),o=ks(Os(n,i,e));return r!==s&&a!==o||!(0!==r||!zs(t,n,e))||!(0!==s||!zs(t,i,e))||!(0!==a||!zs(n,t,i))||!(0!==o||!zs(n,e,i))}function zs(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ks(t){return t>0?1:t<0?-1:0}function Vs(t,e){return Os(t.prev,t,t.next)<0?Os(t,e,t.next)>=0&&Os(t,t.prev,e)>=0:Os(t,e,t.prev)<0||Os(t,t.next,e)<0}function Hs(t,e){const n=qs(t.i,t.x,t.y),i=qs(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Gs(t,e,n,i){const r=qs(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ws(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function qs(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class js{static triangulate(t,e,n=2){return xs(t,e,n)}}class Xs{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return Xs.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];Ys(t),Zs(n,t);let s=t.length;e.forEach(Ys);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,Zs(n,e[t]);const a=js.triangulate(n,i);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function Ys(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Zs(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Ks extends qi{constructor(t=new ys([new Pe(.5,.5),new Pe(-.5,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++)s(t[e]);function s(t){const s=[],a=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:Js;let g,v,_,y,x,b=!1;f&&(g=f.getSpacedPoints(o),b=!0,c=!1,v=f.computeFrenetFrames(o,!1),_=new rn,y=new rn,x=new rn),c||(p=0,h=0,u=0,d=0);const M=t.extractPoints(a);let S=M.shape;const E=M.holes;if(!Xs.isClockWise(S)){S=S.reverse();for(let t=0,e=E.length;t<e;t++){const e=E[t];Xs.isClockWise(e)&&(E[t]=e.reverse())}}function w(t){const e=1e-10*1e-10;let n=t[0];for(let i=1;i<=t.length;i++){const r=i%t.length,s=t[r],a=s.x-n.x,o=s.y-n.y,l=a*a+o*o,c=Math.max(Math.abs(s.x),Math.abs(s.y),Math.abs(n.x),Math.abs(n.y));l<=e*c*c?(t.splice(r,1),i--):n=s}}w(S),E.forEach(w);const T=E.length,A=S;for(let t=0;t<T;t++){const e=E[t];S=S.concat(e)}function C(t,e,n){return t.clone().addScaledVector(e,n)}const R=S.length;function P(t,e,n){let i,r,s;const a=t.x-e.x,o=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=a*a+o*o,u=a*c-o*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,f=e.y+a/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(a*c-o*l);i=p+a*m-t.x,r=f+o*m-t.y;const g=i*i+r*r;if(g<=2)return new Pe(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Pe(i/s,r/s)}const I=[];for(let t=0,e=A.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),I[t]=P(A[t],A[n],A[i]);const N=[];let D,L,U=I.concat();for(let t=0,e=T;t<e;t++){const e=E[t];D=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[t]=P(e[t],e[i],e[r]);N.push(D),U=U.concat(D)}if(0===p)L=Xs.triangulateShape(A,E);else{const t=[],e=[];for(let n=0;n<p;n++){const i=n/p,r=h*Math.cos(i*Math.PI/2),s=u*Math.sin(i*Math.PI/2)+d;for(let e=0,n=A.length;e<n;e++){const n=C(A[e],I[e],s);z(n.x,n.y,-r),0===i&&t.push(n)}for(let t=0,n=T;t<n;t++){const n=E[t];D=N[t];const a=[];for(let t=0,e=n.length;t<e;t++){const e=C(n[t],D[t],s);z(e.x,e.y,-r),0===i&&a.push(e)}0===i&&e.push(a)}}L=Xs.triangulateShape(t,e)}const O=L.length,F=u+d;for(let t=0;t<R;t++){const e=c?C(S[t],U[t],F):S[t];b?(y.copy(v.normals[0]).multiplyScalar(e.x),_.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(_),z(x.x,x.y,x.z)):z(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<R;e++){const n=c?C(S[e],U[e],F):S[e];b?(y.copy(v.normals[t]).multiplyScalar(n.x),_.copy(v.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(y).add(_),z(x.x,x.y,x.z)):z(n.x,n.y,l/o*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=A.length;t<e;t++){const e=C(A[t],I[t],i);z(e.x,e.y,l+n)}for(let t=0,e=E.length;t<e;t++){const e=E[t];D=N[t];for(let t=0,r=e.length;t<r;t++){const r=C(e[t],D[t],i);b?z(r.x,r.y+g[o-1].y,g[o-1].x+n):z(r.x,r.y,l+n)}}}function B(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t<n;t++){const n=R*t,s=R*(t+1);V(e+i+n,e+r+n,e+r+s,e+i+s)}}}function z(t,e,n){s.push(t),s.push(e),s.push(n)}function k(t,e,r){H(t),H(e),H(r);const s=i.length/3,a=m.generateTopUV(n,i,s-3,s-2,s-1);G(a[0]),G(a[1]),G(a[2])}function V(t,e,r,s){H(t),H(e),H(s),H(e),H(r),H(s);const a=i.length/3,o=m.generateSideWallUV(n,i,a-6,a-3,a-2,a-1);G(o[0]),G(o[1]),G(o[3]),G(o[1]),G(o[2]),G(o[3])}function H(t){i.push(s[3*t+0]),i.push(s[3*t+1]),i.push(s[3*t+2])}function G(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(c){let t=0,e=R*t;for(let t=0;t<O;t++){const n=L[t];k(n[2]+e,n[1]+e,n[0]+e)}t=o+2*p,e=R*t;for(let t=0;t<O;t++){const n=L[t];k(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<O;t++){const e=L[t];k(e[2],e[1],e[0])}for(let t=0;t<O;t++){const e=L[t];k(e[0]+R*o,e[1]+R*o,e[2]+R*o)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;B(A,e),e+=A.length;for(let t=0,n=E.length;t<n;t++){const n=E[t];B(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Fi(i,3)),this.setAttribute("uv",new Fi(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new gs[i.type]).fromJSON(i)),new Ks(n,t.options)}}const Js={generateTopUV:function(t,e,n,i,r){const s=e[3*n],a=e[3*n+1],o=e[3*i],l=e[3*i+1],c=e[3*r],h=e[3*r+1];return[new Pe(s,a),new Pe(o,l),new Pe(c,h)]},generateSideWallUV:function(t,e,n,i,r,s){const a=e[3*n],o=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*s],g=e[3*s+1],v=e[3*s+2];return Math.abs(o-h)<Math.abs(a-c)?[new Pe(a,1-l),new Pe(c,1-u),new Pe(d,1-f),new Pe(m,1-v)]:[new Pe(o,1-l),new Pe(h,1-u),new Pe(p,1-f),new Pe(g,1-v)]}};class $s extends es{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new $s(t.radius,t.detail)}}class Qs extends qi{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,a=Math.floor(n),o=Math.floor(i),l=a+1,c=o+1,h=t/a,u=e/o,d=[],p=[],f=[],m=[];for(let t=0;t<c;t++){const e=t*u-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/a),m.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute("position",new Fi(p,3)),this.setAttribute("normal",new Fi(f,3)),this.setAttribute("uv",new Fi(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Qs(t.width,t.height,t.widthSegments,t.heightSegments)}}class ta extends qi{constructor(t=new ys([new Pe(0,.5),new Pe(-.5,-.5),new Pe(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],s=[];let a=0,o=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(a,o,e),a+=o,o=0;function l(t){const a=i.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===Xs.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===Xs.isClockWise(e)&&(h[t]=e.reverse())}const u=Xs.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+a,r=e[1]+a,s=e[2]+a;n.push(i,r,s),o+=3}}this.setIndex(n),this.setAttribute("position",new Fi(i,3)),this.setAttribute("normal",new Fi(r,3)),this.setAttribute("uv",new Fi(s,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new ta(n,t.curveSegments)}}class ea extends Ri{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ti(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class na extends hr{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ia extends Ri{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ti(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ti(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ra extends Ri{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ti(16777215),this.specular=new Ti(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ti(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class sa extends Ri{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class aa extends Ri{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function oa(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function la(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n}function ca(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r}function ha(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push(...a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)}class ua{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t<i)){for(let s=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=e[++n],t<i)break e}s=e.length;break n}if(t>=r)break t;{const a=e[1];t<a&&(n=2,r=a);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0}}for(;n<s;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class da extends ua{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Qt,endingEnd:Qt}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,a=i[r],o=i[s];if(void 0===a)switch(this.getSettings_().endingStart){case te:r=t,a=2*e-n;break;case ee:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=n}if(void 0===o)switch(this.getSettings_().endingEnd){case te:s=t,o=2*n-e;break;case ee:s=1,o=n+i[1]-i[0];break;default:s=t-1,o=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==a;++t)r[t]=g*s[c+t]+v*s[l+t]+_*s[o+t]+y*s[h+t];return r}}class pa extends ua{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==a;++t)r[t]=s[l+t]*h+s[o+t]*c;return r}}class fa extends ua{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class ma{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=oa(e,this.TimeBufferType),this.values=oa(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:oa(t.times,Array),values:oa(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new fa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new pa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new da(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Kt:e=this.InterpolantFactoryMethodDiscrete;break;case Jt:e=this.InterpolantFactoryMethodLinear;break;case $t:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Kt;case this.InterpolantFactoryMethodLinear:return Jt;case this.InterpolantFactoryMethodSmooth:return $t}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){t=!1;break}if(null!==s&&s>i){t=!1;break}s=i}if(void 0!==i&&(a=i,ArrayBuffer.isView(a)&&!(a instanceof DataView)))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){t=!1;break}}var a;return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===$t,r=t.length-1;let s=1;for(let a=1;a<r;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(i)r=!0;else{const t=a*n,i=t-n,s=t+n;for(let a=0;a!==n;++a){const n=e[t+a];if(n!==e[i+a]||n!==e[s+a]){r=!0;break}}}if(r){if(a!==s){t[s]=t[a];const i=a*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}ma.prototype.ValueTypeName="",ma.prototype.TimeBufferType=Float32Array,ma.prototype.ValueBufferType=Float32Array,ma.prototype.DefaultInterpolation=Jt;class ga extends ma{constructor(t,e,n){super(t,e,n)}}ga.prototype.ValueTypeName="bool",ga.prototype.ValueBufferType=Array,ga.prototype.DefaultInterpolation=Kt,ga.prototype.InterpolantFactoryMethodLinear=void 0,ga.prototype.InterpolantFactoryMethodSmooth=void 0;class va extends ma{constructor(t,e,n,i){super(t,e,n,i)}}va.prototype.ValueTypeName="color";class _a extends ma{constructor(t,e,n,i){super(t,e,n,i)}}_a.prototype.ValueTypeName="number";class ya extends ua{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let t=l+a;l!==t;l+=4)nn.slerpFlat(r,0,s,l-a,s,l,o);return r}}class xa extends ma{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new ya(this.times,this.values,this.getValueSize(),t)}}xa.prototype.ValueTypeName="quaternion",xa.prototype.InterpolantFactoryMethodSmooth=void 0;class ba extends ma{constructor(t,e,n){super(t,e,n)}}ba.prototype.ValueTypeName="string",ba.prototype.ValueBufferType=Array,ba.prototype.DefaultInterpolation=Kt,ba.prototype.InterpolantFactoryMethodLinear=void 0,ba.prototype.InterpolantFactoryMethodSmooth=void 0;class Ma extends ma{constructor(t,e,n,i){super(t,e,n,i)}}Ma.prototype.ValueTypeName="vector";class Sa{constructor(t="",e=-1,n=[],i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=Ee(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Ea(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(ma.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=la(a);a=ca(a,1,l),o=ca(o,1,l),i||0!==a[0]||(a.push(r),o.push(o[0])),s.push(new _a(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(t,e){if(!t)return null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];ha(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new _a(".morphTargetInfluence["+n+"]",t,s))}o=t.length*s}else{const s=".bones["+e[t].name+"]";n(Ma,s+".position",r,"pos",i),n(xa,s+".quaternion",r,"rot",i),n(Ma,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,o,i,a)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Ea(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _a;case"vector":case"vector2":case"vector3":case"vector4":return Ma;case"color":return va;case"quaternion":return xa;case"bool":case"boolean":return ga;case"string":return ba}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];ha(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const wa={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Ta{constructor(t,e,n){const i=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===s&&void 0!==i.onStart&&i.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Aa=new Ta;class Ca{constructor(t){this.manager=void 0!==t?t:Aa,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ca.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ra={};class Pa extends Error{constructor(t,e){super(t),this.response=e}}class Ia extends Ca{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=wa.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Ra[t])return void Ra[t].push({onLoad:e,onProgress:n,onError:i});Ra[t]=[],Ra[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Ra[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}),(e=>{t.error(e)}))}()}});return new Response(l)}throw new Pa(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{wa.add(t,e);const n=Ra[t];delete Ra[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=Ra[t];if(void 0===n)throw this.manager.itemError(t),e;delete Ra[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Na extends oi{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Ti(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}const Da=new Ln,La=new rn,Ua=new rn;class Oa{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.mapType=tt,this.map=null,this.mapPass=null,this.matrix=new Ln,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new kr,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Je(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;La.setFromMatrixPosition(t.matrixWorld),e.position.copy(La),Ua.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Ua),e.updateMatrixWorld(),Da.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Da),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Da)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Fa extends ur{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class Ba extends Oa{constructor(){super(new Fa(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class za extends Na{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(oi.DEFAULT_UP),this.updateMatrix(),this.target=new oi,this.shadow=new Ba}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class ka extends Na{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Va extends mr{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class Ha{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Ga(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Ga();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Ga(){return performance.now()}class Wa{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){nn.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;nn.multiplyQuaternionsFlat(t,s,t,e,t,n),nn.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const qa="\\[\\]\\.:\\/",ja=new RegExp("["+qa+"]","g"),Xa="[^"+qa+"]",Ya="[^"+qa.replace("\\.","")+"]",Za=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Xa)+/(WCOD+)?/.source.replace("WCOD",Ya)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Xa)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Xa)+"$"),Ka=["material","materials","bones","map"];class Ja{constructor(t,e,n){this.path=e,this.parsedPath=n||Ja.parseTrackName(e),this.node=Ja.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Ja.Composite(t,e,n):new Ja(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(ja,"")}static parseTrackName(t){const e=Za.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Ka.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Ja.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return;if(!t.material.materials)return;t=t.material.materials;break;case"bones":if(!t.skeleton)return;t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return;if(!t.material.map)return;t=t.material.map;break;default:if(void 0===t[n])return;t=t[n]}if(void 0!==i){if(void 0===t[i])return;t=t[i]}}const s=t[i];if(void 0===s)return void e.nodeName;let a=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?a=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return;if(!t.geometry.morphAttributes)return;void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ja.Composite=class{constructor(t,e,n){const i=n||Ja.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ja.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ja.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ja.prototype.GetterByBindingType=[Ja.prototype._getValue_direct,Ja.prototype._getValue_array,Ja.prototype._getValue_arrayElement,Ja.prototype._getValue_toArray],Ja.prototype.SetterByBindingTypeAndVersioning=[[Ja.prototype._setValue_direct,Ja.prototype._setValue_direct_setNeedsUpdate,Ja.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ja.prototype._setValue_array,Ja.prototype._setValue_array_setNeedsUpdate,Ja.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ja.prototype._setValue_arrayElement,Ja.prototype._setValue_arrayElement_setNeedsUpdate,Ja.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ja.prototype._setValue_fromArray,Ja.prototype._setValue_fromArray_setNeedsUpdate,Ja.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class $a{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:Qt,endingEnd:Qt};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),!0===n){const n=this._clip.duration,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;i<0||0===n?e=0:(this._startTime=null,e=n*i)}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r||!s||1&~r?i:e-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=te,i.endingEnd=te):(i.endingStart=t?this.zeroSlopeAtStart?te:Qt:ee,i.endingEnd=e?this.zeroSlopeAtEnd?te:Qt:ee)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}const Qa=new Float32Array(1);class to extends xe{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new Wa(Ja.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,o[c]=l,o.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,a=s[i],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new pa(new Float32Array(2),new Float32Array(2),1,Qa),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s="string"==typeof t?Sa.findByName(i,t):t;const a=null!==s?s.uuid:t,o=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:ne),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new $a(this,s,e,n);return this._bindAction(c,l),this._addInactiveAction(c,a,r),c}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?Sa.findByName(n,t):t,s=r?r.uuid:t,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a)e[a]._update(i,t,r,s);const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class eo{constructor(t=1,e=0,n=0){this.radius=t,this.phi=e,this.theta=n}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=we(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(we(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const no=new Pe;let io=class{constructor(t=new Pe(1/0,1/0),e=new Pe(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=no.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,no).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const ro=new rn,so=new rn,ao=new rn;class oo extends oi{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===e&&(e=1);let i=new qi;i.setAttribute("position",new Fi([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new Vr({fog:!1,toneMapped:!1});this.lightPlane=new Zr(i,r),this.add(this.lightPlane),i=new qi,i.setAttribute("position",new Fi([0,0,0,0,0,1],3)),this.targetLine=new Zr(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),ro.setFromMatrixPosition(this.light.matrixWorld),so.setFromMatrixPosition(this.light.target.matrixWorld),ao.subVectors(so,ro),this.lightPlane.lookAt(so),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(so),this.targetLine.scale.z=ao.length()}}const lo=new rn,co=new ur;class ho extends Qr{constructor(t){const e=new qi,n=new Vr({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function a(t,e){o(t),o(e)}function o(t){i.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new Fi(i,3)),e.setAttribute("color",new Fi(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new Ti(16755200),c=new Ti(16711680),h=new Ti(43775),u=new Ti(16777215),d=new Ti(3355443);this.setColors(l,c,h,u,d)}setColors(t,e,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;co.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const n=this.camera.coordinateSystem===_e?-1:0;uo("c",e,t,co,0,0,n),uo("t",e,t,co,0,0,1),uo("n1",e,t,co,-1,-1,n),uo("n2",e,t,co,1,-1,n),uo("n3",e,t,co,-1,1,n),uo("n4",e,t,co,1,1,n),uo("f1",e,t,co,-1,-1,1),uo("f2",e,t,co,1,-1,1),uo("f3",e,t,co,-1,1,1),uo("f4",e,t,co,1,1,1),uo("u1",e,t,co,.7,1.1,n),uo("u2",e,t,co,-.7,1.1,n),uo("u3",e,t,co,0,2,n),uo("cf1",e,t,co,-1,0,1),uo("cf2",e,t,co,1,0,1),uo("cf3",e,t,co,0,-1,1),uo("cf4",e,t,co,0,1,1),uo("cn1",e,t,co,-1,0,n),uo("cn2",e,t,co,1,0,n),uo("cn3",e,t,co,0,-1,n),uo("cn4",e,t,co,0,1,n),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function uo(t,e,n,i,r,s,a){lo.set(r,s,a).unproject(i);const o=e[t];if(void 0!==o){const t=n.getAttribute("position");for(let e=0,n=o.length;e<n;e++)t.setXYZ(o[e],lo.x,lo.y,lo.z)}}class po{constructor(){this.type="ShapePath",this.color=new Ti,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new _s,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=e[r],a=e[s],o=a.x-n.x,l=a.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.y<n.y||t.y>a.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const n=Xs.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new ys,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],f=0;h[f]=void 0,p[f]=[];for(let e=0,a=i.length;e<a;e++)s=i[e],u=s.getPoints(),r=n(u),r=t?!r:r,r?(!l&&h[f]&&f++,h[f]={s:new ys,p:u},h[f].s.curves=s.curves,l&&f++,p[f]=[]):p[f].push({h:s,p:u[0]});if(!h[0])return function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new ys;r.curves=i.curves,e.push(r)}return e}(i);if(h.length>1){let t=!1,n=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const a=r[s];let o=!0;for(let r=0;r<h.length;r++)e(a.p,h[r].p)&&(i!==r&&n++,o?(o=!1,c[r].push(a)):t=!0);o&&c[i].push(a)}}n>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){a=h[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;t<e;t++)a.holes.push(d[t].h)}return o}}class fo extends xe{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){void 0!==t&&(null!==this.domElement&&this.disconnect(),this.domElement=t)}disconnect(){}dispose(){}update(){}}function mo(t,e,n,i){const r=function(t){switch(t){case tt:case et:return{byteLength:1,components:1};case it:case nt:case ot:return{byteLength:2,components:1};case lt:case ct:return{byteLength:2,components:4};case st:case rt:case at:return{byteLength:4,components:1};case ut:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(n){case 1021:return t*e;case mt:case gt:return t*e/r.components*r.byteLength;case 1030:case vt:return t*e*2/r.components*r.byteLength;case 1022:return t*e*3/r.components*r.byteLength;case dt:case _t:return t*e*4/r.components*r.byteLength;case yt:case xt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case bt:case Mt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Et:case Tt:return Math.max(t,16)*Math.max(e,8)/4;case St:case wt:return Math.max(t,8)*Math.max(e,8)/2;case At:case Ct:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Rt:case Pt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case It:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Nt:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Dt:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Lt:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Ut:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Ot:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Ft:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Bt:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case zt:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case kt:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Vt:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case Ht:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Gt:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Wt:case qt:case jt:return Math.ceil(t/4)*Math.ceil(e/4)*16;case 36283:case Xt:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Yt:case Zt:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2010-2025 Three.js Authors
|
|
11
|
+
* SPDX-License-Identifier: MIT
|
|
12
|
+
*/
|
|
13
|
+
function go(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function vo(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version<n.version)&&e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,s=i.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(n,a),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)o=t.FLOAT;else if(i instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=t.SHORT;else if(i instanceof Uint32Array)o=t.UNSIGNED_INT;else if(i instanceof Int32Array)o=t.INT;else if(i instanceof Int8Array)o=t.BYTE;else if(i instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,i){const r=n.array,s=n.updateRanges;if(t.bindBuffer(i,e),0===s.length)t.bufferSubData(i,0,r);else{s.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<s.length;t++){const n=s[e],i=s[t];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++e,s[e]=i)}s.length=e+1;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__=e));const _o={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},yo={common:{diffuse:{value:new Ti(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ie},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ie}},envmap:{envMap:{value:null},envMapRotation:{value:new Ie},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ie}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ie}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ie},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ie},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ie},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ie}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ie}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ie}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ti(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ti(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0},uvTransform:{value:new Ie}},sprite:{diffuse:{value:new Ti(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ie},alphaMap:{value:null},alphaMapTransform:{value:new Ie},alphaTest:{value:0}}},xo={basic:{uniforms:or([yo.common,yo.specularmap,yo.envmap,yo.aomap,yo.lightmap,yo.fog]),vertexShader:_o.meshbasic_vert,fragmentShader:_o.meshbasic_frag},lambert:{uniforms:or([yo.common,yo.specularmap,yo.envmap,yo.aomap,yo.lightmap,yo.emissivemap,yo.bumpmap,yo.normalmap,yo.displacementmap,yo.fog,yo.lights,{emissive:{value:new Ti(0)}}]),vertexShader:_o.meshlambert_vert,fragmentShader:_o.meshlambert_frag},phong:{uniforms:or([yo.common,yo.specularmap,yo.envmap,yo.aomap,yo.lightmap,yo.emissivemap,yo.bumpmap,yo.normalmap,yo.displacementmap,yo.fog,yo.lights,{emissive:{value:new Ti(0)},specular:{value:new Ti(1118481)},shininess:{value:30}}]),vertexShader:_o.meshphong_vert,fragmentShader:_o.meshphong_frag},standard:{uniforms:or([yo.common,yo.envmap,yo.aomap,yo.lightmap,yo.emissivemap,yo.bumpmap,yo.normalmap,yo.displacementmap,yo.roughnessmap,yo.metalnessmap,yo.fog,yo.lights,{emissive:{value:new Ti(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_o.meshphysical_vert,fragmentShader:_o.meshphysical_frag},toon:{uniforms:or([yo.common,yo.aomap,yo.lightmap,yo.emissivemap,yo.bumpmap,yo.normalmap,yo.displacementmap,yo.gradientmap,yo.fog,yo.lights,{emissive:{value:new Ti(0)}}]),vertexShader:_o.meshtoon_vert,fragmentShader:_o.meshtoon_frag},matcap:{uniforms:or([yo.common,yo.bumpmap,yo.normalmap,yo.displacementmap,yo.fog,{matcap:{value:null}}]),vertexShader:_o.meshmatcap_vert,fragmentShader:_o.meshmatcap_frag},points:{uniforms:or([yo.points,yo.fog]),vertexShader:_o.points_vert,fragmentShader:_o.points_frag},dashed:{uniforms:or([yo.common,yo.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_o.linedashed_vert,fragmentShader:_o.linedashed_frag},depth:{uniforms:or([yo.common,yo.displacementmap]),vertexShader:_o.depth_vert,fragmentShader:_o.depth_frag},normal:{uniforms:or([yo.common,yo.bumpmap,yo.normalmap,yo.displacementmap,{opacity:{value:1}}]),vertexShader:_o.meshnormal_vert,fragmentShader:_o.meshnormal_frag},sprite:{uniforms:or([yo.sprite,yo.fog]),vertexShader:_o.sprite_vert,fragmentShader:_o.sprite_frag},background:{uniforms:{uvTransform:{value:new Ie},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_o.background_vert,fragmentShader:_o.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ie}},vertexShader:_o.backgroundCube_vert,fragmentShader:_o.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_o.cube_vert,fragmentShader:_o.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_o.equirect_vert,fragmentShader:_o.equirect_frag},distanceRGBA:{uniforms:or([yo.common,yo.displacementmap,{referencePosition:{value:new rn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_o.distanceRGBA_vert,fragmentShader:_o.distanceRGBA_frag},shadow:{uniforms:or([yo.lights,yo.fog,{color:{value:new Ti(0)},opacity:{value:1}}]),vertexShader:_o.shadow_vert,fragmentShader:_o.shadow_frag}};xo.physical={uniforms:or([xo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ie},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ie},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ie},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ie},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ie},sheen:{value:0},sheenColor:{value:new Ti(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ie},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ie},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ie},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ie},attenuationDistance:{value:0},attenuationColor:{value:new Ti(0)},specularColor:{value:new Ti(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ie},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ie},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ie}}]),vertexShader:_o.meshphysical_vert,fragmentShader:_o.meshphysical_frag};const bo={r:0,b:0,g:0},Mo=new Wn,So=new Ln;function Eo(t,e,n,i,r,s,a){const o=new Ti(0);let l,c,h=!0===s?0:1,u=null,d=0,p=null;function f(t){let i=!0===t.isScene?t.background:null;return i&&i.isTexture&&(i=(t.backgroundBlurriness>0?n:e).get(i)),i}function m(e,n){e.getRGB(bo,lr(t)),i.buffers.color.setClear(bo.r,bo.g,bo.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,m(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,m(o,h)},render:function(e){let n=!1;const r=f(e);null===r?m(o,h):r&&r.isColor&&(m(r,1),n=!0);const s=t.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===W)?(void 0===c&&(c=new ir(new sr(1,1,1),new hr({name:"BackgroundCubeMaterial",uniforms:ar(xo.backgroundCube.uniforms),vertexShader:xo.backgroundCube.vertexShader,fragmentShader:xo.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Mo.copy(n.backgroundRotation),Mo.x*=-1,Mo.y*=-1,Mo.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Mo.y*=-1,Mo.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(So.makeRotationFromEuler(Mo)),c.material.toneMapped=Ve.getTransfer(i.colorSpace)!==oe,u===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new ir(new Qs(2,2),new hr({name:"BackgroundMaterial",uniforms:ar(xo.background.uniforms),vertexShader:xo.background.vertexShader,fragmentShader:xo.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=Ve.getTransfer(i.colorSpace)!==oe,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),u===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function wo(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,a=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],i=[],r=[];for(let t=0;t<n;t++)e[t]=0,i[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function h(){const t=s.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function u(t){d(t,0)}function d(e,n){const i=s.newAttributes,r=s.enabledAttributes,a=s.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),a[e]!==n&&(t.vertexAttribDivisor(e,n),a[e]=n)}function p(){const e=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function f(e,n,i,r,s,a,o){!0===o?t.vertexAttribIPointer(e,n,i,s,a):t.vertexAttribPointer(e,n,i,r,s,a)}function m(){g(),a=!0,s!==r&&(s=r,o(s.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,m,g){let v=!1;const _=function(e,n,r){const s=!0===r.wireframe;let a=i[e.id];void 0===a&&(a={},i[e.id]=a);let o=a[n.id];void 0===o&&(o={},a[n.id]=o);let l=o[s];return void 0===l&&(l=c(t.createVertexArray()),o[s]=l),l}(m,l,r);s!==_&&(s=_,o(s.object)),v=function(t,e,n,i){const r=s.attributes,a=e.attributes;let o=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){const n=r[e];let i=a[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return s.attributesNum!==o||s.index!==i}(n,m,l,g),v&&function(t,e,n,i){const r={},a=e.attributes;let o=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){let n=a[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,o++}s.attributes=r,s.attributesNum=o,s.index=i}(n,m,l,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(v||a)&&(a=!1,function(n,i,r,s){h();const a=s.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=a[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,a=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===rt;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)f(r.location+t,a/r.locationSize,h,i,l*p,(g+a/r.locationSize*t)*p,m)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)f(r.location+t,a/r.locationSize,h,i,a*p,a/r.locationSize*t*p,m)}}else if(void 0!==l){const e=l[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(n,r,l,m),null!==g&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){m();for(const t in i){const e=i[t];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t]}},releaseStatesOfGeometry:function(t){if(void 0===i[t.id])return;const e=i[t.id];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t.id]},releaseStatesOfProgram:function(t){for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)l(r[t].object),delete r[t];delete n[t.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function To(t,e,n){let i;function r(e,r,s){0!==s&&(t.drawArraysInstanced(i,e,r,s),n.update(r,i,s))}this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,s){if(0===s)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,t,0,r,0,s);let a=0;for(let t=0;t<s;t++)a+=r[t];n.update(a,i,1)},this.renderMultiDrawInstances=function(t,s,a,o){if(0===a)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)r(t[e],s[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,s,0,o,0,a);let e=0;for(let t=0;t<a;t++)e+=s[t]*o[t];n.update(e,i,1)}}}function Ao(t,e,n,i){let r;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==n.precision?n.precision:"highp";const o=s(a);o!==a&&(a=o);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(e){return e===dt||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===ot&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==tt&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==at&&!r)},precision:a,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:u>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function Co(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new Fr,o=new Ie,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==s;++e,n+=4)a.copy(t[e]).applyMatrix4(r,o),a.normal.toArray(c,n),c[n+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){n=c(t,e,0)},this.setState=function(a,o,h){const u=a.clippingPlanes,d=a.clipIntersection,p=a.clipShadows,f=t.get(a);if(!r||null===u||0===u.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0);else{const t=s?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=c(u,o,e,h);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function Ro(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=H:304===e&&(t.mapping=G),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(303===s||304===s){if(e.has(r))return n(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const a=new yr(s.height);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}const Po=[.125,.215,.35,.446,.526,.582],Io=20,No=new Fa,Do=new Ti;let Lo=null,Uo=0,Oo=0,Fo=!1;const Bo=(1+Math.sqrt(5))/2,zo=1/Bo,ko=[new rn(-Bo,zo,0),new rn(Bo,zo,0),new rn(-zo,0,Bo),new rn(zo,0,Bo),new rn(0,Bo,-zo),new rn(0,Bo,zo),new rn(-1,1,-1),new rn(1,1,-1),new rn(-1,1,1),new rn(1,1,1)],Vo=new rn;class Ho{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100,r={}){const{size:s=256,position:a=Vo}=r;Lo=this._renderer.getRenderTarget(),Uo=this._renderer.getActiveCubeFace(),Oo=this._renderer.getActiveMipmapLevel(),Fo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(t,n,i,o,a),e>0&&this._blur(o,0,0,e),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=jo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=qo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Lo,Uo,Oo),this._renderer.xr.enabled=Fo,t.scissorTest=!1,Wo(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===H||t.mapping===G?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Lo=this._renderer.getRenderTarget(),Uo=this._renderer.getActiveCubeFace(),Oo=this._renderer.getActiveMipmapLevel(),Fo=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:J,minFilter:J,generateMipmaps:!1,type:ot,format:dt,colorSpace:se,depthBuffer:!1},i=Go(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Go(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+Po.length;for(let a=0;a<s;a++){const s=Math.pow(2,r);n.push(s);let o=1/s;a>t-4?o=Po[a-t+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*d),_=new Float32Array(m*p*d),y=new Float32Array(g*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,f*p*t),_.set(u,m*p*t);const r=[t,t,t,t,t,t];y.set(r,g*p*t)}const x=new qi;x.setAttribute("position",new Li(v,f)),x.setAttribute("uv",new Li(_,m)),x.setAttribute("faceIndex",new Li(y,g)),e.push(x),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(Io),r=new rn(0,1,0),s=new hr({name:"SphericalGaussianBlur",defines:{n:Io,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return s}(i,t,e)}return i}_compileMaterial(t){const e=new ir(this._lodPlanes[0],t);this._renderer.compile(e,No)}_sceneToCubeUV(t,e,n,i,r){const s=new mr(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,h=l.toneMapping;l.getClearColor(Do),l.toneMapping=0,l.autoClear=!1;const u=new Pi({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new ir(new sr,u);let p=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,p=!0):(u.color.copy(Do),p=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(s.up.set(0,a[e],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+o[e],r.y,r.z)):1===n?(s.up.set(0,0,a[e]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+o[e],r.z)):(s.up.set(0,a[e],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+o[e]));const c=this._cubeSize;Wo(i,n*c,e>2?c:0,c,c),l.setRenderTarget(i),p&&l.render(d,s),l.render(t,s)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=h,l.autoClear=c,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===H||t.mapping===G;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=jo()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=qo());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new ir(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;Wo(e,0,0,3*a,2*a),n.setRenderTarget(e),n.render(s,No)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e<i;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),r=ko[(i-e-1)%ko.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,s,a){const o=this._renderer,l=this._blurMaterial,c=new ir(this._lodPlanes[i],l),h=l.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):Io,m=[];let g=0;for(let t=0;t<Io;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0===t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===s,a&&(h.poleAxis.value=a);const{_lodMax:v}=this;h.dTheta.value=d,h.mipInt.value=v-n;const _=this._sizeLods[i];Wo(e,3*_*(i>v-4?i-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,No)}}function Go(t,e,n){const i=new Qe(t,e,n);return i.texture.mapping=W,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Wo(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function qo(){return new hr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function jo(){return new hr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Xo(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=303===s||304===s,o=s===H||s===G;if(a||o){let s=e.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Ho(t)),s=a?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return a&&l&&l.height>0||o&&l&&function(t){let e=0;const n=6;for(let i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}(l)?(null===n&&(n=new Ho(t)),s=a?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Yo(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&Fe("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Zo(t,e,n,i){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(e.remove(l),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(t){const n=[],i=t.index,r=t.attributes.position;let a=0;if(null!==i){const t=i.array;a=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],s=t[e+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const t=r.array;a=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}}const o=new(De(n)?Oi:Ui)(n,1);o.version=a;const l=s.get(t);l&&e.remove(l),s.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",a),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&o(t)}else o(t);return s.get(t)}}}function Ko(t,e,n){let i,r,s;function a(e,a,o){0!==o&&(t.drawElementsInstanced(i,a,r,e*s,o),n.update(a,i,o))}this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,s=t.bytesPerElement},this.render=function(e,a){t.drawElements(i,a,r,e*s),n.update(a,i,1)},this.renderInstances=a,this.renderMultiDraw=function(t,s,a){if(0===a)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,t,0,a);let o=0;for(let t=0;t<a;t++)o+=s[t];n.update(o,i,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)a(t[e]/s,o[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(i,o,0,r,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=o[t]*c[t];n.update(e,i,1)}}}function Jo(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n}}}}function $o(t,e,n){const i=new WeakMap,r=new Je;return{update:function(s,a,o){const l=s.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==c?c.length:0;let u=i.get(a);if(void 0===u||u.count!==h){let t=function(){v.dispose(),i.delete(a),a.removeEventListener("dispose",t)};void 0!==u&&u.texture.dispose();const n=void 0!==a.morphAttributes.position,s=void 0!==a.morphAttributes.normal,o=void 0!==a.morphAttributes.color,l=a.morphAttributes.position||[],c=a.morphAttributes.normal||[],d=a.morphAttributes.color||[];let p=0;!0===n&&(p=1),!0===s&&(p=2),!0===o&&(p=3);let f=a.attributes.position.count*p,m=1;f>e.maxTextureSize&&(m=Math.ceil(f/e.maxTextureSize),f=e.maxTextureSize);const g=new Float32Array(f*m*4*h),v=new tn(g,f,m,h);v.type=at,v.needsUpdate=!0;const _=4*p;for(let t=0;t<h;t++){const e=l[t],i=c[t],a=d[t],h=f*m*4*t;for(let t=0;t<e.count;t++){const l=t*_;!0===n&&(r.fromBufferAttribute(e,t),g[h+l+0]=r.x,g[h+l+1]=r.y,g[h+l+2]=r.z,g[h+l+3]=0),!0===s&&(r.fromBufferAttribute(i,t),g[h+l+4]=r.x,g[h+l+5]=r.y,g[h+l+6]=r.z,g[h+l+7]=0),!0===o&&(r.fromBufferAttribute(a,t),g[h+l+8]=r.x,g[h+l+9]=r.y,g[h+l+10]=r.z,g[h+l+11]=4===a.itemSize?r.w:1)}}u={count:h,texture:v,size:new Pe(f,m)},i.set(a,u),a.addEventListener("dispose",t)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)o.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let e=0;for(let t=0;t<l.length;t++)e+=l[t];const n=a.morphTargetsRelative?1:1-e;o.getUniforms().setValue(t,"morphTargetBaseInfluence",n),o.getUniforms().setValue(t,"morphTargetInfluences",l)}o.getUniforms().setValue(t,"morphTargetsTexture",u.texture,n),o.getUniforms().setValue(t,"morphTargetsTextureSize",u.size)}}}function Qo(t,e,n,i){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(a){const o=i.render.frame,l=a.geometry,c=e.get(a,l);if(r.get(c)!==o&&(e.update(c),r.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",s)&&a.addEventListener("dispose",s),r.get(a)!==o&&(n.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,t.ARRAY_BUFFER),r.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;r.get(t)!==o&&(t.update(),r.set(t,o))}return c},dispose:function(){r=new WeakMap}}}const tl=new Ke,el=new ts(1,1),nl=new tn,il=new en,rl=new _r,sl=[],al=[],ol=new Float32Array(16),ll=new Float32Array(9),cl=new Float32Array(4);function hl(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=sl[r];if(void 0===s&&(s=new Float32Array(r),sl[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function ul(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function dl(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function pl(t,e){let n=al[e];void 0===n&&(n=new Int32Array(e),al[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function fl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function ml(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ul(n,e))return;t.uniform2fv(this.addr,e),dl(n,e)}}function gl(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ul(n,e))return;t.uniform3fv(this.addr,e),dl(n,e)}}function vl(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ul(n,e))return;t.uniform4fv(this.addr,e),dl(n,e)}}function _l(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ul(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),dl(n,e)}else{if(ul(n,i))return;cl.set(i),t.uniformMatrix2fv(this.addr,!1,cl),dl(n,i)}}function yl(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ul(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),dl(n,e)}else{if(ul(n,i))return;ll.set(i),t.uniformMatrix3fv(this.addr,!1,ll),dl(n,i)}}function xl(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(ul(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),dl(n,e)}else{if(ul(n,i))return;ol.set(i),t.uniformMatrix4fv(this.addr,!1,ol),dl(n,i)}}function bl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Ml(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ul(n,e))return;t.uniform2iv(this.addr,e),dl(n,e)}}function Sl(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ul(n,e))return;t.uniform3iv(this.addr,e),dl(n,e)}}function El(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ul(n,e))return;t.uniform4iv(this.addr,e),dl(n,e)}}function wl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Tl(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ul(n,e))return;t.uniform2uiv(this.addr,e),dl(n,e)}}function Al(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ul(n,e))return;t.uniform3uiv(this.addr,e),dl(n,e)}}function Cl(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ul(n,e))return;t.uniform4uiv(this.addr,e),dl(n,e)}}function Rl(t,e,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),this.type===t.SAMPLER_2D_SHADOW?(el.compareFunction=515,s=el):s=tl,n.setTexture2D(e||s,r)}function Pl(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||il,r)}function Il(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||rl,r)}function Nl(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||nl,r)}function Dl(t,e){t.uniform1fv(this.addr,e)}function Ll(t,e){const n=hl(e,this.size,2);t.uniform2fv(this.addr,n)}function Ul(t,e){const n=hl(e,this.size,3);t.uniform3fv(this.addr,n)}function Ol(t,e){const n=hl(e,this.size,4);t.uniform4fv(this.addr,n)}function Fl(t,e){const n=hl(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Bl(t,e){const n=hl(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function zl(t,e){const n=hl(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function kl(t,e){t.uniform1iv(this.addr,e)}function Vl(t,e){t.uniform2iv(this.addr,e)}function Hl(t,e){t.uniform3iv(this.addr,e)}function Gl(t,e){t.uniform4iv(this.addr,e)}function Wl(t,e){t.uniform1uiv(this.addr,e)}function ql(t,e){t.uniform2uiv(this.addr,e)}function jl(t,e){t.uniform3uiv(this.addr,e)}function Xl(t,e){t.uniform4uiv(this.addr,e)}function Yl(t,e,n){const i=this.cache,r=e.length,s=pl(n,r);ul(i,s)||(t.uniform1iv(this.addr,s),dl(i,s));for(let t=0;t!==r;++t)n.setTexture2D(e[t]||tl,s[t])}function Zl(t,e,n){const i=this.cache,r=e.length,s=pl(n,r);ul(i,s)||(t.uniform1iv(this.addr,s),dl(i,s));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||il,s[t])}function Kl(t,e,n){const i=this.cache,r=e.length,s=pl(n,r);ul(i,s)||(t.uniform1iv(this.addr,s),dl(i,s));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||rl,s[t])}function Jl(t,e,n){const i=this.cache,r=e.length,s=pl(n,r);ul(i,s)||(t.uniform1iv(this.addr,s),dl(i,s));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||nl,s[t])}class $l{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return fl;case 35664:return ml;case 35665:return gl;case 35666:return vl;case 35674:return _l;case 35675:return yl;case 35676:return xl;case 5124:case 35670:return bl;case 35667:case 35671:return Ml;case 35668:case 35672:return Sl;case 35669:case 35673:return El;case 5125:return wl;case 36294:return Tl;case 36295:return Al;case 36296:return Cl;case 35678:case 36198:case 36298:case 36306:case 35682:return Rl;case 35679:case 36299:case 36307:return Pl;case 35680:case 36300:case 36308:case 36293:return Il;case 36289:case 36303:case 36311:case 36292:return Nl}}(e.type)}}class Ql{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Dl;case 35664:return Ll;case 35665:return Ul;case 35666:return Ol;case 35674:return Fl;case 35675:return Bl;case 35676:return zl;case 5124:case 35670:return kl;case 35667:case 35671:return Vl;case 35668:case 35672:return Hl;case 35669:case 35673:return Gl;case 5125:return Wl;case 36294:return ql;case 36295:return jl;case 36296:return Xl;case 35678:case 36198:case 36298:case 36306:case 35682:return Yl;case 35679:case 36299:case 36307:return Zl;case 35680:case 36300:case 36308:case 36293:return Kl;case 36289:case 36303:case 36311:case 36292:return Jl}}(e.type)}}class tc{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}}}const ec=/(\w+)(\])?(\[|\.)?/g;function nc(t,e){t.seq.push(e),t.map[e.id]=e}function ic(t,e,n){const i=t.name,r=i.length;for(ec.lastIndex=0;;){const s=ec.exec(i),a=ec.lastIndex;let o=s[1];const l="]"===s[2],c=s[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===r){nc(n,void 0===c?new $l(o,t,e):new Ql(o,t,e));break}{let t=n.map[o];void 0===t&&(t=new tc(o),nc(n,t)),n=t}}}class rc{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);ic(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],a=n[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function sc(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let ac=0;const oc=new Ie;function lc(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;t<s;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function cc(t,e){const n=function(t){Ve._getMatrix(oc,Ve.workingColorSpace,t);const e=`mat3( ${oc.elements.map((t=>t.toFixed(4)))} )`;switch(Ve.getTransfer(t)){case ae:return[e,"LinearTransferOETF"];case oe:return[e,"sRGBTransferOETF"];default:return[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function hc(t,e){let n;switch(e){case 1:default:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const uc=new rn;function dc(){return Ve.getLuminanceCoefficients(uc),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${uc.x.toFixed(4)}, ${uc.y.toFixed(4)}, ${uc.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function pc(t){return""!==t}function fc(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function mc(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const gc=/^[ \t]*#include +<([\w\d./]+)>/gm;function vc(t){return t.replace(gc,yc)}const _c=new Map;function yc(t,e){let n=_o[e];if(void 0===n){const t=_c.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=_o[t]}return vc(n)}const xc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function bc(t){return t.replace(xc,Mc)}function Mc(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Sc(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Ec(t,e,n,i){const r=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case H:case G:e="ENVMAP_TYPE_CUBE";break;case W:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===G&&(e="ENVMAP_MODE_REFRACTION"),e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(pc).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),m=r.createProgram();let g,v,_=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(pc).join("\n"),g.length>0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(pc).join("\n"),v.length>0&&(v+="\n")):(g=[Sc(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(pc).join("\n"),v=[Sc(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?_o.tonemapping_pars_fragment:"",0!==n.toneMapping?hc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",_o.colorspace_pars_fragment,cc("linearToOutputTexel",n.outputColorSpace),dc(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(pc).join("\n")),a=vc(a),a=fc(a,n),a=mc(a,n),o=vc(o),o=fc(o,n),o=mc(o,n),a=bc(a),o=bc(o),!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===ve?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===ve?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const y=_+g+a,x=_+v+o,b=sc(r,r.VERTEX_SHADER,y),M=sc(r,r.FRAGMENT_SHADER,x);function S(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(m).trim(),i=r.getShaderInfoLog(b).trim(),s=r.getShaderInfoLog(M).trim();let a=!0,o=!0;!1===r.getProgramParameter(m,r.LINK_STATUS)?(a=!1,"function"==typeof t.debug.onShaderError?t.debug.onShaderError(r,m,b,M):(lc(r,b,"vertex"),lc(r,M,"fragment"))):""!==n||""!==i&&""!==s||(o=!1),o&&(e.diagnostics={runnable:a,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:s,prefix:v}})}r.deleteShader(b),r.deleteShader(M),E=new rc(r,m),w=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),s=i.name;let a=1;i.type===t.FLOAT_MAT2&&(a=2),i.type===t.FLOAT_MAT3&&(a=3),i.type===t.FLOAT_MAT4&&(a=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:a}}return n}(r,m)}let E,w;r.attachShader(m,b),r.attachShader(m,M),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),this.getUniforms=function(){return void 0===E&&S(this),E},this.getAttributes=function(){return void 0===w&&S(this),w};let T=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===T&&(T=r.getProgramParameter(m,37297)),T},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=ac++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=M,this}let wc=0;class Tc{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new Ac(t),e.set(t,n)),n}}class Ac{constructor(t){this.id=wc++,this.code=t,this.usedTimes=0}}function Cc(t,e,n,i,r,s,a){const o=new qn,l=new Tc,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(s,o,h,g,v){const _=g.fog,y=v.geometry,x=s.isMeshStandardMaterial?g.environment:null,b=(s.isMeshStandardMaterial?n:e).get(s.envMap||x),M=b&&b.mapping===W?b.image.height:null,S=f[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),s.precision);const E=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,w=void 0!==E?E.length:0;let T,A,C,R,P=0;if(void 0!==y.morphAttributes.position&&(P=1),void 0!==y.morphAttributes.normal&&(P=2),void 0!==y.morphAttributes.color&&(P=3),S){const t=xo[S];T=t.vertexShader,A=t.fragmentShader}else T=s.vertexShader,A=s.fragmentShader,l.update(s),C=l.getVertexShaderID(s),R=l.getFragmentShaderID(s);const I=t.getRenderTarget(),N=t.state.buffers.depth.getReversed(),D=!0===v.isInstancedMesh,L=!0===v.isBatchedMesh,U=!!s.map,O=!!s.matcap,F=!!b,B=!!s.aoMap,z=!!s.lightMap,k=!!s.bumpMap,V=!!s.normalMap,H=!!s.displacementMap,G=!!s.emissiveMap,q=!!s.metalnessMap,j=!!s.roughnessMap,X=s.anisotropy>0,Y=s.clearcoat>0,Z=s.dispersion>0,K=s.iridescence>0,J=s.sheen>0,$=s.transmission>0,Q=X&&!!s.anisotropyMap,tt=Y&&!!s.clearcoatMap,et=Y&&!!s.clearcoatNormalMap,nt=Y&&!!s.clearcoatRoughnessMap,it=K&&!!s.iridescenceMap,rt=K&&!!s.iridescenceThicknessMap,st=J&&!!s.sheenColorMap,at=J&&!!s.sheenRoughnessMap,ot=!!s.specularMap,lt=!!s.specularColorMap,ct=!!s.specularIntensityMap,ht=$&&!!s.transmissionMap,ut=$&&!!s.thicknessMap,dt=!!s.gradientMap,pt=!!s.alphaMap,ft=s.alphaTest>0,mt=!!s.alphaHash,gt=!!s.extensions;let vt=0;s.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(vt=t.toneMapping));const _t={shaderID:S,shaderType:s.type,shaderName:s.name,vertexShader:T,fragmentShader:A,defines:s.defines,customVertexShaderID:C,customFragmentShaderID:R,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:L,batchingColor:L&&null!==v._colorsTexture,instancing:D,instancingColor:D&&null!==v.instanceColor,instancingMorph:D&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===I?t.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:se,alphaToCoverage:!!s.alphaToCoverage,map:U,matcap:O,envMap:F,envMapMode:F&&b.mapping,envMapCubeUVHeight:M,aoMap:B,lightMap:z,bumpMap:k,normalMap:V,displacementMap:d&&H,emissiveMap:G,normalMapObjectSpace:V&&1===s.normalMapType,normalMapTangentSpace:V&&0===s.normalMapType,metalnessMap:q,roughnessMap:j,anisotropy:X,anisotropyMap:Q,clearcoat:Y,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:Z,iridescence:K,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:J,sheenColorMap:st,sheenRoughnessMap:at,specularMap:ot,specularColorMap:lt,specularIntensityMap:ct,transmission:$,transmissionMap:ht,thicknessMap:ut,gradientMap:dt,opaque:!1===s.transparent&&1===s.blending&&!1===s.alphaToCoverage,alphaMap:pt,alphaTest:ft,alphaHash:mt,combine:s.combine,mapUv:U&&m(s.map.channel),aoMapUv:B&&m(s.aoMap.channel),lightMapUv:z&&m(s.lightMap.channel),bumpMapUv:k&&m(s.bumpMap.channel),normalMapUv:V&&m(s.normalMap.channel),displacementMapUv:H&&m(s.displacementMap.channel),emissiveMapUv:G&&m(s.emissiveMap.channel),metalnessMapUv:q&&m(s.metalnessMap.channel),roughnessMapUv:j&&m(s.roughnessMap.channel),anisotropyMapUv:Q&&m(s.anisotropyMap.channel),clearcoatMapUv:tt&&m(s.clearcoatMap.channel),clearcoatNormalMapUv:et&&m(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&m(s.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&m(s.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&m(s.iridescenceThicknessMap.channel),sheenColorMapUv:st&&m(s.sheenColorMap.channel),sheenRoughnessMapUv:at&&m(s.sheenRoughnessMap.channel),specularMapUv:ot&&m(s.specularMap.channel),specularColorMapUv:lt&&m(s.specularColorMap.channel),specularIntensityMapUv:ct&&m(s.specularIntensityMap.channel),transmissionMapUv:ht&&m(s.transmissionMap.channel),thicknessMapUv:ut&&m(s.thicknessMap.channel),alphaMapUv:pt&&m(s.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(V||X),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!y.attributes.uv&&(U||pt),fog:!!_,useFog:!0===s.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,reverseDepthBuffer:N,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:w,morphTextureStride:P,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:vt,decodeVideoTexture:U&&!0===s.map.isVideoTexture&&Ve.getTransfer(s.map.colorSpace)===oe,decodeVideoTextureEmissive:G&&!0===s.emissiveMap.isVideoTexture&&Ve.getTransfer(s.emissiveMap.colorSpace)===oe,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:gt&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(gt&&!0===s.extensions.multiDraw||L)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return _t.vertexUv1s=c.has(1),_t.vertexUv2s=c.has(2),_t.vertexUv3s=c.has(3),c.clear(),_t},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0),e.instancing&&o.enable(1),e.instancingColor&&o.enable(2),e.instancingMorph&&o.enable(3),e.matcap&&o.enable(4),e.envMap&&o.enable(5),e.normalMapObjectSpace&&o.enable(6),e.normalMapTangentSpace&&o.enable(7),e.clearcoat&&o.enable(8),e.iridescence&&o.enable(9),e.alphaTest&&o.enable(10),e.vertexColors&&o.enable(11),e.vertexAlphas&&o.enable(12),e.vertexUv1s&&o.enable(13),e.vertexUv2s&&o.enable(14),e.vertexUv3s&&o.enable(15),e.vertexTangents&&o.enable(16),e.anisotropy&&o.enable(17),e.alphaHash&&o.enable(18),e.batching&&o.enable(19),e.dispersion&&o.enable(20),e.batchingColor&&o.enable(21),t.push(o.mask),o.disableAll(),e.fog&&o.enable(0),e.useFog&&o.enable(1),e.flatShading&&o.enable(2),e.logarithmicDepthBuffer&&o.enable(3),e.reverseDepthBuffer&&o.enable(4),e.skinning&&o.enable(5),e.morphTargets&&o.enable(6),e.morphNormals&&o.enable(7),e.morphColors&&o.enable(8),e.premultipliedAlpha&&o.enable(9),e.shadowMapEnabled&&o.enable(10),e.doubleSided&&o.enable(11),e.flipSided&&o.enable(12),e.useDepthPacking&&o.enable(13),e.dithering&&o.enable(14),e.transmission&&o.enable(15),e.sheen&&o.enable(16),e.opaque&&o.enable(17),e.pointsUvs&&o.enable(18),e.decodeVideoTexture&&o.enable(19),e.decodeVideoTextureEmissive&&o.enable(20),e.alphaToCoverage&&o.enable(21),t.push(o.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=xo[e];n=cr.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new Ec(t,n,e,s),h.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function Rc(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Pc(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Ic(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Nc(){const t=[];let e=0;const n=[],i=[],r=[];function s(n,i,r,s,a,o){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:a,group:o},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=a,l.group=o),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Pc),i.length>1&&i.sort(e||Ic),r.length>1&&r.sort(e||Ic)}}}function Dc(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Nc,t.set(e,[r])):n>=i.length?(r=new Nc,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function Lc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new rn,color:new Ti};break;case"SpotLight":n={position:new rn,direction:new rn,color:new Ti,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new rn,color:new Ti,distance:0,decay:0};break;case"HemisphereLight":n={direction:new rn,skyColor:new Ti,groundColor:new Ti};break;case"RectAreaLight":n={color:new Ti,position:new rn,halfWidth:new rn,halfHeight:new rn}}return t[e.id]=n,n}}}let Uc=0;function Oc(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Fc(t){const e=new Lc,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new rn);const r=new rn,s=new Ln,a=new Ln;return{setup:function(r){let s=0,a=0,o=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;r.sort(Oc);for(let t=0,y=r.length;t<y;t++){const y=r[t],x=y.color,b=y.intensity,M=y.distance,S=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=x.r*b,a+=x.g*b,o+=x.b*b;else if(y.isLightProbe){for(let t=0;t<9;t++)i.probe[t].addScaledVector(y.sh.coefficients[t],b);_++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[l]=e,i.directionalShadowMap[l]=S,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(x).multiplyScalar(b),t.distance=M,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,i.spot[h]=t;const r=y.shadow;if(y.map&&(i.spotLightMap[g]=y.map,g++,r.updateMatrices(y),y.castShadow&&v++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const t=n.get(y);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[h]=t,i.spotShadowMap[h]=S,m++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(x).multiplyScalar(b),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),i.rectArea[u]=t,u++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[c]=e,i.pointShadowMap[c]=S,i.pointShadowMatrix[c]=y.shadow.matrix,f++}i.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(b),t.groundColor.copy(y.groundColor).multiplyScalar(b),i.hemi[d]=t,d++}}u>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=yo.LTC_FLOAT_1,i.rectAreaLTC2=yo.LTC_FLOAT_2):(i.rectAreaLTC1=yo.LTC_HALF_1,i.rectAreaLTC2=yo.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=a,i.ambient[2]=o;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===u&&y.hemiLength===d&&y.numDirectionalShadows===p&&y.numPointShadows===f&&y.numSpotShadows===m&&y.numSpotMaps===g&&y.numLightProbes===_||(i.directional.length=l,i.spot.length=h,i.rectArea.length=u,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=_,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=u,y.hemiLength=d,y.numDirectionalShadows=p,y.numPointShadows=f,y.numSpotShadows=m,y.numSpotMaps=g,y.numLightProbes=_,i.version=Uc++)},setupView:function(t,e){let n=0,o=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a.identity(),s.copy(d.matrixWorld),s.premultiply(u),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(d.isPointLight){const t=i.point[o];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o++}else if(d.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:i}}function Bc(t){const e=new Fc(t),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function zc(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let s;return void 0===r?(s=new Bc(t),e.set(n,[s])):i>=r.length?(s=new Bc(t),r.push(s)):s=r[i],s},dispose:function(){e=new WeakMap}}}function kc(t,e,n){let i=new kr;const r=new Pe,s=new Pe,a=new Je,o=new sa({depthPacking:3201}),l=new aa,h={},u=n.maxTextureSize,d={[c]:1,[f]:0,[m]:2},p=new hr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const v=new qi;v.setAttribute("position",new Li(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new ir(v,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let x=this.type;function b(n,i){const s=e.update(_);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,g.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Qe(r.x,r.y)),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,s,p,_,null),g.uniforms.shadow_pass.value=n.mapPass.texture,g.uniforms.resolution.value=n.mapSize,g.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,s,g,_,null)}function M(e,n,i,r){let s=null;const a=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===i.isPointLight?l:o,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const t=s.uuid,e=n.uuid;let i=h[t];void 0===i&&(i={},h[t]=i);let r=i[e];void 0===r&&(r=s.clone(),i[e]=r,n.addEventListener("dispose",E)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],s.alphaMap=n.alphaMap,s.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(t.properties.get(s).light=i),s}function S(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),l=n.material;if(Array.isArray(l)){const e=i.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],u=l[h.materialIndex];if(u&&u.visible){const e=M(n,u,a,o);n.onBeforeShadow(t,n,r,s,i,e,h),t.renderBufferDirect(s,null,i,e,n,h),n.onAfterShadow(t,n,r,s,i,e,h)}}}else if(l.visible){const e=M(n,l,a,o);n.onBeforeShadow(t,n,r,s,i,e,null),t.renderBufferDirect(s,null,i,e,n,null),n.onAfterShadow(t,n,r,s,i,e,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)S(l[t],r,s,a,o)}function E(t){t.target.removeEventListener("dispose",E);for(const e in h){const n=h[e],i=t.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(e,n,o){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=3!==x&&3===this.type,f=3===x&&3!==this.type;for(let l=0,c=e.length;l<c;l++){const c=e[l],h=c.shadow;if(void 0===h)continue;if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;r.copy(h.mapSize);const m=h.getFrameExtents();if(r.multiply(m),s.copy(h.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/m.x),r.x=s.x*m.x,h.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/m.y),r.y=s.y*m.y,h.mapSize.y=s.y)),null===h.map||!0===p||!0===f){const t=3!==this.type?{minFilter:Y,magFilter:Y}:{};null!==h.map&&h.map.dispose(),h.map=new Qe(r.x,r.y,t),h.map.texture.name=c.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const g=h.getViewportCount();for(let t=0;t<g;t++){const e=h.getViewport(t);a.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(a),h.updateMatrices(c,t),i=h.getFrustum(),S(n,o,h.camera,c,this.type)}!0!==h.isPointLightShadow&&3===this.type&&b(h,o),h.needsUpdate=!1}x=this.type,y.needsUpdate=!1,t.setRenderTarget(l,c,h)}}const Vc={[L]:1,[O]:6,[B]:7,[F]:5,[U]:0,[k]:2,[V]:4,[z]:3};function Hc(t,e){const n=new function(){let e=!1;const n=new Je;let i=null;const r=new Je(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,a,o){!0===o&&(e*=a,i*=a,s*=a),n.set(e,i,s,a),!1===r.equals(n)&&(t.clearColor(e,i,s,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,a=null;return{setReversed:function(t){if(i!==t){const n=e.get("EXT_clip_control");t?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),i=t;const r=a;a=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(e){e?rt(t.DEPTH_TEST):st(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=Vc[e]),s!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}s=e}},setLocked:function(t){n=t},setClear:function(e){a!==e&&(i&&(e=1-e),t.clearDepth(e),a=e)},reset:function(){n=!1,r=null,s=null,a=null,i=!1}}},r=new function(){let e=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null;return{setTest:function(n){e||(n?rt(t.STENCIL_TEST):st(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&s===a||(t.stencilFunc(e,n,a),i=e,r=n,s=a)},setOp:function(e,n,i){a===e&&o===n&&l===i||(t.stencilOp(e,n,i),a=e,o=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null}}},s=new WeakMap,a=new WeakMap;let o={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,f=null,m=null,L=null,U=null,O=null,F=null,B=new Ti(0,0,0),z=0,k=!1,V=null,H=null,G=null,W=null,q=null;const j=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Y=0;const Z=t.getParameter(t.VERSION);-1!==Z.indexOf("WebGL")?(Y=parseFloat(/^WebGL (\d)/.exec(Z)[1]),X=Y>=1):-1!==Z.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),X=Y>=2);let K=null,J={};const $=t.getParameter(t.SCISSOR_BOX),Q=t.getParameter(t.VIEWPORT),tt=(new Je).fromArray($),et=(new Je).fromArray(Q);function nt(e,n,i,r){const s=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;a<i;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return a}const it={};function rt(e){!0!==o[e]&&(t.enable(e),o[e]=!0)}function st(e){!1!==o[e]&&(t.disable(e),o[e]=!1)}it[t.TEXTURE_2D]=nt(t.TEXTURE_2D,t.TEXTURE_2D,1),it[t.TEXTURE_CUBE_MAP]=nt(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),it[t.TEXTURE_2D_ARRAY]=nt(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),it[t.TEXTURE_3D]=nt(t.TEXTURE_3D,t.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),rt(t.DEPTH_TEST),i.setFunc(3),ct(!1),ht(1),rt(t.CULL_FACE),lt(0);const at={[g]:t.FUNC_ADD,[v]:t.FUNC_SUBTRACT,[_]:t.FUNC_REVERSE_SUBTRACT};at[103]=t.MIN,at[104]=t.MAX;const ot={[y]:t.ZERO,[x]:t.ONE,[b]:t.SRC_COLOR,[S]:t.SRC_ALPHA,[R]:t.SRC_ALPHA_SATURATE,[A]:t.DST_COLOR,[w]:t.DST_ALPHA,[M]:t.ONE_MINUS_SRC_COLOR,[E]:t.ONE_MINUS_SRC_ALPHA,[C]:t.ONE_MINUS_DST_COLOR,[T]:t.ONE_MINUS_DST_ALPHA,[P]:t.CONSTANT_COLOR,[I]:t.ONE_MINUS_CONSTANT_COLOR,[N]:t.CONSTANT_ALPHA,[D]:t.ONE_MINUS_CONSTANT_ALPHA};function lt(e,n,i,r,s,a,o,l,c,h){if(0!==e){if(!1===d&&(rt(t.BLEND),d=!0),5===e)s=s||n,a=a||i,o=o||r,n===f&&s===U||(t.blendEquationSeparate(at[n],at[s]),f=n,U=s),i===m&&r===L&&a===O&&o===F||(t.blendFuncSeparate(ot[i],ot[r],ot[a],ot[o]),m=i,L=r,O=a,F=o),!1!==l.equals(B)&&c===z||(t.blendColor(l.r,l.g,l.b,c),B.copy(l),z=c),p=e,k=!1;else if(e!==p||h!==k){if(f===g&&U===g||(t.blendEquation(t.FUNC_ADD),f=g,U=g),h)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR)}m=null,L=null,O=null,F=null,B.set(0,0,0),z=0,p=e,k=h}}else!0===d&&(st(t.BLEND),d=!1)}function ct(e){V!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),V=e)}function ht(e){0!==e?(rt(t.CULL_FACE),e!==H&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):st(t.CULL_FACE),H=e}function ut(e,n,i){e?(rt(t.POLYGON_OFFSET_FILL),W===n&&q===i||(t.polygonOffset(n,i),W=n,q=i)):st(t.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:rt,disable:st,bindFramebuffer:function(e,n){return l[e]!==n&&(t.bindFramebuffer(e,n),l[e]=n,e===t.DRAW_FRAMEBUFFER&&(l[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(l[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=h,r=!1;if(e){i=c.get(n),void 0===i&&(i=[],c.set(n,i));const s=e.textures;if(i.length!==s.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=s.length;e<n;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:lt,setMaterial:function(e,s){2===e.side?st(t.CULL_FACE):rt(t.CULL_FACE);let a=1===e.side;s&&(a=!a),ct(a),1===e.blending&&!1===e.transparent?lt(0):lt(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),i.setFunc(e.depthFunc),i.setTest(e.depthTest),i.setMask(e.depthWrite),n.setMask(e.colorWrite);const o=e.stencilWrite;r.setTest(o),o&&(r.setMask(e.stencilWriteMask),r.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),r.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),ut(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?rt(t.SAMPLE_ALPHA_TO_COVERAGE):st(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:ct,setCullFace:ht,setLineWidth:function(e){e!==G&&(X&&t.lineWidth(e),G=e)},setPolygonOffset:ut,setScissorTest:function(e){e?rt(t.SCISSOR_TEST):st(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+j-1),K!==e&&(t.activeTexture(e),K=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===K?t.TEXTURE0+j-1:K);let r=J[i];void 0===r&&(r={type:void 0,texture:void 0},J[i]=r),r.type===e&&r.texture===n||(K!==i&&(t.activeTexture(i),K=i),t.bindTexture(e,n||it[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=J[K];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D(...arguments)}catch(t){}},compressedTexImage3D:function(){try{t.compressedTexImage3D(...arguments)}catch(t){}},texImage2D:function(){try{t.texImage2D(...arguments)}catch(t){}},texImage3D:function(){try{t.texImage3D(...arguments)}catch(t){}},updateUBOMapping:function(e,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=a.get(n).get(e);s.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{t.texStorage2D(...arguments)}catch(t){}},texStorage3D:function(){try{t.texStorage3D(...arguments)}catch(t){}},texSubImage2D:function(){try{t.texSubImage2D(...arguments)}catch(t){}},texSubImage3D:function(){try{t.texSubImage3D(...arguments)}catch(t){}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D(...arguments)}catch(t){}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D(...arguments)}catch(t){}},scissor:function(e){!1===tt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),tt.copy(e))},viewport:function(e){!1===et.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),et.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),i.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),o={},K=null,J={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,f=null,m=null,L=null,U=null,O=null,F=null,B=new Ti(0,0,0),z=0,k=!1,V=null,H=null,G=null,W=null,q=null,tt.set(0,0,t.canvas.width,t.canvas.height),et.set(0,0,t.canvas.width,t.canvas.height),n.reset(),i.reset(),r.reset()}}}function Gc(t,e,n,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new Pe,h=new WeakMap;let u;const d=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function f(t,e){return p?new OffscreenCanvas(t,e):Le("canvas")}function m(t,e,n){let i=1;const r=H(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===u&&(u=f(n,s));const a=e?f(n,s):u;return a.width=n,a.height=s,a.getContext("2d").drawImage(t,0,0,n,s),a}return t}return t}function g(t){return t.generateMipmaps}function v(e){t.generateMipmap(e)}function _(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function y(n,i,r,s,a=!1){if(null!==n&&void 0!==t[n])return t[n];let o=i;if(i===t.RED&&(r===t.FLOAT&&(o=t.R32F),r===t.HALF_FLOAT&&(o=t.R16F),r===t.UNSIGNED_BYTE&&(o=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.R8UI),r===t.UNSIGNED_SHORT&&(o=t.R16UI),r===t.UNSIGNED_INT&&(o=t.R32UI),r===t.BYTE&&(o=t.R8I),r===t.SHORT&&(o=t.R16I),r===t.INT&&(o=t.R32I)),i===t.RG&&(r===t.FLOAT&&(o=t.RG32F),r===t.HALF_FLOAT&&(o=t.RG16F),r===t.UNSIGNED_BYTE&&(o=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RG8UI),r===t.UNSIGNED_SHORT&&(o=t.RG16UI),r===t.UNSIGNED_INT&&(o=t.RG32UI),r===t.BYTE&&(o=t.RG8I),r===t.SHORT&&(o=t.RG16I),r===t.INT&&(o=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RGB8UI),r===t.UNSIGNED_SHORT&&(o=t.RGB16UI),r===t.UNSIGNED_INT&&(o=t.RGB32UI),r===t.BYTE&&(o=t.RGB8I),r===t.SHORT&&(o=t.RGB16I),r===t.INT&&(o=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(o=t.RGBA16UI),r===t.UNSIGNED_INT&&(o=t.RGBA32UI),r===t.BYTE&&(o=t.RGBA8I),r===t.SHORT&&(o=t.RGBA16I),r===t.INT&&(o=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),i===t.RGBA){const e=a?ae:Ve.getTransfer(s);r===t.FLOAT&&(o=t.RGBA32F),r===t.HALF_FLOAT&&(o=t.RGBA16F),r===t.UNSIGNED_BYTE&&(o=e===oe?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function x(e,n){let i;return e?null===n||n===st||n===ht?i=t.DEPTH24_STENCIL8:n===at?i=t.DEPTH32F_STENCIL8:n===it&&(i=t.DEPTH24_STENCIL8):null===n||n===st||n===ht?i=t.DEPTH_COMPONENT24:n===at?i=t.DEPTH_COMPONENT32F:n===it&&(i=t.DEPTH_COMPONENT16),i}function b(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==Y&&t.minFilter!==J?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function M(t){const e=t.target;e.removeEventListener("dispose",M),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=d.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&E(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function S(e){const n=e.target;n.removeEventListener("dispose",S),function(e){const n=i.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,n=r.length;e<n;e++){const n=i.get(r[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),a.memory.textures--),i.remove(r[e])}i.remove(e)}(n)}function E(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete d.get(r)[n.__cacheKey],a.memory.textures--}let w=0;function T(e,r){const s=i.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;h.get(t)!==e&&(h.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version){const t=e.image;if(null===t);else if(!1!==t.complete)return void N(s,e,r)}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}const A={[q]:t.REPEAT,[j]:t.CLAMP_TO_EDGE,[X]:t.MIRRORED_REPEAT},C={[Y]:t.NEAREST,[Z]:t.NEAREST_MIPMAP_NEAREST,[K]:t.NEAREST_MIPMAP_LINEAR,[J]:t.LINEAR,[$]:t.LINEAR_MIPMAP_NEAREST,[Q]:t.LINEAR_MIPMAP_LINEAR},R={[ce]:t.NEVER,[ge]:t.ALWAYS,[he]:t.LESS,[de]:t.LEQUAL,[ue]:t.EQUAL,[me]:t.GEQUAL,[pe]:t.GREATER,[fe]:t.NOTEQUAL};function P(n,s){if(s.type===at&&!1===e.has("OES_texture_float_linear")&&(s.magFilter===J||s.magFilter===$||s.magFilter===K||s.magFilter===Q||s.minFilter===J||s.minFilter===$||s.minFilter===K||s.minFilter),t.texParameteri(n,t.TEXTURE_WRAP_S,A[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,A[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,A[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,C[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,C[s.minFilter]),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,R[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Y)return;if(s.minFilter!==K&&s.minFilter!==Q)return;if(s.type===at&&!1===e.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function I(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",M));const r=n.source;let s=d.get(r);void 0===s&&(s={},d.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&E(n)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return i}function N(e,a,o){let l=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=t.TEXTURE_3D);const c=I(e,a),h=a.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const u=i.get(h);if(h.version!==u.__version||!0===c){n.activeTexture(t.TEXTURE0+o);const e=Ve.getPrimaries(Ve.workingColorSpace),i=a.colorSpace===ie?null:Ve.getPrimaries(a.colorSpace),d=a.colorSpace===ie||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=m(a.image,!1,r.maxTextureSize);p=V(a,p);const f=s.convert(a.format,a.colorSpace),_=s.convert(a.type);let M,S=y(a.internalFormat,f,_,a.colorSpace,a.isVideoTexture);P(l,a);const E=a.mipmaps,w=!0!==a.isVideoTexture,T=void 0===u.__version||!0===c,A=h.dataReady,C=b(a,p);if(a.isDepthTexture)S=x(a.format===ft,a.type),T&&(w?n.texStorage2D(t.TEXTURE_2D,1,S,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,S,p.width,p.height,0,f,_,null));else if(a.isDataTexture)if(E.length>0){w&&T&&n.texStorage2D(t.TEXTURE_2D,C,S,E[0].width,E[0].height);for(let e=0,i=E.length;e<i;e++)M=E[e],w?A&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,M.width,M.height,f,_,M.data):n.texImage2D(t.TEXTURE_2D,e,S,M.width,M.height,0,f,_,M.data);a.generateMipmaps=!1}else w?(T&&n.texStorage2D(t.TEXTURE_2D,C,S,p.width,p.height),A&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,f,_,p.data)):n.texImage2D(t.TEXTURE_2D,0,S,p.width,p.height,0,f,_,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){w&&T&&n.texStorage3D(t.TEXTURE_2D_ARRAY,C,S,E[0].width,E[0].height,p.depth);for(let e=0,i=E.length;e<i;e++)if(M=E[e],a.format!==dt){if(null!==f)if(w){if(A)if(a.layerUpdates.size>0){const i=mo(M.width,M.height,a.format,a.type);for(const r of a.layerUpdates){const s=M.data.subarray(r*i/M.data.BYTES_PER_ELEMENT,(r+1)*i/M.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,M.width,M.height,1,f,s)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,M.width,M.height,p.depth,f,M.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,S,M.width,M.height,p.depth,0,M.data,0,0)}else w?A&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,M.width,M.height,p.depth,f,_,M.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,S,M.width,M.height,p.depth,0,f,_,M.data)}else{w&&T&&n.texStorage2D(t.TEXTURE_2D,C,S,E[0].width,E[0].height);for(let e=0,i=E.length;e<i;e++)M=E[e],a.format!==dt?null!==f&&(w?A&&n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,M.width,M.height,f,M.data):n.compressedTexImage2D(t.TEXTURE_2D,e,S,M.width,M.height,0,M.data)):w?A&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,M.width,M.height,f,_,M.data):n.texImage2D(t.TEXTURE_2D,e,S,M.width,M.height,0,f,_,M.data)}else if(a.isDataArrayTexture)if(w){if(T&&n.texStorage3D(t.TEXTURE_2D_ARRAY,C,S,p.width,p.height,p.depth),A)if(a.layerUpdates.size>0){const e=mo(p.width,p.height,a.format,a.type);for(const i of a.layerUpdates){const r=p.data.subarray(i*e/p.data.BYTES_PER_ELEMENT,(i+1)*e/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,f,_,r)}a.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,_,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,f,_,p.data);else if(a.isData3DTexture)w?(T&&n.texStorage3D(t.TEXTURE_3D,C,S,p.width,p.height,p.depth),A&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,_,p.data)):n.texImage3D(t.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,f,_,p.data);else if(a.isFramebufferTexture){if(T)if(w)n.texStorage2D(t.TEXTURE_2D,C,S,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r<C;r++)n.texImage2D(t.TEXTURE_2D,r,S,e,i,0,f,_,null),e>>=1,i>>=1}}else if(E.length>0){if(w&&T){const e=H(E[0]);n.texStorage2D(t.TEXTURE_2D,C,S,e.width,e.height)}for(let e=0,i=E.length;e<i;e++)M=E[e],w?A&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,f,_,M):n.texImage2D(t.TEXTURE_2D,e,S,f,_,M);a.generateMipmaps=!1}else if(w){if(T){const e=H(p);n.texStorage2D(t.TEXTURE_2D,C,S,e.width,e.height)}A&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,f,_,p)}else n.texImage2D(t.TEXTURE_2D,0,S,f,_,p);g(a)&&v(l),u.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function D(e,r,a,l,c,h){const u=s.convert(a.format,a.colorSpace),d=s.convert(a.type),p=y(a.internalFormat,u,d,a.colorSpace),f=i.get(r),m=i.get(a);if(m.__renderTarget=r,!f.__hasExternalTextures){const e=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?n.texImage3D(c,h,p,e,i,r.depth,0,u,d,null):n.texImage2D(c,h,p,e,i,0,u,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),k(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,m.__webglTexture,0,z(r)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,m.__webglTexture,h),n.bindFramebuffer(t.FRAMEBUFFER,null)}function L(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){const r=n.depthTexture,s=r&&r.isDepthTexture?r.type:null,a=x(n.stencilBuffer,s),l=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=z(n);k(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,a,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,a,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,a,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=n.textures;for(let r=0;r<e.length;r++){const a=e[r],l=s.convert(a.format,a.colorSpace),c=s.convert(a.type),h=y(a.internalFormat,l,c,a.colorSpace),u=z(n);i&&!1===k(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,h,n.width,n.height):k(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,h,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,h,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function U(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),T(r.depthTexture,0);const a=s.__webglTexture,l=z(r);if(r.depthTexture.format===pt)k(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==ft)throw new Error("Unknown depthTexture format");k(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}function O(e){const r=i.get(e),s=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),t){const e=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");const t=e.texture.mipmaps;t&&t.length>0?U(r.__webglFramebuffer[0],e):U(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=t.createRenderbuffer(),L(r.__webglDepthbuffer[i],e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];t.bindRenderbuffer(t.RENDERBUFFER,s),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,s)}}else{const i=e.texture.mipmaps;if(i&&i.length>0?n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),L(r.__webglDepthbuffer,e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,i)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}const F=[],B=[];function z(t){return Math.min(r.maxSamples,t.samples)}function k(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function V(t,e){const n=t.colorSpace;return t.format,t.type,!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==se&&n!==ie&&Ve.getTransfer(n),e}function H(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=w;return r.maxTextures,w+=1,t},this.resetTextureUnits=function(){w=0},this.setTexture2D=T,this.setTexture2DArray=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?N(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?N(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,a){const o=i.get(e);e.version>0&&o.__version!==e.version?function(e,a,o){if(6!==a.image.length)return;const l=I(e,a),c=a.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(t.TEXTURE0+o);const e=Ve.getPrimaries(Ve.workingColorSpace),i=a.colorSpace===ie?null:Ve.getPrimaries(a.colorSpace),u=a.colorSpace===ie||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,f=[];for(let t=0;t<6;t++)f[t]=d||p?p?a.image[t].image:a.image[t]:m(a.image[t],!0,r.maxCubemapSize),f[t]=V(a,f[t]);const _=f[0],x=s.convert(a.format,a.colorSpace),M=s.convert(a.type),S=y(a.internalFormat,x,M,a.colorSpace),E=!0!==a.isVideoTexture,w=void 0===h.__version||!0===l,T=c.dataReady;let A,C=b(a,_);if(P(t.TEXTURE_CUBE_MAP,a),d){E&&w&&n.texStorage2D(t.TEXTURE_CUBE_MAP,C,S,_.width,_.height);for(let e=0;e<6;e++){A=f[e].mipmaps;for(let i=0;i<A.length;i++){const r=A[i];a.format!==dt?null!==x&&(E?T&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,x,r.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,S,r.width,r.height,0,r.data)):E?T&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,x,M,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,S,r.width,r.height,0,x,M,r.data)}}}else{if(A=a.mipmaps,E&&w){A.length>0&&C++;const e=H(f[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,C,S,e.width,e.height)}for(let e=0;e<6;e++)if(p){E?T&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,f[e].width,f[e].height,x,M,f[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,f[e].width,f[e].height,0,x,M,f[e].data);for(let i=0;i<A.length;i++){const r=A[i].image[e].image;E?T&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,x,M,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,S,r.width,r.height,0,x,M,r.data)}}else{E?T&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,x,M,f[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,x,M,f[e]);for(let i=0;i<A.length;i++){const r=A[i];E?T&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,x,M,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,S,x,M,r.image[e])}}}g(a)&&v(t.TEXTURE_CUBE_MAP),h.__version=c.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(o,e,a):n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,n,r){const s=i.get(e);void 0!==n&&D(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&O(e)},this.setupRenderTarget=function(e){const r=e.texture,o=i.get(e),l=i.get(r);e.addEventListener("dispose",S);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=c.length>1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,a.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[e][n]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,n=c.length;e<n;e++){const n=i.get(c[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),a.memory.textures++)}if(e.samples>0&&!1===k(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];o.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),a=s.convert(i.type),l=y(i.internalFormat,r,a,i.colorSpace,!0===e.isXRRenderTarget),h=z(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,o.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),L(o.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),P(t.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(o.__webglFramebuffer[n][i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(o.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&v(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(u){for(let r=0,s=c.length;r<s;r++){const s=c[r],a=i.get(s);n.bindTexture(t.TEXTURE_2D,a.__webglTexture),P(t.TEXTURE_2D,s),D(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+r,t.TEXTURE_2D,0),g(s)&&v(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(o.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,i,n);else D(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,i,0);g(r)&&v(i),n.unbindTexture()}e.depthBuffer&&O(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let r=0,s=e.length;r<s;r++){const s=e[r];if(g(s)){const e=_(t),r=i.get(s).__webglTexture;n.bindTexture(e,r),v(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===k(e)){const r=e.textures,s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=r.length>1;if(u)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer);const d=e.texture.mipmaps;d&&d.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),u){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,a,0,0,s,a,o,t.NEAREST),!0===l&&(F.length=0,B.length=0,F.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&!1===e.resolveDepthBuffer&&(F.push(c),B.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,B)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,F))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const s=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=O,this.setupFrameBufferTexture=D,this.useMultisampledRTT=k}function Wc(t,e){return{convert:function(n,i=""){let r;const s=Ve.getTransfer(i);if(n===tt)return t.UNSIGNED_BYTE;if(n===lt)return t.UNSIGNED_SHORT_4_4_4_4;if(n===ct)return t.UNSIGNED_SHORT_5_5_5_1;if(n===ut)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===et)return t.BYTE;if(n===nt)return t.SHORT;if(n===it)return t.UNSIGNED_SHORT;if(n===rt)return t.INT;if(n===st)return t.UNSIGNED_INT;if(n===at)return t.FLOAT;if(n===ot)return t.HALF_FLOAT;if(1021===n)return t.ALPHA;if(1022===n)return t.RGB;if(n===dt)return t.RGBA;if(n===pt)return t.DEPTH_COMPONENT;if(n===ft)return t.DEPTH_STENCIL;if(n===mt)return t.RED;if(n===gt)return t.RED_INTEGER;if(1030===n)return t.RG;if(n===vt)return t.RG_INTEGER;if(n===_t)return t.RGBA_INTEGER;if(n===yt||n===xt||n===bt||n===Mt)if(s===oe){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===yt)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===xt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===bt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Mt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===yt)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===xt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===bt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Mt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===St||n===Et||n===wt||n===Tt){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===St)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Et)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===wt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Tt)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===At||n===Ct||n===Rt){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===At||n===Ct)return s===oe?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Rt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Pt||n===It||n===Nt||n===Dt||n===Lt||n===Ut||n===Ot||n===Ft||n===Bt||n===zt||n===kt||n===Vt||n===Ht||n===Gt){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===Pt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===It)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Nt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Dt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Lt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ut)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ot)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ft)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Bt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===zt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===kt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Vt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ht)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Gt)return s===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Wt||n===qt||n===jt){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(n===Wt)return s===oe?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===qt)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===jt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||n===Xt||n===Yt||n===Zt){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===Wt)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Xt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Yt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Zt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===ht?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}class qc{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new Ke;t.properties.get(i).__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new hr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ir(new Qs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class jc extends xe{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,f=null;const m=new qc,g=e.getContextAttributes();let v=null,_=null;const y=[],x=[],b=new Pe;let M=null;const S=new mr;S.viewport=new Je;const E=new mr;E.viewport=new Je;const w=[S,E],T=new Va;let A=null,C=null;function R(t){const e=x.indexOf(t.inputSource);if(-1===e)return;const n=y[e];void 0!==n&&(n.update(t.inputSource,t.frame,l||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}function P(){i.removeEventListener("select",R),i.removeEventListener("selectstart",R),i.removeEventListener("selectend",R),i.removeEventListener("squeeze",R),i.removeEventListener("squeezestart",R),i.removeEventListener("squeezeend",R),i.removeEventListener("end",P),i.removeEventListener("inputsourceschange",I);for(let t=0;t<y.length;t++){const e=x[t];null!==e&&(x[t]=null,y[t].disconnect(e))}A=null,C=null,m.reset(),t.setRenderTarget(v),d=null,u=null,h=null,i=null,_=null,O.stop(),n.isPresenting=!1,t.setPixelRatio(M),t.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}function I(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=x.indexOf(n);i>=0&&(x[i]=null,y[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=x.indexOf(n);if(-1===i){for(let t=0;t<y.length;t++){if(t>=x.length){x.push(n),i=t;break}if(null===x[t]){x[t]=n,i=t;break}}if(-1===i)break}const r=y[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=y[t];return void 0===e&&(e=new Mr,y[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=y[t];return void 0===e&&(e=new Mr,y[t]=e),e.getGripSpace()},this.getHand=function(t){let e=y[t];return void 0===e&&(e=new Mr,y[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,n.isPresenting},this.setReferenceSpaceType=function(t){a=t,n.isPresenting},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=function(c){return p(this,null,(function*(){if(i=c,null!==i){if(v=t.getRenderTarget(),i.addEventListener("select",R),i.addEventListener("selectstart",R),i.addEventListener("selectend",R),i.addEventListener("squeeze",R),i.addEventListener("squeezestart",R),i.addEventListener("squeezeend",R),i.addEventListener("end",P),i.addEventListener("inputsourceschange",I),!0!==g.xrCompatible&&(yield e.makeXRCompatible()),M=t.getPixelRatio(),t.getSize(b),"undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,s=null,a=null;g.depth&&(a=g.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=g.stencil?ft:pt,s=g.stencil?ht:st);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),_=new Qe(u.textureWidth,u.textureHeight,{format:dt,type:tt,depthTexture:new ts(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:g.stencil,colorSpace:t.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues})}else{const n={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new Qe(d.framebufferWidth,d.framebufferHeight,{format:dt,type:tt,colorSpace:t.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=yield i.requestReferenceSpace(a),O.setContext(i),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}}))},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const N=new rn,D=new rn;function L(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;let e=t.near,n=t.far;null!==m.texture&&(m.depthNear>0&&(e=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=E.near=S.near=e,T.far=E.far=S.far=n,A===T.near&&C===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,C=T.far),S.layers.mask=2|t.layers.mask,E.layers.mask=4|t.layers.mask,T.layers.mask=S.layers.mask|E.layers.mask;const r=t.parent,s=T.cameras;L(T,r);for(let t=0;t<s.length;t++)L(s[t],r);2===s.length?function(t,e,n){N.setFromMatrixPosition(e.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=N.distanceTo(D),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=a*h,p=a*u,f=i/(-h+u),m=f*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=a+f,n=o+f,r=d-m,s=p+(i-m),h=l*o/n*e,u=c*o/n*e;t.projectionMatrix.makePerspective(r,s,h,u,e,n),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(T,S,E):T.projectionMatrix.copy(S.projectionMatrix),function(t,e,n){null===n?t.matrix.copy(e.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*Se*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,T,r)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(t){o=t,null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(T)};let U=null;const O=new go;O.setAnimationLoop((function(e,r){if(c=r.getViewerPose(l||s),f=r,null!==c){const e=c.views;null!==d&&(t.setRenderTargetFramebuffer(_,d.framebuffer),t.setRenderTarget(_));let n=!1;e.length!==T.cameras.length&&(T.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==d)s=d.getViewport(r);else{const e=h.getViewSubImage(u,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(_,e.colorTexture,e.depthStencilTexture),t.setRenderTarget(_))}let a=w[i];void 0===a&&(a=new mr,a.layers.enable(i),a.viewport=new Je,w[i]=a),a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(r.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===i&&(T.matrix.copy(a.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),!0===n&&T.cameras.push(a)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")&&"gpu-optimized"==i.depthUsage&&h){const n=h.getDepthInformation(e[0]);n&&n.isValid&&n.texture&&m.init(t,n,i.renderState)}}for(let t=0;t<y.length;t++){const e=x[t],n=y[t];null!==e&&void 0!==n&&n.update(e,r,l||s)}U&&U(e,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),f=null})),this.setAnimationLoop=function(t){U=t},this.dispose=function(){}}}const Xc=new Wn,Yc=new Ln;function Zc(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,1===i.side&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),1===i.side&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),s=r.envMap,a=r.envMapRotation;s&&(t.envMap.value=s,Xc.copy(a),Xc.x*=-1,Xc.y*=-1,Xc.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Xc.y*=-1,Xc.z*=-1),t.envMapRotation.value.setFromMatrix4(Yc.makeRotationFromEuler(Xc)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,lr(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Kc(t,e,n,i){let r={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,n,i){const r=t.value,s=e+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture,e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=a.indexOf(n.__bindingPointIndex);a.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(function(t){const e=t.uniforms;let n=0;const i=16;for(let t=0,r=e.length;t<r;t++){const r=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=r.length;t<e;t++){const e=r[t],s=Array.isArray(e.value)?e.value:[e.value];for(let t=0,r=s.length;t<r;t++){const r=c(s[t]),a=n%i,o=a%r.boundary,l=a+o;n+=o,0!==l&&i-l<r.storage&&(n+=i-l),e.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=r.storage}}}const r=n%i;r>0&&(n+=i-r),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return 0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",h));const p=u.program;i.updateUBOMapping(n,p);const f=e.render.frame;s[n.id]!==f&&(function(e){const n=r[e.id],i=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,e,i,s)){const e=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const a=n[s],o=c(a);"number"==typeof a||"boolean"==typeof a?(r.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+i,r.__data)):a.isMatrix3?(r.__data[0]=a.elements[0],r.__data[1]=a.elements[1],r.__data[2]=a.elements[2],r.__data[3]=0,r.__data[4]=a.elements[3],r.__data[5]=a.elements[4],r.__data[6]=a.elements[5],r.__data[7]=0,r.__data[8]=a.elements[6],r.__data[9]=a.elements[7],r.__data[10]=a.elements[8],r.__data[11]=0):(a.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),s[n.id]=f)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);a=[],r={},s={}}}}class Jc{constructor(t={}){const{canvas:n=Ue(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=t;let f;if(this.isWebGLRenderer=!0,null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=i.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),g=new Int32Array(4);let v=null,_=null;const y=[],x=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const b=this;let M=!1;this._outputColorSpace=re;let S=0,E=0,w=null,T=-1,A=null;const C=new Je,R=new Je;let P=null;const I=new Ti(0);let N=0,D=n.width,L=n.height,U=1,O=null,F=null;const B=new Je(0,0,D,L),z=new Je(0,0,D,L);let k=!1;const V=new kr;let H=!1,G=!1;const W=new Ln,q=new Ln,j=new rn,X=new Je,Y={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Z=!1;function K(){return null===w?U:1}let J,$,et,nt,rt,at,ut,dt,pt,ft,mt,yt,xt,bt,Mt,St,Et,wt,Tt,At,Ct,Rt,Pt,It,Nt=i;function Dt(t,e){return n.getContext(t,e)}try{const t={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${e}`),n.addEventListener("webglcontextlost",Ot,!1),n.addEventListener("webglcontextrestored",Ft,!1),n.addEventListener("webglcontextcreationerror",Bt,!1),null===Nt){const e="webgl2";if(Nt=Dt(e,t),null===Nt)throw Dt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw t}function Lt(){J=new Yo(Nt),J.init(),Rt=new Wc(Nt,J),$=new Ao(Nt,J,t,Rt),et=new Hc(Nt,J),$.reverseDepthBuffer&&d&&et.buffers.depth.setReversed(!0),nt=new Jo(Nt),rt=new Rc,at=new Gc(Nt,J,et,rt,$,Rt,nt),ut=new Ro(b),dt=new Xo(b),pt=new vo(Nt),Pt=new wo(Nt,pt),ft=new Zo(Nt,pt,nt,Pt),mt=new Qo(Nt,ft,pt,nt),Tt=new $o(Nt,$,at),St=new Co(rt),yt=new Cc(b,ut,dt,J,$,Pt,St),xt=new Zc(b,rt),bt=new Dc,Mt=new zc(J),wt=new Eo(b,ut,dt,et,mt,f,l),Et=new kc(b,mt,$),It=new Kc(Nt,nt,$,et),At=new To(Nt,J,nt),Ct=new Ko(Nt,J,nt),nt.programs=yt.programs,b.capabilities=$,b.extensions=J,b.properties=rt,b.renderLists=bt,b.shadowMap=Et,b.state=et,b.info=nt}Lt();const Ut=new jc(b,Nt);function Ot(t){t.preventDefault(),M=!0}function Ft(){M=!1;const t=nt.autoReset,e=Et.enabled,n=Et.autoUpdate,i=Et.needsUpdate,r=Et.type;Lt(),nt.autoReset=t,Et.enabled=e,Et.autoUpdate=n,Et.needsUpdate=i,Et.type=r}function Bt(t){}function zt(t){const e=t.target;e.removeEventListener("dispose",zt),function(t){(function(t){const e=rt.get(t).programs;void 0!==e&&(e.forEach((function(t){yt.releaseProgram(t)})),t.isShaderMaterial&&yt.releaseShaderCache(t))})(t),rt.remove(t)}(e)}function kt(t,e,n){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Kt(t,e,n),t.side=0,t.needsUpdate=!0,Kt(t,e,n),t.side=2):Kt(t,e,n)}this.xr=Ut,this.getContext=function(){return Nt},this.getContextAttributes=function(){return Nt.getContextAttributes()},this.forceContextLoss=function(){const t=J.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=J.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(t){void 0!==t&&(U=t,this.setSize(D,L,!1))},this.getSize=function(t){return t.set(D,L)},this.setSize=function(t,e,i=!0){Ut.isPresenting||(D=t,L=e,n.width=Math.floor(t*U),n.height=Math.floor(e*U),!0===i&&(n.style.width=t+"px",n.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(D*U,L*U).floor()},this.setDrawingBufferSize=function(t,e,i){D=t,L=e,U=i,n.width=Math.floor(t*i),n.height=Math.floor(e*i),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(C)},this.getViewport=function(t){return t.copy(B)},this.setViewport=function(t,e,n,i){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,n,i),et.viewport(C.copy(B).multiplyScalar(U).round())},this.getScissor=function(t){return t.copy(z)},this.setScissor=function(t,e,n,i){t.isVector4?z.set(t.x,t.y,t.z,t.w):z.set(t,e,n,i),et.scissor(R.copy(z).multiplyScalar(U).round())},this.getScissorTest=function(){return k},this.setScissorTest=function(t){et.setScissorTest(k=t)},this.setOpaqueSort=function(t){O=t},this.setTransparentSort=function(t){F=t},this.getClearColor=function(t){return t.copy(wt.getClearColor())},this.setClearColor=function(){wt.setClearColor(...arguments)},this.getClearAlpha=function(){return wt.getClearAlpha()},this.setClearAlpha=function(){wt.setClearAlpha(...arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==w){const e=w.texture.format;t=e===_t||e===vt||e===gt}if(t){const t=w.texture.type,e=t===tt||t===st||t===it||t===ht||t===lt||t===ct,n=wt.getClearColor(),i=wt.getClearAlpha(),r=n.r,s=n.g,a=n.b;e?(m[0]=r,m[1]=s,m[2]=a,m[3]=i,Nt.clearBufferuiv(Nt.COLOR,0,m)):(g[0]=r,g[1]=s,g[2]=a,g[3]=i,Nt.clearBufferiv(Nt.COLOR,0,g))}else i|=Nt.COLOR_BUFFER_BIT}e&&(i|=Nt.DEPTH_BUFFER_BIT),n&&(i|=Nt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Nt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Ot,!1),n.removeEventListener("webglcontextrestored",Ft,!1),n.removeEventListener("webglcontextcreationerror",Bt,!1),wt.dispose(),bt.dispose(),Mt.dispose(),rt.dispose(),ut.dispose(),dt.dispose(),mt.dispose(),Pt.dispose(),It.dispose(),yt.dispose(),Ut.dispose(),Ut.removeEventListener("sessionstart",Ht),Ut.removeEventListener("sessionend",Gt),Wt.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=Y);const a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,n,i,r){!0!==e.isScene&&(e=Y),at.resetTextureUnits();const s=e.fog,a=i.isMeshStandardMaterial?e.environment:null,o=null===w?b.outputColorSpace:!0===w.isXRRenderTarget?w.texture.colorSpace:se,l=(i.isMeshStandardMaterial?dt:ut).get(i.envMap||a),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=0;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(f=b.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,v=rt.get(i),y=_.state.lights;if(!0===H&&(!0===G||t!==A)){const e=t===A&&i.id===T;St.setState(i,t,e)}let x=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==o||r.isBatchedMesh&&!1===v.batching?x=!0:r.isBatchedMesh||!0!==v.batching?r.isBatchedMesh&&!0===v.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===v.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===v.instancing?x=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?x=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===v.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===v.instancingMorph&&null!==r.morphTexture||v.envMap!==l||!0===i.fog&&v.fog!==s?x=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===St.numPlanes&&v.numIntersection===St.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==u||v.morphNormals!==d||v.morphColors!==p||v.toneMapping!==f||v.morphTargetsCount!==g)&&(x=!0):x=!0:x=!0:x=!0:x=!0:(x=!0,v.__version=i.version);let M=v.currentProgram;!0===x&&(M=Kt(i,e,r));let S=!1,E=!1,C=!1;const R=M.getUniforms(),P=v.uniforms;if(et.useProgram(M.program)&&(S=!0,E=!0,C=!0),i.id!==T&&(T=i.id,E=!0),S||A!==t){et.buffers.depth.getReversed()?(W.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(W),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(W),R.setValue(Nt,"projectionMatrix",W)):R.setValue(Nt,"projectionMatrix",t.projectionMatrix),R.setValue(Nt,"viewMatrix",t.matrixWorldInverse);const e=R.map.cameraPosition;void 0!==e&&e.setValue(Nt,j.setFromMatrixPosition(t.matrixWorld)),$.logarithmicDepthBuffer&&R.setValue(Nt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&R.setValue(Nt,"isOrthographic",!0===t.isOrthographicCamera),A!==t&&(A=t,E=!0,C=!0)}if(r.isSkinnedMesh){R.setOptional(Nt,r,"bindMatrix"),R.setOptional(Nt,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),R.setValue(Nt,"boneTexture",t.boneTexture,at))}r.isBatchedMesh&&(R.setOptional(Nt,r,"batchingTexture"),R.setValue(Nt,"batchingTexture",r._matricesTexture,at),R.setOptional(Nt,r,"batchingIdTexture"),R.setValue(Nt,"batchingIdTexture",r._indirectTexture,at),R.setOptional(Nt,r,"batchingColorTexture"),null!==r._colorsTexture&&R.setValue(Nt,"batchingColorTexture",r._colorsTexture,at));const I=n.morphAttributes;var N,D;if(void 0===I.position&&void 0===I.normal&&void 0===I.color||Tt.update(r,n,M),(E||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,R.setValue(Nt,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(P.envMap.value=l,P.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(P.envMapIntensity.value=e.environmentIntensity),E&&(R.setValue(Nt,"toneMappingExposure",b.toneMappingExposure),v.needsLights&&(D=C,(N=P).ambientLightColor.needsUpdate=D,N.lightProbe.needsUpdate=D,N.directionalLights.needsUpdate=D,N.directionalLightShadows.needsUpdate=D,N.pointLights.needsUpdate=D,N.pointLightShadows.needsUpdate=D,N.spotLights.needsUpdate=D,N.spotLightShadows.needsUpdate=D,N.rectAreaLights.needsUpdate=D,N.hemisphereLights.needsUpdate=D),s&&!0===i.fog&&xt.refreshFogUniforms(P,s),xt.refreshMaterialUniforms(P,i,U,L,_.state.transmissionRenderTarget[t.id]),rc.upload(Nt,Jt(v),P,at)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(rc.upload(Nt,Jt(v),P,at),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&R.setValue(Nt,"center",r.center),R.setValue(Nt,"modelViewMatrix",r.modelViewMatrix),R.setValue(Nt,"normalMatrix",r.normalMatrix),R.setValue(Nt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++){const n=t[e];It.update(n,M),It.bind(n,M)}}return M}(t,e,n,i,r);et.setMaterial(i,a);let l=n.index,c=1;if(!0===i.wireframe){if(l=ft.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,u=n.attributes.position;let d=h.start*c,p=(h.start+h.count)*c;null!==s&&(d=Math.max(d,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=u&&(d=Math.max(d,0),p=Math.min(p,u.count));const f=p-d;if(f<0||f===1/0)return;let m;Pt.setup(r,i,o,n,l);let g=At;if(null!==l&&(m=pt.get(l),g=Ct,g.setIndex(m)),r.isMesh)!0===i.wireframe?(et.setLineWidth(i.wireframeLinewidth*K()),g.setMode(Nt.LINES)):g.setMode(Nt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),et.setLineWidth(t*K()),r.isLineSegments?g.setMode(Nt.LINES):r.isLineLoop?g.setMode(Nt.LINE_LOOP):g.setMode(Nt.LINE_STRIP)}else r.isPoints?g.setMode(Nt.POINTS):r.isSprite&&g.setMode(Nt.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)Fe("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),g.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))g.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const t=r._multiDrawStarts,e=r._multiDrawCounts,n=r._multiDrawCount,s=l?pt.get(l).bytesPerElement:1,a=rt.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)a.setValue(Nt,"_gl_DrawID",i),g.render(t[i]/s,e[i])}else if(r.isInstancedMesh)g.renderInstances(d,f,r.count);else if(n.isInstancedBufferGeometry){const t=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,e=Math.min(n.instanceCount,t);g.renderInstances(d,f,e)}else g.render(d,f)},this.compile=function(t,e,n=null){null===n&&(n=t),_=Mt.get(n),_.init(e),x.push(_),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(_.pushLight(t),t.castShadow&&_.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(_.pushLight(t),t.castShadow&&_.pushShadow(t))})),_.setupLights();const i=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];kt(s,n,t),i.add(s)}else kt(e,n,t),i.add(e)})),_=x.pop(),i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise((e=>{function n(){i.forEach((function(t){rt.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==J.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Vt=null;function Ht(){Wt.stop()}function Gt(){Wt.start()}const Wt=new go;function qt(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)_.pushLight(t),t.castShadow&&_.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||V.intersectsSprite(t)){i&&X.setFromMatrixPosition(t.matrixWorld).applyMatrix4(q);const e=mt.update(t),r=t.material;r.visible&&v.push(t,e,r,n,X.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||V.intersectsObject(t))){const e=mt.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),X.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),X.copy(e.boundingSphere.center)),X.applyMatrix4(t.matrixWorld).applyMatrix4(q)),Array.isArray(r)){const i=e.groups;for(let s=0,a=i.length;s<a;s++){const a=i[s],o=r[a.materialIndex];o&&o.visible&&v.push(t,e,o,n,X.z,a)}}else r.visible&&v.push(t,e,r,n,X.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)qt(r[t],e,n,i)}function jt(t,e,n,i){const r=t.opaque,s=t.transmissive,a=t.transparent;_.setupLightsView(n),!0===H&&St.setGlobalState(b.clippingPlanes,n),i&&et.viewport(C.copy(i)),r.length>0&&Yt(r,e,n),s.length>0&&Yt(s,e,n),a.length>0&&Yt(a,e,n),et.buffers.depth.setTest(!0),et.buffers.depth.setMask(!0),et.buffers.color.setMask(!0),et.setPolygonOffset(!1)}function Xt(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===_.state.transmissionRenderTarget[i.id]&&(_.state.transmissionRenderTarget[i.id]=new Qe(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?ot:tt,minFilter:Q,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ve.workingColorSpace}));const r=_.state.transmissionRenderTarget[i.id],a=i.viewport||C;r.setSize(a.z*b.transmissionResolutionScale,a.w*b.transmissionResolutionScale);const o=b.getRenderTarget();b.setRenderTarget(r),b.getClearColor(I),N=b.getClearAlpha(),N<1&&b.setClearColor(16777215,.5),b.clear(),Z&&wt.render(n);const l=b.toneMapping;b.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),_.setupLightsView(i),!0===H&&St.setGlobalState(b.clippingPlanes,i),Yt(t,n,i),at.updateMultisampleRenderTarget(r),at.updateRenderTargetMipmap(r),!1===J.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,s=e.length;r<s;r++){const s=e[r],a=s.object,o=s.geometry,l=s.material,c=s.group;if(2===l.side&&a.layers.test(i.layers)){const e=l.side;l.side=1,l.needsUpdate=!0,Zt(a,n,i,o,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(at.updateMultisampleRenderTarget(r),at.updateRenderTargetMipmap(r))}b.setRenderTarget(o),b.setClearColor(I,N),void 0!==c&&(i.viewport=c),b.toneMapping=l}function Yt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],a=s.object,o=s.geometry,l=s.group;let c=s.material;!0===c.allowOverride&&null!==i&&(c=i),a.layers.test(n.layers)&&Zt(a,e,n,o,c,l)}}function Zt(t,e,n,i,r,s){t.onBeforeRender(b,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(b,e,n,i,t,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,b.renderBufferDirect(n,e,i,r,t,s),r.side=0,r.needsUpdate=!0,b.renderBufferDirect(n,e,i,r,t,s),r.side=2):b.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(b,e,n,i,r,s)}function Kt(t,e,n){!0!==e.isScene&&(e=Y);const i=rt.get(t),r=_.state.lights,s=_.state.shadowsArray,a=r.state.version,o=yt.getParameters(t,r.state,s,e,n),l=yt.getProgramCacheKey(o);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?dt:ut).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",zt),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===a)return $t(t,o),h}else o.uniforms=yt.getUniforms(t),t.onBeforeCompile(o,b),h=yt.acquireProgram(o,l),c.set(l,h),i.uniforms=o.uniforms;const u=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=St.uniform),$t(t,o),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=a,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Jt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=rc.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function $t(t,e){const n=rt.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}Wt.setAnimationLoop((function(t){Vt&&Vt(t)})),"undefined"!=typeof self&&Wt.setContext(self),this.setAnimationLoop=function(t){Vt=t,Ut.setAnimationLoop(t),null===t?Wt.stop():Wt.start()},Ut.addEventListener("sessionstart",Ht),Ut.addEventListener("sessionend",Gt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return;if(!0===M)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Ut.enabled&&!0===Ut.isPresenting&&(!0===Ut.cameraAutoUpdate&&Ut.updateCamera(e),e=Ut.getCamera()),!0===t.isScene&&t.onBeforeRender(b,t,e,w),_=Mt.get(t,x.length),_.init(e),x.push(_),q.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),V.setFromProjectionMatrix(q),G=this.localClippingEnabled,H=St.init(this.clippingPlanes,G),v=bt.get(t,y.length),v.init(),y.push(v),!0===Ut.enabled&&!0===Ut.isPresenting){const t=b.xr.getDepthSensingMesh();null!==t&&qt(t,e,-1/0,b.sortObjects)}qt(t,e,0,b.sortObjects),v.finish(),!0===b.sortObjects&&v.sort(O,F),Z=!1===Ut.enabled||!1===Ut.isPresenting||!1===Ut.hasDepthSensing(),Z&&wt.addToRenderList(v,t),this.info.render.frame++,!0===H&&St.beginShadows();const n=_.state.shadowsArray;Et.render(n,t,e),!0===H&&St.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=v.opaque,r=v.transmissive;if(_.setupLights(),e.isArrayCamera){const n=e.cameras;if(r.length>0)for(let e=0,s=n.length;e<s;e++)Xt(i,r,t,n[e]);Z&&wt.render(t);for(let e=0,i=n.length;e<i;e++){const i=n[e];jt(v,t,i,i.viewport)}}else r.length>0&&Xt(i,r,t,e),Z&&wt.render(t),jt(v,t,e);null!==w&&0===E&&(at.updateMultisampleRenderTarget(w),at.updateRenderTargetMipmap(w)),!0===t.isScene&&t.onAfterRender(b,t,e),Pt.resetDefaultState(),T=-1,A=null,x.pop(),x.length>0?(_=x[x.length-1],!0===H&&St.setGlobalState(b.clippingPlanes,_.state.camera)):_=null,y.pop(),v=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){const i=rt.get(t);i.__autoAllocateDepthBuffer=!1===t.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),rt.get(t.texture).__webglTexture=e,rt.get(t.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(t,e){const n=rt.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};const Qt=Nt.createFramebuffer();this.setRenderTarget=function(t,e=0,n=0){w=t,S=e,E=n;let i=!0,r=null,s=!1,a=!1;if(t){const o=rt.get(t);if(void 0!==o.__useDefaultFramebuffer)et.bindFramebuffer(Nt.FRAMEBUFFER,null),i=!1;else if(void 0===o.__webglFramebuffer)at.setupRenderTarget(t);else if(o.__hasExternalTextures)at.rebindTextures(t,rt.get(t.texture).__webglTexture,rt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(o.__boundDepthTexture!==e){if(null!==e&&rt.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");at.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=rt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=t.samples>0&&!1===at.useMultisampledRTT(t)?rt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,C.copy(t.viewport),R.copy(t.scissor),P=t.scissorTest}else C.copy(B).multiplyScalar(U).floor(),R.copy(z).multiplyScalar(U).floor(),P=k;if(0!==n&&(r=Qt),et.bindFramebuffer(Nt.FRAMEBUFFER,r)&&i&&et.drawBuffers(t,r),et.viewport(C),et.scissor(R),et.setScissorTest(P),s){const i=rt.get(t.texture);Nt.framebufferTexture2D(Nt.FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,Nt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(a){const i=rt.get(t.texture),r=e;Nt.framebufferTextureLayer(Nt.FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,i.__webglTexture,n,r)}else if(null!==t&&0!==n){const e=rt.get(t.texture);Nt.framebufferTexture2D(Nt.FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,Nt.TEXTURE_2D,e.__webglTexture,n)}T=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return;let o=rt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){et.bindFramebuffer(Nt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(!$.textureFormatReadable(o))return;if(!$.textureTypeReadable(l))return;e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Nt.readPixels(e,n,i,r,Rt.convert(o),Rt.convert(l),s)}finally{const t=null!==w?rt.get(w).__webglFramebuffer:null;et.bindFramebuffer(Nt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=function(t,e,n,i,r,s,a){return p(this,null,(function*(){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=rt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){et.bindFramebuffer(Nt.FRAMEBUFFER,o);const a=t.texture,l=a.format,c=a.type;if(!$.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!$.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const h=Nt.createBuffer();Nt.bindBuffer(Nt.PIXEL_PACK_BUFFER,h),Nt.bufferData(Nt.PIXEL_PACK_BUFFER,s.byteLength,Nt.STREAM_READ),Nt.readPixels(e,n,i,r,Rt.convert(l),Rt.convert(c),0);const u=null!==w?rt.get(w).__webglFramebuffer:null;et.bindFramebuffer(Nt.FRAMEBUFFER,u);const d=Nt.fenceSync(Nt.SYNC_GPU_COMMANDS_COMPLETE,0);return Nt.flush(),yield function(t,e,n){return new Promise((function(i,r){setTimeout((function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}),n)}))}(Nt,d,4),Nt.bindBuffer(Nt.PIXEL_PACK_BUFFER,h),Nt.getBufferSubData(Nt.PIXEL_PACK_BUFFER,0,s),Nt.deleteBuffer(h),Nt.deleteSync(d),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}}))},this.copyFramebufferToTexture=function(t,e=null,n=0){const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i),a=null!==e?e.x:0,o=null!==e?e.y:0;at.setTexture2D(t,0),Nt.copyTexSubImage2D(Nt.TEXTURE_2D,n,0,0,a,o,r,s),et.unbindTexture()};const te=Nt.createFramebuffer(),ee=Nt.createFramebuffer();this.copyTextureToTexture=function(t,e,n=null,i=null,r=0,s=null){let a,o,l,c,h,u,d,p,f;null===s&&(0!==r?(Fe("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const m=t.isCompressedTexture?t.mipmaps[s]:t.image;if(null!==n)a=n.max.x-n.min.x,o=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,u=n.isBox3?n.min.z:0;else{const e=Math.pow(2,-r);a=Math.floor(m.width*e),o=Math.floor(m.height*e),l=t.isDataArrayTexture?m.depth:t.isData3DTexture?Math.floor(m.depth*e):1,c=0,h=0,u=0}null!==i?(d=i.x,p=i.y,f=i.z):(d=0,p=0,f=0);const g=Rt.convert(e.format),v=Rt.convert(e.type);let _;e.isData3DTexture?(at.setTexture3D(e,0),_=Nt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(at.setTexture2DArray(e,0),_=Nt.TEXTURE_2D_ARRAY):(at.setTexture2D(e,0),_=Nt.TEXTURE_2D),Nt.pixelStorei(Nt.UNPACK_FLIP_Y_WEBGL,e.flipY),Nt.pixelStorei(Nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Nt.pixelStorei(Nt.UNPACK_ALIGNMENT,e.unpackAlignment);const y=Nt.getParameter(Nt.UNPACK_ROW_LENGTH),x=Nt.getParameter(Nt.UNPACK_IMAGE_HEIGHT),b=Nt.getParameter(Nt.UNPACK_SKIP_PIXELS),M=Nt.getParameter(Nt.UNPACK_SKIP_ROWS),S=Nt.getParameter(Nt.UNPACK_SKIP_IMAGES);Nt.pixelStorei(Nt.UNPACK_ROW_LENGTH,m.width),Nt.pixelStorei(Nt.UNPACK_IMAGE_HEIGHT,m.height),Nt.pixelStorei(Nt.UNPACK_SKIP_PIXELS,c),Nt.pixelStorei(Nt.UNPACK_SKIP_ROWS,h),Nt.pixelStorei(Nt.UNPACK_SKIP_IMAGES,u);const E=t.isDataArrayTexture||t.isData3DTexture,w=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const n=rt.get(t),i=rt.get(e),m=rt.get(n.__renderTarget),g=rt.get(i.__renderTarget);et.bindFramebuffer(Nt.READ_FRAMEBUFFER,m.__webglFramebuffer),et.bindFramebuffer(Nt.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<l;n++)E&&(Nt.framebufferTextureLayer(Nt.READ_FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,rt.get(t).__webglTexture,r,u+n),Nt.framebufferTextureLayer(Nt.DRAW_FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,rt.get(e).__webglTexture,s,f+n)),Nt.blitFramebuffer(c,h,a,o,d,p,a,o,Nt.DEPTH_BUFFER_BIT,Nt.NEAREST);et.bindFramebuffer(Nt.READ_FRAMEBUFFER,null),et.bindFramebuffer(Nt.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||rt.has(t)){const n=rt.get(t),i=rt.get(e);et.bindFramebuffer(Nt.READ_FRAMEBUFFER,te),et.bindFramebuffer(Nt.DRAW_FRAMEBUFFER,ee);for(let t=0;t<l;t++)E?Nt.framebufferTextureLayer(Nt.READ_FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,n.__webglTexture,r,u+t):Nt.framebufferTexture2D(Nt.READ_FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,Nt.TEXTURE_2D,n.__webglTexture,r),w?Nt.framebufferTextureLayer(Nt.DRAW_FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,i.__webglTexture,s,f+t):Nt.framebufferTexture2D(Nt.DRAW_FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,Nt.TEXTURE_2D,i.__webglTexture,s),0!==r?Nt.blitFramebuffer(c,h,a,o,d,p,a,o,Nt.COLOR_BUFFER_BIT,Nt.NEAREST):w?Nt.copyTexSubImage3D(_,s,d,p,f+t,c,h,a,o):Nt.copyTexSubImage2D(_,s,d,p,c,h,a,o);et.bindFramebuffer(Nt.READ_FRAMEBUFFER,null),et.bindFramebuffer(Nt.DRAW_FRAMEBUFFER,null)}else w?t.isDataTexture||t.isData3DTexture?Nt.texSubImage3D(_,s,d,p,f,a,o,l,g,v,m.data):e.isCompressedArrayTexture?Nt.compressedTexSubImage3D(_,s,d,p,f,a,o,l,g,m.data):Nt.texSubImage3D(_,s,d,p,f,a,o,l,g,v,m):t.isDataTexture?Nt.texSubImage2D(Nt.TEXTURE_2D,s,d,p,a,o,g,v,m.data):t.isCompressedTexture?Nt.compressedTexSubImage2D(Nt.TEXTURE_2D,s,d,p,m.width,m.height,g,m.data):Nt.texSubImage2D(Nt.TEXTURE_2D,s,d,p,a,o,g,v,m);Nt.pixelStorei(Nt.UNPACK_ROW_LENGTH,y),Nt.pixelStorei(Nt.UNPACK_IMAGE_HEIGHT,x),Nt.pixelStorei(Nt.UNPACK_SKIP_PIXELS,b),Nt.pixelStorei(Nt.UNPACK_SKIP_ROWS,M),Nt.pixelStorei(Nt.UNPACK_SKIP_IMAGES,S),0===s&&e.generateMipmaps&&Nt.generateMipmap(_),et.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){return Fe('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===rt.get(t).__webglFramebuffer&&at.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?at.setTextureCube(t,0):t.isData3DTexture?at.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?at.setTexture2DArray(t,0):at.setTexture2D(t,0),et.unbindTexture()},this.resetState=function(){S=0,E=0,w=null,et.reset(),Pt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return _e}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Ve._getDrawingBufferColorSpace(t),e.unpackColorSpace=Ve._getUnpackColorSpace()}}function $c(){}class Qc extends xe{constructor(){super(),d(this,"isProxy",!0),d(this,"width"),d(this,"height"),d(this,"left"),d(this,"right"),d(this,"top"),d(this,"bottom"),d(this,"style",{})}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:(this.left||0)+(this.width||0),bottom:(this.top||0)+(this.height||0)}}handleEvent(t){if("size"===t.type)return this.left=t.left,this.top=t.top,this.width=t.width,void(this.height=t.height);t.preventDefault=$c,t.stopPropagation=$c,this.dispatchEvent(t)}focus(){}getRootNode(){return{addEventListener:$c,removeEventListener:$c}}}class th{constructor(){d(this,"targets",{}),this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:e}=t,n=new Qc;this.targets[e]=n}getProxy(t){return this.targets[t]}handleEvent(t){var e;null==(e=this.targets[t.id])||e.handleEvent(t.data)}static instance(){return eh}}const eh=new th;function nh(t,e){const n=t.x*Math.cos(e)-t.y*Math.sin(e),i=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=n,t.y=i}function ih(t,e){t.x*=e,t.y*=e}class rh{constructor(t){d(this,"commands"),this.commands=[],t&&t instanceof rh?this.commands.push(...t.commands):t&&(this.commands=function(t){const e=[],n=String(t).trim();return"M"!==n[0]&&"m"!==n[0]||n.replace(oh,((t,n,i)=>{const r=function(t){const e=t.match(lh);return e?e.map(Number):[]}(i);let s=n.toLowerCase(),a=n;if("m"===s&&r.length>2&&(e.push([a,...r.splice(0,2)]),s="l",a="m"===a?"l":"L"),r.length<ah[s])return"";for(e.push([a,...r.splice(0,ah[s])]);r.length>=ah[s]&&r.length&&ah[s];)e.push([a,...r.splice(0,ah[s])]);return""})),e}(t))}addPath(t){t&&t instanceof rh&&this.commands.push(...t.commands)}moveTo(t,e){this.commands.push(["M",t,e])}lineTo(t,e){this.commands.push(["L",t,e])}arc(t,e,n,i,r,s){this.commands.push(["AC",t,e,n,i,r,!!s])}arcTo(t,e,n,i,r){this.commands.push(["AT",t,e,n,i,r])}ellipse(t,e,n,i,r,s,a,o){this.commands.push(["E",t,e,n,i,r,s,a,!!o])}closePath(){this.commands.push(["Z"])}bezierCurveTo(t,e,n,i,r,s){this.commands.push(["C",t,e,n,i,r,s])}quadraticCurveTo(t,e,n,i){this.commands.push(["Q",t,e,n,i])}rect(t,e,n,i){this.commands.push(["R",t,e,n,i])}roundRect(t,e,n,i,r){void 0===r?this.commands.push(["RR",t,e,n,i,0]):this.commands.push(["RR",t,e,n,i,r])}}function sh(t,e){let n,i,r,s,a,o,l,c,h,u,d,p,f,m,g,v,_,y,x,b,M,S=0,E=0,w=null,T=null,A=null,C=null,R=null,P=null;t.beginPath();for(let L=0;L<e.length;++L){let U;switch(y=e[L][0],"S"!==y&&"s"!==y&&"C"!==y&&"c"!==y&&(w=null,T=null),"T"!==y&&"t"!==y&&"Q"!==y&&"q"!==y&&(A=null,C=null),y){case"m":case"M":U=e[L],"m"===y?(S+=U[1],E+=U[2]):(S=U[1],E=U[2]),"M"!==y&&R||(R={x:S,y:E}),t.moveTo(S,E);break;case"l":U=e[L],S+=U[1],E+=U[2],t.lineTo(S,E);break;case"L":U=e[L],S=U[1],E=U[2],t.lineTo(S,E);break;case"H":U=e[L],S=U[1],t.lineTo(S,E);break;case"h":U=e[L],S+=U[1],t.lineTo(S,E);break;case"V":U=e[L],E=U[1],t.lineTo(S,E);break;case"v":U=e[L],E+=U[1],t.lineTo(S,E);break;case"a":case"A":if(U=e[L],null===P)throw new Error("This should never happen");"a"===y?(S+=U[6],E+=U[7]):(S=U[6],E=U[7]),m=U[1],g=U[2],l=U[3]*Math.PI/180,r=!!U[4],s=!!U[5],a={x:S,y:E},o={x:(P.x-a.x)/2,y:(P.y-a.y)/2},nh(o,-l),c=o.x*o.x/(m*m)+o.y*o.y/(g*g),c>1&&(c=Math.sqrt(c),m*=c,g*=c),x={x:m*o.y/g,y:-g*o.x/m},h=m*m*g*g,u=m*m*o.y*o.y+g*g*o.x*o.x,ih(x,s!==r?Math.sqrt((h-u)/u)||0:-Math.sqrt((h-u)/u)||0),i=Math.atan2((o.y-x.y)/g,(o.x-x.x)/m),n=Math.atan2(-(o.y+x.y)/g,-(o.x+x.x)/m),nh(x,l),I=x,N=(a.x+P.x)/2,D=(a.y+P.y)/2,I.x+=N,I.y+=D,t.save(),t.translate(x.x,x.y),t.rotate(l),t.scale(m,g),t.arc(0,0,1,i,n,!s),t.restore();break;case"C":U=e[L],w=U[3],T=U[4],S=U[5],E=U[6],t.bezierCurveTo(U[1],U[2],w,T,S,E);break;case"c":U=e[L],t.bezierCurveTo(U[1]+S,U[2]+E,U[3]+S,U[4]+E,U[5]+S,U[6]+E),w=U[3]+S,T=U[4]+E,S+=U[5],E+=U[6];break;case"S":U=e[L],null!==w&&null!==T||(w=S,T=E),t.bezierCurveTo(2*S-w,2*E-T,U[1],U[2],U[3],U[4]),w=U[1],T=U[2],S=U[3],E=U[4];break;case"s":U=e[L],null!==w&&null!==T||(w=S,T=E),t.bezierCurveTo(2*S-w,2*E-T,U[1]+S,U[2]+E,U[3]+S,U[4]+E),w=U[1]+S,T=U[2]+E,S+=U[3],E+=U[4];break;case"Q":U=e[L],A=U[1],C=U[2],S=U[3],E=U[4],t.quadraticCurveTo(A,C,S,E);break;case"q":U=e[L],A=U[1]+S,C=U[2]+E,S+=U[3],E+=U[4],t.quadraticCurveTo(A,C,S,E);break;case"T":U=e[L],null!==A&&null!==C||(A=S,C=E),A=2*S-A,C=2*E-C,S=U[1],E=U[2],t.quadraticCurveTo(A,C,S,E);break;case"t":U=e[L],null!==A&&null!==C||(A=S,C=E),A=2*S-A,C=2*E-C,S+=U[1],E+=U[2],t.quadraticCurveTo(A,C,S,E);break;case"z":case"Z":R&&(S=R.x,E=R.y),R=null,t.closePath();break;case"AC":U=e[L],S=U[1],E=U[2],f=U[3],i=U[4],n=U[5],b=U[6],t.arc(S,E,f,i,n,b);break;case"AT":U=e[L],d=U[1],p=U[2],S=U[3],E=U[4],f=U[5],t.arcTo(d,p,S,E,f);break;case"E":U=e[L],S=U[1],E=U[2],m=U[3],g=U[4],l=U[5],i=U[6],n=U[7],b=U[8],t.save(),t.translate(S,E),t.rotate(l),t.scale(m,g),t.arc(0,0,1,i,n,b),t.restore();break;case"R":U=e[L],S=U[1],E=U[2],v=U[3],_=U[4],R={x:S,y:E},t.rect(S,E,v,_);break;case"RR":U=e[L],S=U[1],E=U[2],v=U[3],_=U[4],M=U[5],R={x:S,y:E},t.roundRect(S,E,v,_,M)}P?(P.x=S,P.y=E):P={x:S,y:E}}var I,N,D}const ah={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},oh=/([astvzqmhlc])([^astvzqmhlc]*)/gi,lh=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var ch="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function hh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uh={},dh={};function ph(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var fh=ph({HTML:"text/html",isHTML:function(t){return t===fh.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),mh=ph({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===mh.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});dh.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},dh.find=function(t,e,n){if(void 0===n&&(n=Array.prototype),t&&"function"==typeof n.find)return n.find.call(t,e);for(var i=0;i<t.length;i++)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];if(e.call(void 0,r,i,t))return r}},dh.freeze=ph,dh.MIME_TYPE=fh,dh.NAMESPACE=mh;var gh=dh,vh=gh.find,_h=gh.NAMESPACE;function yh(t){return""!==t}function xh(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function bh(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(yh):[]}(t);return Object.keys(e.reduce(xh,{}))}function Mh(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Sh(t,e){var n=t.prototype;if(!(n instanceof e)){let i=function(){};i.prototype=e.prototype,i=new i,Mh(n,i),t.prototype=n=i}n.constructor!=t&&(n.constructor=t)}var Eh={},wh=Eh.ELEMENT_NODE=1,Th=Eh.ATTRIBUTE_NODE=2,Ah=Eh.TEXT_NODE=3,Ch=Eh.CDATA_SECTION_NODE=4,Rh=Eh.ENTITY_REFERENCE_NODE=5,Ph=Eh.ENTITY_NODE=6,Ih=Eh.PROCESSING_INSTRUCTION_NODE=7,Nh=Eh.COMMENT_NODE=8,Dh=Eh.DOCUMENT_NODE=9,Lh=Eh.DOCUMENT_TYPE_NODE=10,Uh=Eh.DOCUMENT_FRAGMENT_NODE=11,Oh=Eh.NOTATION_NODE=12,Fh={},Bh={};Fh.INDEX_SIZE_ERR=(Bh[1]="Index size error",1),Fh.DOMSTRING_SIZE_ERR=(Bh[2]="DOMString size error",2);var zh=Fh.HIERARCHY_REQUEST_ERR=(Bh[3]="Hierarchy request error",3);Fh.WRONG_DOCUMENT_ERR=(Bh[4]="Wrong document",4),Fh.INVALID_CHARACTER_ERR=(Bh[5]="Invalid character",5),Fh.NO_DATA_ALLOWED_ERR=(Bh[6]="No data allowed",6),Fh.NO_MODIFICATION_ALLOWED_ERR=(Bh[7]="No modification allowed",7);var kh=Fh.NOT_FOUND_ERR=(Bh[8]="Not found",8);Fh.NOT_SUPPORTED_ERR=(Bh[9]="Not supported",9);var Vh=Fh.INUSE_ATTRIBUTE_ERR=(Bh[10]="Attribute in use",10);function Hh(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,Bh[t]),this.message=Bh[t],Error.captureStackTrace&&Error.captureStackTrace(this,Hh);return n.code=t,e&&(this.message=this.message+": "+e),n}function Gh(){}function Wh(t,e){this._node=t,this._refresh=e,qh(this)}function qh(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(Nu(t,"length",n.length),!t.$$length||n.length<t.$$length)for(var i=n.length;i in t;i++)Object.prototype.hasOwnProperty.call(t,i)&&delete t[i];Mh(n,t),t._inc=e}}function jh(){}function Xh(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function Yh(t,e,n,i){if(i?e[Xh(e,i)]=n:e[e.length++]=n,t){n.ownerElement=t;var r=t.ownerDocument;r&&(i&&eu(r,t,i),function(t,e,n){t&&t._inc++;var i=n.namespaceURI;i===_h.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}(r,t,n))}}function Zh(t,e,n){var i=Xh(e,n);if(!(i>=0))throw new Hh(kh,new Error(t.tagName+"@"+n));for(var r=e.length-1;i<r;)e[i]=e[++i];if(e.length=r,t){var s=t.ownerDocument;s&&(eu(s,t,n),n.ownerElement=null)}}function Kh(){}function Jh(){}function $h(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function Qh(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(Qh(t,e))return!0}while(t=t.nextSibling)}function tu(){this.ownerDocument=this}function eu(t,e,n,i){t&&t._inc++,n.namespaceURI===_h.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function nu(t,e,n){if(t&&t._inc){t._inc++;var i=e.childNodes;if(n)i[i.length++]=n;else{for(var r=e.firstChild,s=0;r;)i[s++]=r,r=r.nextSibling;i.length=s,delete i[i.length]}}}function iu(t,e){var n=e.previousSibling,i=e.nextSibling;return n?n.nextSibling=i:t.firstChild=i,i?i.previousSibling=n:t.lastChild=n,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,nu(t.ownerDocument,t),e}function ru(t){return t&&t.nodeType===Jh.DOCUMENT_TYPE_NODE}function su(t){return t&&t.nodeType===Jh.ELEMENT_NODE}function au(t){return t&&t.nodeType===Jh.TEXT_NODE}function ou(t,e){var n=t.childNodes||[];if(vh(n,su)||ru(e))return!1;var i=vh(n,ru);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function lu(t,e){var n=t.childNodes||[];if(vh(n,(function(t){return su(t)&&t!==e})))return!1;var i=vh(n,ru);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function cu(t,e,n){if(!function(t){return t&&(t.nodeType===Jh.DOCUMENT_NODE||t.nodeType===Jh.DOCUMENT_FRAGMENT_NODE||t.nodeType===Jh.ELEMENT_NODE)}(t))throw new Hh(zh,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new Hh(kh,"child not in parent");if(!function(t){return t&&(su(t)||au(t)||ru(t)||t.nodeType===Jh.DOCUMENT_FRAGMENT_NODE||t.nodeType===Jh.COMMENT_NODE||t.nodeType===Jh.PROCESSING_INSTRUCTION_NODE)}(e)||ru(e)&&t.nodeType!==Jh.DOCUMENT_NODE)throw new Hh(zh,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function hu(t,e,n){var i=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===Jh.DOCUMENT_FRAGMENT_NODE){var s=r.filter(su);if(s.length>1||vh(r,au))throw new Hh(zh,"More than one element or text in fragment");if(1===s.length&&!ou(t,n))throw new Hh(zh,"Element in fragment can not be inserted before doctype")}if(su(e)&&!ou(t,n))throw new Hh(zh,"Only one element can be added and only after doctype");if(ru(e)){if(vh(i,ru))throw new Hh(zh,"Only one doctype is allowed");var a=vh(i,su);if(n&&i.indexOf(a)<i.indexOf(n))throw new Hh(zh,"Doctype can only be inserted before an element");if(!n&&a)throw new Hh(zh,"Doctype can not be appended since element is present")}}function uu(t,e,n){var i=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===Jh.DOCUMENT_FRAGMENT_NODE){var s=r.filter(su);if(s.length>1||vh(r,au))throw new Hh(zh,"More than one element or text in fragment");if(1===s.length&&!lu(t,n))throw new Hh(zh,"Element in fragment can not be inserted before doctype")}if(su(e)&&!lu(t,n))throw new Hh(zh,"Only one element can be added and only after doctype");if(ru(e)){let t=function(t){return ru(t)&&t!==n};if(vh(i,t))throw new Hh(zh,"Only one doctype is allowed");var a=vh(i,su);if(n&&i.indexOf(a)<i.indexOf(n))throw new Hh(zh,"Doctype can only be inserted before an element")}}function du(t,e,n,i){cu(t,e,n),t.nodeType===Jh.DOCUMENT_NODE&&(i||hu)(t,e,n);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===Uh){var s=e.firstChild;if(null==s)return e;var a=e.lastChild}else s=a=e;var o=n?n.previousSibling:t.lastChild;s.previousSibling=o,a.nextSibling=n,o?o.nextSibling=s:t.firstChild=s,null==n?t.lastChild=a:n.previousSibling=a;do{s.parentNode=t}while(s!==a&&(s=s.nextSibling));return nu(t.ownerDocument||t,t),e.nodeType==Uh&&(e.firstChild=e.lastChild=null),e}function pu(){this._nsMap={}}function fu(){}function mu(){}function gu(){}function vu(){}function _u(){}function yu(){}function xu(){}function bu(){}function Mu(){}function Su(){}function Eu(){}function wu(){}function Tu(t,e){var n=[],i=9==this.nodeType&&this.documentElement||this,r=i.prefix,s=i.namespaceURI;if(s&&null==r&&null==(r=i.lookupPrefix(s)))var a=[{namespace:s,prefix:null}];return Ru(this,n,t,e,a),n.join("")}function Au(t,e,n){var i=t.prefix||"",r=t.namespaceURI;if(!r)return!1;if("xml"===i&&r===_h.XML||r===_h.XMLNS)return!1;for(var s=n.length;s--;){var a=n[s];if(a.prefix===i)return a.namespace!==r}return!0}function Cu(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,$h),'"')}function Ru(t,e,n,i,r){if(r||(r=[]),i){if(!(t=i(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case wh:var s=t.attributes,a=s.length,o=t.firstChild,l=t.tagName,c=l;if(!(n=_h.isHTML(t.namespaceURI)||n)&&!t.prefix&&t.namespaceURI){for(var h,u=0;u<s.length;u++)if("xmlns"===s.item(u).name){h=s.item(u).value;break}if(!h)for(var d=r.length-1;d>=0;d--)if(""===(p=r[d]).prefix&&p.namespace===t.namespaceURI){h=p.namespace;break}if(h!==t.namespaceURI)for(d=r.length-1;d>=0;d--){var p;if((p=r[d]).namespace===t.namespaceURI){p.prefix&&(c=p.prefix+":"+l);break}}}e.push("<",c);for(var f=0;f<a;f++)"xmlns"==(m=s.item(f)).prefix?r.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&r.push({prefix:"",namespace:m.value});for(f=0;f<a;f++){var m,g,v;Au(m=s.item(f),0,r)&&(Cu(e,(g=m.prefix||"")?"xmlns:"+g:"xmlns",v=m.namespaceURI),r.push({prefix:g,namespace:v})),Ru(m,e,n,i,r)}if(l===c&&Au(t,0,r)&&(Cu(e,(g=t.prefix||"")?"xmlns:"+g:"xmlns",v=t.namespaceURI),r.push({prefix:g,namespace:v})),o||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),n&&/^script$/i.test(l))for(;o;)o.data?e.push(o.data):Ru(o,e,n,i,r.slice()),o=o.nextSibling;else for(;o;)Ru(o,e,n,i,r.slice()),o=o.nextSibling;e.push("</",c,">")}else e.push("/>");return;case Dh:case Uh:for(o=t.firstChild;o;)Ru(o,e,n,i,r.slice()),o=o.nextSibling;return;case Th:return Cu(e,t.name,t.value);case Ah:return e.push(t.data.replace(/[<&>]/g,$h));case Ch:return e.push("<![CDATA[",t.data,"]]>");case Nh:return e.push("\x3c!--",t.data,"--\x3e");case Lh:var _=t.publicId,y=t.systemId;if(e.push("<!DOCTYPE ",t.name),_)e.push(" PUBLIC ",_),y&&"."!=y&&e.push(" ",y),e.push(">");else if(y&&"."!=y)e.push(" SYSTEM ",y,">");else{var x=t.internalSubset;x&&e.push(" [",x,"]"),e.push(">")}return;case Ih:return e.push("<?",t.target," ",t.data,"?>");case Rh:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function Pu(t,e,n){var i;switch(e.nodeType){case wh:(i=e.cloneNode(!1)).ownerDocument=t;case Uh:break;case Th:n=!0}if(i||(i=e.cloneNode(!1)),i.ownerDocument=t,i.parentNode=null,n)for(var r=e.firstChild;r;)i.appendChild(Pu(t,r,n)),r=r.nextSibling;return i}function Iu(t,e,n){var i=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=e[r];"object"!=typeof s&&s!=i[r]&&(i[r]=s)}switch(e.childNodes&&(i.childNodes=new Gh),i.ownerDocument=t,i.nodeType){case wh:var a=e.attributes,o=i.attributes=new jh,l=a.length;o._ownerElement=i;for(var c=0;c<l;c++)i.setAttributeNode(Iu(t,a.item(c),!0));break;case Th:n=!0}if(n)for(var h=e.firstChild;h;)i.appendChild(Iu(t,h,n)),h=h.nextSibling;return i}function Nu(t,e,n){t[e]=n}Fh.INVALID_STATE_ERR=(Bh[11]="Invalid state",11),Fh.SYNTAX_ERR=(Bh[12]="Syntax error",12),Fh.INVALID_MODIFICATION_ERR=(Bh[13]="Invalid modification",13),Fh.NAMESPACE_ERR=(Bh[14]="Invalid namespace",14),Fh.INVALID_ACCESS_ERR=(Bh[15]="Invalid access",15),Hh.prototype=Error.prototype,Mh(Fh,Hh),Gh.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var n=[],i=0;i<this.length;i++)Ru(this[i],n,t,e);return n.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},Wh.prototype.item=function(t){return qh(this),this[t]||null},Sh(Wh,Gh),jh.prototype={length:0,item:Gh.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var n=this[e];if(n.nodeName==t)return n}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new Hh(Vh);var n=this.getNamedItem(t.nodeName);return Yh(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e,n=t.ownerElement;if(n&&n!=this._ownerElement)throw new Hh(Vh);return e=this.getNamedItemNS(t.namespaceURI,t.localName),Yh(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return Zh(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return Zh(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){for(var n=this.length;n--;){var i=this[n];if(i.localName==e&&i.namespaceURI==t)return i}return null}},Kh.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var i=new tu;if(i.implementation=this,i.childNodes=new Gh,i.doctype=n||null,n&&i.appendChild(n),e){var r=i.createElementNS(t,e);i.appendChild(r)}return i},createDocumentType:function(t,e,n){var i=new yu;return i.name=t,i.nodeName=t,i.publicId=e||"",i.systemId=n||"",i}},Jh.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return du(this,t,e)},replaceChild:function(t,e){du(this,t,e,uu),e&&this.removeChild(e)},removeChild:function(t){return iu(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Iu(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==Ah&&t.nodeType==Ah?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n)for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&n[i]===t)return i;e=e.nodeType==Th?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,t))return n[t];e=e.nodeType==Th?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},Mh(Eh,Jh),Mh(Eh,Jh.prototype),tu.prototype={nodeName:"#document",nodeType:Dh,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==Uh){for(var n=t.firstChild;n;){var i=n.nextSibling;this.insertBefore(n,e),n=i}return t}return du(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===wh&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),iu(this,t)},replaceChild:function(t,e){du(this,t,e,uu),t.ownerDocument=this,e&&this.removeChild(e),su(t)&&(this.documentElement=t)},importNode:function(t,e){return Pu(this,t,e)},getElementById:function(t){var e=null;return Qh(this.documentElement,(function(n){if(n.nodeType==wh&&n.getAttribute("id")==t)return e=n,!0})),e},getElementsByClassName:function(t){var e=bh(t);return new Wh(this,(function(n){var i=[];return e.length>0&&Qh(n.documentElement,(function(r){if(r!==n&&r.nodeType===wh){var s=r.getAttribute("class");if(s){var a=t===s;if(!a){var o=bh(s);a=e.every((l=o,function(t){return l&&-1!==l.indexOf(t)}))}a&&i.push(r)}}var l})),i}))},createElement:function(t){var e=new pu;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Gh,(e.attributes=new jh)._ownerElement=e,e},createDocumentFragment:function(){var t=new Su;return t.ownerDocument=this,t.childNodes=new Gh,t},createTextNode:function(t){var e=new gu;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new vu;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new _u;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Eu;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new fu;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Mu;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new pu,i=e.split(":"),r=n.attributes=new jh;return n.childNodes=new Gh,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=e,r._ownerElement=n,n},createAttributeNS:function(t,e){var n=new fu,i=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=e,n}},Sh(tu,Jh),pu.prototype={nodeType:wh,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===Uh?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,nu(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var i=this.ownerDocument.createAttributeNS(t,e);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new Wh(this,(function(e){var n=[];return Qh(e,(function(i){i===e||i.nodeType!=wh||"*"!==t&&i.tagName!=t||n.push(i)})),n}))},getElementsByTagNameNS:function(t,e){return new Wh(this,(function(n){var i=[];return Qh(n,(function(r){r===n||r.nodeType!==wh||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||i.push(r)})),i}))}},tu.prototype.getElementsByTagName=pu.prototype.getElementsByTagName,tu.prototype.getElementsByTagNameNS=pu.prototype.getElementsByTagNameNS,Sh(pu,Jh),fu.prototype.nodeType=Th,Sh(fu,Jh),mu.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(Bh[zh])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){n=this.data.substring(0,t)+n+this.data.substring(t+e),this.nodeValue=this.data=n,this.length=n.length}},Sh(mu,Jh),gu.prototype={nodeName:"#text",nodeType:Ah,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},Sh(gu,mu),vu.prototype={nodeName:"#comment",nodeType:Nh},Sh(vu,mu),_u.prototype={nodeName:"#cdata-section",nodeType:Ch},Sh(_u,mu),yu.prototype.nodeType=Lh,Sh(yu,Jh),xu.prototype.nodeType=Oh,Sh(xu,Jh),bu.prototype.nodeType=Ph,Sh(bu,Jh),Mu.prototype.nodeType=Rh,Sh(Mu,Jh),Su.prototype.nodeName="#document-fragment",Su.prototype.nodeType=Uh,Sh(Su,Jh),Eu.prototype.nodeType=Ih,Sh(Eu,Jh),wu.prototype.serializeToString=function(t,e,n){return Tu.call(t,e,n)},Jh.prototype.toString=Tu;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case wh:case Uh:var n=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&n.push(t(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}};Object.defineProperty(Wh.prototype,"length",{get:function(){return qh(this),this.$$length}}),Object.defineProperty(Jh.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case wh:case Uh:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Nu=function(t,e,n){t["$$"+e]=n}}}catch(t){}uh.DocumentType=yu,uh.DOMException=Hh,uh.DOMImplementation=Kh,uh.Element=pu,uh.Node=Jh,uh.NodeList=Gh,uh.XMLSerializer=wu;var Du,Lu,Uu={},Ou={};Du=Ou,Lu=dh.freeze,Du.XML_ENTITIES=Lu({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),Du.HTML_ENTITIES=Lu({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),Du.entityMap=Du.HTML_ENTITIES;var Fu={},Bu=dh.NAMESPACE,zu=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,ku=new RegExp("[\\-\\.0-9"+zu.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Vu=new RegExp("^"+zu.source+ku.source+"*(?::"+zu.source+ku.source+"*)?$");function Hu(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Hu)}function Gu(){}function Wu(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function qu(t,e,n,i,r,s){function a(t,e,i){n.attributeNames.hasOwnProperty(t)&&s.fatalError("Attribute "+t+" redefined"),n.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),i)}for(var o,l=++e,c=0;;){var h=t.charAt(l);switch(h){case"=":if(1===c)o=t.slice(e,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(s.warning('attribute value must after "="'),o=t.slice(e,l)),e=l+1,!((l=t.indexOf(h,e))>0))throw new Error("attribute value no end '"+h+"' match");a(o,u=t.slice(e,l),e-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');a(o,u=t.slice(e,l),e),s.warning('attribute "'+o+'" missed start quot('+h+")!!"),e=l+1,c=5}break;case"/":switch(c){case 0:n.setTagName(t.slice(e,l));case 5:case 6:case 7:c=7,n.closed=!0;case 4:case 1:break;case 2:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==c&&n.setTagName(t.slice(e,l)),l;case">":switch(c){case 0:n.setTagName(t.slice(e,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=t.slice(e,l)).slice(-1)&&(n.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=o),4==c?(s.warning('attribute "'+u+'" missed quot(")!'),a(o,u,e)):(Bu.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case 3:throw new Error("attribute value missed!!")}return l;case"":h=" ";default:if(h<=" ")switch(c){case 0:n.setTagName(t.slice(e,l)),c=6;break;case 1:o=t.slice(e,l),c=2;break;case 4:var u=t.slice(e,l);s.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,e);case 5:c=6}else switch(c){case 2:n.tagName,Bu.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=l,c=1;break;case 5:s.warning('attribute space is required"'+o+'"!!');case 6:c=1,e=l;break;case 3:c=4,e=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function ju(t,e,n){for(var i=t.tagName,r=null,s=t.length;s--;){var a=t[s],o=a.qName,l=a.value;if((d=o.indexOf(":"))>0)var c=a.prefix=o.slice(0,d),h=o.slice(d+1),u="xmlns"===c&&h;else h=o,c=null,u="xmlns"===o&&"";a.localName=h,!1!==u&&(null==r&&(r={},Zu(n,n={})),n[u]=r[u]=l,a.uri=Bu.XMLNS,e.startPrefixMapping(u,l))}for(s=t.length;s--;)(c=(a=t[s]).prefix)&&("xml"===c&&(a.uri=Bu.XML),"xmlns"!==c&&(a.uri=n[c||""]));var d;(d=i.indexOf(":"))>0?(c=t.prefix=i.slice(0,d),h=t.localName=i.slice(d+1)):(c=null,h=t.localName=i);var p=t.uri=n[c||""];if(e.startElement(p,h,i,t),!t.closed)return t.currentNSMap=n,t.localNSMap=r,!0;if(e.endElement(p,h,i),r)for(c in r)Object.prototype.hasOwnProperty.call(r,c)&&e.endPrefixMapping(c)}function Xu(t,e,n,i,r){if(/^(?:script|textarea)$/i.test(n)){var s=t.indexOf("</"+n+">",e),a=t.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(n)?(r.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,i),r.characters(a,0,a.length),s)}return e+1}function Yu(t,e,n,i){var r=i[n];return null==r&&((r=t.lastIndexOf("</"+n+">"))<e&&(r=t.lastIndexOf("</"+n)),i[n]=r),r<e}function Zu(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Ku(t,e,n,i){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(r=t.indexOf("--\x3e",e+4))>e?(n.comment(t,e+4,r-e-4),r+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var r=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,r-e-9),n.endCDATA(),r+3}var s=function(t,e){var n,i=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(t);n=r.exec(t);)if(i.push(n),n[1])return i}(t,e),a=s.length;if(a>1&&/!doctype/i.test(s[0][0])){var o=s[1][0],l=!1,c=!1;a>3&&(/^public$/i.test(s[2][0])?(l=s[3][0],c=a>4&&s[4][0]):/^system$/i.test(s[2][0])&&(c=s[3][0]));var h=s[a-1];return n.startDTD(o,l,c),n.endDTD(),h.index+h[0].length}return-1}function Ju(t,e,n){var i=t.indexOf("?>",e);if(i){var r=t.substring(e,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,n.processingInstruction(r[1],r[2]),i+2):-1}return-1}function $u(){this.attributeNames={}}Hu.prototype=new Error,Hu.prototype.name=Hu.name,Gu.prototype={parse:function(t,e,n){var i=this.domBuilder;i.startDocument(),Zu(e,e={}),function(t,e,n,i,r){function s(t){if(t>65535){var e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}function a(t){var e=t.slice(1,-1);return Object.hasOwnProperty.call(n,e)?n[e]:"#"===e.charAt(0)?s(parseInt(e.substr(1).replace("x","0x"))):(r.error("entity not found:"+t),t)}function o(e){if(e>m){var n=t.substring(m,e).replace(/&#?\w+;/g,a);d&&l(m),i.characters(n,0,e-m),m=e}}function l(e,n){for(;e>=h&&(n=u.exec(t));)c=n.index,h=c+n[0].length,d.lineNumber++;d.columnNumber=e-c+1}for(var c=0,h=0,u=/.*(?:\r\n?|\n)|.*$/g,d=i.locator,p=[{currentNSMap:e}],f={},m=0;;){try{var g=t.indexOf("<",m);if(g<0){if(!t.substr(m).match(/^\s*$/)){var v=i.doc,_=v.createTextNode(t.substr(m));v.appendChild(_),i.currentElement=_}return}switch(g>m&&o(g),t.charAt(g+1)){case"/":var y=t.indexOf(">",g+3),x=t.substring(g+2,y).replace(/[ \t\n\r]+$/g,""),b=p.pop();y<0?(x=t.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+x+" is not complete:"+b.tagName),y=g+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),r.error("end tag name: "+x+" maybe not complete"),y=g+1+x.length);var M=b.localNSMap,S=b.tagName==x;if(S||b.tagName&&b.tagName.toLowerCase()==x.toLowerCase()){if(i.endElement(b.uri,b.localName,x),M)for(var E in M)Object.prototype.hasOwnProperty.call(M,E)&&i.endPrefixMapping(E);S||r.fatalError("end tag name: "+x+" is not match the current start tagName:"+b.tagName)}else p.push(b);y++;break;case"?":d&&l(g),y=Ju(t,g,i);break;case"!":d&&l(g),y=Ku(t,g,i,r);break;default:d&&l(g);var w=new $u,T=p[p.length-1].currentNSMap,A=(y=qu(t,g,w,T,a,r),w.length);if(!w.closed&&Yu(t,y,w.tagName,f)&&(w.closed=!0,n.nbsp||r.warning("unclosed xml attribute")),d&&A){for(var C=Wu(d,{}),R=0;R<A;R++){var P=w[R];l(P.offset),P.locator=Wu(d,{})}i.locator=C,ju(w,i,T)&&p.push(w),i.locator=d}else ju(w,i,T)&&p.push(w);Bu.isHTML(w.uri)&&!w.closed?y=Xu(t,y,w.tagName,a,i):y++}}catch(t){if(t instanceof Hu)throw t;r.error("element parse error: "+t),y=-1}y>m?m=y:o(Math.max(g,m)+1)}}(t,e,n,i,this.errorHandler),i.endDocument()}},$u.prototype={setTagName:function(t){if(!Vu.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!Vu.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},Fu.XMLReader=Gu,Fu.ParseError=Hu;var Qu=dh,td=Ou,ed=Fu,nd=uh.DOMImplementation,id=Qu.NAMESPACE,rd=ed.ParseError,sd=ed.XMLReader;function ad(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function od(t){this.options=t||{locator:{}}}function ld(){this.cdata=!1}function cd(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function hd(t,e,n){return"string"==typeof t?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}function ud(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}od.prototype.parseFromString=function(t,e){var n=this.options,i=new sd,r=n.domBuilder||new ld,s=n.errorHandler,a=n.locator,o=n.xmlns||{},l=/\/x?html?$/.test(e),c=l?td.HTML_ENTITIES:td.XML_ENTITIES;a&&r.setDocumentLocator(a),i.errorHandler=function(t,e,n){if(!t){if(e instanceof ld)return e;t=e}var i={},r=t instanceof Function;function s(e){var s=t[e];!s&&r&&(s=2==t.length?function(n){t(e,n)}:t),i[e]=s&&function(t){s("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(n))}||function(){}}return n=n||{},s("warning"),s("error"),s("fatalError"),i}(s,r,a),i.domBuilder=n.domBuilder||r,l&&(o[""]=id.HTML),o.xml=o.xml||id.XML;var h=n.normalizeLineEndings||ad;return t&&"string"==typeof t?i.parse(h(t),o,c):i.errorHandler.error("invalid doc source"),r.doc},ld.prototype={startDocument:function(){this.doc=(new nd).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,i){var r=this.doc,s=r.createElementNS(t,n||e),a=i.length;ud(this,s),this.currentElement=s,this.locator&&cd(this.locator,s);for(var o=0;o<a;o++){t=i.getURI(o);var l=i.getValue(o),c=(n=i.getQName(o),r.createAttributeNS(t,n));this.locator&&cd(i.getLocator(o),c),c.value=c.nodeValue=l,s.setAttributeNode(c)}},endElement:function(t,e,n){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&cd(this.locator,n),ud(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=hd.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(t);else i=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(t)&&this.doc.appendChild(i),this.locator&&cd(this.locator,i)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,n){t=hd.apply(this,arguments);var i=this.doc.createComment(t);this.locator&&cd(this.locator,i),ud(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var r=i.createDocumentType(t,e,n);this.locator&&cd(this.locator,r),ud(this,r),this.doc.doctype=r}},warning:function(t){},error:function(t){},fatalError:function(t){throw new rd(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){ld.prototype[t]=function(){return null}})),Uu.__DOMHandler=ld,Uu.normalizeLineEndings=ad,Uu.DOMParser=od;var dd=Uu.DOMParser;const pd="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{document:void 0};pd.Path2D||function(t){if(!t||!t.CanvasRenderingContext2D||t.Path2D)return;const{CanvasRenderingContext2D:e}=t,n=null==e?void 0:e.prototype.fill,i=null==e?void 0:e.prototype.stroke,r=null==e?void 0:e.prototype.isPointInPath;e.prototype.fill=function(...t){if(!(t[0]instanceof rh)){const e=t[0]||"nonzero";return n.apply(this,[e])}{const e=t[0],i=t[1]||"nonzero";sh(this,e.commands),n.apply(this,[i])}},e.prototype.stroke=function(t){t&&sh(this,t.commands),i.apply(this)},e.prototype.isPointInPath=function(...t){if(t[0]instanceof rh){const e=t[0],n=t[1],i=t[2],s=t[3]||"nonzero";return sh(this,e.commands),r.apply(this,[n,i,s])}return r.apply(this,t)},t.Path2D=rh}(pd),pd.DOMParser||(pd.DOMParser=dd);const fd={window:pd,isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),config:{dpr:1}};var md=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(t){var e=1.70158;return 1===t?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return 0===t?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-md.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*md.Bounce.In(2*t):.5*md.Bounce.Out(2*t-1)+.5}}),generatePow:function(t){return void 0===t&&(t=4),t=(t=t<Number.EPSILON?Number.EPSILON:t)>1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(2*e,t)/2:(1-Math.pow(2-2*e,t))/2+.5}}}}),gd=function(){return performance.now()},vd=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var i=0,r=e;i<r.length;i++){var s=r[i];null===(t=s._group)||void 0===t||t.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},t.prototype.remove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,i=t;n<i.length;n++){var r=i[n];r._group=void 0,delete this._tweens[r.getId()],delete this._tweensAddedDuringUpdate[r.getId()]}},t.prototype.allStopped=function(){return this.getAll().every((function(t){return!t.isPlaying()}))},t.prototype.update=function(t,e){void 0===t&&(t=gd()),void 0===e&&(e=!0);var n=Object.keys(this._tweens);if(0!==n.length)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!e;r&&!1===r.update(t,s)&&!e&&this.remove(r)}n=Object.keys(this._tweensAddedDuringUpdate)}},t}(),_d={Linear:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),s=_d.Utils.Linear;return e<0?s(t[0],t[1],i):e>1?s(t[n],t[n-1],n-i):s(t[r],t[r+1>n?n:r+1],i-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t}}},yd=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),xd=new vd,bd=function(){function t(t,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=md.Linear.None,this._interpolationFunction=_d.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=yd.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,"object"==typeof e?(this._group=e,e.add(this)):!0===e&&(this._group=xd,xd.add(this))}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(t,e){if(void 0===e&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},t.prototype.duration=function(t){return void 0===t&&(t=1e3),this._duration=t<0?0:t,this},t.prototype.dynamic=function(t){return void 0===t&&(t=!1),this._isDynamic=t,this},t.prototype.start=function(t,e){if(void 0===t&&(t=gd()),void 0===e&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var r in this._valuesEnd)i[r]=this._valuesEnd[r];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},t.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},t.prototype._setupProperties=function(t,e,n,i,r){for(var s in n){var a=t[s],o=Array.isArray(a),l=o?"array":typeof a,c=!o&&Array.isArray(n[s]);if("undefined"!==l&&"function"!==l){if(c){if(0===(g=n[s]).length)continue;for(var h=[a],u=0,d=g.length;u<d;u+=1){var p=this._handleRelativeValue(a,g[u]);if(isNaN(p)){c=!1;break}h.push(p)}c&&(n[s]=h)}if("object"!==l&&!o||!a||c)(void 0===e[s]||r)&&(e[s]=a),o||(e[s]*=1),i[s]=c?n[s].slice().reverse():e[s]||0;else{e[s]=o?[]:{};var f=a;for(var m in f)e[s][m]=f[m];i[s]=o?[]:{};var g=n[s];if(!this._isDynamic){var v={};for(var m in g)v[m]=g[m];n[s]=g=v}this._setupProperties(f,e[s],g,i[s],r)}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(t){return void 0===t&&(t=gd()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t),this},t.prototype.resume=function(t){return void 0===t&&(t=gd()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return t?(t.add(this),this):this},t.prototype.remove=function(){var t;return null===(t=this._group)||void 0===t||t.remove(this),this},t.prototype.delay=function(t){return void 0===t&&(t=0),this._delayTime=t,this},t.prototype.repeat=function(t){return void 0===t&&(t=0),this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return void 0===t&&(t=!1),this._yoyo=t,this},t.prototype.easing=function(t){return void 0===t&&(t=md.Linear.None),this._easingFunction=t,this},t.prototype.interpolation=function(t){return void 0===t&&(t=_d.Linear),this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(e,n){var i,r,s=this;if(void 0===e&&(e=gd()),void 0===n&&(n=t.autoStartOnUpdate),this._isPaused)return!0;if(!this._goToEnd&&!this._isPlaying){if(!n)return!1;this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,o=this._duration+(null!==(i=this._repeatDelayTime)&&void 0!==i?i:this._delayTime),l=this._duration+this._repeat*o,c=function(){if(0===s._duration)return 1;if(a>l)return 1;var t=Math.trunc(a/o),e=a-t*o,n=Math.min(e/s._duration,1);return 0===n&&a===s._duration?1:n}(),h=this._easingFunction(c);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,h),this._onUpdateCallback&&this._onUpdateCallback(this._object,c),0===this._duration||a>=this._duration){if(this._repeat>0){var u=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);for(r in isFinite(this._repeat)&&(this._repeat-=u),this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[r]||(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*u,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,p=this._chainedTweens.length;d<p;d++)this._chainedTweens[d].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,n,i){for(var r in n)if(void 0!==e[r]){var s=e[r]||0,a=n[r],o=Array.isArray(t[r]),l=Array.isArray(a);!o&&l?t[r]=this._interpolationFunction(a,i):"object"==typeof a&&a?this._updateProperties(t[r],s,a,i):"number"==typeof(a=this._handleRelativeValue(s,a))&&(t[r]=s+(a-s)*i)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof n?this._valuesStartRepeat[t]+parseFloat(n):this._valuesEnd[t],this._valuesEnd[t]=e},t.autoStartOnUpdate=!1,t}();yd.nextId;var Md=xd;Md.getAll.bind(Md),Md.removeAll.bind(Md),Md.add.bind(Md),Md.remove.bind(Md),Md.update.bind(Md),t={Easing:md,Tween:bd};class Sd extends rn{constructor(t,e,n){super(t,e,n)}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}floorToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}roundToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}toString(){return`{x: ${this.x}, y: ${this.y}}`}}class Ed extends on{constructor(t=new Sd(1/0,1/0,1/0),e=new Sd(-1/0,-1/0,-1/0)){super(t,e)}ceil(){return this.min.ceilToZero(),this.max.ceilToZero(),this}round(){return this.min.roundToZero(),this.max.roundToZero(),this}floor(){return this.min.floorToZero(),this.max.floorToZero(),this}toString(){return`{min: ${this.min.toString()}, max: ${this.max.toString()}}`}}function wd(t,e=new Ed){return t.traverse((t=>{t instanceof ir&&t.geometry&&(Td.setFromObject(t),Td.isEmpty()||(e.expandByPoint(Td.min),e.expandByPoint(Td.max)))})),e}const Td=new Ed;new OffscreenCanvas(1,1).getContext("2d");const Ad={type:"change"},Cd={type:"start"},Rd={type:"end"},Pd=new Dn,Id=new Fr,Nd=Math.cos(70*Re),Dd=new rn,Ld=2*Math.PI,Ud=-1,Od=0,Fd=1,Bd=2,zd=3,kd=4,Vd=5,Hd=6,Gd=1e-6;class Wd extends fo{constructor(t,e=null){super(t,e),this.state=Ud,this.target=new rn,this.cursor=new rn,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:n,MIDDLE:i,RIGHT:r},this.touches={ONE:s,TWO:o},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new rn,this._lastQuaternion=new nn,this._lastTargetPosition=new rn,this._quat=(new nn).setFromUnitVectors(t.up,new rn(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new eo,this._sphericalDelta=new eo,this._scale=1,this._panOffset=new rn,this._rotateStart=new Pe,this._rotateEnd=new Pe,this._rotateDelta=new Pe,this._panStart=new Pe,this._panEnd=new Pe,this._panDelta=new Pe,this._dollyStart=new Pe,this._dollyEnd=new Pe,this._dollyDelta=new Pe,this._dollyDirection=new rn,this._mouse=new Pe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=jd.bind(this),this._onPointerDown=qd.bind(this),this._onPointerUp=Xd.bind(this),this._onContextMenu=tp.bind(this),this._onMouseWheel=Kd.bind(this),this._onKeyDown=Jd.bind(this),this._onTouchStart=$d.bind(this),this._onTouchMove=Qd.bind(this),this._onMouseDown=Yd.bind(this),this._onMouseMove=Zd.bind(this),this._interceptControlDown=ep.bind(this),this._interceptControlUp=np.bind(this),null!==this.domElement&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){null!==this._domElementKeyEvents&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Ad),this.update(),this.state=Ud}update(t=null){const e=this.object.position;Dd.copy(e).sub(this.target),Dd.applyQuaternion(this._quat),this._spherical.setFromVector3(Dd),this.autoRotate&&this.state===Ud&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=Ld:n>Math.PI&&(n-=Ld),i<-Math.PI?i+=Ld:i>Math.PI&&(i-=Ld),this._spherical.theta=n<=i?Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const t=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=t!=this._spherical.radius}if(Dd.setFromSpherical(this._spherical),Dd.applyQuaternion(this._quatInverse),e.copy(this.target).add(Dd),this.object.lookAt(this.target),!0===this.enableDamping?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let t=null;if(this.object.isPerspectiveCamera){const e=Dd.length();t=this._clampDistance(e*this._scale);const n=e-t;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),r=!!n}else if(this.object.isOrthographicCamera){const e=new rn(this._mouse.x,this._mouse.y,0);e.unproject(this.object);const n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=n!==this.object.zoom;const i=new rn(this._mouse.x,this._mouse.y,0);i.unproject(this.object),this.object.position.sub(i).add(e),this.object.updateMatrixWorld(),t=Dd.length()}else this.zoomToCursor=!1;null!==t&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(t).add(this.object.position):(Pd.origin.copy(this.object.position),Pd.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Pd.direction))<Nd?this.object.lookAt(this.target):(Id.setFromNormalAndCoplanarPoint(this.object.up,this.target),Pd.intersectPlane(Id,this.target))))}else if(this.object.isOrthographicCamera){const t=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),t!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,!!(r||this._lastPosition.distanceToSquared(this.object.position)>Gd||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Gd||this._lastTargetPosition.distanceToSquared(this.target)>Gd)&&(this.dispatchEvent(Ad),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0)}_getAutoRotationAngle(t){return null!==t?Ld/60*this.autoRotateSpeed*t:Ld/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(.01*t);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){Dd.setFromMatrixColumn(e,0),Dd.multiplyScalar(-t),this._panOffset.add(Dd)}_panUp(t,e){!0===this.screenSpacePanning?Dd.setFromMatrixColumn(e,1):(Dd.setFromMatrixColumn(e,0),Dd.crossVectors(this.object.up,Dd)),Dd.multiplyScalar(t),this._panOffset.add(Dd)}_pan(t,e){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Dd.copy(i).sub(this.target);let r=Dd.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*r/n.clientHeight,this.object.matrix),this._panUp(2*e*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):this.enablePan=!1}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:this.enableZoom=!1}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:this.enableZoom=!1}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=t-n.left,r=e-n.top,s=n.width,a=n.height;this._mouse.x=i/s*2-1,this._mouse.y=-r/a*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Ld*this._rotateDelta.x/e.clientHeight),this._rotateUp(Ld*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(Ld*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-Ld*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(Ld*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-Ld*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(1===this._pointers.length)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(t){if(1===this._pointers.length)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._panStart.set(n,i)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,i=t.pageY-e.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(1==this._pointers.length)this._rotateEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._rotateEnd.set(n,i)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(Ld*this._rotateDelta.x/e.clientHeight),this._rotateUp(Ld*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(1===this._pointers.length)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,i=t.pageY-e.y,r=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const s=.5*(t.pageX+e.x),a=.5*(t.pageY+e.y);this._updateZoomParameters(s,a)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return void this._pointers.splice(e,1)}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];void 0===e&&(e=new Pe,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){const e=t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(t){const e=t.deltaMode,n={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(e){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}return t.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function qd(t){!1!==this.enabled&&(0===this._pointers.length&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),this._isTrackingPointer(t)||(this._addPointer(t),"touch"===t.pointerType?this._onTouchStart(t):this._onMouseDown(t)))}function jd(t){!1!==this.enabled&&("touch"===t.pointerType?this._onTouchMove(t):this._onMouseMove(t))}function Xd(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Rd),this.state=Ud;break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y})}}function Yd(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i:if(!1===this.enableZoom)return;this._handleMouseDownDolly(t),this.state=Fd;break;case n:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===this.enablePan)return;this._handleMouseDownPan(t),this.state=Bd}else{if(!1===this.enableRotate)return;this._handleMouseDownRotate(t),this.state=Od}break;case r:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===this.enableRotate)return;this._handleMouseDownRotate(t),this.state=Od}else{if(!1===this.enablePan)return;this._handleMouseDownPan(t),this.state=Bd}break;default:this.state=Ud}this.state!==Ud&&this.dispatchEvent(Cd)}function Zd(t){switch(this.state){case Od:if(!1===this.enableRotate)return;this._handleMouseMoveRotate(t);break;case Fd:if(!1===this.enableZoom)return;this._handleMouseMoveDolly(t);break;case Bd:if(!1===this.enablePan)return;this._handleMouseMovePan(t)}}function Kd(t){!1!==this.enabled&&!1!==this.enableZoom&&this.state===Ud&&(t.preventDefault(),this.dispatchEvent(Cd),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(Rd))}function Jd(t){!1!==this.enabled&&this._handleKeyDown(t)}function $d(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case s:if(!1===this.enableRotate)return;this._handleTouchStartRotate(t),this.state=zd;break;case a:if(!1===this.enablePan)return;this._handleTouchStartPan(t),this.state=kd;break;default:this.state=Ud}break;case 2:switch(this.touches.TWO){case o:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchStartDollyPan(t),this.state=Vd;break;case l:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchStartDollyRotate(t),this.state=Hd;break;default:this.state=Ud}break;default:this.state=Ud}this.state!==Ud&&this.dispatchEvent(Cd)}function Qd(t){switch(this._trackPointer(t),this.state){case zd:if(!1===this.enableRotate)return;this._handleTouchMoveRotate(t),this.update();break;case kd:if(!1===this.enablePan)return;this._handleTouchMovePan(t),this.update();break;case Vd:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchMoveDollyPan(t),this.update();break;case Hd:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Ud}}function tp(t){!1!==this.enabled&&t.preventDefault()}function ep(t){"Control"===t.key&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function np(t){"Control"===t.key&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class ip extends Wd{constructor(t,e){super(t,e),this.screenSpacePanning=!1,this.mouseButtons={LEFT:r,MIDDLE:i,RIGHT:n},this.touches={ONE:a,TWO:l}}}class rp extends Ln{constructor(t=1,e=0,n=0,i=0,r=0,s=1,a=0,o=0,l=0,c=0,h=1,u=0,d=0,p=0,f=0,m=1){super(t,e,n,i,r,s,a,o,l,c,h,u,d,p,f,m)}setByMatrix3(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[4]=n[3],e[8]=0,e[12]=n[6],e[1]=n[1],e[5]=n[4],e[9]=0,e[13]=n[7],e[2]=0,e[6]=0,e[10]=1,e[14]=0,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}getMatrix3Array(t=[]){const e=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[4],t[4]=e[5],t[5]=0,t[6]=e[12],t[7]=e[13],t[8]=1,t}}class sp extends xe{constructor(t={}){var e;super(),d(this,"container"),d(this,"animateDuration"),d(this,"cvs"),d(this,"inpEl"),d(this,"controls"),d(this,"tween"),d(this,"scene"),d(this,"scenes",[]),d(this,"boundingBox",new Ed),d(this,"_version",0),d(this,"controlsChangedHandler",this.handleControlsChanged.bind(this)),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.container=this.params.cvs?this.params.cvs:this.params.canvasId?document.getElementById(this.params.canvasId):fd.window.document.getElementsByTagName("body")[0],this.initCamera(),this.inpEl=(null==(e=this.params)?void 0:e.workerRender)?this.params.inpEl:void 0,this.params.workerRender&&this.params.inpEl?this.controls=new ip(this.camera,this.inpEl):this.controls=new ip(this.camera,this.cvs),this.controls.zoomToCursor=!0,this.controls.screenSpacePanning=!0,this.bindEvents()}destroy(){var t,e;this.unbindEvents(),null==(t=this.controls)||t.dispose();for(let t=0,n=(null==(e=this.scenes)?void 0:e.length)||0;t<n;t++)this.scenes[t].destroy();this.scenes.length=0}get version(){return this._version}set version(t){this._version=t,this.camera&&(this.camera.userData.version=t)}set needsUpdate(t){t&&this.version++}initCamera(){var t,e,n,i;if(this.params.aspect=(this.params.width||1)/(this.params.height||1),null==(e=null==(t=this.params)?void 0:t.camera)?void 0:e.type){const{fov:t,aspect:e,near:n,far:i}=this.params.camera;this.camera=new mr(t,e,n,i)}else{const{left:t,right:e,top:n,bottom:i,near:r,far:s}=this.params.camera||{},{w:a,h:o}={w:this.params.width,h:this.params.height,k:this.params.aspect,s:this.params.width/4},{l:l,r:c,t:h,b:u,n:d,f:p}={l:a/-2,r:a/2,t:o/2,b:o/-2,n:r,f:s};this.camera=new Fa(l,c,h,u,d,p)}(null==(i=null==(n=this.params)?void 0:n.camera)?void 0:i.helperEnable)&&(this.cameraHelper=new ho(this.camera))}pushScenes(...t){return(null==t?void 0:t.length)?(this.scenes.push(...t),this):this}bindScene(t){t&&(this.scene=t,this.cameraHelper&&this.scene.add(this.cameraHelper))}clearScenes(){var t;if(!(null==(t=this.scenes)?void 0:t.length))return this;for(let t=0,e=this.scenes.length;t<e;t++)this.scenes[t].destroy();return this.scenes.length=0,this.boundingBox.makeEmpty(),this}computeBoundingBox(){var t;this.boundingBox.makeEmpty();for(let e=0,n=(null==(t=this.scenes)?void 0:t.length)||0;e<n;e++)this.scenes[e].userData.boundingBox=wd(this.scenes[e]),this.boundingBox.isEmpty()?this.boundingBox.copy(this.scenes[e].userData.boundingBox):(this.boundingBox.expandByVector(this.scenes[e].userData.boundingBox.min),this.boundingBox.expandByVector(this.scenes[e].userData.boundingBox.max));return this.boundingBox.ceil()}getScenesBoundingBox(){var t;dp.makeEmpty();for(let e=0,n=(null==(t=this.scenes)?void 0:t.length)||0;e<n;e++)this.scenes[e].userData.boundingBox&&!this.scenes[e].userData.boundingBox.isEmpty()||(this.scenes[e].updateMatrixWorld(),this.scenes[e].userData.boundingBox=wd(this.scenes[e])),dp.isEmpty()?dp.copy(this.scenes[e].userData.boundingBox):(dp.expandByPoint(this.scenes[e].userData.boundingBox.min),dp.expandByPoint(this.scenes[e].userData.boundingBox.max));return dp.clone().ceil()}bindEvents(){this.controls.addEventListener("change",this.controlsChangedHandler)}unbindEvents(){this.controls.removeEventListener("change",this.controlsChangedHandler)}handleControlsChanged(t){this.needsUpdate=!0,this.dispatchEvent({type:"change"})}getCameraPosition(t={}){var e,n;return this.controls?lp.copy(this.controls.target):lp.set(0,0,0),cp.copy(this.camera.position).sub(lp),cp.applyQuaternion(up),hp.setFromVector3(cp),cp.applyQuaternion(up.clone().invert()),hp.makeSafe(),t.x=lp.x,t.y=lp.y,t.z=lp.z,t.sr=hp.radius,t.sp=hp.phi,t.st=hp.theta,(null==(n=null==(e=this.params)?void 0:e.camera)?void 0:n.type)||(pp.multiplyMatrices(this.camera.matrixWorld,this.camera.projectionMatrixInverse),op.set(-1,-1,0).unproject(this.camera).ceil(),t.l=op.x,t.b=op.y,op.set(1,1,0).unproject(this.camera).ceil(),t.r=op.x,t.t=op.y,t.x=this.camera.position.x,t.y=this.camera.position.y,t.z=this.camera.position.z,t.n=this.camera.near,t.f=this.camera.far,t.zm=1),t}setCameraPosition(t,e=!1){var n,i;const r=this.getCameraPosition();e&&(null==(n=this.params.camera)?void 0:n.type)?this.animatePerspectiveCamera(r,t):(null==(i=this.params.camera)?void 0:i.type)?this.setPerspectiveCameraPosition(t):e?this.animateOrthographicCamera(r,t):this.setOrthographicCameraPosition(t)}saveCameraPosition(t){const e=this.getCameraPosition(),n=t?ap+t:ap;sessionStorage.setItem(n,JSON.stringify(e))}restoreCameraPosition(t){const e=t?ap+t:ap,n=sessionStorage.getItem(e);if(!n)return this.fullscreen();const i=JSON.parse(n||"{}");this.setCameraPosition(i,!0)}clearCameraPosition(t){const e=t?ap+t:ap;sessionStorage.setItem(e,"")}zoomIn(){this.controls._scale=.9,this.controls.update()}zoomOut(){this.controls._scale=1.1,this.controls.update()}fullscreen(t=!0){this.resetCameraByBox(void 0,t)}resetCameraByBox(t,e=!0){var n;const{l:i,r:r,b:s,t:a,w:o,h:l,x:c,y:h,z:u,radius:d,n:p,f:f}=this.getBoundingClientRect(t);if(null==(n=this.params.camera)?void 0:n.type){const t={x:i+o/2,y:s+l/2,z:0,sr:d,sp:0,st:0};this.setCameraPosition(t,e)}else{const t={l:i,r:r,t:a,b:s,x:i+o/2,y:s+l/2,z:0,sr:d,sp:0,st:0,zm:1,n:p,f:f};this.setCameraPosition(t,e)}}getBoundingClientRect(t){var e,n;t&&!t.isEmpty()||(t=this.getScenesBoundingBox());let{l:i,r:r,b:s,t:a}={l:t.min.x,r:t.max.x,t:t.max.y,b:t.min.y},{w:o,h:l}={w:r-i,h:a-s};if((null==(e=this.params)?void 0:e.aspect)&&(null==(n=this.params)?void 0:n.aspect)>=1){const t=Math.ceil(Math.abs(o-l*this.params.aspect)/2);i-=t,r+=t;const e=Math.ceil(Math.abs((r-i)/this.params.aspect-l)/2);a+=e,s-=e}else if(this.params.aspect){const t=Math.ceil(Math.abs(l-o/this.params.aspect)/2);a+=t,s-=t;const e=Math.ceil(Math.abs((a-s)*this.params.aspect-o)/2);i-=e,r+=e}o=Math.ceil(r-i),l=Math.ceil(a-s);const c=Math.ceil(.7*Math.sqrt(o*o+l*l)),h=this.camera.near,u=2*c;return t.getCenter(op),{l:i,r:r,b:s,t:a,w:o,h:l,x:op.x,y:op.y,z:op.z,radius:c,n:h,f:u}}animatePerspectiveCamera(e,n){this.controls&&(this.controls.enabled=!1),this.tween&&this.tween.stop(),this.tween=new bd(e),this.tween.to(n,this.animateDuration),this.tween.onUpdate((t=>{this.setPerspectiveCameraPosition(t,!1)})),this.tween.onComplete((()=>{this.controls&&(this.controls.enabled=!0),this.camera.updateProjectionMatrix(),this.controls&&(this.controls.target.copy(lp),this.controls.target0.copy(lp),this.controls.update())})),this.tween.easing(t.Easing.Cubic.InOut),this.tween.start()}animateOrthographicCamera(e,n){return p(this,null,(function*(){return this.controls&&(this.controls.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new t.Tween(e).to(n,this.animateDuration).easing(t.Easing.Cubic.InOut).onUpdate((t=>{this.setOrthographicCameraPosition(t,!1)})).onComplete((()=>{this.camera.updateProjectionMatrix(),this.controls&&(this.controls.target.copy(this.controls.target0),this.controls.update(),this.controls.enabled=!0),i()})).start()}))}))}setPerspectiveCameraPosition(t,e=!0){lp.set(t.x,t.y,t.z),hp.set(t.sr,t.sp,t.st),hp.makeSafe(),cp.applyQuaternion(up),cp.setFromSpherical(hp),cp.applyQuaternion(up.clone().invert()),this.camera.position.copy(lp).add(cp),this.camera.lookAt(lp),e&&(this.camera.updateProjectionMatrix(),this.controls&&(this.controls.target.copy(lp),this.controls.target0.copy(lp),this.controls.update()))}setOrthographicCameraPosition(t,e=!0){this.camera.left=t.l,this.camera.right=t.r,this.camera.bottom=t.b,this.camera.top=t.t,this.camera.near=t.n,this.camera.far=t.f,this.camera.position.set(0,0,t.sr),this.camera.zoom=t.zm,this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.cameraHelper&&(this.cameraHelper.position.copy(this.camera.position),this.cameraHelper.lookAt(this.camera.position),this.cameraHelper.update()),e&&this.controls&&(this.controls.target.set(0,0,0),this.controls.update()),this.needsUpdate=!0}update(t){var e;this.tween&&this.tween.update(t);for(let n=0,i=(null==(e=this.scenes)?void 0:e.length)||0;n<i;n++)"function"==typeof this.scenes[n].update&&this.scenes[n].update(t)}}const ap="camera3_position_",op=new Sd;new Sd;const lp=new Sd,cp=new Sd,hp=new eo,up=new nn;new Ed;const dp=new Ed,pp=new rp,fp=(t,e=1e-6)=>Math.abs(t)<e?0:t<0?-1:1;class mp{constructor(t=0,e=0,n){d(this,"isVector2",!0),d(this,"x",0),d(this,"y",0),d(this,"z"),this.x=t,this.y=e,this.z=n||0}static isZero(t){return 0===t.x&&0===t.y}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,n=!0){return n?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<vp&&Math.abs(t.y-e.y)<vp}static getInt32Array(t,e=2){const n=new ArrayBuffer(t.length*e*4),i=new Int32Array(n);for(let e=0,n=t.length;e<n;e++)i[2*e]=t[e].x,i[2*e+1]=t[e].y;return i}static getFloat64Array(t,e=2){const n=new ArrayBuffer(t.length*e*8),i=new Float64Array(n);for(let e=0,n=t.length;e<n;e++)i[2*e]=t[e].x,i[2*e+1]=t[e].y;return i}static getVectors(t){const e=[];for(let n=0,i=t.length;n<i;n++)e.push(new mp(t[n].x,t[n].y));return e}static getStrings(t){const e=[];if(!t||!t.length)return"";for(let n=0,i=t.length;n<i;n++)e.push(mp.getString(t[n]));return e.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static distanceToPolygon(t,e){let n=1/0;for(let i=0,r=e.length-1;i<e.length;r=i++){const s=e[i].x,a=e[i].y,o=e[r].x-s,l=e[r].y-a,c=Math.sqrt(o*o+l*l);if(c>0){const e=Math.max(0,Math.min(1,((t.x-s)*o+(t.y-a)*l)/(c*c))),i=s+e*o,r=a+e*l,h=Math.sqrt((t.x-i)*(t.x-i)+(t.y-r)*(t.y-r));n=Math.min(n,h)}}return n}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(t,e){return(new mp).subVectors(t,e)}static isPointOnSegment(t,e,n){return 0===fp(this.sub(t,n).cross(this.sub(e,n)))&&fp(this.sub(t,n).dot(this.sub(e,n)))<=0}static angle(t,e,n){return n?Math.atan2(t.y-e.y,t.x-e.x):(t=>{let e=t*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e})(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let n=this.getClothoidPoints(t,e),i=0;for(let t=0,e=n.length;t<e;t++){let e=Math.max(0,t-1);t>0?i+=this.getDistance(n[e],n[e+1]):i=0,n[t].l=Math.round(i);let r=this.angle(n[e+1],n[e]);n[t].a=Math.round(100*r)/100}return n}static getClothoidPoints(t,e=100){let n=[],i=t.concat([]);if(!i||i.length<2)return n;2===i.length?(i.push(i[1]),i.unshift(i[0])):3===i.length&&i.splice(2,0,i[1]);for(let t=0;t<i.length-3;t+=3){let r=new mp(i[t].x,i[t].y),s=new mp(i[t+1].x,i[t+1].y),a=new mp(i[t+2].x,i[t+2].y),o=new mp(i[t+3].x,i[t+3].y),l=0;l+=r.distanceTo(s),l+=s.distanceTo(a),l+=a.distanceTo(o);let c=Math.min(.5,1/(l/e));for(let t=c;t<1;t+=c){let e=3*(s.x-r.x),i=3*(a.x-s.x)-e,l=o.x-r.x-e-i,c=3*(s.y-r.y),h=3*(a.y-s.y)-c,u=o.y-r.y-c-h,d=l*Math.pow(t,3)+i*Math.pow(t,2)+e*t+r.x,p=u*Math.pow(t,3)+h*Math.pow(t,2)+c*t+r.y;n.push({x:Math.round(d),y:Math.round(p),a:0,l:0})}}return n.unshift({x:i[0].x,y:i[0].y,a:0,l:0}),n.push({x:i[i.length-1].x,y:i[i.length-1].y,a:0,l:0}),n}static getClothoidLength(t){let e=0;if(t.length>2)for(let n=0;n<t.length;n++){let i=Math.max(0,n-1);n>0&&(e+=this.getDistance(t[i],t[i+1]))}return e}static getCircleCenterByChord(t,e,n,i=!0,r=new mp){const s=this.getDistance(t,e);if(0===s)return r.x=1/0,r.y=1/0,r;gp.set((t.x+e.x)/2,(t.y+e.y)/2);const a=Math.sqrt(n*n-s*s/4),o=i?-1:1;return r.x=gp.x+o*a*(e.y-t.y)/s,r.y=gp.y-o*a*(e.x-t.x)/s,r}static isPointInCircle(t,e,n){return this.getDistance(n,t)<e}static isPointInConvexHull(t,e){let n=!1;const i=e.length;for(let r=0,s=i-1;r<i;s=r++){const i=e[r],a=e[s];if(Math.min(i.x,a.x)<=t.x&&t.x<=Math.max(i.x,a.x)&&Math.min(i.y,a.y)<=t.y&&t.y<=Math.max(i.y,a.y)){const e=(a.x-i.x)*(t.y-i.y)-(a.y-i.y)*(t.x-i.x);if(Math.abs(e)<1e-12)return!0}i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}static isPointInPolygon(t,e){let n=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){const s=e[i].x,a=e[i].y,o=e[r].x,l=e[r].y;a>t.y!=l>t.y&&t.x<(o-s)*(t.y-a)/(l-a)+s&&(n=!n)}return n}static isPointInPolygonByRay(t,e){let n=0;const i=(new mp).copy(t),r=new mp,s=new mp;for(let t=0;t<e.length;t++){t===e.length-1?(r.copy(e[t]),s.copy(e[0])):(r.copy(e[t]),s.copy(e[t+1]));let a=[r.y,s.y].sort(((t,e)=>t-e));a[0]<i.y&&a[1]>i.y&&(r.x<i.x||s.x<i.x)&&n++}return n%2==1}static getIntersectionOfSegments(t,e,n,i,r=!1,s=new mp){const a=(i.y-n.y)*(e.x-t.x)-(i.x-n.x)*(e.y-t.y);if(0===a)return s.makeEmpty();const o=((i.x-n.x)*(t.y-n.y)-(i.y-n.y)*(t.x-n.x))/a,l=((e.x-t.x)*(t.y-n.y)-(e.y-t.y)*(t.x-n.x))/a;return r&&(o<0||o>1||l<0||l>1)?s.makeEmpty():(s.x=t.x+o*(e.x-t.x),s.y=t.y+o*(e.y-t.y),s)}static getConvexHullByGrahamScan(t,e=!1,n=[]){if(!t||!t.length)return n;const i=t.length;let r=0;for(let e=0;e<i;e++)t[e].x<t[r].x&&(r=e);let s,a=r;do{n.push(t[a]),s=(a+1)%i;for(let e=0;e<i;e++)this.whichSideOfSegment(t[a],t[e],t[s])>0&&(s=e);a=s}while(a!==r);return e&&n.push(t[r]),n}static whichSideOfSegment(t,e,n){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const n=[];if(!t)return n;for(let i=0,r=t.length;i<r;i++)n.push({x:e.elements[0]*t[i].x+e.elements[3]*t[i].y+e.elements[6],y:e.elements[1]*t[i].x+e.elements[4]*t[i].y+e.elements[7]});return n}static getPointsApplyMatrix3(t,e=[]){for(let n=0,i=e.length;n<i;n++){const i=t.elements[0]*e[n].x+t.elements[3]*e[n].y+t.elements[6],r=t.elements[1]*e[n].x+t.elements[4]*e[n].y+t.elements[7];e[n].x=i,e[n].y=r}return e}static getCentral(t,e=new mp){let n=0,i=0;for(let e=0,r=t.length;e<r;e++)n+=t[e].x,i+=t[e].y;return e.set(n/t.length,i/t.length)}static getCentralByNumbers2(t,e=new mp){let n=0,i=0;for(let e=0,r=t.length;e<r;e+=2)n+=t[e],i+=t[e+1];const r=t.length/2;return e.set(n/r,i/r)}static getCentroidByNumbers2(t,e=new mp){if(!t||0===t.length)return e.set(0,0);if(t.length<6)return this.getCentralByNumbers2(t,e);let n=0,i=0,r=0;for(let e=0;e<t.length;e+=2){const s=(e+2)%t.length,a=t[e]*t[s+1]-t[s]*t[e+1];n+=a,i+=(t[e]+t[s])*a,r+=(t[e+1]+t[s+1])*a}return n/=2,Math.abs(n)<1e-10?this.getCentralByNumbers2(t,e):(i/=6*n,r/=6*n,e.set(i,r))}static getPoleOfInaccessibility(t,e=new mp,n=1){const i=new mp;mp.getCentroidByNumbers2(t,i);const r=[];for(let e=0;e<t.length;e+=2)r.push({x:t[e],y:t[e+1]});let s={x:i.x,y:i.y},a=this.distanceToPolygon(s,r);for(let t=0;t<20;t++){const e=2*Math.PI*t/20,n=20*Math.random(),o={x:i.x+n*Math.cos(e),y:i.y+n*Math.sin(e)};if(this.isPointInPolygon(o,r)){const t=this.distanceToPolygon(o,r);t>a&&(a=t,s=o)}}return e.set(s.x,s.y),e.z=a,e}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new mp(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<vp&&Math.abs(t.y-this.y)<vp}equalsXY(){return Math.abs(this.x-this.y)<vp}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.x,r=this.y;return this.x=i*e-r*n,this.y=i*n+r*e,this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e,n){return this.x=t,this.y=e,n&&(this.z=n),this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,3*e)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}}const gp=new mp,vp=1e-8;class _p{static destroy(){this.cached.clear(),this.cachedCanvas.clear()}static createCanvas(t){var e;if(!(null==(e=fd.window)?void 0:e.document))throw new Error("environment not support");let n,i;if(t.containerId&&(n=fd.window.document.getElementById(t.containerId)),n||(n=fd.window.document.getElementsByTagName("body")[0]),t.canvasId&&(i=fd.window.document.getElementById(t.canvasId)||void 0),t.width||(t.width=(null==n?void 0:n.offsetWidth)||100),t.height||(t.height=(null==n?void 0:n.offsetHeight)||100),t.dpr||(t.dpr=fd.config.dpr),i)this.resizeCanvas(i,t.width,t.height,t.dpr);else{if(i=this.createHtmlCanvas(t.width,t.height,t.dpr),!i)throw new Error("error environment");t.canvasId&&i.setAttribute("id",t.canvasId),null==n||n.appendChild(i)}return i.style.background=t.background||"transparent",i}static getContext2D(t,e={}){const n={alpha:!0,willReadFrequently:!!e.willReadFrequently},i=t.getContext("2d",n);if(!i)throw new Error("getContext2D error");return i.scale(e.dpr||1,e.dpr||1),i}static resizeCanvas(t,e,n,i=1){t instanceof OffscreenCanvas?(t.width=e,t.height=n):t instanceof HTMLCanvasElement&&(t.setAttribute("width",(e*i).toString()),t.setAttribute("height",(n*i).toString()),t.style.width=e+"px",t.style.height=n+"px",t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.imageRendering="pixelated",t.style.transform="translateZ(0)")}static getImageBitmapByCanvasAsync(t){return p(this,null,(function*(){if(t)return t instanceof OffscreenCanvas?t.transferToImageBitmap():t instanceof HTMLCanvasElement?yield createImageBitmap(t):void 0}))}static get(t,e,n,i=1){let r=this.cached.get(t);return r||(r=this.create(e,n,i),this.set(t,r)),this.resizeCanvas(r,e,n,i),r}static set(t,e){if(!t||!e)throw new Error("error input");return this.cached.set(t,e)}static remove(t){this.cached.has(t)&&this.cached.delete(t)}static create(t,e,n=1){var i;if(null==(i=fd.window)?void 0:i.OffscreenCanvas)return new OffscreenCanvas(t,e);throw new Error("environment does not support")}static createHtmlCanvas(t,e,n=1){if(!fd.window.document)throw new Error("environment does not support");const i=fd.window.document.createElement("canvas");return this.resizeCanvas(i,t,e,n),i}static measureText(t,e,n=new mp){if(!t)throw new Error("input error");const i=this.get("measureText",1,1).getContext("2d");if(!i)throw new Error("bufferCtx not found");e.render(i);const r=i.measureText(t);if(!r)throw new Error("measureText error");const s=r.actualBoundingBoxRight+r.actualBoundingBoxLeft,a=r.actualBoundingBoxAscent+r.actualBoundingBoxDescent;return n.set(s,a),n}static measureText2(t,e=12,n=new mp){if(!t)throw new Error("input error");const i=this.get("measureText",1,1).getContext("2d");if(!i)throw new Error("bufferCtx not found");i.font=`${e}px sans-serif`;const r=i.measureText(t);if(!r)throw new Error("measureText error");const s=r.actualBoundingBoxRight+r.actualBoundingBoxLeft,a=r.actualBoundingBoxAscent+r.actualBoundingBoxDescent;return n.set(s,a),n}static getCtx(t,e,n,i=1){if(!yp[t]){const r=this.create(e,n,i);yp[t]={cvs:r,ctx:r.getContext("2d")},this.resizeCanvas(r,e,n,i)}return yp[t].ctx}}d(_p,"cached",new Map),d(_p,"cachedCanvas",new Map);const yp={},xp={uniforms:{iResolution:{value:null},iTime:{value:0}},vertexShader:"\nvoid main() {\n gl_Position = vec4(position, 1.0);\n}\n ",fragmentShader:"\n#define PI 3.14159265359\n#define TPI 6.28318530718\n#define HPI 1.57079632679\n\nuniform vec2 iResolution;\nuniform float iTime;\n\nvoid main() {\n vec2 fragCoord = gl_FragCoord.xy;\n vec2 uv = fragCoord.xy / iResolution.y;\n\n vec2 p = uv - vec2(iResolution.x / iResolution.y + .58, .15);\n float time = iTime * 1.5;\n\n float angle = -(time - sin(time + PI) * cos(time)) - time * .95;\n mat2 rot = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n p = rot * p;\n\n // 外环\n float L1 = length(p) * 6.8;\n float f1 = 0.0;\n f1 = smoothstep(L1 - .005, L1, .38);\n f1 -= smoothstep(L1, L1 + 0.005, .36);\n\n // 内环\n float L2 = length(p) * 7.8;\n float f2 = 0.0;\n f2 = smoothstep(L2 - .008, L2, .35);\n f2 -= smoothstep(L2, L2 + 0.008, .33);\n\n float t = mod(time, TPI) - PI;\n float a = atan(p.y, p.x);\n\n float t1 = -PI;\n float t2_outer = sin(t) * (PI - .25); // 外环\n\n float t2_inner = sin(t) * (PI - 1.1); // 内环\n\n f1 *= step(a, t2_outer) * (1. - step(a, t1)); // 外环\n f2 *= step(a, t2_inner) * (.5 - step(a, t1)); // 内环\n\n float combinedAlpha = max(f1, f2);\n\n vec3 outerColor = vec3(.5, .5, .5); // 外环\n vec3 innerColor = vec3(.5, .5, .5); // 内环\n\n // vec3 finalColor = mix(outerColor, innerColor, f2/(f1+f2+0.001));\n vec3 finalColor = mix(outerColor, innerColor, 1.);\n\n vec4 fragColor = vec4(finalColor, combinedAlpha);\n gl_FragColor = fragColor;\n}\n ",transparent:!0};var bp={exports:{}};
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Lodash <https://lodash.com/>
|
|
17
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
18
|
+
* Released under MIT license <https://lodash.com/license>
|
|
19
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
20
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
21
|
+
*/!function(t,e){(function(){var n,i="Expected a function",r="__lodash_hash_undefined__",s="__lodash_placeholder__",a=32,o=128,l=256,c=1/0,h=9007199254740991,u=NaN,d=4294967295,p=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",l]],f="[object Arguments]",m="[object Array]",g="[object Boolean]",v="[object Date]",_="[object Error]",y="[object Function]",x="[object GeneratorFunction]",b="[object Map]",M="[object Number]",S="[object Object]",E="[object Promise]",w="[object RegExp]",T="[object Set]",A="[object String]",C="[object Symbol]",R="[object WeakMap]",P="[object ArrayBuffer]",I="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",L="[object Int8Array]",U="[object Int16Array]",O="[object Int32Array]",F="[object Uint8Array]",B="[object Uint8ClampedArray]",z="[object Uint16Array]",k="[object Uint32Array]",V=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,j=RegExp(W.source),X=RegExp(q.source),Y=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,it=/\s/,rt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,st=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ut=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_t=/($^)/,yt=/['\n\r\u2028\u2029\\]/g,xt="\\ud800-\\udfff",bt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Mt="\\u2700-\\u27bf",St="a-z\\xdf-\\xf6\\xf8-\\xff",Et="A-Z\\xc0-\\xd6\\xd8-\\xde",wt="\\ufe0e\\ufe0f",Tt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="['’]",Ct="["+xt+"]",Rt="["+Tt+"]",Pt="["+bt+"]",It="\\d+",Nt="["+Mt+"]",Dt="["+St+"]",Lt="[^"+xt+Tt+It+Mt+St+Et+"]",Ut="\\ud83c[\\udffb-\\udfff]",Ot="[^"+xt+"]",Ft="(?:\\ud83c[\\udde6-\\uddff]){2}",Bt="[\\ud800-\\udbff][\\udc00-\\udfff]",zt="["+Et+"]",kt="\\u200d",Vt="(?:"+Dt+"|"+Lt+")",Ht="(?:"+zt+"|"+Lt+")",Gt="(?:['’](?:d|ll|m|re|s|t|ve))?",Wt="(?:['’](?:D|LL|M|RE|S|T|VE))?",qt="(?:"+Pt+"|"+Ut+")?",jt="["+wt+"]?",Xt=jt+qt+"(?:"+kt+"(?:"+[Ot,Ft,Bt].join("|")+")"+jt+qt+")*",Yt="(?:"+[Nt,Ft,Bt].join("|")+")"+Xt,Zt="(?:"+[Ot+Pt+"?",Pt,Ft,Bt,Ct].join("|")+")",Kt=RegExp(At,"g"),Jt=RegExp(Pt,"g"),$t=RegExp(Ut+"(?="+Ut+")|"+Zt+Xt,"g"),Qt=RegExp([zt+"?"+Dt+"+"+Gt+"(?="+[Rt,zt,"$"].join("|")+")",Ht+"+"+Wt+"(?="+[Rt,zt+Vt,"$"].join("|")+")",zt+"?"+Vt+"+"+Gt,zt+"+"+Wt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",It,Yt].join("|"),"g"),te=RegExp("["+kt+xt+bt+wt+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ie=-1,re={};re[N]=re[D]=re[L]=re[U]=re[O]=re[F]=re[B]=re[z]=re[k]=!0,re[f]=re[m]=re[P]=re[g]=re[I]=re[v]=re[_]=re[y]=re[b]=re[M]=re[S]=re[w]=re[T]=re[A]=re[R]=!1;var se={};se[f]=se[m]=se[P]=se[I]=se[g]=se[v]=se[N]=se[D]=se[L]=se[U]=se[O]=se[b]=se[M]=se[S]=se[w]=se[T]=se[A]=se[C]=se[F]=se[B]=se[z]=se[k]=!0,se[_]=se[y]=se[R]=!1;var ae={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},oe=parseFloat,le=parseInt,ce="object"==typeof ch&&ch&&ch.Object===Object&&ch,he="object"==typeof self&&self&&self.Object===Object&&self,ue=ce||he||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,fe=pe&&pe.exports===de,me=fe&&ce.process,ge=function(){try{var t=pe&&pe.require&&pe.require("util").types;return t||me&&me.binding&&me.binding("util")}catch(t){}}(),ve=ge&&ge.isArrayBuffer,_e=ge&&ge.isDate,ye=ge&&ge.isMap,xe=ge&&ge.isRegExp,be=ge&&ge.isSet,Me=ge&&ge.isTypedArray;function Se(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ee(t,e,n,i){for(var r=-1,s=null==t?0:t.length;++r<s;){var a=t[r];e(i,a,n(a),t)}return i}function we(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t}function Te(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Ae(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(!e(t[n],n,t))return!1;return!0}function Ce(t,e){for(var n=-1,i=null==t?0:t.length,r=0,s=[];++n<i;){var a=t[n];e(a,n,t)&&(s[r++]=a)}return s}function Re(t,e){return!(null==t||!t.length)&&ze(t,e,0)>-1}function Pe(t,e,n){for(var i=-1,r=null==t?0:t.length;++i<r;)if(n(e,t[i]))return!0;return!1}function Ie(t,e){for(var n=-1,i=null==t?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r}function Ne(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t}function De(t,e,n,i){var r=-1,s=null==t?0:t.length;for(i&&s&&(n=t[++r]);++r<s;)n=e(n,t[r],r,t);return n}function Le(t,e,n,i){var r=null==t?0:t.length;for(i&&r&&(n=t[--r]);r--;)n=e(n,t[r],r,t);return n}function Ue(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}var Oe=Ge("length");function Fe(t,e,n){var i;return n(t,(function(t,n,r){if(e(t,n,r))return i=n,!1})),i}function Be(t,e,n,i){for(var r=t.length,s=n+(i?1:-1);i?s--:++s<r;)if(e(t[s],s,t))return s;return-1}function ze(t,e,n){return e==e?function(t,e,n){for(var i=n-1,r=t.length;++i<r;)if(t[i]===e)return i;return-1}(t,e,n):Be(t,Ve,n)}function ke(t,e,n,i){for(var r=n-1,s=t.length;++r<s;)if(i(t[r],e))return r;return-1}function Ve(t){return t!=t}function He(t,e){var n=null==t?0:t.length;return n?je(t,e)/n:u}function Ge(t){return function(e){return null==e?n:e[t]}}function We(t){return function(e){return null==t?n:t[e]}}function qe(t,e,n,i,r){return r(t,(function(t,r,s){n=i?(i=!1,t):e(n,t,r,s)})),n}function je(t,e){for(var i,r=-1,s=t.length;++r<s;){var a=e(t[r]);a!==n&&(i=i===n?a:i+a)}return i}function Xe(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function Ye(t){return t?t.slice(0,un(t)+1).replace(nt,""):t}function Ze(t){return function(e){return t(e)}}function Ke(t,e){return Ie(e,(function(e){return t[e]}))}function Je(t,e){return t.has(e)}function $e(t,e){for(var n=-1,i=t.length;++n<i&&ze(e,t[n],0)>-1;);return n}function Qe(t,e){for(var n=t.length;n--&&ze(e,t[n],0)>-1;);return n}var tn=We({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),en=We({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(t){return"\\"+ae[t]}function rn(t){return te.test(t)}function sn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n}function an(t,e){return function(n){return t(e(n))}}function on(t,e){for(var n=-1,i=t.length,r=0,a=[];++n<i;){var o=t[n];o!==e&&o!==s||(t[n]=s,a[r++]=n)}return a}function ln(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function cn(t){return rn(t)?function(t){for(var e=$t.lastIndex=0;$t.test(t);)++e;return e}(t):Oe(t)}function hn(t){return rn(t)?function(t){return t.match($t)||[]}(t):function(t){return t.split("")}(t)}function un(t){for(var e=t.length;e--&&it.test(t.charAt(e)););return e}var dn=We({"&":"&","<":"<",">":">",""":'"',"'":"'"}),pn=function t(e){var it,xt=(e=null==e?ue:pn.defaults(ue.Object(),e,pn.pick(ue,ne))).Array,bt=e.Date,Mt=e.Error,St=e.Function,Et=e.Math,wt=e.Object,Tt=e.RegExp,At=e.String,Ct=e.TypeError,Rt=xt.prototype,Pt=St.prototype,It=wt.prototype,Nt=e["__core-js_shared__"],Dt=Pt.toString,Lt=It.hasOwnProperty,Ut=0,Ot=(it=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||""))?"Symbol(src)_1."+it:"",Ft=It.toString,Bt=Dt.call(wt),zt=ue._,kt=Tt("^"+Dt.call(Lt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=fe?e.Buffer:n,Ht=e.Symbol,Gt=e.Uint8Array,Wt=Vt?Vt.allocUnsafe:n,qt=an(wt.getPrototypeOf,wt),jt=wt.create,Xt=It.propertyIsEnumerable,Yt=Rt.splice,Zt=Ht?Ht.isConcatSpreadable:n,$t=Ht?Ht.iterator:n,te=Ht?Ht.toStringTag:n,ae=function(){try{var t=cs(wt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ce=e.clearTimeout!==ue.clearTimeout&&e.clearTimeout,he=bt&&bt.now!==ue.Date.now&&bt.now,de=e.setTimeout!==ue.setTimeout&&e.setTimeout,pe=Et.ceil,me=Et.floor,ge=wt.getOwnPropertySymbols,Oe=Vt?Vt.isBuffer:n,We=e.isFinite,fn=Rt.join,mn=an(wt.keys,wt),gn=Et.max,vn=Et.min,_n=bt.now,yn=e.parseInt,xn=Et.random,bn=Rt.reverse,Mn=cs(e,"DataView"),Sn=cs(e,"Map"),En=cs(e,"Promise"),wn=cs(e,"Set"),Tn=cs(e,"WeakMap"),An=cs(wt,"create"),Cn=Tn&&new Tn,Rn={},Pn=Bs(Mn),In=Bs(Sn),Nn=Bs(En),Dn=Bs(wn),Ln=Bs(Tn),Un=Ht?Ht.prototype:n,On=Un?Un.valueOf:n,Fn=Un?Un.toString:n;function Bn(t){if(eo(t)&&!Wa(t)&&!(t instanceof Hn)){if(t instanceof Vn)return t;if(Lt.call(t,"__wrapped__"))return zs(t)}return new Vn(t)}var zn=function(){function t(){}return function(e){if(!to(e))return{};if(jt)return jt(e);t.prototype=e;var i=new t;return t.prototype=n,i}}();function kn(){}function Vn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=n}function Hn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function jn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new qn;++e<n;)this.add(t[e])}function Xn(t){var e=this.__data__=new Wn(t);this.size=e.size}function Yn(t,e){var n=Wa(t),i=!n&&Ga(t),r=!n&&!i&&Ya(t),s=!n&&!i&&!r&&co(t),a=n||i||r||s,o=a?Xe(t.length,At):[],l=o.length;for(var c in t)!e&&!Lt.call(t,c)||a&&("length"==c||r&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||gs(c,l))||o.push(c);return o}function Zn(t){var e=t.length;return e?t[ji(0,e-1)]:n}function Kn(t,e){return Ns(Ar(t),si(e,0,t.length))}function Jn(t){return Ns(Ar(t))}function $n(t,e,i){(i!==n&&!ka(t[e],i)||i===n&&!(e in t))&&ii(t,e,i)}function Qn(t,e,i){var r=t[e];Lt.call(t,e)&&ka(r,i)&&(i!==n||e in t)||ii(t,e,i)}function ti(t,e){for(var n=t.length;n--;)if(ka(t[n][0],e))return n;return-1}function ei(t,e,n,i){return hi(t,(function(t,r,s){e(i,t,n(t),s)})),i}function ni(t,e){return t&&Cr(e,No(e),t)}function ii(t,e,n){"__proto__"==e&&ae?ae(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ri(t,e){for(var i=-1,r=e.length,s=xt(r),a=null==t;++i<r;)s[i]=a?n:Ao(t,e[i]);return s}function si(t,e,i){return t==t&&(i!==n&&(t=t<=i?t:i),e!==n&&(t=t>=e?t:e)),t}function ai(t,e,i,r,s,a){var o,l=1&e,c=2&e,h=4&e;if(i&&(o=s?i(t,r,s,a):i(t)),o!==n)return o;if(!to(t))return t;var u=Wa(t);if(u){if(o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Lt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!l)return Ar(t,o)}else{var d=ds(t),p=d==y||d==x;if(Ya(t))return br(t,l);if(d==S||d==f||p&&!s){if(o=c||p?{}:fs(t),!l)return c?function(t,e){return Cr(t,us(t),e)}(t,function(t,e){return t&&Cr(e,Do(e),t)}(o,t)):function(t,e){return Cr(t,hs(t),e)}(t,ni(o,t))}else{if(!se[d])return s?t:{};o=function(t,e,n){var i,r=t.constructor;switch(e){case P:return Mr(t);case g:case v:return new r(+t);case I:return function(t,e){var n=e?Mr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case N:case D:case L:case U:case O:case F:case B:case z:case k:return Sr(t,n);case b:return new r;case M:case A:return new r(t);case w:return function(t){var e=new t.constructor(t.source,ut.exec(t));return e.lastIndex=t.lastIndex,e}(t);case T:return new r;case C:return i=t,On?wt(On.call(i)):{}}}(t,d,l)}}a||(a=new Xn);var m=a.get(t);if(m)return m;a.set(t,o),ao(t)?t.forEach((function(n){o.add(ai(n,e,i,n,t,a))})):no(t)&&t.forEach((function(n,r){o.set(r,ai(n,e,i,r,t,a))}));var _=u?n:(h?c?ns:es:c?Do:No)(t);return we(_||t,(function(n,r){_&&(n=t[r=n]),Qn(o,r,ai(n,e,i,r,t,a))})),o}function oi(t,e,i){var r=i.length;if(null==t)return!r;for(t=wt(t);r--;){var s=i[r],a=e[s],o=t[s];if(o===n&&!(s in t)||!a(o))return!1}return!0}function li(t,e,r){if("function"!=typeof t)throw new Ct(i);return Cs((function(){t.apply(n,r)}),e)}function ci(t,e,n,i){var r=-1,s=Re,a=!0,o=t.length,l=[],c=e.length;if(!o)return l;n&&(e=Ie(e,Ze(n))),i?(s=Pe,a=!1):e.length>=200&&(s=Je,a=!1,e=new jn(e));t:for(;++r<o;){var h=t[r],u=null==n?h:n(h);if(h=i||0!==h?h:0,a&&u==u){for(var d=c;d--;)if(e[d]===u)continue t;l.push(h)}else s(e,u,i)||l.push(h)}return l}Bn.templateSettings={escape:Y,evaluate:Z,interpolate:K,variable:"",imports:{_:Bn}},Bn.prototype=kn.prototype,Bn.prototype.constructor=Bn,Vn.prototype=zn(kn.prototype),Vn.prototype.constructor=Vn,Hn.prototype=zn(kn.prototype),Hn.prototype.constructor=Hn,Gn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},Gn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Gn.prototype.get=function(t){var e=this.__data__;if(An){var i=e[t];return i===r?n:i}return Lt.call(e,t)?e[t]:n},Gn.prototype.has=function(t){var e=this.__data__;return An?e[t]!==n:Lt.call(e,t)},Gn.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=An&&e===n?r:e,this},Wn.prototype.clear=function(){this.__data__=[],this.size=0},Wn.prototype.delete=function(t){var e=this.__data__,n=ti(e,t);return!(n<0||(n==e.length-1?e.pop():Yt.call(e,n,1),--this.size,0))},Wn.prototype.get=function(t){var e=this.__data__,i=ti(e,t);return i<0?n:e[i][1]},Wn.prototype.has=function(t){return ti(this.__data__,t)>-1},Wn.prototype.set=function(t,e){var n=this.__data__,i=ti(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(Sn||Wn),string:new Gn}},qn.prototype.delete=function(t){var e=os(this,t).delete(t);return this.size-=e?1:0,e},qn.prototype.get=function(t){return os(this,t).get(t)},qn.prototype.has=function(t){return os(this,t).has(t)},qn.prototype.set=function(t,e){var n=os(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this},jn.prototype.add=jn.prototype.push=function(t){return this.__data__.set(t,r),this},jn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.clear=function(){this.__data__=new Wn,this.size=0},Xn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Xn.prototype.get=function(t){return this.__data__.get(t)},Xn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Wn){var i=n.__data__;if(!Sn||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new qn(i)}return n.set(t,e),this.size=n.size,this};var hi=Ir(_i),ui=Ir(yi,!0);function di(t,e){var n=!0;return hi(t,(function(t,i,r){return n=!!e(t,i,r)})),n}function pi(t,e,i){for(var r=-1,s=t.length;++r<s;){var a=t[r],o=e(a);if(null!=o&&(l===n?o==o&&!lo(o):i(o,l)))var l=o,c=a}return c}function fi(t,e){var n=[];return hi(t,(function(t,i,r){e(t,i,r)&&n.push(t)})),n}function mi(t,e,n,i,r){var s=-1,a=t.length;for(n||(n=ms),r||(r=[]);++s<a;){var o=t[s];e>0&&n(o)?e>1?mi(o,e-1,n,i,r):Ne(r,o):i||(r[r.length]=o)}return r}var gi=Nr(),vi=Nr(!0);function _i(t,e){return t&&gi(t,e,No)}function yi(t,e){return t&&vi(t,e,No)}function xi(t,e){return Ce(e,(function(e){return Ja(t[e])}))}function bi(t,e){for(var i=0,r=(e=vr(e,t)).length;null!=t&&i<r;)t=t[Fs(e[i++])];return i&&i==r?t:n}function Mi(t,e,n){var i=e(t);return Wa(t)?i:Ne(i,n(t))}function Si(t){return null==t?t===n?"[object Undefined]":"[object Null]":te&&te in wt(t)?function(t){var e=Lt.call(t,te),i=t[te];try{t[te]=n;var r=!0}catch(t){}var s=Ft.call(t);return r&&(e?t[te]=i:delete t[te]),s}(t):function(t){return Ft.call(t)}(t)}function Ei(t,e){return t>e}function wi(t,e){return null!=t&&Lt.call(t,e)}function Ti(t,e){return null!=t&&e in wt(t)}function Ai(t,e,i){for(var r=i?Pe:Re,s=t[0].length,a=t.length,o=a,l=xt(a),c=1/0,h=[];o--;){var u=t[o];o&&e&&(u=Ie(u,Ze(e))),c=vn(u.length,c),l[o]=!i&&(e||s>=120&&u.length>=120)?new jn(o&&u):n}u=t[0];var d=-1,p=l[0];t:for(;++d<s&&h.length<c;){var f=u[d],m=e?e(f):f;if(f=i||0!==f?f:0,!(p?Je(p,m):r(h,m,i))){for(o=a;--o;){var g=l[o];if(!(g?Je(g,m):r(t[o],m,i)))continue t}p&&p.push(m),h.push(f)}}return h}function Ci(t,e,i){var r=null==(t=ws(t,e=vr(e,t)))?t:t[Fs(Ks(e))];return null==r?n:Se(r,t,i)}function Ri(t){return eo(t)&&Si(t)==f}function Pi(t,e,i,r,s){return t===e||(null==t||null==e||!eo(t)&&!eo(e)?t!=t&&e!=e:function(t,e,i,r,s,a){var o=Wa(t),l=Wa(e),c=o?m:ds(t),h=l?m:ds(e),u=(c=c==f?S:c)==S,d=(h=h==f?S:h)==S,p=c==h;if(p&&Ya(t)){if(!Ya(e))return!1;o=!0,u=!1}if(p&&!u)return a||(a=new Xn),o||co(t)?Qr(t,e,i,r,s,a):function(t,e,n,i,r,s,a){switch(n){case I:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case P:return!(t.byteLength!=e.byteLength||!s(new Gt(t),new Gt(e)));case g:case v:case M:return ka(+t,+e);case _:return t.name==e.name&&t.message==e.message;case w:case A:return t==e+"";case b:var o=sn;case T:var l=1&i;if(o||(o=ln),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;i|=2,a.set(t,e);var h=Qr(o(t),o(e),i,r,s,a);return a.delete(t),h;case C:if(On)return On.call(t)==On.call(e)}return!1}(t,e,c,i,r,s,a);if(!(1&i)){var y=u&&Lt.call(t,"__wrapped__"),x=d&&Lt.call(e,"__wrapped__");if(y||x){var E=y?t.value():t,R=x?e.value():e;return a||(a=new Xn),s(E,R,i,r,a)}}return!!p&&(a||(a=new Xn),function(t,e,i,r,s,a){var o=1&i,l=es(t),c=l.length,h=es(e),u=h.length;if(c!=u&&!o)return!1;for(var d=c;d--;){var p=l[d];if(!(o?p in e:Lt.call(e,p)))return!1}var f=a.get(t),m=a.get(e);if(f&&m)return f==e&&m==t;var g=!0;a.set(t,e),a.set(e,t);for(var v=o;++d<c;){var _=t[p=l[d]],y=e[p];if(r)var x=o?r(y,_,p,e,t,a):r(_,y,p,t,e,a);if(!(x===n?_===y||s(_,y,i,r,a):x)){g=!1;break}v||(v="constructor"==p)}if(g&&!v){var b=t.constructor,M=e.constructor;b==M||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof M&&M instanceof M||(g=!1)}return a.delete(t),a.delete(e),g}(t,e,i,r,s,a))}(t,e,i,r,Pi,s))}function Ii(t,e,i,r){var s=i.length,a=s,o=!r;if(null==t)return!a;for(t=wt(t);s--;){var l=i[s];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<a;){var c=(l=i[s])[0],h=t[c],u=l[1];if(o&&l[2]){if(h===n&&!(c in t))return!1}else{var d=new Xn;if(r)var p=r(h,u,c,t,e,d);if(!(p===n?Pi(u,h,3,r,d):p))return!1}}return!0}function Ni(t){return!(!to(t)||(e=t,Ot&&Ot in e))&&(Ja(t)?kt:ft).test(Bs(t));var e}function Di(t){return"function"==typeof t?t:null==t?rl:"object"==typeof t?Wa(t)?zi(t[0],t[1]):Bi(t):pl(t)}function Li(t){if(!bs(t))return mn(t);var e=[];for(var n in wt(t))Lt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Ui(t){if(!to(t))return function(t){var e=[];if(null!=t)for(var n in wt(t))e.push(n);return e}(t);var e=bs(t),n=[];for(var i in t)("constructor"!=i||!e&&Lt.call(t,i))&&n.push(i);return n}function Oi(t,e){return t<e}function Fi(t,e){var n=-1,i=ja(t)?xt(t.length):[];return hi(t,(function(t,r,s){i[++n]=e(t,r,s)})),i}function Bi(t){var e=ls(t);return 1==e.length&&e[0][2]?Ss(e[0][0],e[0][1]):function(n){return n===t||Ii(n,t,e)}}function zi(t,e){return _s(t)&&Ms(e)?Ss(Fs(t),e):function(i){var r=Ao(i,t);return r===n&&r===e?Co(i,t):Pi(e,r,3)}}function ki(t,e,i,r,s){t!==e&&gi(e,(function(a,o){if(s||(s=new Xn),to(a))!function(t,e,i,r,s,a,o){var l=Ts(t,i),c=Ts(e,i),h=o.get(c);if(h)$n(t,i,h);else{var u=a?a(l,c,i+"",t,e,o):n,d=u===n;if(d){var p=Wa(c),f=!p&&Ya(c),m=!p&&!f&&co(c);u=c,p||f||m?Wa(l)?u=l:Xa(l)?u=Ar(l):f?(d=!1,u=br(c,!0)):m?(d=!1,u=Sr(c,!0)):u=[]:ro(c)||Ga(c)?(u=l,Ga(l)?u=_o(l):to(l)&&!Ja(l)||(u=fs(c))):d=!1}d&&(o.set(c,u),s(u,c,r,a,o),o.delete(c)),$n(t,i,u)}}(t,e,o,i,ki,r,s);else{var l=r?r(Ts(t,o),a,o+"",t,e,s):n;l===n&&(l=a),$n(t,o,l)}}),Do)}function Vi(t,e){var i=t.length;if(i)return gs(e+=e<0?i:0,i)?t[e]:n}function Hi(t,e,n){e=e.length?Ie(e,(function(t){return Wa(t)?function(e){return bi(e,1===t.length?t[0]:t)}:t})):[rl];var i=-1;return e=Ie(e,Ze(as())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(Fi(t,(function(t,n,r){return{criteria:Ie(e,(function(e){return e(t)})),index:++i,value:t}})),(function(t,e){return function(t,e,n){for(var i=-1,r=t.criteria,s=e.criteria,a=r.length,o=n.length;++i<a;){var l=Er(r[i],s[i]);if(l)return i>=o?l:l*("desc"==n[i]?-1:1)}return t.index-e.index}(t,e,n)}))}function Gi(t,e,n){for(var i=-1,r=e.length,s={};++i<r;){var a=e[i],o=bi(t,a);n(o,a)&&Ji(s,vr(a,t),o)}return s}function Wi(t,e,n,i){var r=i?ke:ze,s=-1,a=e.length,o=t;for(t===e&&(e=Ar(e)),n&&(o=Ie(t,Ze(n)));++s<a;)for(var l=0,c=e[s],h=n?n(c):c;(l=r(o,h,l,i))>-1;)o!==t&&Yt.call(o,l,1),Yt.call(t,l,1);return t}function qi(t,e){for(var n=t?e.length:0,i=n-1;n--;){var r=e[n];if(n==i||r!==s){var s=r;gs(r)?Yt.call(t,r,1):cr(t,r)}}return t}function ji(t,e){return t+me(xn()*(e-t+1))}function Xi(t,e){var n="";if(!t||e<1||e>h)return n;do{e%2&&(n+=t),(e=me(e/2))&&(t+=t)}while(e);return n}function Yi(t,e){return Rs(Es(t,e,rl),t+"")}function Zi(t){return Zn(Vo(t))}function Ki(t,e){var n=Vo(t);return Ns(n,si(e,0,n.length))}function Ji(t,e,i,r){if(!to(t))return t;for(var s=-1,a=(e=vr(e,t)).length,o=a-1,l=t;null!=l&&++s<a;){var c=Fs(e[s]),h=i;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(s!=o){var u=l[c];(h=r?r(u,c,l):n)===n&&(h=to(u)?u:gs(e[s+1])?[]:{})}Qn(l,c,h),l=l[c]}return t}var $i=Cn?function(t,e){return Cn.set(t,e),t}:rl,Qi=ae?function(t,e){return ae(t,"toString",{configurable:!0,enumerable:!1,value:el(e),writable:!0})}:rl;function tr(t){return Ns(Vo(t))}function er(t,e,n){var i=-1,r=t.length;e<0&&(e=-e>r?0:r+e),(n=n>r?r:n)<0&&(n+=r),r=e>n?0:n-e>>>0,e>>>=0;for(var s=xt(r);++i<r;)s[i]=t[i+e];return s}function nr(t,e){var n;return hi(t,(function(t,i,r){return!(n=e(t,i,r))})),!!n}function ir(t,e,n){var i=0,r=null==t?i:t.length;if("number"==typeof e&&e==e&&r<=2147483647){for(;i<r;){var s=i+r>>>1,a=t[s];null!==a&&!lo(a)&&(n?a<=e:a<e)?i=s+1:r=s}return r}return rr(t,e,rl,n)}function rr(t,e,i,r){var s=0,a=null==t?0:t.length;if(0===a)return 0;for(var o=(e=i(e))!=e,l=null===e,c=lo(e),h=e===n;s<a;){var u=me((s+a)/2),d=i(t[u]),p=d!==n,f=null===d,m=d==d,g=lo(d);if(o)var v=r||m;else v=h?m&&(r||p):l?m&&p&&(r||!f):c?m&&p&&!f&&(r||!g):!f&&!g&&(r?d<=e:d<e);v?s=u+1:a=u}return vn(a,4294967294)}function sr(t,e){for(var n=-1,i=t.length,r=0,s=[];++n<i;){var a=t[n],o=e?e(a):a;if(!n||!ka(o,l)){var l=o;s[r++]=0===a?0:a}}return s}function ar(t){return"number"==typeof t?t:lo(t)?u:+t}function or(t){if("string"==typeof t)return t;if(Wa(t))return Ie(t,or)+"";if(lo(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function lr(t,e,n){var i=-1,r=Re,s=t.length,a=!0,o=[],l=o;if(n)a=!1,r=Pe;else if(s>=200){var c=e?null:Xr(t);if(c)return ln(c);a=!1,r=Je,l=new jn}else l=e?[]:o;t:for(;++i<s;){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,a&&u==u){for(var d=l.length;d--;)if(l[d]===u)continue t;e&&l.push(u),o.push(h)}else r(l,u,n)||(l!==o&&l.push(u),o.push(h))}return o}function cr(t,e){return null==(t=ws(t,e=vr(e,t)))||delete t[Fs(Ks(e))]}function hr(t,e,n,i){return Ji(t,e,n(bi(t,e)),i)}function ur(t,e,n,i){for(var r=t.length,s=i?r:-1;(i?s--:++s<r)&&e(t[s],s,t););return n?er(t,i?0:s,i?s+1:r):er(t,i?s+1:0,i?r:s)}function dr(t,e){var n=t;return n instanceof Hn&&(n=n.value()),De(e,(function(t,e){return e.func.apply(e.thisArg,Ne([t],e.args))}),n)}function pr(t,e,n){var i=t.length;if(i<2)return i?lr(t[0]):[];for(var r=-1,s=xt(i);++r<i;)for(var a=t[r],o=-1;++o<i;)o!=r&&(s[r]=ci(s[r]||a,t[o],e,n));return lr(mi(s,1),e,n)}function fr(t,e,i){for(var r=-1,s=t.length,a=e.length,o={};++r<s;){var l=r<a?e[r]:n;i(o,t[r],l)}return o}function mr(t){return Xa(t)?t:[]}function gr(t){return"function"==typeof t?t:rl}function vr(t,e){return Wa(t)?t:_s(t,e)?[t]:Os(yo(t))}var _r=Yi;function yr(t,e,i){var r=t.length;return i=i===n?r:i,!e&&i>=r?t:er(t,e,i)}var xr=ce||function(t){return ue.clearTimeout(t)};function br(t,e){if(e)return t.slice();var n=t.length,i=Wt?Wt(n):new t.constructor(n);return t.copy(i),i}function Mr(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}function Sr(t,e){var n=e?Mr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Er(t,e){if(t!==e){var i=t!==n,r=null===t,s=t==t,a=lo(t),o=e!==n,l=null===e,c=e==e,h=lo(e);if(!l&&!h&&!a&&t>e||a&&o&&c&&!l&&!h||r&&o&&c||!i&&c||!s)return 1;if(!r&&!a&&!h&&t<e||h&&i&&s&&!r&&!a||l&&i&&s||!o&&s||!c)return-1}return 0}function wr(t,e,n,i){for(var r=-1,s=t.length,a=n.length,o=-1,l=e.length,c=gn(s-a,0),h=xt(l+c),u=!i;++o<l;)h[o]=e[o];for(;++r<a;)(u||r<s)&&(h[n[r]]=t[r]);for(;c--;)h[o++]=t[r++];return h}function Tr(t,e,n,i){for(var r=-1,s=t.length,a=-1,o=n.length,l=-1,c=e.length,h=gn(s-o,0),u=xt(h+c),d=!i;++r<h;)u[r]=t[r];for(var p=r;++l<c;)u[p+l]=e[l];for(;++a<o;)(d||r<s)&&(u[p+n[a]]=t[r++]);return u}function Ar(t,e){var n=-1,i=t.length;for(e||(e=xt(i));++n<i;)e[n]=t[n];return e}function Cr(t,e,i,r){var s=!i;i||(i={});for(var a=-1,o=e.length;++a<o;){var l=e[a],c=r?r(i[l],t[l],l,i,t):n;c===n&&(c=t[l]),s?ii(i,l,c):Qn(i,l,c)}return i}function Rr(t,e){return function(n,i){var r=Wa(n)?Ee:ei,s=e?e():{};return r(n,t,as(i,2),s)}}function Pr(t){return Yi((function(e,i){var r=-1,s=i.length,a=s>1?i[s-1]:n,o=s>2?i[2]:n;for(a=t.length>3&&"function"==typeof a?(s--,a):n,o&&vs(i[0],i[1],o)&&(a=s<3?n:a,s=1),e=wt(e);++r<s;){var l=i[r];l&&t(e,l,r,a)}return e}))}function Ir(t,e){return function(n,i){if(null==n)return n;if(!ja(n))return t(n,i);for(var r=n.length,s=e?r:-1,a=wt(n);(e?s--:++s<r)&&!1!==i(a[s],s,a););return n}}function Nr(t){return function(e,n,i){for(var r=-1,s=wt(e),a=i(e),o=a.length;o--;){var l=a[t?o:++r];if(!1===n(s[l],l,s))break}return e}}function Dr(t){return function(e){var i=rn(e=yo(e))?hn(e):n,r=i?i[0]:e.charAt(0),s=i?yr(i,1).join(""):e.slice(1);return r[t]()+s}}function Lr(t){return function(e){return De($o(Wo(e).replace(Kt,"")),t,"")}}function Ur(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=zn(t.prototype),i=t.apply(n,e);return to(i)?i:n}}function Or(t){return function(e,i,r){var s=wt(e);if(!ja(e)){var a=as(i,3);e=No(e),i=function(t){return a(s[t],t,s)}}var o=t(e,i,r);return o>-1?s[a?e[o]:o]:n}}function Fr(t){return ts((function(e){var r=e.length,s=r,a=Vn.prototype.thru;for(t&&e.reverse();s--;){var o=e[s];if("function"!=typeof o)throw new Ct(i);if(a&&!l&&"wrapper"==rs(o))var l=new Vn([],!0)}for(s=l?s:r;++s<r;){var c=rs(o=e[s]),h="wrapper"==c?is(o):n;l=h&&ys(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?l[rs(h[0])].apply(l,h[3]):1==o.length&&ys(o)?l[c]():l.thru(o)}return function(){var t=arguments,n=t[0];if(l&&1==t.length&&Wa(n))return l.plant(n).value();for(var i=0,s=r?e[i].apply(this,t):n;++i<r;)s=e[i].call(this,s);return s}}))}function Br(t,e,i,r,s,a,l,c,h,u){var d=e&o,p=1&e,f=2&e,m=24&e,g=512&e,v=f?n:Ur(t);return function o(){for(var _=arguments.length,y=xt(_),x=_;x--;)y[x]=arguments[x];if(m)var b=ss(o),M=function(t,e){for(var n=t.length,i=0;n--;)t[n]===e&&++i;return i}(y,b);if(r&&(y=wr(y,r,s,m)),a&&(y=Tr(y,a,l,m)),_-=M,m&&_<u){var S=on(y,b);return qr(t,e,Br,o.placeholder,i,y,S,c,h,u-_)}var E=p?i:this,w=f?E[t]:t;return _=y.length,c?y=function(t,e){for(var i=t.length,r=vn(e.length,i),s=Ar(t);r--;){var a=e[r];t[r]=gs(a,i)?s[a]:n}return t}(y,c):g&&_>1&&y.reverse(),d&&h<_&&(y.length=h),this&&this!==ue&&this instanceof o&&(w=v||Ur(w)),w.apply(E,y)}}function zr(t,e){return function(n,i){return function(t,e,n,i){return _i(t,(function(t,r,s){e(i,n(t),r,s)})),i}(n,t,e(i),{})}}function kr(t,e){return function(i,r){var s;if(i===n&&r===n)return e;if(i!==n&&(s=i),r!==n){if(s===n)return r;"string"==typeof i||"string"==typeof r?(i=or(i),r=or(r)):(i=ar(i),r=ar(r)),s=t(i,r)}return s}}function Vr(t){return ts((function(e){return e=Ie(e,Ze(as())),Yi((function(n){var i=this;return t(e,(function(t){return Se(t,i,n)}))}))}))}function Hr(t,e){var i=(e=e===n?" ":or(e)).length;if(i<2)return i?Xi(e,t):e;var r=Xi(e,pe(t/cn(e)));return rn(e)?yr(hn(r),0,t).join(""):r.slice(0,t)}function Gr(t){return function(e,i,r){return r&&"number"!=typeof r&&vs(e,i,r)&&(i=r=n),e=fo(e),i===n?(i=e,e=0):i=fo(i),function(t,e,n,i){for(var r=-1,s=gn(pe((e-t)/(n||1)),0),a=xt(s);s--;)a[i?s:++r]=t,t+=n;return a}(e,i,r=r===n?e<i?1:-1:fo(r),t)}}function Wr(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=vo(e),n=vo(n)),t(e,n)}}function qr(t,e,i,r,s,o,l,c,h,u){var d=8&e;e|=d?a:64,4&(e&=~(d?64:a))||(e&=-4);var p=[t,e,s,d?o:n,d?l:n,d?n:o,d?n:l,c,h,u],f=i.apply(n,p);return ys(t)&&As(f,p),f.placeholder=r,Ps(f,t,e)}function jr(t){var e=Et[t];return function(t,n){if(t=vo(t),(n=null==n?0:vn(mo(n),292))&&We(t)){var i=(yo(t)+"e").split("e");return+((i=(yo(e(i[0]+"e"+(+i[1]+n)))+"e").split("e"))[0]+"e"+(+i[1]-n))}return e(t)}}var Xr=wn&&1/ln(new wn([,-0]))[1]==c?function(t){return new wn(t)}:cl;function Yr(t){return function(e){var n=ds(e);return n==b?sn(e):n==T?function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}(e):function(t,e){return Ie(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Zr(t,e,r,c,h,u,d,p){var f=2&e;if(!f&&"function"!=typeof t)throw new Ct(i);var m=c?c.length:0;if(m||(e&=-97,c=h=n),d=d===n?d:gn(mo(d),0),p=p===n?p:mo(p),m-=h?h.length:0,64&e){var g=c,v=h;c=h=n}var _=f?n:is(t),y=[t,e,r,c,h,g,v,u,d,p];if(_&&function(t,e){var n=t[1],i=e[1],r=n|i,a=r<131,c=i==o&&8==n||i==o&&n==l&&t[7].length<=e[8]||384==i&&e[7].length<=e[8]&&8==n;if(!a&&!c)return t;1&i&&(t[2]=e[2],r|=1&n?0:4);var h=e[3];if(h){var u=t[3];t[3]=u?wr(u,h,e[4]):h,t[4]=u?on(t[3],s):e[4]}(h=e[5])&&(u=t[5],t[5]=u?Tr(u,h,e[6]):h,t[6]=u?on(t[5],s):e[6]),(h=e[7])&&(t[7]=h),i&o&&(t[8]=null==t[8]?e[8]:vn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=r}(y,_),t=y[0],e=y[1],r=y[2],c=y[3],h=y[4],!(p=y[9]=y[9]===n?f?0:t.length:gn(y[9]-m,0))&&24&e&&(e&=-25),e&&1!=e)x=8==e||16==e?function(t,e,i){var r=Ur(t);return function s(){for(var a=arguments.length,o=xt(a),l=a,c=ss(s);l--;)o[l]=arguments[l];var h=a<3&&o[0]!==c&&o[a-1]!==c?[]:on(o,c);return(a-=h.length)<i?qr(t,e,Br,s.placeholder,n,o,h,n,n,i-a):Se(this&&this!==ue&&this instanceof s?r:t,this,o)}}(t,e,p):e!=a&&33!=e||h.length?Br.apply(n,y):function(t,e,n,i){var r=1&e,s=Ur(t);return function e(){for(var a=-1,o=arguments.length,l=-1,c=i.length,h=xt(c+o),u=this&&this!==ue&&this instanceof e?s:t;++l<c;)h[l]=i[l];for(;o--;)h[l++]=arguments[++a];return Se(u,r?n:this,h)}}(t,e,r,c);else var x=function(t,e,n){var i=1&e,r=Ur(t);return function e(){return(this&&this!==ue&&this instanceof e?r:t).apply(i?n:this,arguments)}}(t,e,r);return Ps((_?$i:As)(x,y),t,e)}function Kr(t,e,i,r){return t===n||ka(t,It[i])&&!Lt.call(r,i)?e:t}function Jr(t,e,i,r,s,a){return to(t)&&to(e)&&(a.set(e,t),ki(t,e,n,Jr,a),a.delete(e)),t}function $r(t){return ro(t)?n:t}function Qr(t,e,i,r,s,a){var o=1&i,l=t.length,c=e.length;if(l!=c&&!(o&&c>l))return!1;var h=a.get(t),u=a.get(e);if(h&&u)return h==e&&u==t;var d=-1,p=!0,f=2&i?new jn:n;for(a.set(t,e),a.set(e,t);++d<l;){var m=t[d],g=e[d];if(r)var v=o?r(g,m,d,e,t,a):r(m,g,d,t,e,a);if(v!==n){if(v)continue;p=!1;break}if(f){if(!Ue(e,(function(t,e){if(!Je(f,e)&&(m===t||s(m,t,i,r,a)))return f.push(e)}))){p=!1;break}}else if(m!==g&&!s(m,g,i,r,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function ts(t){return Rs(Es(t,n,qs),t+"")}function es(t){return Mi(t,No,hs)}function ns(t){return Mi(t,Do,us)}var is=Cn?function(t){return Cn.get(t)}:cl;function rs(t){for(var e=t.name+"",n=Rn[e],i=Lt.call(Rn,e)?n.length:0;i--;){var r=n[i],s=r.func;if(null==s||s==t)return r.name}return e}function ss(t){return(Lt.call(Bn,"placeholder")?Bn:t).placeholder}function as(){var t=Bn.iteratee||sl;return t=t===sl?Di:t,arguments.length?t(arguments[0],arguments[1]):t}function os(t,e){var n,i,r=t.__data__;return("string"==(i=typeof(n=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function ls(t){for(var e=No(t),n=e.length;n--;){var i=e[n],r=t[i];e[n]=[i,r,Ms(r)]}return e}function cs(t,e){var i=function(t,e){return null==t?n:t[e]}(t,e);return Ni(i)?i:n}var hs=ge?function(t){return null==t?[]:(t=wt(t),Ce(ge(t),(function(e){return Xt.call(t,e)})))}:gl,us=ge?function(t){for(var e=[];t;)Ne(e,hs(t)),t=qt(t);return e}:gl,ds=Si;function ps(t,e,n){for(var i=-1,r=(e=vr(e,t)).length,s=!1;++i<r;){var a=Fs(e[i]);if(!(s=null!=t&&n(t,a)))break;t=t[a]}return s||++i!=r?s:!!(r=null==t?0:t.length)&&Qa(r)&&gs(a,r)&&(Wa(t)||Ga(t))}function fs(t){return"function"!=typeof t.constructor||bs(t)?{}:zn(qt(t))}function ms(t){return Wa(t)||Ga(t)||!!(Zt&&t&&t[Zt])}function gs(t,e){var n=typeof t;return!!(e=null==e?h:e)&&("number"==n||"symbol"!=n&>.test(t))&&t>-1&&t%1==0&&t<e}function vs(t,e,n){if(!to(n))return!1;var i=typeof e;return!!("number"==i?ja(n)&&gs(e,n.length):"string"==i&&e in n)&&ka(n[e],t)}function _s(t,e){if(Wa(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!lo(t))||$.test(t)||!J.test(t)||null!=e&&t in wt(e)}function ys(t){var e=rs(t),n=Bn[e];if("function"!=typeof n||!(e in Hn.prototype))return!1;if(t===n)return!0;var i=is(n);return!!i&&t===i[0]}(Mn&&ds(new Mn(new ArrayBuffer(1)))!=I||Sn&&ds(new Sn)!=b||En&&ds(En.resolve())!=E||wn&&ds(new wn)!=T||Tn&&ds(new Tn)!=R)&&(ds=function(t){var e=Si(t),i=e==S?t.constructor:n,r=i?Bs(i):"";if(r)switch(r){case Pn:return I;case In:return b;case Nn:return E;case Dn:return T;case Ln:return R}return e});var xs=Nt?Ja:vl;function bs(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||It)}function Ms(t){return t==t&&!to(t)}function Ss(t,e){return function(i){return null!=i&&i[t]===e&&(e!==n||t in wt(i))}}function Es(t,e,i){return e=gn(e===n?t.length-1:e,0),function(){for(var n=arguments,r=-1,s=gn(n.length-e,0),a=xt(s);++r<s;)a[r]=n[e+r];r=-1;for(var o=xt(e+1);++r<e;)o[r]=n[r];return o[e]=i(a),Se(t,this,o)}}function ws(t,e){return e.length<2?t:bi(t,er(e,0,-1))}function Ts(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var As=Is($i),Cs=de||function(t,e){return ue.setTimeout(t,e)},Rs=Is(Qi);function Ps(t,e,n){var i=e+"";return Rs(t,function(t,e){var n=e.length;if(!n)return t;var i=n-1;return e[i]=(n>1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(rt,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return we(p,(function(n){var i="_."+n[0];e&n[1]&&!Re(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(st);return e?e[1].split(at):[]}(i),n)))}function Is(t){var e=0,i=0;return function(){var r=_n(),s=16-(r-i);if(i=r,s>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(n,arguments)}}function Ns(t,e){var i=-1,r=t.length,s=r-1;for(e=e===n?r:e;++i<e;){var a=ji(i,s),o=t[a];t[a]=t[i],t[i]=o}return t.length=e,t}var Ds,Ls,Us,Os=(Ds=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Q,(function(t,n,i,r){e.push(i?r.replace(ct,"$1"):n||t)})),e},Ls=La(Ds,(function(t){return 500===Us.size&&Us.clear(),t})),Us=Ls.cache,Ls);function Fs(t){if("string"==typeof t||lo(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Bs(t){if(null!=t){try{return Dt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zs(t){if(t instanceof Hn)return t.clone();var e=new Vn(t.__wrapped__,t.__chain__);return e.__actions__=Ar(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var ks=Yi((function(t,e){return Xa(t)?ci(t,mi(e,1,Xa,!0)):[]})),Vs=Yi((function(t,e){var i=Ks(e);return Xa(i)&&(i=n),Xa(t)?ci(t,mi(e,1,Xa,!0),as(i,2)):[]})),Hs=Yi((function(t,e){var i=Ks(e);return Xa(i)&&(i=n),Xa(t)?ci(t,mi(e,1,Xa,!0),n,i):[]}));function Gs(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:mo(n);return r<0&&(r=gn(i+r,0)),Be(t,as(e,3),r)}function Ws(t,e,i){var r=null==t?0:t.length;if(!r)return-1;var s=r-1;return i!==n&&(s=mo(i),s=i<0?gn(r+s,0):vn(s,r-1)),Be(t,as(e,3),s,!0)}function qs(t){return null!=t&&t.length?mi(t,1):[]}function js(t){return t&&t.length?t[0]:n}var Xs=Yi((function(t){var e=Ie(t,mr);return e.length&&e[0]===t[0]?Ai(e):[]})),Ys=Yi((function(t){var e=Ks(t),i=Ie(t,mr);return e===Ks(i)?e=n:i.pop(),i.length&&i[0]===t[0]?Ai(i,as(e,2)):[]})),Zs=Yi((function(t){var e=Ks(t),i=Ie(t,mr);return(e="function"==typeof e?e:n)&&i.pop(),i.length&&i[0]===t[0]?Ai(i,n,e):[]}));function Ks(t){var e=null==t?0:t.length;return e?t[e-1]:n}var Js=Yi($s);function $s(t,e){return t&&t.length&&e&&e.length?Wi(t,e):t}var Qs=ts((function(t,e){var n=null==t?0:t.length,i=ri(t,e);return qi(t,Ie(e,(function(t){return gs(t,n)?+t:t})).sort(Er)),i}));function ta(t){return null==t?t:bn.call(t)}var ea=Yi((function(t){return lr(mi(t,1,Xa,!0))})),na=Yi((function(t){var e=Ks(t);return Xa(e)&&(e=n),lr(mi(t,1,Xa,!0),as(e,2))})),ia=Yi((function(t){var e=Ks(t);return e="function"==typeof e?e:n,lr(mi(t,1,Xa,!0),n,e)}));function ra(t){if(!t||!t.length)return[];var e=0;return t=Ce(t,(function(t){if(Xa(t))return e=gn(t.length,e),!0})),Xe(e,(function(e){return Ie(t,Ge(e))}))}function sa(t,e){if(!t||!t.length)return[];var i=ra(t);return null==e?i:Ie(i,(function(t){return Se(e,n,t)}))}var aa=Yi((function(t,e){return Xa(t)?ci(t,e):[]})),oa=Yi((function(t){return pr(Ce(t,Xa))})),la=Yi((function(t){var e=Ks(t);return Xa(e)&&(e=n),pr(Ce(t,Xa),as(e,2))})),ca=Yi((function(t){var e=Ks(t);return e="function"==typeof e?e:n,pr(Ce(t,Xa),n,e)})),ha=Yi(ra),ua=Yi((function(t){var e=t.length,i=e>1?t[e-1]:n;return i="function"==typeof i?(t.pop(),i):n,sa(t,i)}));function da(t){var e=Bn(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var fa=ts((function(t){var e=t.length,i=e?t[0]:0,r=this.__wrapped__,s=function(e){return ri(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Hn&&gs(i)?((r=r.slice(i,+i+(e?1:0))).__actions__.push({func:pa,args:[s],thisArg:n}),new Vn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(n),t}))):this.thru(s)})),ma=Rr((function(t,e,n){Lt.call(t,n)?++t[n]:ii(t,n,1)})),ga=Or(Gs),va=Or(Ws);function _a(t,e){return(Wa(t)?we:hi)(t,as(e,3))}function ya(t,e){return(Wa(t)?Te:ui)(t,as(e,3))}var xa=Rr((function(t,e,n){Lt.call(t,n)?t[n].push(e):ii(t,n,[e])})),ba=Yi((function(t,e,n){var i=-1,r="function"==typeof e,s=ja(t)?xt(t.length):[];return hi(t,(function(t){s[++i]=r?Se(e,t,n):Ci(t,e,n)})),s})),Ma=Rr((function(t,e,n){ii(t,n,e)}));function Sa(t,e){return(Wa(t)?Ie:Fi)(t,as(e,3))}var Ea=Rr((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),wa=Yi((function(t,e){if(null==t)return[];var n=e.length;return n>1&&vs(t,e[0],e[1])?e=[]:n>2&&vs(e[0],e[1],e[2])&&(e=[e[0]]),Hi(t,mi(e,1),[])})),Ta=he||function(){return ue.Date.now()};function Aa(t,e,i){return e=i?n:e,e=t&&null==e?t.length:e,Zr(t,o,n,n,n,n,e)}function Ca(t,e){var r;if("function"!=typeof e)throw new Ct(i);return t=mo(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=n),r}}var Ra=Yi((function(t,e,n){var i=1;if(n.length){var r=on(n,ss(Ra));i|=a}return Zr(t,i,e,n,r)})),Pa=Yi((function(t,e,n){var i=3;if(n.length){var r=on(n,ss(Pa));i|=a}return Zr(e,i,t,n,r)}));function Ia(t,e,r){var s,a,o,l,c,h,u=0,d=!1,p=!1,f=!0;if("function"!=typeof t)throw new Ct(i);function m(e){var i=s,r=a;return s=a=n,u=e,l=t.apply(r,i)}function g(t){var i=t-h;return h===n||i>=e||i<0||p&&t-u>=o}function v(){var t=Ta();if(g(t))return _(t);c=Cs(v,function(t){var n=e-(t-h);return p?vn(n,o-(t-u)):n}(t))}function _(t){return c=n,f&&s?m(t):(s=a=n,l)}function y(){var t=Ta(),i=g(t);if(s=arguments,a=this,h=t,i){if(c===n)return function(t){return u=t,c=Cs(v,e),d?m(t):l}(h);if(p)return xr(c),c=Cs(v,e),m(h)}return c===n&&(c=Cs(v,e)),l}return e=vo(e)||0,to(r)&&(d=!!r.leading,o=(p="maxWait"in r)?gn(vo(r.maxWait)||0,e):o,f="trailing"in r?!!r.trailing:f),y.cancel=function(){c!==n&&xr(c),u=0,s=h=a=c=n},y.flush=function(){return c===n?l:_(Ta())},y}var Na=Yi((function(t,e){return li(t,1,e)})),Da=Yi((function(t,e,n){return li(t,vo(e)||0,n)}));function La(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ct(i);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],s=n.cache;if(s.has(r))return s.get(r);var a=t.apply(this,i);return n.cache=s.set(r,a)||s,a};return n.cache=new(La.Cache||qn),n}function Ua(t){if("function"!=typeof t)throw new Ct(i);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}La.Cache=qn;var Oa=_r((function(t,e){var n=(e=1==e.length&&Wa(e[0])?Ie(e[0],Ze(as())):Ie(mi(e,1),Ze(as()))).length;return Yi((function(i){for(var r=-1,s=vn(i.length,n);++r<s;)i[r]=e[r].call(this,i[r]);return Se(t,this,i)}))})),Fa=Yi((function(t,e){var i=on(e,ss(Fa));return Zr(t,a,n,e,i)})),Ba=Yi((function(t,e){var i=on(e,ss(Ba));return Zr(t,64,n,e,i)})),za=ts((function(t,e){return Zr(t,l,n,n,n,e)}));function ka(t,e){return t===e||t!=t&&e!=e}var Va=Wr(Ei),Ha=Wr((function(t,e){return t>=e})),Ga=Ri(function(){return arguments}())?Ri:function(t){return eo(t)&&Lt.call(t,"callee")&&!Xt.call(t,"callee")},Wa=xt.isArray,qa=ve?Ze(ve):function(t){return eo(t)&&Si(t)==P};function ja(t){return null!=t&&Qa(t.length)&&!Ja(t)}function Xa(t){return eo(t)&&ja(t)}var Ya=Oe||vl,Za=_e?Ze(_e):function(t){return eo(t)&&Si(t)==v};function Ka(t){if(!eo(t))return!1;var e=Si(t);return e==_||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ro(t)}function Ja(t){if(!to(t))return!1;var e=Si(t);return e==y||e==x||"[object AsyncFunction]"==e||"[object Proxy]"==e}function $a(t){return"number"==typeof t&&t==mo(t)}function Qa(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function to(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function eo(t){return null!=t&&"object"==typeof t}var no=ye?Ze(ye):function(t){return eo(t)&&ds(t)==b};function io(t){return"number"==typeof t||eo(t)&&Si(t)==M}function ro(t){if(!eo(t)||Si(t)!=S)return!1;var e=qt(t);if(null===e)return!0;var n=Lt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Dt.call(n)==Bt}var so=xe?Ze(xe):function(t){return eo(t)&&Si(t)==w},ao=be?Ze(be):function(t){return eo(t)&&ds(t)==T};function oo(t){return"string"==typeof t||!Wa(t)&&eo(t)&&Si(t)==A}function lo(t){return"symbol"==typeof t||eo(t)&&Si(t)==C}var co=Me?Ze(Me):function(t){return eo(t)&&Qa(t.length)&&!!re[Si(t)]},ho=Wr(Oi),uo=Wr((function(t,e){return t<=e}));function po(t){if(!t)return[];if(ja(t))return oo(t)?hn(t):Ar(t);if($t&&t[$t])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[$t]());var e=ds(t);return(e==b?sn:e==T?ln:Vo)(t)}function fo(t){return t?(t=vo(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function mo(t){var e=fo(t),n=e%1;return e==e?n?e-n:e:0}function go(t){return t?si(mo(t),0,d):0}function vo(t){if("number"==typeof t)return t;if(lo(t))return u;if(to(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=to(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ye(t);var n=pt.test(t);return n||mt.test(t)?le(t.slice(2),n?2:8):dt.test(t)?u:+t}function _o(t){return Cr(t,Do(t))}function yo(t){return null==t?"":or(t)}var xo=Pr((function(t,e){if(bs(e)||ja(e))Cr(e,No(e),t);else for(var n in e)Lt.call(e,n)&&Qn(t,n,e[n])})),bo=Pr((function(t,e){Cr(e,Do(e),t)})),Mo=Pr((function(t,e,n,i){Cr(e,Do(e),t,i)})),So=Pr((function(t,e,n,i){Cr(e,No(e),t,i)})),Eo=ts(ri),wo=Yi((function(t,e){t=wt(t);var i=-1,r=e.length,s=r>2?e[2]:n;for(s&&vs(e[0],e[1],s)&&(r=1);++i<r;)for(var a=e[i],o=Do(a),l=-1,c=o.length;++l<c;){var h=o[l],u=t[h];(u===n||ka(u,It[h])&&!Lt.call(t,h))&&(t[h]=a[h])}return t})),To=Yi((function(t){return t.push(n,Jr),Se(Uo,n,t)}));function Ao(t,e,i){var r=null==t?n:bi(t,e);return r===n?i:r}function Co(t,e){return null!=t&&ps(t,e,Ti)}var Ro=zr((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=n}),el(rl)),Po=zr((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Lt.call(t,e)?t[e].push(n):t[e]=[n]}),as),Io=Yi(Ci);function No(t){return ja(t)?Yn(t):Li(t)}function Do(t){return ja(t)?Yn(t,!0):Ui(t)}var Lo=Pr((function(t,e,n){ki(t,e,n)})),Uo=Pr((function(t,e,n,i){ki(t,e,n,i)})),Oo=ts((function(t,e){var n={};if(null==t)return n;var i=!1;e=Ie(e,(function(e){return e=vr(e,t),i||(i=e.length>1),e})),Cr(t,ns(t),n),i&&(n=ai(n,7,$r));for(var r=e.length;r--;)cr(n,e[r]);return n})),Fo=ts((function(t,e){return null==t?{}:function(t,e){return Gi(t,e,(function(e,n){return Co(t,n)}))}(t,e)}));function Bo(t,e){if(null==t)return{};var n=Ie(ns(t),(function(t){return[t]}));return e=as(e),Gi(t,n,(function(t,n){return e(t,n[0])}))}var zo=Yr(No),ko=Yr(Do);function Vo(t){return null==t?[]:Ke(t,No(t))}var Ho=Lr((function(t,e,n){return e=e.toLowerCase(),t+(n?Go(e):e)}));function Go(t){return Jo(yo(t).toLowerCase())}function Wo(t){return(t=yo(t))&&t.replace(vt,tn).replace(Jt,"")}var qo=Lr((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),jo=Lr((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Xo=Dr("toLowerCase"),Yo=Lr((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Zo=Lr((function(t,e,n){return t+(n?" ":"")+Jo(e)})),Ko=Lr((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Jo=Dr("toUpperCase");function $o(t,e,i){return t=yo(t),(e=i?n:e)===n?function(t){return ee.test(t)}(t)?function(t){return t.match(Qt)||[]}(t):function(t){return t.match(ot)||[]}(t):t.match(e)||[]}var Qo=Yi((function(t,e){try{return Se(t,n,e)}catch(t){return Ka(t)?t:new Mt(t)}})),tl=ts((function(t,e){return we(e,(function(e){e=Fs(e),ii(t,e,Ra(t[e],t))})),t}));function el(t){return function(){return t}}var nl=Fr(),il=Fr(!0);function rl(t){return t}function sl(t){return Di("function"==typeof t?t:ai(t,1))}var al=Yi((function(t,e){return function(n){return Ci(n,t,e)}})),ol=Yi((function(t,e){return function(n){return Ci(t,n,e)}}));function ll(t,e,n){var i=No(e),r=xi(e,i);null!=n||to(e)&&(r.length||!i.length)||(n=e,e=t,t=this,r=xi(e,No(e)));var s=!(to(n)&&"chain"in n&&!n.chain),a=Ja(t);return we(r,(function(n){var i=e[n];t[n]=i,a&&(t.prototype[n]=function(){var e=this.__chain__;if(s||e){var n=t(this.__wrapped__);return(n.__actions__=Ar(this.__actions__)).push({func:i,args:arguments,thisArg:t}),n.__chain__=e,n}return i.apply(t,Ne([this.value()],arguments))})})),t}function cl(){}var hl=Vr(Ie),ul=Vr(Ae),dl=Vr(Ue);function pl(t){return _s(t)?Ge(Fs(t)):function(t){return function(e){return bi(e,t)}}(t)}var fl=Gr(),ml=Gr(!0);function gl(){return[]}function vl(){return!1}var _l,yl=kr((function(t,e){return t+e}),0),xl=jr("ceil"),bl=kr((function(t,e){return t/e}),1),Ml=jr("floor"),Sl=kr((function(t,e){return t*e}),1),El=jr("round"),wl=kr((function(t,e){return t-e}),0);return Bn.after=function(t,e){if("function"!=typeof e)throw new Ct(i);return t=mo(t),function(){if(--t<1)return e.apply(this,arguments)}},Bn.ary=Aa,Bn.assign=xo,Bn.assignIn=bo,Bn.assignInWith=Mo,Bn.assignWith=So,Bn.at=Eo,Bn.before=Ca,Bn.bind=Ra,Bn.bindAll=tl,Bn.bindKey=Pa,Bn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Wa(t)?t:[t]},Bn.chain=da,Bn.chunk=function(t,e,i){e=(i?vs(t,e,i):e===n)?1:gn(mo(e),0);var r=null==t?0:t.length;if(!r||e<1)return[];for(var s=0,a=0,o=xt(pe(r/e));s<r;)o[a++]=er(t,s,s+=e);return o},Bn.compact=function(t){for(var e=-1,n=null==t?0:t.length,i=0,r=[];++e<n;){var s=t[e];s&&(r[i++]=s)}return r},Bn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=xt(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Ne(Wa(n)?Ar(n):[n],mi(e,1))},Bn.cond=function(t){var e=null==t?0:t.length,n=as();return t=e?Ie(t,(function(t){if("function"!=typeof t[1])throw new Ct(i);return[n(t[0]),t[1]]})):[],Yi((function(n){for(var i=-1;++i<e;){var r=t[i];if(Se(r[0],this,n))return Se(r[1],this,n)}}))},Bn.conforms=function(t){return function(t){var e=No(t);return function(n){return oi(n,t,e)}}(ai(t,1))},Bn.constant=el,Bn.countBy=ma,Bn.create=function(t,e){var n=zn(t);return null==e?n:ni(n,e)},Bn.curry=function t(e,i,r){var s=Zr(e,8,n,n,n,n,n,i=r?n:i);return s.placeholder=t.placeholder,s},Bn.curryRight=function t(e,i,r){var s=Zr(e,16,n,n,n,n,n,i=r?n:i);return s.placeholder=t.placeholder,s},Bn.debounce=Ia,Bn.defaults=wo,Bn.defaultsDeep=To,Bn.defer=Na,Bn.delay=Da,Bn.difference=ks,Bn.differenceBy=Vs,Bn.differenceWith=Hs,Bn.drop=function(t,e,i){var r=null==t?0:t.length;return r?er(t,(e=i||e===n?1:mo(e))<0?0:e,r):[]},Bn.dropRight=function(t,e,i){var r=null==t?0:t.length;return r?er(t,0,(e=r-(e=i||e===n?1:mo(e)))<0?0:e):[]},Bn.dropRightWhile=function(t,e){return t&&t.length?ur(t,as(e,3),!0,!0):[]},Bn.dropWhile=function(t,e){return t&&t.length?ur(t,as(e,3),!0):[]},Bn.fill=function(t,e,i,r){var s=null==t?0:t.length;return s?(i&&"number"!=typeof i&&vs(t,e,i)&&(i=0,r=s),function(t,e,i,r){var s=t.length;for((i=mo(i))<0&&(i=-i>s?0:s+i),(r=r===n||r>s?s:mo(r))<0&&(r+=s),r=i>r?0:go(r);i<r;)t[i++]=e;return t}(t,e,i,r)):[]},Bn.filter=function(t,e){return(Wa(t)?Ce:fi)(t,as(e,3))},Bn.flatMap=function(t,e){return mi(Sa(t,e),1)},Bn.flatMapDeep=function(t,e){return mi(Sa(t,e),c)},Bn.flatMapDepth=function(t,e,i){return i=i===n?1:mo(i),mi(Sa(t,e),i)},Bn.flatten=qs,Bn.flattenDeep=function(t){return null!=t&&t.length?mi(t,c):[]},Bn.flattenDepth=function(t,e){return null!=t&&t.length?mi(t,e=e===n?1:mo(e)):[]},Bn.flip=function(t){return Zr(t,512)},Bn.flow=nl,Bn.flowRight=il,Bn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,i={};++e<n;){var r=t[e];i[r[0]]=r[1]}return i},Bn.functions=function(t){return null==t?[]:xi(t,No(t))},Bn.functionsIn=function(t){return null==t?[]:xi(t,Do(t))},Bn.groupBy=xa,Bn.initial=function(t){return null!=t&&t.length?er(t,0,-1):[]},Bn.intersection=Xs,Bn.intersectionBy=Ys,Bn.intersectionWith=Zs,Bn.invert=Ro,Bn.invertBy=Po,Bn.invokeMap=ba,Bn.iteratee=sl,Bn.keyBy=Ma,Bn.keys=No,Bn.keysIn=Do,Bn.map=Sa,Bn.mapKeys=function(t,e){var n={};return e=as(e,3),_i(t,(function(t,i,r){ii(n,e(t,i,r),t)})),n},Bn.mapValues=function(t,e){var n={};return e=as(e,3),_i(t,(function(t,i,r){ii(n,i,e(t,i,r))})),n},Bn.matches=function(t){return Bi(ai(t,1))},Bn.matchesProperty=function(t,e){return zi(t,ai(e,1))},Bn.memoize=La,Bn.merge=Lo,Bn.mergeWith=Uo,Bn.method=al,Bn.methodOf=ol,Bn.mixin=ll,Bn.negate=Ua,Bn.nthArg=function(t){return t=mo(t),Yi((function(e){return Vi(e,t)}))},Bn.omit=Oo,Bn.omitBy=function(t,e){return Bo(t,Ua(as(e)))},Bn.once=function(t){return Ca(2,t)},Bn.orderBy=function(t,e,i,r){return null==t?[]:(Wa(e)||(e=null==e?[]:[e]),Wa(i=r?n:i)||(i=null==i?[]:[i]),Hi(t,e,i))},Bn.over=hl,Bn.overArgs=Oa,Bn.overEvery=ul,Bn.overSome=dl,Bn.partial=Fa,Bn.partialRight=Ba,Bn.partition=Ea,Bn.pick=Fo,Bn.pickBy=Bo,Bn.property=pl,Bn.propertyOf=function(t){return function(e){return null==t?n:bi(t,e)}},Bn.pull=Js,Bn.pullAll=$s,Bn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Wi(t,e,as(n,2)):t},Bn.pullAllWith=function(t,e,i){return t&&t.length&&e&&e.length?Wi(t,e,n,i):t},Bn.pullAt=Qs,Bn.range=fl,Bn.rangeRight=ml,Bn.rearg=za,Bn.reject=function(t,e){return(Wa(t)?Ce:fi)(t,Ua(as(e,3)))},Bn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var i=-1,r=[],s=t.length;for(e=as(e,3);++i<s;){var a=t[i];e(a,i,t)&&(n.push(a),r.push(i))}return qi(t,r),n},Bn.rest=function(t,e){if("function"!=typeof t)throw new Ct(i);return Yi(t,e=e===n?e:mo(e))},Bn.reverse=ta,Bn.sampleSize=function(t,e,i){return e=(i?vs(t,e,i):e===n)?1:mo(e),(Wa(t)?Kn:Ki)(t,e)},Bn.set=function(t,e,n){return null==t?t:Ji(t,e,n)},Bn.setWith=function(t,e,i,r){return r="function"==typeof r?r:n,null==t?t:Ji(t,e,i,r)},Bn.shuffle=function(t){return(Wa(t)?Jn:tr)(t)},Bn.slice=function(t,e,i){var r=null==t?0:t.length;return r?(i&&"number"!=typeof i&&vs(t,e,i)?(e=0,i=r):(e=null==e?0:mo(e),i=i===n?r:mo(i)),er(t,e,i)):[]},Bn.sortBy=wa,Bn.sortedUniq=function(t){return t&&t.length?sr(t):[]},Bn.sortedUniqBy=function(t,e){return t&&t.length?sr(t,as(e,2)):[]},Bn.split=function(t,e,i){return i&&"number"!=typeof i&&vs(t,e,i)&&(e=i=n),(i=i===n?d:i>>>0)?(t=yo(t))&&("string"==typeof e||null!=e&&!so(e))&&!(e=or(e))&&rn(t)?yr(hn(t),0,i):t.split(e,i):[]},Bn.spread=function(t,e){if("function"!=typeof t)throw new Ct(i);return e=null==e?0:gn(mo(e),0),Yi((function(n){var i=n[e],r=yr(n,0,e);return i&&Ne(r,i),Se(t,this,r)}))},Bn.tail=function(t){var e=null==t?0:t.length;return e?er(t,1,e):[]},Bn.take=function(t,e,i){return t&&t.length?er(t,0,(e=i||e===n?1:mo(e))<0?0:e):[]},Bn.takeRight=function(t,e,i){var r=null==t?0:t.length;return r?er(t,(e=r-(e=i||e===n?1:mo(e)))<0?0:e,r):[]},Bn.takeRightWhile=function(t,e){return t&&t.length?ur(t,as(e,3),!1,!0):[]},Bn.takeWhile=function(t,e){return t&&t.length?ur(t,as(e,3)):[]},Bn.tap=function(t,e){return e(t),t},Bn.throttle=function(t,e,n){var r=!0,s=!0;if("function"!=typeof t)throw new Ct(i);return to(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),Ia(t,e,{leading:r,maxWait:e,trailing:s})},Bn.thru=pa,Bn.toArray=po,Bn.toPairs=zo,Bn.toPairsIn=ko,Bn.toPath=function(t){return Wa(t)?Ie(t,Fs):lo(t)?[t]:Ar(Os(yo(t)))},Bn.toPlainObject=_o,Bn.transform=function(t,e,n){var i=Wa(t),r=i||Ya(t)||co(t);if(e=as(e,4),null==n){var s=t&&t.constructor;n=r?i?new s:[]:to(t)&&Ja(s)?zn(qt(t)):{}}return(r?we:_i)(t,(function(t,i,r){return e(n,t,i,r)})),n},Bn.unary=function(t){return Aa(t,1)},Bn.union=ea,Bn.unionBy=na,Bn.unionWith=ia,Bn.uniq=function(t){return t&&t.length?lr(t):[]},Bn.uniqBy=function(t,e){return t&&t.length?lr(t,as(e,2)):[]},Bn.uniqWith=function(t,e){return e="function"==typeof e?e:n,t&&t.length?lr(t,n,e):[]},Bn.unset=function(t,e){return null==t||cr(t,e)},Bn.unzip=ra,Bn.unzipWith=sa,Bn.update=function(t,e,n){return null==t?t:hr(t,e,gr(n))},Bn.updateWith=function(t,e,i,r){return r="function"==typeof r?r:n,null==t?t:hr(t,e,gr(i),r)},Bn.values=Vo,Bn.valuesIn=function(t){return null==t?[]:Ke(t,Do(t))},Bn.without=aa,Bn.words=$o,Bn.wrap=function(t,e){return Fa(gr(e),t)},Bn.xor=oa,Bn.xorBy=la,Bn.xorWith=ca,Bn.zip=ha,Bn.zipObject=function(t,e){return fr(t||[],e||[],Qn)},Bn.zipObjectDeep=function(t,e){return fr(t||[],e||[],Ji)},Bn.zipWith=ua,Bn.entries=zo,Bn.entriesIn=ko,Bn.extend=bo,Bn.extendWith=Mo,ll(Bn,Bn),Bn.add=yl,Bn.attempt=Qo,Bn.camelCase=Ho,Bn.capitalize=Go,Bn.ceil=xl,Bn.clamp=function(t,e,i){return i===n&&(i=e,e=n),i!==n&&(i=(i=vo(i))==i?i:0),e!==n&&(e=(e=vo(e))==e?e:0),si(vo(t),e,i)},Bn.clone=function(t){return ai(t,4)},Bn.cloneDeep=function(t){return ai(t,5)},Bn.cloneDeepWith=function(t,e){return ai(t,5,e="function"==typeof e?e:n)},Bn.cloneWith=function(t,e){return ai(t,4,e="function"==typeof e?e:n)},Bn.conformsTo=function(t,e){return null==e||oi(t,e,No(e))},Bn.deburr=Wo,Bn.defaultTo=function(t,e){return null==t||t!=t?e:t},Bn.divide=bl,Bn.endsWith=function(t,e,i){t=yo(t),e=or(e);var r=t.length,s=i=i===n?r:si(mo(i),0,r);return(i-=e.length)>=0&&t.slice(i,s)==e},Bn.eq=ka,Bn.escape=function(t){return(t=yo(t))&&X.test(t)?t.replace(q,en):t},Bn.escapeRegExp=function(t){return(t=yo(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Bn.every=function(t,e,i){var r=Wa(t)?Ae:di;return i&&vs(t,e,i)&&(e=n),r(t,as(e,3))},Bn.find=ga,Bn.findIndex=Gs,Bn.findKey=function(t,e){return Fe(t,as(e,3),_i)},Bn.findLast=va,Bn.findLastIndex=Ws,Bn.findLastKey=function(t,e){return Fe(t,as(e,3),yi)},Bn.floor=Ml,Bn.forEach=_a,Bn.forEachRight=ya,Bn.forIn=function(t,e){return null==t?t:gi(t,as(e,3),Do)},Bn.forInRight=function(t,e){return null==t?t:vi(t,as(e,3),Do)},Bn.forOwn=function(t,e){return t&&_i(t,as(e,3))},Bn.forOwnRight=function(t,e){return t&&yi(t,as(e,3))},Bn.get=Ao,Bn.gt=Va,Bn.gte=Ha,Bn.has=function(t,e){return null!=t&&ps(t,e,wi)},Bn.hasIn=Co,Bn.head=js,Bn.identity=rl,Bn.includes=function(t,e,n,i){t=ja(t)?t:Vo(t),n=n&&!i?mo(n):0;var r=t.length;return n<0&&(n=gn(r+n,0)),oo(t)?n<=r&&t.indexOf(e,n)>-1:!!r&&ze(t,e,n)>-1},Bn.indexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:mo(n);return r<0&&(r=gn(i+r,0)),ze(t,e,r)},Bn.inRange=function(t,e,i){return e=fo(e),i===n?(i=e,e=0):i=fo(i),function(t,e,n){return t>=vn(e,n)&&t<gn(e,n)}(t=vo(t),e,i)},Bn.invoke=Io,Bn.isArguments=Ga,Bn.isArray=Wa,Bn.isArrayBuffer=qa,Bn.isArrayLike=ja,Bn.isArrayLikeObject=Xa,Bn.isBoolean=function(t){return!0===t||!1===t||eo(t)&&Si(t)==g},Bn.isBuffer=Ya,Bn.isDate=Za,Bn.isElement=function(t){return eo(t)&&1===t.nodeType&&!ro(t)},Bn.isEmpty=function(t){if(null==t)return!0;if(ja(t)&&(Wa(t)||"string"==typeof t||"function"==typeof t.splice||Ya(t)||co(t)||Ga(t)))return!t.length;var e=ds(t);if(e==b||e==T)return!t.size;if(bs(t))return!Li(t).length;for(var n in t)if(Lt.call(t,n))return!1;return!0},Bn.isEqual=function(t,e){return Pi(t,e)},Bn.isEqualWith=function(t,e,i){var r=(i="function"==typeof i?i:n)?i(t,e):n;return r===n?Pi(t,e,n,i):!!r},Bn.isError=Ka,Bn.isFinite=function(t){return"number"==typeof t&&We(t)},Bn.isFunction=Ja,Bn.isInteger=$a,Bn.isLength=Qa,Bn.isMap=no,Bn.isMatch=function(t,e){return t===e||Ii(t,e,ls(e))},Bn.isMatchWith=function(t,e,i){return i="function"==typeof i?i:n,Ii(t,e,ls(e),i)},Bn.isNaN=function(t){return io(t)&&t!=+t},Bn.isNative=function(t){if(xs(t))throw new Mt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ni(t)},Bn.isNil=function(t){return null==t},Bn.isNull=function(t){return null===t},Bn.isNumber=io,Bn.isObject=to,Bn.isObjectLike=eo,Bn.isPlainObject=ro,Bn.isRegExp=so,Bn.isSafeInteger=function(t){return $a(t)&&t>=-9007199254740991&&t<=h},Bn.isSet=ao,Bn.isString=oo,Bn.isSymbol=lo,Bn.isTypedArray=co,Bn.isUndefined=function(t){return t===n},Bn.isWeakMap=function(t){return eo(t)&&ds(t)==R},Bn.isWeakSet=function(t){return eo(t)&&"[object WeakSet]"==Si(t)},Bn.join=function(t,e){return null==t?"":fn.call(t,e)},Bn.kebabCase=qo,Bn.last=Ks,Bn.lastIndexOf=function(t,e,i){var r=null==t?0:t.length;if(!r)return-1;var s=r;return i!==n&&(s=(s=mo(i))<0?gn(r+s,0):vn(s,r-1)),e==e?function(t,e,n){for(var i=n+1;i--;)if(t[i]===e)return i;return i}(t,e,s):Be(t,Ve,s,!0)},Bn.lowerCase=jo,Bn.lowerFirst=Xo,Bn.lt=ho,Bn.lte=uo,Bn.max=function(t){return t&&t.length?pi(t,rl,Ei):n},Bn.maxBy=function(t,e){return t&&t.length?pi(t,as(e,2),Ei):n},Bn.mean=function(t){return He(t,rl)},Bn.meanBy=function(t,e){return He(t,as(e,2))},Bn.min=function(t){return t&&t.length?pi(t,rl,Oi):n},Bn.minBy=function(t,e){return t&&t.length?pi(t,as(e,2),Oi):n},Bn.stubArray=gl,Bn.stubFalse=vl,Bn.stubObject=function(){return{}},Bn.stubString=function(){return""},Bn.stubTrue=function(){return!0},Bn.multiply=Sl,Bn.nth=function(t,e){return t&&t.length?Vi(t,mo(e)):n},Bn.noConflict=function(){return ue._===this&&(ue._=zt),this},Bn.noop=cl,Bn.now=Ta,Bn.pad=function(t,e,n){t=yo(t);var i=(e=mo(e))?cn(t):0;if(!e||i>=e)return t;var r=(e-i)/2;return Hr(me(r),n)+t+Hr(pe(r),n)},Bn.padEnd=function(t,e,n){t=yo(t);var i=(e=mo(e))?cn(t):0;return e&&i<e?t+Hr(e-i,n):t},Bn.padStart=function(t,e,n){t=yo(t);var i=(e=mo(e))?cn(t):0;return e&&i<e?Hr(e-i,n)+t:t},Bn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),yn(yo(t).replace(nt,""),e||0)},Bn.random=function(t,e,i){if(i&&"boolean"!=typeof i&&vs(t,e,i)&&(e=i=n),i===n&&("boolean"==typeof e?(i=e,e=n):"boolean"==typeof t&&(i=t,t=n)),t===n&&e===n?(t=0,e=1):(t=fo(t),e===n?(e=t,t=0):e=fo(e)),t>e){var r=t;t=e,e=r}if(i||t%1||e%1){var s=xn();return vn(t+s*(e-t+oe("1e-"+((s+"").length-1))),e)}return ji(t,e)},Bn.reduce=function(t,e,n){var i=Wa(t)?De:qe,r=arguments.length<3;return i(t,as(e,4),n,r,hi)},Bn.reduceRight=function(t,e,n){var i=Wa(t)?Le:qe,r=arguments.length<3;return i(t,as(e,4),n,r,ui)},Bn.repeat=function(t,e,i){return e=(i?vs(t,e,i):e===n)?1:mo(e),Xi(yo(t),e)},Bn.replace=function(){var t=arguments,e=yo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Bn.result=function(t,e,i){var r=-1,s=(e=vr(e,t)).length;for(s||(s=1,t=n);++r<s;){var a=null==t?n:t[Fs(e[r])];a===n&&(r=s,a=i),t=Ja(a)?a.call(t):a}return t},Bn.round=El,Bn.runInContext=t,Bn.sample=function(t){return(Wa(t)?Zn:Zi)(t)},Bn.size=function(t){if(null==t)return 0;if(ja(t))return oo(t)?cn(t):t.length;var e=ds(t);return e==b||e==T?t.size:Li(t).length},Bn.snakeCase=Yo,Bn.some=function(t,e,i){var r=Wa(t)?Ue:nr;return i&&vs(t,e,i)&&(e=n),r(t,as(e,3))},Bn.sortedIndex=function(t,e){return ir(t,e)},Bn.sortedIndexBy=function(t,e,n){return rr(t,e,as(n,2))},Bn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var i=ir(t,e);if(i<n&&ka(t[i],e))return i}return-1},Bn.sortedLastIndex=function(t,e){return ir(t,e,!0)},Bn.sortedLastIndexBy=function(t,e,n){return rr(t,e,as(n,2),!0)},Bn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ir(t,e,!0)-1;if(ka(t[n],e))return n}return-1},Bn.startCase=Zo,Bn.startsWith=function(t,e,n){return t=yo(t),n=null==n?0:si(mo(n),0,t.length),e=or(e),t.slice(n,n+e.length)==e},Bn.subtract=wl,Bn.sum=function(t){return t&&t.length?je(t,rl):0},Bn.sumBy=function(t,e){return t&&t.length?je(t,as(e,2)):0},Bn.template=function(t,e,i){var r=Bn.templateSettings;i&&vs(t,e,i)&&(e=n),t=yo(t),e=Mo({},e,r,Kr);var s,a,o=Mo({},e.imports,r.imports,Kr),l=No(o),c=Ke(o,l),h=0,u=e.interpolate||_t,d="__p += '",p=Tt((e.escape||_t).source+"|"+u.source+"|"+(u===K?ht:_t).source+"|"+(e.evaluate||_t).source+"|$","g"),f="//# sourceURL="+(Lt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ie+"]")+"\n";t.replace(p,(function(e,n,i,r,o,l){return i||(i=r),d+=t.slice(h,l).replace(yt,nn),n&&(s=!0,d+="' +\n__e("+n+") +\n'"),o&&(a=!0,d+="';\n"+o+";\n__p += '"),i&&(d+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),h=l+e.length,e})),d+="';\n";var m=Lt.call(e,"variable")&&e.variable;if(m){if(lt.test(m))throw new Mt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(V,""):d).replace(H,"$1").replace(G,"$1;"),d="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Qo((function(){return St(l,f+"return "+d).apply(n,c)}));if(g.source=d,Ka(g))throw g;return g},Bn.times=function(t,e){if((t=mo(t))<1||t>h)return[];var n=d,i=vn(t,d);e=as(e),t-=d;for(var r=Xe(i,e);++n<t;)e(n);return r},Bn.toFinite=fo,Bn.toInteger=mo,Bn.toLength=go,Bn.toLower=function(t){return yo(t).toLowerCase()},Bn.toNumber=vo,Bn.toSafeInteger=function(t){return t?si(mo(t),-9007199254740991,h):0===t?t:0},Bn.toString=yo,Bn.toUpper=function(t){return yo(t).toUpperCase()},Bn.trim=function(t,e,i){if((t=yo(t))&&(i||e===n))return Ye(t);if(!t||!(e=or(e)))return t;var r=hn(t),s=hn(e);return yr(r,$e(r,s),Qe(r,s)+1).join("")},Bn.trimEnd=function(t,e,i){if((t=yo(t))&&(i||e===n))return t.slice(0,un(t)+1);if(!t||!(e=or(e)))return t;var r=hn(t);return yr(r,0,Qe(r,hn(e))+1).join("")},Bn.trimStart=function(t,e,i){if((t=yo(t))&&(i||e===n))return t.replace(nt,"");if(!t||!(e=or(e)))return t;var r=hn(t);return yr(r,$e(r,hn(e))).join("")},Bn.truncate=function(t,e){var i=30,r="...";if(to(e)){var s="separator"in e?e.separator:s;i="length"in e?mo(e.length):i,r="omission"in e?or(e.omission):r}var a=(t=yo(t)).length;if(rn(t)){var o=hn(t);a=o.length}if(i>=a)return t;var l=i-cn(r);if(l<1)return r;var c=o?yr(o,0,l).join(""):t.slice(0,l);if(s===n)return c+r;if(o&&(l+=c.length-l),so(s)){if(t.slice(l).search(s)){var h,u=c;for(s.global||(s=Tt(s.source,yo(ut.exec(s))+"g")),s.lastIndex=0;h=s.exec(u);)var d=h.index;c=c.slice(0,d===n?l:d)}}else if(t.indexOf(or(s),l)!=l){var p=c.lastIndexOf(s);p>-1&&(c=c.slice(0,p))}return c+r},Bn.unescape=function(t){return(t=yo(t))&&j.test(t)?t.replace(W,dn):t},Bn.uniqueId=function(t){var e=++Ut;return yo(t)+e},Bn.upperCase=Ko,Bn.upperFirst=Jo,Bn.each=_a,Bn.eachRight=ya,Bn.first=js,ll(Bn,(_l={},_i(Bn,(function(t,e){Lt.call(Bn.prototype,e)||(_l[e]=t)})),_l),{chain:!1}),Bn.VERSION="4.17.21",we(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Bn[t].placeholder=Bn})),we(["drop","take"],(function(t,e){Hn.prototype[t]=function(i){i=i===n?1:gn(mo(i),0);var r=this.__filtered__&&!e?new Hn(this):this.clone();return r.__filtered__?r.__takeCount__=vn(i,r.__takeCount__):r.__views__.push({size:vn(i,d),type:t+(r.__dir__<0?"Right":"")}),r},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),we(["filter","map","takeWhile"],(function(t,e){var n=e+1,i=1==n||3==n;Hn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:as(t,3),type:n}),e.__filtered__=e.__filtered__||i,e}})),we(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Hn.prototype[t]=function(){return this[n](1).value()[0]}})),we(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Hn.prototype[t]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(rl)},Hn.prototype.find=function(t){return this.filter(t).head()},Hn.prototype.findLast=function(t){return this.reverse().find(t)},Hn.prototype.invokeMap=Yi((function(t,e){return"function"==typeof t?new Hn(this):this.map((function(n){return Ci(n,t,e)}))})),Hn.prototype.reject=function(t){return this.filter(Ua(as(t)))},Hn.prototype.slice=function(t,e){t=mo(t);var i=this;return i.__filtered__&&(t>0||e<0)?new Hn(i):(t<0?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==n&&(i=(e=mo(e))<0?i.dropRight(-e):i.take(e-t)),i)},Hn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hn.prototype.toArray=function(){return this.take(d)},_i(Hn.prototype,(function(t,e){var i=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),s=Bn[r?"take"+("last"==e?"Right":""):e],a=r||/^find/.test(e);s&&(Bn.prototype[e]=function(){var e=this.__wrapped__,o=r?[1]:arguments,l=e instanceof Hn,c=o[0],h=l||Wa(e),u=function(t){var e=s.apply(Bn,Ne([t],o));return r&&d?e[0]:e};h&&i&&"function"==typeof c&&1!=c.length&&(l=h=!1);var d=this.__chain__,p=!!this.__actions__.length,f=a&&!d,m=l&&!p;if(!a&&h){e=m?e:new Hn(this);var g=t.apply(e,o);return g.__actions__.push({func:pa,args:[u],thisArg:n}),new Vn(g,d)}return f&&m?t.apply(this,o):(g=this.thru(u),f?r?g.value()[0]:g.value():g)})})),we(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Rt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);Bn.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(Wa(r)?r:[],t)}return this[n]((function(n){return e.apply(Wa(n)?n:[],t)}))}})),_i(Hn.prototype,(function(t,e){var n=Bn[e];if(n){var i=n.name+"";Lt.call(Rn,i)||(Rn[i]=[]),Rn[i].push({name:e,func:n})}})),Rn[Br(n,2).name]=[{name:"wrapper",func:n}],Hn.prototype.clone=function(){var t=new Hn(this.__wrapped__);return t.__actions__=Ar(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ar(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ar(this.__views__),t},Hn.prototype.reverse=function(){if(this.__filtered__){var t=new Hn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Wa(t),i=e<0,r=n?t.length:0,s=function(t,e,n){for(var i=-1,r=n.length;++i<r;){var s=n[i],a=s.size;switch(s.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=vn(e,t+a);break;case"takeRight":t=gn(t,e-a)}}return{start:t,end:e}}(0,r,this.__views__),a=s.start,o=s.end,l=o-a,c=i?o:a-1,h=this.__iteratees__,u=h.length,d=0,p=vn(l,this.__takeCount__);if(!n||!i&&r==l&&p==l)return dr(t,this.__actions__);var f=[];t:for(;l--&&d<p;){for(var m=-1,g=t[c+=e];++m<u;){var v=h[m],_=v.iteratee,y=v.type,x=_(g);if(2==y)g=x;else if(!x){if(1==y)continue t;break t}}f[d++]=g}return f},Bn.prototype.at=fa,Bn.prototype.chain=function(){return da(this)},Bn.prototype.commit=function(){return new Vn(this.value(),this.__chain__)},Bn.prototype.next=function(){this.__values__===n&&(this.__values__=po(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?n:this.__values__[this.__index__++]}},Bn.prototype.plant=function(t){for(var e,i=this;i instanceof kn;){var r=zs(i);r.__index__=0,r.__values__=n,e?s.__wrapped__=r:e=r;var s=r;i=i.__wrapped__}return s.__wrapped__=t,e},Bn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var e=t;return this.__actions__.length&&(e=new Hn(this)),(e=e.reverse()).__actions__.push({func:pa,args:[ta],thisArg:n}),new Vn(e,this.__chain__)}return this.thru(ta)},Bn.prototype.toJSON=Bn.prototype.valueOf=Bn.prototype.value=function(){return dr(this.__wrapped__,this.__actions__)},Bn.prototype.first=Bn.prototype.head,$t&&(Bn.prototype[$t]=function(){return this}),Bn}();pe?((pe.exports=pn)._=pn,de._=pn):ue._=pn}).call(ch)}(bp,bp.exports);var Mp=hh(bp.exports);class Sp extends Ks{constructor(t,e={}){const n=e.font;if(void 0===n)super();else{const i=n.generateShapes(t,e.size);void 0===e.depth&&(e.depth=50),void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(i,e)}this.type="TextGeometry"}}class Ep{constructor(t={}){var e,n;d(this,"params"),d(this,"light"),d(this,"lightHelper"),this.params=t;const{color:i=16777215,intensity:r=.8,position:s=[0,1,0],castShadow:a=!1}=this.params.light||{};this.light=new za(i,r),this.light.position.set(-30,60,100),this.light.castShadow=a,this.light.shadow.camera.top=2e3,this.light.shadow.camera.bottom=-2e3,this.light.shadow.camera.left=-2e3,this.light.shadow.camera.right=2e3,this.light.shadow.camera.near=1,this.light.shadow.camera.far=2e3,this.light.shadow.mapSize.width=4096,this.light.shadow.mapSize.height=4096,this.light.shadow.radius=3,this.light.shadow.bias=-6e-5;const{helperSize:o=100,helperColor:l=16711680}=this.params.light||{};(null==(n=null==(e=this.params)?void 0:e.light)?void 0:n.helperEnable)&&(this.lightHelper=new oo(this.light,o,l))}destroy(){}bindScene(t){var e,n,i,r,s,a;t&&(t.add&&t.add(this.light),this.lightHelper&&t.add&&t.add(this.lightHelper),this.light.target.updateMatrixWorld(),null==(e=this.lightHelper)||e.update(),(null==(i=null==(n=this.params)?void 0:n.light)?void 0:i.castShadow)&&(!(null==(r=t.userData)?void 0:r.boundingBox)||(null==(a=null==(s=t.userData)?void 0:s.boundingBox)?void 0:a.isEmpty())?wd(t,wp):wp.copy(t.userData.boundingBox),this.light.shadow.camera.top=wp.max.y,this.light.shadow.camera.bottom=wp.min.y,this.light.shadow.camera.left=wp.min.x,this.light.shadow.camera.right=wp.max.x))}}const wp=new on;class Tp extends Sr{constructor(t={}){super(),d(this,"name","LoadingScene3"),d(this,"isDynamic",!0),d(this,"lights"),d(this,"g",new xr),this.params=t,this.background=new Ti(15921906),this.init(),this.userData.boundingBox=new Ed(new Sd(-300,-300,0),new Sd(300,300,0)),this.lights=new Ep(t),this.lights.bindScene(this)}destroy(){}init(){return p(this,null,(function*(){const t=new ka(4210752);this.add(t);const e=new Qs(3e4,3e4,32,32),n=new ia({color:16777215,transparent:!0,opacity:.3}),i=new ir(e,n);i.receiveShadow=!0,this.add(i);const r=Mp.cloneDeep(xp);Mp.set(r,"uniforms.iResolution.value",new Pe(this.params.width,this.params.height)),Mp.set(r,"uniforms.iTime.value",0);const s=new Qs(2,2),a=new hr(r);this.mesh=new ir(s,a),this.g.add(this.mesh),this.add(this.g)}))}initFont(t){if(!t)return;const e=new Sp("LOADING...",{font:t,size:20,depth:2});e.computeBoundingBox();const n=-.5*(e.boundingBox.max.x-e.boundingBox.min.x),i=new ra({color:16711680,specular:328965,shininess:50,emissive:0}),r=new ir(e,i);r.position.x=n,r.castShadow=!0,r.receiveShadow=!1,r.position.setZ(10),this.g.add(r)}update(t){var e,n;Rp+=.001*Ap,Rp>Cp?Ap=-1:Rp<-.1&&(Ap=1),this.g.rotation.y=Rp,this.g.rotation.z=Rp/10,(null==(e=this.mesh)?void 0:e.material)&&((null==(n=this.mesh)?void 0:n.material).uniforms.iTime.value=performance.now()/500)}}let Ap=1,Cp=.1,Rp=0;function Pp(t,e=!1){const n=null!==t[0].index,i=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new qi;let c=0;for(let h=0;h<t.length;++h){const u=t[h];let d=0;if(n!==(null!==u.index))return null;for(const t in u.attributes){if(!i.has(t))return null;void 0===s[t]&&(s[t]=[]),s[t].push(u.attributes[t]),d++}if(d!==i.size)return null;if(o!==u.morphTargetsRelative)return null;for(const t in u.morphAttributes){if(!r.has(t))return null;void 0===a[t]&&(a[t]=[]),a[t].push(u.morphAttributes[t])}if(e){let t;if(n)t=u.index.count;else{if(void 0===u.attributes.position)return null;t=u.attributes.position.count}l.addGroup(c,t,h),c+=t}}if(n){let e=0;const n=[];for(let i=0;i<t.length;++i){const r=t[i].index;for(let t=0;t<r.count;++t)n.push(r.getX(t)+e);e+=t[i].attributes.position.count}l.setIndex(n)}for(const t in s){const e=Ip(s[t]);if(!e)return null;l.setAttribute(t,e)}for(const t in a){const e=a[t][0].length;if(0===e)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[t]=[];for(let n=0;n<e;++n){const e=[];for(let i=0;i<a[t].length;++i)e.push(a[t][i][n]);const i=Ip(e);if(!i)return null;l.morphAttributes[t].push(i)}}return l}function Ip(t){let e,n,i,r=-1,s=0;for(let a=0;a<t.length;++a){const o=t[a];if(void 0===e&&(e=o.array.constructor),e!==o.array.constructor)return null;if(void 0===n&&(n=o.itemSize),n!==o.itemSize)return null;if(void 0===i&&(i=o.normalized),i!==o.normalized)return null;if(-1===r&&(r=o.gpuType),r!==o.gpuType)return null;s+=o.count*n}const a=new e(s),o=new Li(a,n,i);let l=0;for(let e=0;e<t.length;++e){const i=t[e];if(i.isInterleavedBufferAttribute){const t=l/n;for(let e=0,r=i.count;e<r;e++)for(let r=0;r<n;r++){const n=i.getComponent(e,r);o.setComponent(e+t,r,n)}}else a.set(i.array,l);l+=i.count*n}return void 0!==r&&(o.gpuType=r),o}const Np=re;class Dp extends Ca{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit="px"}load(t,e,n,i){const r=this,s=new Ia(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(n))}catch(e){i&&i(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this;function n(t,e,n,r,s,a,o,l){if(0==e||0==n)return void t.lineTo(l.x,l.y);r=r*Math.PI/180,e=Math.abs(e),n=Math.abs(n);const c=(o.x-l.x)/2,h=(o.y-l.y)/2,u=Math.cos(r)*c+Math.sin(r)*h,d=-Math.sin(r)*c+Math.cos(r)*h;let p=e*e,f=n*n;const m=u*u,g=d*d,v=m/p+g/f;if(v>1){const t=Math.sqrt(v);p=(e*=t)*e,f=(n*=t)*n}const _=p*g+f*m,y=(p*f-_)/_;let x=Math.sqrt(Math.max(0,y));s===a&&(x=-x);const b=x*e*d/n,M=-x*n*u/e,S=Math.cos(r)*b-Math.sin(r)*M+(o.x+l.x)/2,E=Math.sin(r)*b+Math.cos(r)*M+(o.y+l.y)/2,w=i(1,0,(u-b)/e,(d-M)/n),T=i((u-b)/e,(d-M)/n,(-u-b)/e,(-d-M)/n)%(2*Math.PI);t.currentPath.absellipse(S,E,e,n,w,w+T,0===a,r)}function i(t,e,n,i){const r=t*n+e*i,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+i*i);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return t*i-e*n<0&&(a=-a),a}function r(t,e){e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;t<e.length;t++)n=Object.assign(n,m["."+e[t]])}function i(i,r,s){void 0===s&&(s=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[r]=s(t.getAttribute(i))),n[i]&&(e[r]=s(n[i])),t.style&&""!==t.style[i]&&(e[r]=s(t.style[i]))}function r(t){return Math.max(0,Math.min(1,c(t)))}function s(t){return Math.max(0,c(t))}return t.hasAttribute("id")&&(n=Object.assign(n,m["#"+t.getAttribute("id")])),i("fill","fill"),i("fill-opacity","fillOpacity",r),i("fill-rule","fillRule"),i("opacity","opacity",r),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",r),i("stroke-width","strokeWidth",s),i("stroke-linejoin","strokeLineJoin"),i("stroke-linecap","strokeLineCap"),i("stroke-miterlimit","strokeMiterLimit",s),i("visibility","visibility"),e}function s(t,e){return t-(e-t)}function a(t,e,n){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const i={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let r=0,s=!0,a="",o="";const l=[];function c(t,e,n){const i=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw i.partial=n,i}function h(){""!==a&&(""===o?l.push(Number(a)):l.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let u;const d=t.length;for(let p=0;p<d;p++)if(u=t[p],Array.isArray(e)&&e.includes(l.length%n)&&i.FLAGS.test(u))r=1,a=u,h();else{if(0===r){if(i.WHITESPACE.test(u))continue;if(i.DIGIT.test(u)||i.SIGN.test(u)){r=1,a=u;continue}if(i.POINT.test(u)){r=2,a=u;continue}i.COMMA.test(u)&&(s&&c(u,p,l),s=!0)}if(1===r){if(i.DIGIT.test(u)){a+=u;continue}if(i.POINT.test(u)){a+=u,r=2;continue}if(i.EXP.test(u)){r=3;continue}i.SIGN.test(u)&&1===a.length&&i.SIGN.test(a[0])&&c(u,p,l)}if(2===r){if(i.DIGIT.test(u)){a+=u;continue}if(i.EXP.test(u)){r=3;continue}i.POINT.test(u)&&"."===a[a.length-1]&&c(u,p,l)}if(3===r){if(i.DIGIT.test(u)){o+=u;continue}if(i.SIGN.test(u)){if(""===o){o+=u;continue}1===o.length&&i.SIGN.test(o)&&c(u,p,l)}}i.WHITESPACE.test(u)?(h(),r=0,s=!1):i.COMMA.test(u)?(h(),r=0,s=!0):i.SIGN.test(u)?(h(),r=1,a=u):i.POINT.test(u)?(h(),r=2,a=u):c(u,p,l)}return h(),l}const o=["mm","cm","in","pt","pc","px"],l={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function c(t){let n,i="px";if("string"==typeof t||t instanceof String)for(let e=0,n=o.length;e<n;e++){const n=o[e];if(t.endsWith(n)){i=n,t=t.substring(0,t.length-n.length);break}}return"px"===i&&"px"!==e.defaultUnit?n=l.in[e.defaultUnit]/e.defaultDPI:(n=l[i][e.defaultUnit],n<0&&(n=l[i].in*e.defaultDPI)),n*parseFloat(t)}function h(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function u(t){const e=t.elements,n=e[0]*e[3]+e[1]*e[4];if(0===n)return!1;const i=d(t),r=p(t);return Math.abs(n/(i*r))>Number.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const f=[],m={},g=[],v=new Ie,_=new Ie,y=new Ie,x=new Ie,b=new Pe,M=new rn,S=new Ie,E=(new DOMParser).parseFromString(t,"image/svg+xml");return function t(e,i){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new Ie,n=v;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const n=c(t.getAttribute("x")),i=c(t.getAttribute("y"));e.translate(n,i)}if(t.hasAttribute("transform")){const i=t.getAttribute("transform").split(")");for(let t=i.length-1;t>=0;t--){const r=i[t].trim();if(""===r)continue;const s=r.indexOf("("),o=r.length;if(s>0&&s<o){const t=r.slice(0,s),e=a(r.slice(s+1));switch(n.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),n.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,r=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],r=e[2]),_.makeTranslation(-i,-r),y.makeRotation(t),x.multiplyMatrices(y,_),_.makeTranslation(i,r),n.multiplyMatrices(_,x)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),n.scale(t,i)}break;case"skewX":1===e.length&&n.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&n.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&n.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(n)}}return e}(t);return g.length>0&&e.premultiply(g[g.length-1]),S.copy(e),g.push(e),e}(e);let l=!1,E=null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){if(t.sheet&&t.sheet.cssRules&&t.sheet.cssRules.length)for(let e=0;e<t.sheet.cssRules.length;e++){const n=t.sheet.cssRules[e];if(1!==n.type)continue;const i=n.selectorText.split(/,/gm).filter(Boolean).map((t=>t.trim()));for(let t=0;t<i.length;t++){const e=Object.fromEntries(Object.entries(n.style).filter((([,t])=>""!==t)));m[i[t]]=Object.assign(m[i[t]]||{},e)}}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(E=function(t){const e=new po,i=new Pe,r=new Pe,o=new Pe;let l=!0,c=!1;const h=t.getAttribute("d");if(""===h||"none"===h)return null;const u=h.match(/[a-df-z][^a-df-z]*/gi);for(let t=0,h=u.length;t<h;t++){const h=u[t],d=h.charAt(0),p=h.slice(1).trim();let f;switch(!0===l&&(c=!0,l=!1),d){case"M":f=a(p);for(let t=0,n=f.length;t<n;t+=2)i.x=f[t+0],i.y=f[t+1],r.x=i.x,r.y=i.y,0===t?e.moveTo(i.x,i.y):e.lineTo(i.x,i.y),0===t&&o.copy(i);break;case"H":f=a(p);for(let t=0,n=f.length;t<n;t++)i.x=f[t],r.x=i.x,r.y=i.y,e.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case"V":f=a(p);for(let t=0,n=f.length;t<n;t++)i.y=f[t],r.x=i.x,r.y=i.y,e.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case"L":f=a(p);for(let t=0,n=f.length;t<n;t+=2)i.x=f[t+0],i.y=f[t+1],r.x=i.x,r.y=i.y,e.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case"C":f=a(p);for(let t=0,n=f.length;t<n;t+=6)e.bezierCurveTo(f[t+0],f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),r.x=f[t+2],r.y=f[t+3],i.x=f[t+4],i.y=f[t+5],0===t&&!0===c&&o.copy(i);break;case"S":f=a(p);for(let t=0,n=f.length;t<n;t+=4)e.bezierCurveTo(s(i.x,r.x),s(i.y,r.y),f[t+0],f[t+1],f[t+2],f[t+3]),r.x=f[t+0],r.y=f[t+1],i.x=f[t+2],i.y=f[t+3],0===t&&!0===c&&o.copy(i);break;case"Q":f=a(p);for(let t=0,n=f.length;t<n;t+=4)e.quadraticCurveTo(f[t+0],f[t+1],f[t+2],f[t+3]),r.x=f[t+0],r.y=f[t+1],i.x=f[t+2],i.y=f[t+3],0===t&&!0===c&&o.copy(i);break;case"T":f=a(p);for(let t=0,n=f.length;t<n;t+=2){const n=s(i.x,r.x),a=s(i.y,r.y);e.quadraticCurveTo(n,a,f[t+0],f[t+1]),r.x=n,r.y=a,i.x=f[t+0],i.y=f[t+1],0===t&&!0===c&&o.copy(i)}break;case"A":f=a(p,[3,4],7);for(let t=0,s=f.length;t<s;t+=7){if(f[t+5]==i.x&&f[t+6]==i.y)continue;const s=i.clone();i.x=f[t+5],i.y=f[t+6],r.x=i.x,r.y=i.y,n(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],s,i),0===t&&!0===c&&o.copy(i)}break;case"m":f=a(p);for(let t=0,n=f.length;t<n;t+=2)i.x+=f[t+0],i.y+=f[t+1],r.x=i.x,r.y=i.y,0===t?e.moveTo(i.x,i.y):e.lineTo(i.x,i.y),0===t&&o.copy(i);break;case"h":f=a(p);for(let t=0,n=f.length;t<n;t++)i.x+=f[t],r.x=i.x,r.y=i.y,e.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case"v":f=a(p);for(let t=0,n=f.length;t<n;t++)i.y+=f[t],r.x=i.x,r.y=i.y,e.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case"l":f=a(p);for(let t=0,n=f.length;t<n;t+=2)i.x+=f[t+0],i.y+=f[t+1],r.x=i.x,r.y=i.y,e.lineTo(i.x,i.y),0===t&&!0===c&&o.copy(i);break;case"c":f=a(p);for(let t=0,n=f.length;t<n;t+=6)e.bezierCurveTo(i.x+f[t+0],i.y+f[t+1],i.x+f[t+2],i.y+f[t+3],i.x+f[t+4],i.y+f[t+5]),r.x=i.x+f[t+2],r.y=i.y+f[t+3],i.x+=f[t+4],i.y+=f[t+5],0===t&&!0===c&&o.copy(i);break;case"s":f=a(p);for(let t=0,n=f.length;t<n;t+=4)e.bezierCurveTo(s(i.x,r.x),s(i.y,r.y),i.x+f[t+0],i.y+f[t+1],i.x+f[t+2],i.y+f[t+3]),r.x=i.x+f[t+0],r.y=i.y+f[t+1],i.x+=f[t+2],i.y+=f[t+3],0===t&&!0===c&&o.copy(i);break;case"q":f=a(p);for(let t=0,n=f.length;t<n;t+=4)e.quadraticCurveTo(i.x+f[t+0],i.y+f[t+1],i.x+f[t+2],i.y+f[t+3]),r.x=i.x+f[t+0],r.y=i.y+f[t+1],i.x+=f[t+2],i.y+=f[t+3],0===t&&!0===c&&o.copy(i);break;case"t":f=a(p);for(let t=0,n=f.length;t<n;t+=2){const n=s(i.x,r.x),a=s(i.y,r.y);e.quadraticCurveTo(n,a,i.x+f[t+0],i.y+f[t+1]),r.x=n,r.y=a,i.x=i.x+f[t+0],i.y=i.y+f[t+1],0===t&&!0===c&&o.copy(i)}break;case"a":f=a(p,[3,4],7);for(let t=0,s=f.length;t<s;t+=7){if(0==f[t+5]&&0==f[t+6])continue;const s=i.clone();i.x+=f[t+5],i.y+=f[t+6],r.x=i.x,r.y=i.y,n(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],s,i),0===t&&!0===c&&o.copy(i)}break;case"Z":case"z":e.currentPath.autoClose=!0,e.currentPath.curves.length>0&&(i.copy(o),e.currentPath.currentPoint.copy(i),l=!0)}c=!1}return e}(e));break;case"rect":i=r(e,i),E=function(t){const e=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),i=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),s=c(t.getAttribute("width")),a=c(t.getAttribute("height")),o=.448084975506,l=new po;return l.moveTo(e+i,n),l.lineTo(e+s-i,n),(0!==i||0!==r)&&l.bezierCurveTo(e+s-i*o,n,e+s,n+r*o,e+s,n+r),l.lineTo(e+s,n+a-r),(0!==i||0!==r)&&l.bezierCurveTo(e+s,n+a-r*o,e+s-i*o,n+a,e+s-i,n+a),l.lineTo(e+i,n+a),(0!==i||0!==r)&&l.bezierCurveTo(e+i*o,n+a,e,n+a-r*o,e,n+a-r),l.lineTo(e,n+r),(0!==i||0!==r)&&l.bezierCurveTo(e,n+r*o,e+i*o,n,e+i,n),l}(e);break;case"polygon":i=r(e,i),E=function(t){function e(t,e,n){const s=c(e),a=c(n);0===r?i.moveTo(s,a):i.lineTo(s,a),r++}const n=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,i=new po;let r=0;return t.getAttribute("points").replace(n,e),i.currentPath.autoClose=!0,i}(e);break;case"polyline":i=r(e,i),E=function(t){function e(t,e,n){const s=c(e),a=c(n);0===r?i.moveTo(s,a):i.lineTo(s,a),r++}const n=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,i=new po;let r=0;return t.getAttribute("points").replace(n,e),i.currentPath.autoClose=!1,i}(e);break;case"circle":i=r(e,i),E=function(t){const e=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),i=c(t.getAttribute("r")||0),r=new _s;r.absarc(e,n,i,0,2*Math.PI);const s=new po;return s.subPaths.push(r),s}(e);break;case"ellipse":i=r(e,i),E=function(t){const e=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),i=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0),s=new _s;s.absellipse(e,n,i,r,0,2*Math.PI);const a=new po;return a.subPaths.push(s),a}(e);break;case"line":i=r(e,i),E=function(t){const e=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),i=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0),s=new po;return s.moveTo(e,n),s.lineTo(i,r),s.currentPath.autoClose=!1,s}(e);break;case"defs":l=!0;break;case"use":i=r(e,i);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),h=e.viewportElement.getElementById(o);h&&t(h,i)}E&&(void 0!==i.fill&&"none"!==i.fill&&E.color.setStyle(i.fill,Np),function(t,e){function n(t){M.set(t.x,t.y,1).applyMatrix3(e),t.set(M.x,M.y)}function i(t){const n=t.xRadius,i=t.yRadius,r=Math.cos(t.aRotation),s=Math.sin(t.aRotation),a=new rn(n*r,n*s,0),o=new rn(-i*s,i*r,0),l=a.applyMatrix3(e),c=o.applyMatrix3(e),u=v.set(l.x,c.x,0,l.y,c.y,0,0,0,1),d=_.copy(u).invert(),p=y.copy(d).transpose().multiply(d).elements,f=function(t,e,n){let i,r,s,a,o;const l=t+n,c=t-n,h=Math.sqrt(c*c+4*e*e);return l>0?(i=.5*(l+h),o=1/i,r=t*o*n-e*o*e):l<0?r=.5*(l-h):(i=.5*h,r=-.5*h),s=c>0?c+h:c-h,Math.abs(s)>2*Math.abs(e)?(o=-2*e/s,a=1/Math.sqrt(1+o*o),s=o*a):0===Math.abs(e)?(s=1,a=0):(o=-.5*s/e,s=1/Math.sqrt(1+o*o),a=o*s),c>0&&(o=s,s=-a,a=o),{rt1:i,rt2:r,cs:s,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);if(t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs),!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const n=_.set(m,0,0,0,g,0,0,0,1),i=y.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),r=n.multiply(i).multiply(u),s=t=>{const{x:e,y:n}=new rn(Math.cos(t),Math.sin(t),0).applyMatrix3(r);return Math.atan2(n,e)};t.aStartAngle=s(t.aStartAngle),t.aEndAngle=s(t.aEndAngle),h(e)&&(t.aClockwise=!t.aClockwise)}}function r(t){const n=d(e),i=p(e);t.xRadius*=n,t.yRadius*=i;const r=n>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=r,h(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const s=t.subPaths;for(let t=0,a=s.length;t<a;t++){const a=s[t].curves;for(let t=0;t<a.length;t++){const s=a[t];s.isLineCurve?(n(s.v1),n(s.v2)):s.isCubicBezierCurve?(n(s.v0),n(s.v1),n(s.v2),n(s.v3)):s.isQuadraticBezierCurve?(n(s.v0),n(s.v1),n(s.v2)):s.isEllipseCurve&&(b.set(s.aX,s.aY),n(b),s.aX=b.x,s.aY=b.y,u(e)?i(s):r(s))}}}(E,S),f.push(E),E.userData={node:e,style:i});const w=e.childNodes;for(let e=0;e<w.length;e++){const n=w[e];l&&"style"!==n.nodeName&&"defs"!==n.nodeName||t(n,i)}o&&(g.pop(),g.length>0?S.copy(g[g.length-1]):S.identity())}(E.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:f,xml:E.documentElement}}static createShapes(t){const e=999999999,n=0,i=1,r=2,s=3,a=4,o=5,l=6,c={loc:n,t:0};function h(t,e,i,s){const a=t.x,o=e.x,l=i.x,h=s.x,d=t.y,p=e.y,f=i.y,m=s.y,g=(h-l)*(d-f)-(m-f)*(a-l),v=(m-f)*(o-a)-(h-l)*(p-d),_=g/v,y=((o-a)*(d-f)-(p-d)*(a-l))/v;if(0===v&&0!==g||_<=0||_>=1||y<0||y>1)return null;if(0===g&&0===v){for(let l=0;l<2;l++){if(u(0===l?i:s,t,e),c.loc==n){const t=0===l?i:s;return{x:t.x,y:t.y,t:c.t}}if(c.loc==r)return{x:+(a+c.t*(o-a)).toPrecision(10),y:+(d+c.t*(p-d)).toPrecision(10),t:c.t}}return null}for(let r=0;r<2;r++)if(u(0===r?i:s,t,e),c.loc==n){const t=0===r?i:s;return{x:t.x,y:t.y,t:c.t}}return{x:+(a+_*(o-a)).toPrecision(10),y:+(d+_*(p-d)).toPrecision(10),t:_}}function u(t,e,h){const u=h.x-e.x,d=h.y-e.y,p=t.x-e.x,f=t.y-e.y,m=u*f-p*d;if(t.x===e.x&&t.y===e.y)return c.loc=n,void(c.t=0);if(t.x===h.x&&t.y===h.y)return c.loc=i,void(c.t=1);if(m<-Number.EPSILON)return void(c.loc=s);if(m>Number.EPSILON)return void(c.loc=a);if(u*p<0||d*f<0)return void(c.loc=o);if(Math.sqrt(u*u+d*d)<Math.sqrt(p*p+f*f))return void(c.loc=l);let g;g=0!==u?p/u:f/d,c.loc=r,c.t=g}function d(t,e,n){const i=new Pe;e.getCenter(i);const r=[];return n.forEach((e=>{e.boundingBox.containsPoint(i)&&function(t,e){const n=[],i=[];for(let r=1;r<t.length;r++){const s=t[r-1],a=t[r];for(let t=1;t<e.length;t++){const r=h(s,a,e[t-1],e[t]);null!==r&&void 0===n.find((t=>t.t<=r.t+Number.EPSILON&&t.t>=r.t-Number.EPSILON))&&(n.push(r),i.push(new Pe(r.x,r.y)))}}return i}(t,e.points).forEach((t=>{r.push({identifier:e.identifier,isCW:e.isCW,point:t})}))})),r.sort(((t,e)=>t.point.x-e.point.x)),r}let p=e,f=-999999999,m=t.subPaths.map((t=>{const n=t.getPoints();let i=-999999999,r=e,s=-999999999,a=e;for(let t=0;t<n.length;t++){const e=n[t];e.y>i&&(i=e.y),e.y<r&&(r=e.y),e.x>s&&(s=e.x),e.x<a&&(a=e.x)}return f<=s&&(f=s+1),p>=a&&(p=a-1),{curves:t.curves,points:n,isCW:Xs.isClockWise(n),identifier:-1,boundingBox:new io(new Pe(a,r),new Pe(s,i))}}));m=m.filter((t=>t.points.length>1));for(let t=0;t<m.length;t++)m[t].identifier=t;const g=m.map((e=>function(t,e,n,i,r){null!=r&&""!==r||(r="nonzero");const s=new Pe;t.boundingBox.getCenter(s);const a=d([new Pe(n,s.y),new Pe(i,s.y)],t.boundingBox,e);a.sort(((t,e)=>t.point.x-e.point.x));const o=[],l=[];a.forEach((e=>{e.identifier===t.identifier?o.push(e):l.push(e)}));const c=o[0].point.x,h=[];let u=0;for(;u<l.length&&l[u].point.x<c;)h.length>0&&h[h.length-1]===l[u].identifier?h.pop():h.push(l[u].identifier),u++;if(h.push(t.identifier),"evenodd"===r){const e=h.length%2==0,n=h[h.length-2];return{identifier:t.identifier,isHole:e,for:n}}if("nonzero"===r){let n=!0,i=null,r=null;for(let t=0;t<h.length;t++){const s=h[t];n?(r=e[s].isCW,n=!1,i=s):r!==e[s].isCW&&(r=e[s].isCW,n=!0)}return{identifier:t.identifier,isHole:n,for:i}}}(e,m,p,f,t.userData?t.userData.style.fillRule:void 0))),v=[];return m.forEach((t=>{if(!g[t.identifier].isHole){const e=new ys;e.curves=t.curves,g.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const n=m[t.identifier],i=new _s;i.curves=n.curves,e.holes.push(i)})),v.push(e)}})),v}static getStrokeStyle(t,e,n,i,r){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:i=void 0!==i?i:"butt",strokeMiterLimit:r=void 0!==r?r:4}}static pointsToStroke(t,e,n,i){const r=[],s=[],a=[];if(0===Dp.pointsToStrokeWithBuffers(t,e,n,i,r,s,a))return null;const o=new qi;return o.setAttribute("position",new Fi(r,3)),o.setAttribute("normal",new Fi(s,3)),o.setAttribute("uv",new Fi(a,2)),o}static pointsToStrokeWithBuffers(t,e,n,i,r,s,a,o){const l=new Pe,c=new Pe,h=new Pe,u=new Pe,d=new Pe,p=new Pe,f=new Pe,m=new Pe,g=new Pe,v=new Pe,_=new Pe,y=new Pe,x=new Pe,b=new Pe,M=new Pe,S=new Pe,E=new Pe;n=void 0!==n?n:12,i=void 0!==i?i:.001,o=void 0!==o?o:0;const w=(t=function(t){let e=!1;for(let n=1,r=t.length-1;n<r;n++)if(t[n].distanceTo(t[n+1])<i){e=!0;break}if(!e)return t;const n=[];n.push(t[0]);for(let e=1,r=t.length-1;e<r;e++)t[e].distanceTo(t[e+1])>=i&&n.push(t[e]);return n.push(t[t.length-1]),n}(t)).length;if(w<2)return 0;const T=t[0].equals(t[w-1]);let A,C,R=t[0];const P=e.strokeWidth/2,I=1/(w-1);let N,D,L,U,O=0,F=!1,B=0,z=3*o,k=2*o;V(t[0],t[1],l).multiplyScalar(P),m.copy(t[0]).sub(l),g.copy(t[0]).add(l),v.copy(m),_.copy(g);for(let n=1;n<w;n++){A=t[n],C=n===w-1?T?t[1]:void 0:t[n+1];const i=l;if(V(R,A,i),h.copy(i).multiplyScalar(P),y.copy(A).sub(h),x.copy(A).add(h),N=O+I,D=!1,void 0!==C){V(A,C,c),h.copy(c).multiplyScalar(P),b.copy(A).sub(h),M.copy(A).add(h),L=!0,h.subVectors(C,R),i.dot(h)<0&&(L=!1),1===n&&(F=L),h.subVectors(C,A),h.normalize();const t=Math.abs(i.dot(h));if(t>Number.EPSILON){const n=P/t;h.multiplyScalar(-n),u.subVectors(A,R),d.copy(u).setLength(n).add(h),S.copy(d).negate();const i=d.length(),r=u.length();u.divideScalar(r),p.subVectors(C,A);const s=p.length();switch(p.divideScalar(s),u.dot(S)<r&&p.dot(S)<s&&(D=!0),E.copy(d).add(A),S.add(A),U=!1,D?L?(M.copy(S),x.copy(S)):(b.copy(S),y.copy(S)):W(),e.strokeLineJoin){case"bevel":q(L,D,N);break;case"round":j(L,D),L?G(A,y,b,N,0):G(A,M,x,N,1);break;default:const t=P*e.strokeMiterLimit/i;if(t<1){if("miter-clip"!==e.strokeLineJoin){q(L,D,N);break}j(L,D),L?(p.subVectors(E,y).multiplyScalar(t).add(y),f.subVectors(E,b).multiplyScalar(t).add(b),H(y,N,0),H(p,N,0),H(A,N,.5),H(A,N,.5),H(p,N,0),H(f,N,0),H(A,N,.5),H(f,N,0),H(b,N,0)):(p.subVectors(E,x).multiplyScalar(t).add(x),f.subVectors(E,M).multiplyScalar(t).add(M),H(x,N,1),H(p,N,1),H(A,N,.5),H(A,N,.5),H(p,N,1),H(f,N,1),H(A,N,.5),H(f,N,1),H(M,N,1))}else D?(L?(H(g,O,1),H(m,O,0),H(E,N,0),H(g,O,1),H(E,N,0),H(S,N,1)):(H(g,O,1),H(m,O,0),H(E,N,1),H(m,O,0),H(S,N,0),H(E,N,1)),L?b.copy(E):M.copy(E)):L?(H(y,N,0),H(E,N,0),H(A,N,.5),H(A,N,.5),H(E,N,0),H(b,N,0)):(H(x,N,1),H(E,N,1),H(A,N,.5),H(A,N,.5),H(E,N,1),H(M,N,1)),U=!0}}else W()}else W();T||n!==w-1||X(t[0],v,_,L,!0,O),O=N,R=A,m.copy(b),g.copy(M)}if(T){if(D&&r){let t=E,e=S;F!==L&&(t=S,e=E),L?(U||F)&&(e.toArray(r,0),e.toArray(r,9),U&&t.toArray(r,3)):!U&&F||(e.toArray(r,3),e.toArray(r,9),U&&t.toArray(r,0))}}else X(A,y,x,L,!1,N);return B;function V(t,e,n){return n.subVectors(e,t),n.set(-n.y,n.x).normalize()}function H(t,e,n){r&&(r[z]=t.x,r[z+1]=t.y,r[z+2]=0,s&&(s[z]=0,s[z+1]=0,s[z+2]=1),z+=3,a&&(a[k]=e,a[k+1]=n,k+=2)),B+=3}function G(t,e,i,r,s){l.copy(e).sub(t).normalize(),c.copy(i).sub(t).normalize();let a=Math.PI;const o=l.dot(c);Math.abs(o)<1&&(a=Math.abs(Math.acos(o))),a/=n,h.copy(e);for(let e=0,i=n-1;e<i;e++)u.copy(h).rotateAround(t,a),H(h,r,s),H(u,r,s),H(t,r,.5),h.copy(u);H(u,r,s),H(i,r,s),H(t,r,.5)}function W(){H(g,O,1),H(m,O,0),H(y,N,0),H(g,O,1),H(y,N,0),H(x,N,1)}function q(t,e,n){e?t?(H(g,O,1),H(m,O,0),H(y,N,0),H(g,O,1),H(y,N,0),H(S,N,1),H(y,n,0),H(b,n,0),H(S,n,.5)):(H(g,O,1),H(m,O,0),H(x,N,1),H(m,O,0),H(S,N,0),H(x,N,1),H(x,n,1),H(S,n,0),H(M,n,1)):t?(H(y,n,0),H(b,n,0),H(A,n,.5)):(H(x,n,1),H(M,n,0),H(A,n,.5))}function j(t,e){e&&(t?(H(g,O,1),H(m,O,0),H(y,N,0),H(g,O,1),H(y,N,0),H(S,N,1),H(y,O,0),H(A,N,.5),H(S,N,1),H(A,N,.5),H(b,O,0),H(S,N,1)):(H(g,O,1),H(m,O,0),H(x,N,1),H(m,O,0),H(S,N,0),H(x,N,1),H(x,O,1),H(S,N,0),H(A,N,.5),H(A,N,.5),H(S,N,0),H(M,O,1)))}function X(t,n,i,s,o,d){switch(e.strokeLineCap){case"round":o?G(t,i,n,d,.5):G(t,n,i,d,.5);break;case"square":if(o)l.subVectors(n,t),c.set(l.y,-l.x),h.addVectors(l,c).add(t),u.subVectors(c,l).add(t),s?(h.toArray(r,3),u.toArray(r,0),u.toArray(r,9)):(h.toArray(r,3),1===a[7]?u.toArray(r,9):h.toArray(r,9),u.toArray(r,0));else{l.subVectors(i,t),c.set(l.y,-l.x),h.addVectors(l,c).add(t),u.subVectors(c,l).add(t);const e=r.length;s?(h.toArray(r,e-3),u.toArray(r,e-6),u.toArray(r,e-12)):(u.toArray(r,e-6),h.toArray(r,e-3),u.toArray(r,e-12))}}}}}class Lp{constructor(){}static getZ(){return this._z=Math.round(100*(this._z+.01))/100,this._z}static getPolygons3ByPaths(t){var e,n,i,r,s,a;const o=[];if(!(null==t?void 0:t.length))return o;for(let l,c=0,h=(null==t?void 0:t.length)||0;c<h;c++){if(l=t[c],!l)continue;const{fill:h,stroke:u}=(null==(e=l.userData)?void 0:e.style)||{};if(h&&"none"!==h&&"transparent"!==h){const t=new Pi({color:(new Ti).setStyle(h),opacity:(null==(n=l.userData)?void 0:n.style.fillOpacity)||0,transparent:!0,depthWrite:!1,wireframe:!1}),e=[],i=Dp.createShapes(l);for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++){const n=new ta(i[t]);e.push(n)}if(null==e?void 0:e.length){const n=Pp(e,!1),i=new ir(n,t);i.renderOrder=Up++,i.userData=Mp.merge({},l.userData),o.push(i)}}else if(u&&"none"!==u&&"transparent"!==u){const t=new Pi({color:(new Ti).setStyle(u),opacity:(null==(r=null==(i=l.userData)?void 0:i.style)?void 0:r.strokeOpacity)||0,transparent:!0,side:2,depthWrite:!1,depthTest:!1,wireframe:!1}),e=[];for(let t,n=0,i=(null==(s=l.subPaths)?void 0:s.length)||0;n<i;n++){t=l.subPaths[n];const i=Dp.pointsToStroke(t.getPoints(),null==(a=l.userData)?void 0:a.style);i&&e.push(i)}if(null==e?void 0:e.length){const n=Pp(e,!1),i=new ir(n,t);i.renderOrder=Up++,i.userData=Mp.merge({},l.userData),o.push(i)}}}return o}static getPolygons3BySymbolUses(t,e){var n,i,r,s,a,o,l,c,h;const u=[];if(!t||!(null==e?void 0:e.length))return u;const d={};for(let e in t){const p=[];for(let o,l=0,c=(null==(i=null==(n=t[e])?void 0:n.paths)?void 0:i.length)||0;l<c;l++){if(o=t[e].paths[l],!(null==(r=null==o?void 0:o.subPaths)?void 0:r.length))continue;const n=Dp.createShapes(o);for(let t=0,e=(null==n?void 0:n.length)||0;t<e;t++)n[t].autoClose=!0,new ta(n[t]);for(let t,e=0,n=(null==(s=o.subPaths)?void 0:s.length)||0;e<n;e++){t=o.subPaths[e];const n=Dp.pointsToStroke(t.getPoints(),null==(a=o.userData)?void 0:a.style);n&&(n.index=null,p.push(n))}}if(!(null==p?void 0:p.length))continue;const f=Pp(p),m=new Pi({color:(new Ti).setStyle((null==(l=null==(o=t[e])?void 0:o.style)?void 0:l.stroke)||3355443),opacity:(null==(h=null==(c=t[e])?void 0:c.style)?void 0:h.strokeOpacity)||1,transparent:!0,side:2,depthWrite:!1,wireframe:!0}),g=new Dr(f,m,t[e].len);u.push(g),d[e]=g}const p=new oi;for(let t,n=0,i=(null==e?void 0:e.length)||0;n<i;n++)t=d[e[n].symbolId],t&&e[n].transform&&(Op.setByMatrix3(e[n].transform),p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1),p.applyMatrix4(Op),p.updateMatrix(),t.setMatrixAt(e[n].idx,p.matrix));return u}static getLabels3ByPaths(t,e){var n;const i=[];if(!(null==t?void 0:t.length)||!e)return i;for(let r,s=0,a=(null==t?void 0:t.length)||0;s<a;s++){if(r=t[s],"text"!==r.type)continue;const{fill:a,fontSize:o}=(null==(n=r.userData)?void 0:n.style)||{},l=new Sp(r.textContent,{font:e,size:o,depth:o/10}).scale(1,-1,1);l.computeBoundingBox();const c=new Pi({color:new Ti(a&&"none"!==a&&"transparent"!==a?a:4013373)}),h=new ir(l,c);r.transform&&(Op.setByMatrix3(r.transform),h.applyMatrix4(Op)),h.userData=Mp.merge({},r.userData),h.renderOrder=Up++,i.push(h)}return i}}d(Lp,"_z",.1);let Up=0;const Op=new rp;class Fp extends Sr{constructor(t={}){super(),d(this,"name","DrawingScene3"),d(this,"isStatic",!0),d(this,"lights"),d(this,"adapter"),d(this,"font"),d(this,"defaultLayersIds"),this.params=t,this.lights=new Ep(t),this.lights.bindScene(this)}destroy(){}init(t){var e,n,i,r;if(!t)return;this.adapter=t;const s=new xr;s.scale.y*=-1;const a=Lp.getPolygons3ByPaths(null==(e=this.adapter)?void 0:e.paths);(null==a?void 0:a.length)&&s.add(...a);const o=Lp.getPolygons3BySymbolUses(null==(n=this.adapter)?void 0:n.symbolsMap,null==(i=this.adapter)?void 0:i.uses);(null==o?void 0:o.length)&&s.add(...o);const l=Lp.getLabels3ByPaths(null==(r=this.adapter)?void 0:r.labels,this.font);(null==l?void 0:l.length)&&s.add(...l),this.add(s)}initFont(t){this.font=t}showDefaultLayers(t,e=!1){var n,i,r;if(!(null==t?void 0:t.length))return;let s=null==(n=this.adapter)?void 0:n.getAllChildrenById(t);s=Mp.uniq(Mp.compact(s)),(null==s?void 0:s.length)&&((null==(i=this.defaultLayersIds)?void 0:i.length)||(this.defaultLayersIds=s),null==(r=this.adapter)||r.updateLayersVisibility(s,e))}update(t){}}function Bp(t){return t>-1e-8&&t<1e-8}function zp(t,e,n,i,r){const s=1-r;return s*s*(s*t+3*r*e)+r*r*(r*i+3*s*n)}function kp(t,e,n,i,r){const s=6*n-12*e+6*t,a=9*e+3*i-3*t-9*n,o=3*e-3*t;let l=0;if(Bp(a)){if((c=s)>1e-8||c<-1e-8){const t=-o/s;t>=0&&t<=1&&(r[l++]=t)}}else{const t=s*s-4*a*o;if(Bp(t))r[0]=-s/(2*a);else if(t>0){const e=Math.sqrt(t),n=(-s+e)/(2*a),i=(-s-e)/(2*a);n>=0&&n<=1&&(r[l++]=n),i>=0&&i<=1&&(r[l++]=i)}}var c;return l}function Vp(t,e,n){const i=t+n-2*e;return 0===i?.5:(t-e)/i}function Hp(t,e,n,i){const r=1-i;return r*(r*t+2*i*e)+i*i*n}const Gp=2*Math.PI;function Wp(t){return(t%=Gp)<0&&(t+=Gp),t}function qp(t,e,n,i){if(Bp(e-n))return!0;const r=1e-8;return t=Wp(t),e=Wp(e),n=Wp(n),i?n<=e?t-r>=n&&t+r<=e:t-r>=n||t+r<=e:e<=n?t+r>=e&&t-r<=n:t+r>=e||t-r<=n}class jp{constructor(t=new mp(1/0,1/0),e=new mp(-1/0,-1/0)){d(this,"isBox2",!0),d(this,"min"),d(this,"max"),this.min=t,this.max=e}applyMatrix3(t){return this.isEmpty()||(Xp[0].set(this.min.x,this.min.y).applyMatrix3(t),Xp[1].set(this.min.x,this.max.y).applyMatrix3(t),Xp[3].set(this.max.x,this.max.y).applyMatrix3(t),Xp[2].set(this.max.x,this.min.y).applyMatrix3(t),this.setFromPoints(Xp)),this}clone(){return(new jp).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}ceil(){return this.min.ceilToZero(),this.max.ceilToZero(),this}distanceToPoint(t){return Yp.copy(t).clamp(this.min,this.max).sub(t).length()}expandByXY(t,e){return this.min.minXY(t,e),this.max.maxXY(t,e),this}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByPoints(t){if(!t||!t.length)return this;for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){var e;this.union(t.boundingBoxWorld);for(let n=0,i=(null==(e=t.children)?void 0:e.length)||0;n<i;n++)this.expandByObject(t.children[n]);return this}expandByObjects(t){for(let e=0,n=t.length;e<n;e++)this.expandByObject(t[e]);return this}expandByBox(t){t.isEmpty()||(this.expandByPoint(t.min),this.expandByPoint(t.max))}expandByCubic(t,e,n,i,r,s,a,o){this.makeEmpty();let l=kp(t,n,r,a,Kp);for(let e=0;e<l;e++){const i=zp(t,n,r,a,Kp[e]);this.min.x=Math.min(i,this.min.x),this.max.x=Math.max(i,this.max.x)}l=kp(e,i,s,o,Jp);for(let t=0;t<l;t++){const n=zp(e,i,s,o,Jp[t]);this.min.y=Math.min(n,this.min.y),this.max.y=Math.max(n,this.max.y)}return this.expandByXY(t,e),this.expandByXY(a,o),this}expandByQuadratic(t,e,n,i,r,s){const a=Math.max(0,Math.min(1,Vp(t,n,r))),o=Math.max(0,Math.min(1,Vp(e,i,s))),l=Hp(t,n,r,a),c=Hp(e,i,s,o);return this.expandByXY(t,e),this.expandByXY(r,s),this.expandByXY(l,c),this}expandByArc(t,e,n,i,r,s,a){let o=r%(2*Math.PI);o<0&&(o+=2*Math.PI);let l=s%(2*Math.PI);if(l<0&&(l+=2*Math.PI),o===l)return this.expandByXY(t-n,e-i),this.expandByXY(t+n,e+i),this;if(a){const t=o;o=l,l=t}return l<o&&(l+=2*Math.PI),this.expandByXY(t+n*Math.cos(o),e+i*Math.sin(o)),this.expandByXY(t+n*Math.cos(l),e+i*Math.sin(l)),o>.5*Math.PI&&l<2*Math.PI+.5*Math.PI&&this.expandByXY(t,e+i),o>Math.PI&&l<2*Math.PI+Math.PI&&this.expandByXY(t-n,e),o>1.5*Math.PI&&l<2*Math.PI+1.5*Math.PI&&this.expandByXY(t,e-i),o>0&&l<2*Math.PI&&this.expandByXY(t+n,e),this}expandByEllipse(t,e,n,i,r,s,a,o){$p[0]=s,$p[1]=a,function(t,e){let n=Wp(t[0]),i=Wp(t[1]);e?n<i&&(n+=Gp):i<n&&(i+=Gp),t[0]=n,t[1]=i}($p,o),s=$p[0],a=$p[1];const l=t+n*Math.cos(s),c=e+i*Math.sin(s),h=t+n*Math.cos(a),u=e+i*Math.sin(a);this.expandByXY(l,c),this.expandByXY(h,u);const d=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const l of d)if(qp(l,s,a,o)){const s=t+n*Math.cos(l),a=e+i*Math.sin(l),o=t+(s-t)*Math.cos(r)-(a-e)*Math.sin(r),c=e+(s-t)*Math.sin(r)+(a-e)*Math.cos(r);this.expandByXY(o,c)}return this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}floor(){return this.min.floorToZero(),this.max.floorToZero(),this}getCenter(t=new mp){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t=new mp){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}getPoints(t=[]){return t.length=0,t[0]={x:this.min.x,y:this.min.y},t[1]={x:this.min.x,y:this.max.y},t[2]={x:this.max.x,y:this.max.y},t[3]={x:this.max.x,y:this.min.y},t}getNumbersArray(t=[]){return[this.min.x,this.min.y,this.min.x,this.max.y,this.max.x,this.max.y,this.max.x,this.min.y]}getArea(){return this.getSize(Yp),Yp.x*Yp.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}intersectsBox(t){return!!t&&!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}intersectsObject(t){return!(!t||!t.geometry)&&this.intersectsBox(t.geometry.boundingBox)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}round(){return this.min.roundToZero(),this.max.roundToZero(),this}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Yp.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Yp.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromProjectionMatrix(t){return this.min.set(t.elements[6],t.elements[7]),this.max.set(t.elements[6],t.elements[7]),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}setFromMinMaxString(t,e=" "){if(this.makeEmpty(),!(null==t?void 0:t.length))return this;let n=t.split(e),i=Mp.map(n,(t=>parseFloat(t)));for(let t=0,e=i.length;t<e;t+=2)this.expandByPoint(Yp.fromArray(i,t));return this}setFromXYXY(t,e,n,i){return this.makeEmpty(),this.expandByXY(t,e),this.expandByXY(n,i),this}translate(t){return this.min.add(t),this.max.add(t),this}toString(){return`{"min":${this.min.toString()},"max":${this.max.toString()}}`}fromString(t){return t?(this.copy(JSON.parse(t)),this):this}union(t){return t.validate()?(this.min.min(t.min),this.max.max(t.max),this):this}validate(){return this.min.validate()&&this.max.validate()}unproject(t){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}centralArrange(t=1,e=20,n=10,i){const r=e+n;i?Yp.copy(i):this.getCenter(Yp),this.getSize(Zp),Zp.subScalar(e);const s=Math.floor(Zp.x/r),a=s*r,o=Math.ceil(t/s)*r;if(Zp.x<r||Zp.y<r||a>=Zp.x||o>=Zp.y)return Yp.clone();let l=[],c=0,h=0;for(let e=0;e<t;e++){const e=s>t?t*r:a,n=Yp.x-e/2+h*r+r/2,i=Yp.y-o/2+c*r+r/2;l.push(new mp(n,i)),h++,h>=s&&(h=0,c++)}return l}flipY(){return Yp.copy(this.min).multiplyScalar(1,-1),Zp.copy(this.max).multiplyScalar(1,-1),this.min.set(Yp.x,Zp.y),this.max.set(Zp.x,Yp.y),this}}const Xp=[new mp,new mp,new mp,new mp],Yp=new mp,Zp=new mp,Kp=[],Jp=[],$p=[];class Qp{constructor(){d(this,"isMatrix3",!0),d(this,"elements",[1,0,0,0,1,0,0,0,1])}static equals(t,e,n=1e-6){if(t.elements.length!=e.elements.length)return!1;for(let i=0,r=t.elements.length;i<r;i++){const r=t.elements[i]-e.elements[i];if(Math.abs(r)>n)return!1}return!0}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}clone(){return(new Qp).fromArray(this.elements)}compose(t,e,n){const i=Math.sin(e.x),r=Math.cos(e.x);return this.set(n.x*r,n.y*i*-1,t.x,n.x*i,n.y*r,t.y,0,0,1)}composeWithCenter(t,e,n,i){return sf.identity(),af.makeTranslation(t.x,t.y),of.makeRotation(e.x),lf.makeScale(n.x,n.y),nf.copy(i).applyMatrix3(lf),sf.multiply(cf.makeTranslation(-nf.x,-nf.y)).multiply(af).multiply(cf.makeTranslation(nf.x,nf.y)).multiply(of).multiply(cf.makeTranslation(-nf.x,-nf.y)).multiply(lf),this.copy(sf)}decompose(t,e,n){const i=sf.copy(this).elements,r=Math.sqrt(i[0]*i[0]+i[3]*i[3]),s=Math.sqrt(i[1]*i[1]+i[4]*i[4]),a=i[0]*i[4]-i[3]*i[1];i[0]||i[3]?n.set(r,a/r):i[1]||i[4]?n.set(a/s,s):n.set(0,0);let o=0;o=i[0]||i[3]?i[3]>0?-Math.acos(i[0]/r):Math.acos(i[0]/r):i[1]||i[4]?Math.PI/2-(i[4]>0?Math.acos(-i[1]/s):-Math.acos(i[1]/s)):0,0!==o&&n.y<0&&(o*=-1),e.set(o,o),t.set(i[6],i[7])}compose2(t,e,n){return this.identity().translate(t.x,t.y).rotate(e.x).scale(n.x,n.y),this}decompose2(t,e,n){const i=this.clone();i.scale(-1,1);const r=i.elements[0],s=i.elements[1],a=i.elements[3],o=i.elements[4];let l=0,c=0,h=0;if(0!==r||0!==a){const t=Math.hypot(r,a);l=t,c=(r*o-s*a)/t;const e=Math.acos(r/t);h=a>0?-e:e}else if(0!==s||0!==o){const t=Math.hypot(s,o);l=(r*o-s*a)/t,c=t;const e=Math.acos(s/t);h=Math.PI/2+(o>0?-e:e)}else l=0,c=0,h=0;l=-l,t.x=i.elements[6],t.y=i.elements[7],e.x=e.y=h/Math.PI/180,n.x=l,n.y=c}composeSvgTransform(t=0,e=0,n,i=!1){if(!n&&!t&&!e)return this;this.identity(),sf.identity();let r=n.split(") ").map((t=>t.trim()+")")).filter((t=>")"!==t));return r||(r=[]),(t||e)&&r.push(`translate(${t},${e})`),r.forEach((t=>{const e=/scale\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(t),n=/rotate\(\s*(-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+)(?:[ ,](-?\d*\.?\d+))?)?\s*\)/.exec(t),i=/translate\(\s*([^\s,)]+)[ ,]([^\s,)]+)/.exec(t);if(e){const t=Number(e[1])||1,n=Number(e[2])||t;sf.multiply(lf.makeScale(t,n))}else if(n){const t=(Number(n[1])||0)*(Math.PI/180);Number(n[2])||Number(n[3])?(ef.set(Number(n[2]||"0"),Number(n[3]||"0")),sf.multiply(of.makeRotationByPoint(t,ef))):sf.multiply(of.makeRotation(t))}else i&&sf.multiply(af.makeTranslation(Number(i[1])||0,Number(i[2])||0))})),this.copy(sf),i&&this.premultiply(lf.makeScale(1,-1)),this}decomposeSvgMatrix(t,e,n){const i=sf.copy(this).elements;ef.set(i[0],i[1]),nf.set(i[3],i[4]);let r=ef.length();ef.normalize();let s=ef.dot(nf);rf.copy(ef).multiplyScalar(-s),nf.add(rf);const a=nf.length()||0;nf.normalize(),ef.x*nf.y<nf.x*ef.y&&(ef.x=-ef.x,ef.y=-ef.y,r=-r,s=-s);const o=r?Math.atan2(ef.y,ef.x):Math.atan2(-ef.x,nf.y);t.set(i[6],i[7]),e.set(o,o),n.set(r,a)}determinant(){const t=this.elements,e=t[0],n=t[3],i=t[6],r=t[1],s=t[4],a=t[7],o=t[2],l=t[5],c=t[8];return e*s*c-e*l*a-r*n*c+r*l*i+o*n*a-o*s*i}equals(t,e=0){const n=this.elements,i=t.elements;for(let t=0;t<9;t++)if(Math.abs(n[t]-i[t])>e)return!1;return!0}extractBasis2(t,e){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),this}flipY(){return this.premultiply(lf.makeScale(1,-1))}flipSvgY(){return this.elements[1]*=-1,this.elements[3]*=-1,this.elements[7]*=-1,this}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}getComponents(t=[1,0,0,1,0,0]){return t[0]=this.elements[0],t[1]=this.elements[1],t[2]=this.elements[3],t[3]=this.elements[4],t[4]=this.elements[6],t[5]=this.elements[7],t}fromComponents(t){return this}getNormalMatrix(t){return this.setFromMatrix(t).invert().transpose()}getRotation(t){let e=this.elements;const n=Math.sqrt(e[0]*e[0]+e[3]*e[3]),i=Math.sqrt(e[1]*e[1]+e[4]*e[4]);let r=0;r=e[0]||e[3]?e[3]>0?-Math.acos(e[0]/n):Math.acos(e[0]/n):e[1]||e[4]?Math.PI/2-(e[4]>0?Math.acos(-e[1]/i):-Math.acos(e[1]/i)):0,this.getScale(nf),0!==r&&nf.x<0&&(r*=-1),t.set(r,r)}getScale(t){let e=this.elements,n=Math.sqrt(e[0]*e[0]+e[1]*e[1]),i=Math.sqrt(e[3]*e[3]+e[4]*e[4]),r=e[0]*e[4]-e[3]*e[1];e[0]||e[1]?t.set(r/i,i):e[3]||e[4]?t.set(n,r/n):t.set(0,0)}getTransition(t){t.set(this.elements[6],this.elements[7])}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}hasChange(){for(let t=0,e=this.elements.length;t<e;t++)if(Math.abs(this.elements[t]-tf[t])>Number.EPSILON)return!0;return!1}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(a*n-i*s)*f,t[3]=u*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-a*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(s*e-n*r)*f,this}lookAt(t,e,n){return this.identity().rotate(e.angle()-t.angle()+n.angle())}makeProjection(t,e,n,i,r,s){const a=r/(e-t),o=s/(n-i),l=r/2-(e+t)*a,c=s/2+(n+i)*o;return this.elements[0]=a,this.elements[3]=0,this.elements[6]=l,this.elements[1]=0,this.elements[4]=-o,this.elements[7]=c,this.elements[2]=0,this.elements[5]=0,this.elements[8]=1,this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeRotationByPoint(t,e){const n=Math.cos(t),i=Math.sin(t),r=-e.x*n+e.y*i+e.x,s=-e.x*i-e.y*n+e.y;return this.set(n,-i,r,i,n,s,0,0,1),this}makeRotationFromQuaternion(t){return this.compose(hf,t,uf)}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}multiply(t){return this.multiplyMatrices(this,t)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],y=i[7],x=i[2],b=i[5],M=i[8];return r[0]=s*f+a*v+o*x,r[3]=s*m+a*_+o*b,r[6]=s*g+a*y+o*M,r[1]=l*f+c*v+h*x,r[4]=l*m+c*_+h*b,r[7]=l*g+c*y+h*M,r[2]=u*f+d*v+p*x,r[5]=u*m+d*_+p*b,r[8]=u*g+d*y+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}premultiply(t){return this.multiplyMatrices(t,this)}rotate(t){return this.premultiply(of.makeRotation(-t))}scale(t,e){return this.premultiply(lf.makeScale(t,e))}set(t,e,n,i,r,s,a,o,l){return this.elements[0]=t,this.elements[3]=e,this.elements[6]=n,this.elements[1]=i,this.elements[4]=r,this.elements[7]=s,this.elements[2]=a,this.elements[5]=o,this.elements[8]=l,this}setFromDomMatrix(t){return void 0!==t.m11&&void 0!==t.m21&&void 0!==t.m41&&void 0!==t.m12&&void 0!==t.m22&&void 0!==t.m42&&void 0!==t.m14&&void 0!==t.m24&&void 0!==t.m44?this.set(t.m11,t.m21,t.m41,t.m12,t.m22,t.m42,t.m14,t.m24,t.m44):void 0!==t.a&&void 0!==t.b&&void 0!==t.c&&void 0!==t.d&&void 0!==t.e&&void 0!==t.f&&this.set(t.a,t.c,t.e,t.b,t.d,t.f,0,0,1),this}setFromMatrix(t){const e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}toString(){return`[${this.elements[0]},${this.elements[1]}, ${this.elements[3]},${this.elements[4]}, ${this.elements[6]},${this.elements[7]}]`}translate(t,e){return this.premultiply(af.makeTranslation(t,e))}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}getTransformScaleX(){return Math.sqrt(this.elements[0]*this.elements[0]+this.elements[1]*this.elements[1])}getTransformScaleY(){return Math.sqrt(this.elements[3]*this.elements[3]+this.elements[4]*this.elements[4])}isTransformSkewed(){const t=this.elements[0]*this.elements[3]+this.elements[1]*this.elements[4];return 0!==t&&Math.abs(t/(this.getTransformScaleX()*this.getTransformScaleY()))>Number.EPSILON}isTransformFlipped(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]<0}hasMirror(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]<0}hasMirrorY(){return this.elements[0]<0&&this.elements[4]>0}hasMirrorX(){return this.elements[4]<0&&this.elements[0]>0}}const tf=[1,0,0,0,1,0,0,0,1],ef=new mp,nf=new mp,rf=new mp,sf=new Qp,af=new Qp,of=new Qp,lf=new Qp,cf=new Qp,hf=new mp(0,0,0),uf=new mp(1,1,1),df=["view"],pf=["viewer","mirror"];let ff=0;function mf(t,e=0,n=0,i=[]){var r,s;if(!t)return i;const a=function(t,e,n){if(!t)return n;let i=n;return"function"==typeof t.getAttribute?i=null==t?void 0:t.getAttribute(e):Object.hasOwnProperty.call(t,"attributes")&&(i=t.attributes[e]),i||n}(t,"id","");if(df.includes(t.nodeName)||"defs"===t.nodeName)return ff--,i;if(e&&ff>e)return i;let o;a&&!pf.includes(a)&&(o={label:a,value:a,children:[]},i.push(o)),ff++;for(let n=0,s=null==(r=t.childNodes)?void 0:r.length;n<s;n++)mf(t.childNodes[n],e,ff,o?o.children:i);return 0===(null==(s=null==o?void 0:o.children)?void 0:s.length)&&delete o.children,ff=n,i}function gf(t,e){var n;if(Array.isArray(t))for(let n=0,i=t.length||0;n<i;n++)gf(t[n],e);else if(e(t),null==(n=t.children)?void 0:n.length)for(let n=0,i=t.children.length;n<i;n++)gf(t.children[n],e)}function vf(t){var e,n,i;const r=[];if(!(null==(e=null==t?void 0:t.children)?void 0:e.length))return r;for(let e,s=0,a=(null==(n=null==t?void 0:t.children)?void 0:n.length)||0;s<a;s++)e=t.children[s],r.push(e),(null==(i=e.children)?void 0:i.length)&&r.push(...vf(e));return r}var _f=(t=>(t.GROS="gros",t.RM="rm",t.WS="ws",t.SU="su",t.EQ="eq",t.FN="fn",t.GL="gl",t.IP="ip",t))(_f||{}),yf=(t=>(t.BACKGROUND="background",t.BACKGROUND_LABELS="background-labels",t.ASSETS="assets",t.ANNOTATIONS="annotations",t.TEXT="text",t.ASSET_LABELS="asset-labels",t.LABELS="labels",t))(yf||{});class xf extends Dp{constructor(t=void 0){super(t),d(this,"viewportElement"),d(this,"instancedMesh",!1),d(this,"dpr",1)}setRequestHeader(t){return this.requestHeader=t,this}setInstancedMesh(t=!1){return this.instancedMesh=t,this}setPixelRatio(t){return this.dpr=t,this}parse(t,e=!0){const n=this;function i(t,e,n,i,s,a,o,l){var c;if(0==e||0==n)return void t.lineTo(l.x,l.y);i=i*Math.PI/180,e=Math.abs(e),n=Math.abs(n);const h=(o.x-l.x)/2,u=(o.y-l.y)/2,d=Math.cos(i)*h+Math.sin(i)*u,p=-Math.sin(i)*h+Math.cos(i)*u;let f=e*e,m=n*n;const g=d*d,v=p*p,_=g/f+v/m;if(_>1){const t=Math.sqrt(_);f=(e*=t)*e,m=(n*=t)*n}const y=f*v+m*g,x=(f*m-y)/y;let b=Math.sqrt(Math.max(0,x));s===a&&(b=-b);const M=b*e*p/n,S=-b*n*d/e,E=Math.cos(i)*M-Math.sin(i)*S+(o.x+l.x)/2,w=Math.sin(i)*M+Math.cos(i)*S+(o.y+l.y)/2,T=r(1,0,(d-M)/e,(p-S)/n),A=r((d-M)/e,(p-S)/n,(-d-M)/e,(-p-S)/n)%(2*Math.PI);null==(c=t.currentPath)||c.absellipse(E,w,e,n,T,T+A,0===a,i)}function r(t,e,n,i){const r=t*n+e*i,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+i*i);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return t*i-e*n<0&&(a=-a),a}function s(t,e){var n;e=Object.assign({},e);let i={};if(t.hasAttribute("class")){const e=null==(n=t.getAttribute("class"))?void 0:n.split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0,n=(null==e?void 0:e.length)||0;t<n;t++)i=Object.assign(i,T["."+e[t]])}function r(n,r,s){void 0===s&&(s=function(t){return t.startsWith("url"),t}),t.hasAttribute(n)&&(e[r]=s(t.getAttribute(n))),i[n]&&(e[r]=s(i[n])),t.style&&""!==t.style[n]&&(e[r]=s(t.style[n]))}t.hasAttribute("id")&&(i=Object.assign(i,T["#"+t.getAttribute("id")]));const{fontSize:s,strokeWidth:a}=e;function o(t){return Math.max(0,Math.min(1,u(t)))}function l(t){return Math.max(0,u(t,{fontSize:s}))}r("font-size","fontSize",l),r("fill","fill"),r("fill-opacity","fillOpacity",o),r("fill-rule","fillRule"),r("opacity","opacity",o),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",o),r("stroke-width","strokeWidth",(function(t){return Math.max(0,u(t,{}))})),r("stroke-linejoin","strokeLineJoin"),r("stroke-linecap","strokeLineCap"),r("stroke-miterlimit","strokeMiterLimit",l),r("visibility","visibility");const c=t.getAttribute("stroke-width")||e.strokeWidth;return Mp.endsWith(c,"%")&&(e.thinLine=!0),e}function a(t,e){return t-(e-t)}function o(t,e,n){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const i={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let r=0,s=!0,a="",o="";const l=[];function c(t,e,n){const i=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw i.partial=n,i}function h(){""!==a&&(""===o?l.push(Number(a)):l.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let u;const d=t.length;for(let p=0;p<d;p++)if(u=t[p],Array.isArray(e)&&e.includes(l.length%(n||0))&&i.FLAGS.test(u))r=1,a=u,h();else{if(0===r){if(i.WHITESPACE.test(u))continue;if(i.DIGIT.test(u)||i.SIGN.test(u)){r=1,a=u;continue}if(i.POINT.test(u)){r=2,a=u;continue}i.COMMA.test(u)&&(s&&c(u,p,l),s=!0)}if(1===r){if(i.DIGIT.test(u)){a+=u;continue}if(i.POINT.test(u)){a+=u,r=2;continue}if(i.EXP.test(u)){r=3;continue}i.SIGN.test(u)&&1===a.length&&i.SIGN.test(a[0])&&c(u,p,l)}if(2===r){if(i.DIGIT.test(u)){a+=u;continue}if(i.EXP.test(u)){r=3;continue}i.POINT.test(u)&&"."===a[a.length-1]&&c(u,p,l)}if(3===r){if(i.DIGIT.test(u)){o+=u;continue}if(i.SIGN.test(u)){if(""===o){o+=u;continue}1===o.length&&i.SIGN.test(o)&&c(u,p,l)}}i.WHITESPACE.test(u)?(h(),r=0,s=!1):i.COMMA.test(u)?(h(),r=0,s=!0):i.SIGN.test(u)?(h(),r=1,a=u):i.POINT.test(u)?(h(),r=2,a=u):c(u,p,l)}return h(),l}const l=["mm","cm","in","pt","pc","px","em","%"],c={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}};function u(t,e){let i,r="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,n=l.length;e<n;e++){const n=l[e];if(t.endsWith(n)){r=n,t=t.substring(0,t.length-n.length);break}}}if("px"===r&&"px"!==n.defaultUnit)i=c.in[n.defaultUnit]/n.defaultDPI;else if("%"===r){B.getSize(Sf),Mf.copy(L).getScale(Ef);const t=Math.abs(Ef.x||1);i=Sf.x/100*t}else"em"===r?i=(null==e?void 0:e.fontSize)||V:(i=c[r][n.defaultUnit],i<0&&(i=c[r].in*n.defaultDPI));return i*parseFloat(t)}function d(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function p(t){const e=t.elements,n=e[0]*e[3]+e[1]*e[4];if(0===n)return!1;const i=f(t),r=m(t);return Math.abs(n/(i*r))>Number.EPSILON}function f(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function m(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function g(t){return Math.round(t*k*100)/100}function v(t){return Math.round(t*k*100)/100}function _(t){return Math.round(t*k*100)/100}function y(t){return Math.round(t*k*100)/100}function x(t,e="asset"){let n;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!i&&t.parentNode)return x(t.parentNode,e);if(!i)return n;if("layer"===e)n=Z.find((t=>i===t));else{const t=null==i?void 0:i.replace(/-assets/g,"");n=Y.find((e=>t===e))}return!n&&t.parentNode&&(n=x(t.parentNode,e)),n}function b(t){let e;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!n&&t.parentNode?b(t.parentNode):n,e}function M(t,e){let n;const i=b(t);return n=t.parentNode&&b(t.parentNode),n&&i!==e||(n=M(t.parentNode,e)),n||i||""}function S(t){let e;return b(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=S(t.parentNode)),e}const E=[],w=[],T={},A=[],C=new Ie,R=new Ie,P=new Ie,I=new Ie,N=new Pe,D=new rn,L=new Ie,U={},O={},F=[],B=new jp,z=new mp,k=1,V=16,H=(new DOMParser).parseFromString(t,"image/svg+xml");n.viewportElement=H.documentElement,function(t,e=new jp){if(!t)return e;let n=t.split(" "),i=Mp.map(n,(t=>parseFloat(t)));4!==(null==i?void 0:i.length)||(e.min.set(i[0],i[1]),e.max.set(i[0]+i[2],i[1]+i[3]))}(n.viewportElement.getAttribute("viewBox")||"",B);const G=H.getElementsByTagName("view"),W=(null==G?void 0:G.length)?G[0]:null,q=(null==W?void 0:W.getAttribute("units"))||"";B.getCenter(z);const j=mf(H.documentElement);let X=[];gf(j||[],(t=>{var e;if("assets"===t.label&&(null==(e=t.children)?void 0:e.length))for(let e,n=0,i=t.children.length;n<i;n++)e=t.children[n],e.label&&X.push(Mp.head(Mp.split(e.label,"-"))||"")})),X=Mp.uniq(Mp.compact(X));const Y=Mp.uniq(Mp.compact([...X,...Object.values(_f)])),Z=Object.values(yf);!function t(e,n,r,l=!1){var c;if(1!==e.nodeType)return;const U=function(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const n=function(t,e){var n;const i=new Ie,r=C;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){let e=u(t.getAttribute("x")),n=u(t.getAttribute("y"));i.translate(e,n)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){let n=0,r=0;n=t.hasAttribute("dx")?u(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,r=t.hasAttribute("dy")?u(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0,i.translate(n,r)}if(t.hasAttribute("transform")){const e=null==(n=t.getAttribute("transform"))?void 0:n.split(")");for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const n=e[t].trim();if(""===n)continue;const s=n.indexOf("("),a=n.length;if(s>0&&s<a){const t=n.slice(0,s),e=o(n.slice(s+1));switch(r.identity(),t){case"translate":if(e.length>=1){const t=e[0];let n=0;e.length>=2&&(n=e[1]),r.translate(t,n)}break;case"rotate":if(e.length>=1){let t=0,n=0,i=0;t=e[0]*Math.PI/180,e.length>=3&&(n=e[1],i=e[2]),R.makeTranslation(-n,-i),P.makeRotation(t),I.multiplyMatrices(P,R),R.makeTranslation(n,i),r.multiplyMatrices(R,I)}break;case"scale":if(e.length>=1){const t=e[0];let n=t;e.length>=2&&(n=e[1]),r.scale(t,n)}break;case"skewX":1===e.length&&r.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&r.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&r.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}i.premultiply(r)}}return i}(t,e);return A.length>0&&n.premultiply(A[A.length-1]),L.copy(n),A.push(n),n}(e,n);let F=!1,B=null,z=[];const k="function"==typeof e.getAttribute?e.getAttribute("id"):null;switch(e.nodeName){case"svg":case"g":n=s(e,n);break;case"style":!function(t){const e=t.textContent,n=null==e?void 0:e.replace(/\/\*[\s\S]*?\*\//g,""),i=null==n?void 0:n.replace(/([^;])}/g,"$1;}");if(!i)return;const r=[];let s="",a=0;for(const t of i)"{"===t?a++:"}"===t&&a--,s+=t,"}"===t&&0===a&&(r.push(s.trim()),s="");for(const t of r){if(!t.includes("{"))continue;const[e,n]=t.split(/\s*\{\s*/);if(!e||!n)continue;const i=e.split(",").map((t=>t.trim())).filter(Boolean),r={};n.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,n]=t.split(/:\s*/);if(e&&n){const t=n.replace(/\s*!important\s*$/,"").trim();r[e.trim()]=t}})),i.forEach((t=>{t&&(T[t]=h(h({},T[t]||{}),r))}))}}(e);break;case"path":n=s(e,n),e.hasAttribute("d")&&(B=function(t,e=!1){const n=new po,r=new mp,s=new mp,l=new mp;let c=!0,h=!1;const u=t.getAttribute("d");if(!u||""===u||"none"===u)return null;const d=u.match(/[a-df-z][^a-df-z]*/gi);if(!(null==d?void 0:d.length))return null;for(let t=0,u=(null==d?void 0:d.length)||0;t<u;t++){const u=d[t],p=u.charAt(0),f=u.slice(1).trim();let m;switch(!0===c&&(h=!0,c=!1),p){case"M":m=o(f);for(let t=0,i=m.length;t<i;t+=2)r.x=e?m[t]:g(m[t]),r.y=e?m[t+1]:v(m[t+1]),s.x=r.x,s.y=r.y,0===t?n.moveTo(r.x,r.y):n.lineTo(r.x,r.y),0===t&&l.copy(r);break;case"H":m=o(f);for(let t=0,i=m.length;t<i;t++)r.x=e?m[t]:g(m[t]),s.x=r.x,s.y=r.y,n.lineTo(r.x,r.y),0===t&&!0===h&&l.copy(r);break;case"V":m=o(f);for(let t=0,i=m.length;t<i;t++)r.y=e?m[t]:v(m[t]),s.x=r.x,s.y=r.y,n.lineTo(r.x,r.y),0===t&&!0===h&&l.copy(r);break;case"L":m=o(f);for(let t=0,i=m.length;t<i;t+=2)r.x=e?m[t]:g(m[t]),r.y=e?m[t+1]:v(m[t+1]),s.x=r.x,s.y=r.y,n.lineTo(r.x,r.y),0===t&&!0===h&&l.copy(r);break;case"C":m=o(f);for(let t,i=0,a=m.length;i<a;i+=6)t=e?[m[i],m[i+1],m[i+2],m[i+3],m[i+4],m[i+5]]:[g(m[i]),v(m[i+1]),g(m[i+2]),v(m[i+3]),g(m[i+4]),v(m[i+5])],n.bezierCurveTo(...t),s.x=t[2],s.y=t[3],r.x=t[4],r.y=t[5],0===i&&!0===h&&l.copy(r);break;case"S":m=o(f);for(let t,i=0,o=m.length;i<o;i+=4)t=e?[m[i],m[i+1],m[i+2],m[i+3]]:[g(m[i]),v(m[i+1]),g(m[i+2]),v(m[i+3])],n.bezierCurveTo(a(r.x,s.x),a(r.y,s.y),t[0],t[1],t[2],t[3]),s.x=t[0],s.y=t[1],r.x=t[2],r.y=t[3],0===i&&!0===h&&l.copy(r);break;case"Q":m=o(f);for(let t,i=0,a=m.length;i<a;i+=4)t=e?[m[i],m[i+1],m[i+2],m[i+3]]:[g(m[i]),v(m[i+1]),g(m[i+2]),v(m[i+3])],n.quadraticCurveTo(t[0],t[1],t[2],t[3]),s.x=t[0],s.y=t[1],r.x=t[2],r.y=t[3],0===i&&!0===h&&l.copy(r);break;case"T":m=o(f);for(let t,i=0,o=m.length;i<o;i+=2){const o=a(r.x,s.x),c=a(r.y,s.y);t=e?[m[i],m[i+1]]:[g(m[i]),v(m[i+1])],n.quadraticCurveTo(o,c,t[0],t[1]),s.x=o,s.y=c,r.x=t[0],r.y=t[1],0===i&&!0===h&&l.copy(r)}break;case"A":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[g(m[a]),v(m[a+1]),m[a+2],m[a+3],m[a+4],_(m[a+5]),y(m[a+6])],t[5]==r.x&&t[6]==r.y)continue;const o=r.clone();r.x=t[5],r.y=t[6],s.x=r.x,s.y=r.y,i(n,t[a],t[1],t[2],t[3],t[4],o,r),0===a&&!0===h&&l.copy(r)}break;case"m":m=o(f);for(let t=0,i=m.length;t<i;t+=2)r.x+=e?m[t]:_(m[t]),r.y+=e?m[t+1]:y(m[t+1]),s.x=r.x,s.y=r.y,0===t?n.moveTo(r.x,r.y):n.lineTo(r.x,r.y),0===t&&l.copy(r);break;case"h":m=o(f);for(let t=0,i=m.length;t<i;t++)r.x+=e?m[t]:_(m[t]),s.x=r.x,s.y=r.y,n.lineTo(r.x,r.y),0===t&&!0===h&&l.copy(r);break;case"v":m=o(f);for(let t=0,i=m.length;t<i;t++)r.y+=e?m[t]:y(m[t]),s.x=r.x,s.y=r.y,n.lineTo(r.x,r.y),0===t&&!0===h&&l.copy(r);break;case"l":m=o(f);for(let t=0,i=m.length;t<i;t+=2)r.x+=e?m[t]:_(m[t]),r.y+=e?m[t+1]:y(m[t+1]),s.x=r.x,s.y=r.y,n.lineTo(r.x,r.y),0===t&&!0===h&&l.copy(r);break;case"c":m=o(f);for(let t,i=0,a=m.length;i<a;i+=6)t=e?[m[i],m[i+1],m[i+2],m[i+3],m[i+4],m[i+5]]:[_(m[i]),y(m[i+1]),_(m[i+2]),y(m[i+3]),_(m[i+4]),y(m[i+5])],n.bezierCurveTo(r.x+t[0],r.y+t[1],r.x+t[2],r.y+t[3],r.x+t[4],r.y+t[5]),s.x=r.x+t[2],s.y=r.y+t[3],r.x+=t[4],r.y+=t[5],0===i&&!0===h&&l.copy(r);break;case"s":m=o(f);for(let t,i=0,o=m.length;i<o;i+=4)t=e?[m[i],m[i+1],m[i+2],m[i+3]]:[_(m[i]),y(m[i+1]),_(m[i+2]),y(m[i+3])],n.bezierCurveTo(a(r.x,s.x),a(r.y,s.y),r.x+t[0],r.y+t[1],r.x+t[2],r.y+t[3]),s.x=r.x+t[0],s.y=r.y+t[1],r.x+=t[2],r.y+=t[3],0===i&&!0===h&&l.copy(r);break;case"q":m=o(f);for(let t,i=0,a=m.length;i<a;i+=4)t=e?[m[i],m[i+1],m[i+2],m[i+3]]:[_(m[i]),y(m[i+1]),_(m[i+2]),y(m[i+3])],n.quadraticCurveTo(r.x+t[0],r.y+t[1],r.x+t[2],r.y+t[3]),s.x=r.x+t[0],s.y=r.y+t[1],r.x+=t[2],r.y+=t[3],0===i&&!0===h&&l.copy(r);break;case"t":m=o(f);for(let t,i=0,o=m.length;i<o;i+=2){const o=a(r.x,s.x),c=a(r.y,s.y);t=e?[m[i],m[i+1]]:[_(m[i]),y(m[i+1])],n.quadraticCurveTo(o,c,r.x+t[0],r.y+t[1]),s.x=o,s.y=c,r.x=r.x+t[0],r.y=r.y+t[1],0===i&&!0===h&&l.copy(r)}break;case"a":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[_(m[a]),y(m[a+1]),m[a+2],m[a+3],m[a+4],_(m[a+5]),y(m[a+6])],0==t[5]&&0==t[6])continue;const o=r.clone();r.x+=t[5],r.y+=t[6],s.x=r.x,s.y=r.y,i(n,t[0],t[1],t[2],t[3],t[4],o,r),0===a&&!0===h&&l.copy(r)}break;case"Z":case"z":n.currentPath.autoClose=!0,n.currentPath.curves.length>0&&(r.copy(l),n.currentPath.currentPoint.copy(r),c=!0)}h=!1}return n}(e,l));break;case"rect":n=s(e,n),B=function(t,e=!1){let n=u(t.getAttribute("x")||0),i=u(t.getAttribute("y")||0),r=u(t.getAttribute("rx")||t.getAttribute("ry")||0),s=u(t.getAttribute("ry")||t.getAttribute("rx")||0),a=u(t.getAttribute("width")),o=u(t.getAttribute("height"));e||(n=g(n),i=v(i),r=_(r),s=y(s),a=_(a),o=y(o));const l=.448084975506,c=new po;return c.moveTo(n+r,i),c.lineTo(n+a-r,i),(0!==r||0!==s)&&c.bezierCurveTo(n+a-r*l,i,n+a,i+s*l,n+a,i+s),c.lineTo(n+a,i+o-s),(0!==r||0!==s)&&c.bezierCurveTo(n+a,i+o-s*l,n+a-r*l,i+o,n+a-r,i+o),c.lineTo(n+r,i+o),(0!==r||0!==s)&&c.bezierCurveTo(n+r*l,i+o,n,i+o-s*l,n,i+o-s),c.lineTo(n,i+s),(0!==r||0!==s)&&c.bezierCurveTo(n,i+s*l,n+r*l,i,n+r,i),c}(e,l);break;case"polygon":n=s(e,n),B=function(t,e=!1){var n;function i(t,n,i){const r=e?u(n):g(u(n)),o=e?u(i):v(u(i));return 0===a?s.moveTo(r,o):s.lineTo(r,o),a++,t}const r=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,s=new po;let a=0;return null==(n=t.getAttribute("points"))||n.replace(r,i),s.currentPath.autoClose=!0,s}(e,l);break;case"polyline":n=s(e,n),B=function(t,e=!1){var n;function i(t,n,i){const r=e?u(n):g(u(n)),o=e?u(i):v(u(i));return 0===a?s.moveTo(r,o):s.lineTo(r,o),a++,t}const r=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,s=new po;let a=0;return null==(n=t.getAttribute("points"))||n.replace(r,i),s.currentPath.autoClose=!1,s}(e,l);break;case"circle":n=s(e,n),B=function(t,e=!1){let n=u(t.getAttribute("cx")||0),i=u(t.getAttribute("cy")||0),r=u(t.getAttribute("r")||0);e||(n=g(n),i=v(i),r=_(r));const s=new _s;s.absarc(n,i,r,0,2*Math.PI);const a=new po;return a.subPaths.push(s),a}(e,l);break;case"ellipse":n=s(e,n),B=function(t,e=!1){let n=u(t.getAttribute("cx")||0),i=u(t.getAttribute("cy")||0),r=u(t.getAttribute("rx")||0),s=u(t.getAttribute("ry")||0);e||(n=g(n),i=v(i),r=_(r),s=y(s));const a=new _s;a.absellipse(n,i,r,s,0,2*Math.PI);const o=new po;return o.subPaths.push(a),o}(e,l);break;case"line":n=s(e,n),B=function(t,e=!1){let n=u(t.getAttribute("x1")||0),i=u(t.getAttribute("y1")||0),r=u(t.getAttribute("x2")||0),s=u(t.getAttribute("y2")||0);e||(n=g(n),i=v(i),r=g(r),s=v(s));const a=new po;return a.moveTo(n,i),a.lineTo(r,s),a.currentPath.autoClose=!1,a}(e,l);break;case"defs":F=!0;break;case"use":const c=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=O[c];d&&(n=s(e,n),void 0===(n=s(d,n)).assetType&&(n.assetType=x(e)),void 0===n.layerType&&(n.layerType=x(e,"layer")),t(d,n,k||r,l));break;case"text":n=s(e,n),B=function(t,e){parseFloat(t.getAttribute("x")||"0"),parseFloat(t.getAttribute("y")||"0");const n=t.textContent;if(!n||!e.fontSize)return;const i=Object.assign({},e);return i.fill=t.getAttribute("fill")||e.fill||"#000",i.fontSize=parseFloat(t.getAttribute("font-size")||e.fontSize||"72"),i.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{type:"text",textContent:n,style:i,color:new Ti,subPaths:[],userData:{}}}(e,n)}if(B){void 0!==n.fill&&"transparent"===n.fill||void 0!==n.fill&&"none"!==n.fill&&B.color.setStyle(n.fill,bf);const t=n.assetType||x(e),i=n.layerType||x(e,"layer");if(B.userData={pid:r,id:k||r,nodeName:e.nodeName,layerType:i,assetType:t,style:n},"text"===e.nodeName){r||Mp.set(B,"userData.pid",b(e)),B.userData.textContent=e.textContent,B.transform=Mp.cloneDeep(L),B.userData.id=Mp.get(B,"userData.pid"),Mp.set(B,"userData.pid",M(e,r));const t=S(e);t?Mp.set(B,"userData.aid",t):Mp.set(B,"userData.aid",Mp.split(null==(c=B.userData)?void 0:c.id,"-").splice(2).join("-")),E.find((t=>t.userData.id===B.userData.aid))}else!function(t,e){function n(t){D.set(t.x,t.y,1).applyMatrix3(e),t.set(D.x,D.y)}function i(t){const n=t.xRadius,i=t.yRadius,r=Math.cos(t.aRotation),s=Math.sin(t.aRotation),a=new Sd(n*r,n*s,0),o=new Sd(-i*s,i*r,0),l=a.applyMatrix3(e),c=o.applyMatrix3(e),h=C.set(l.x,c.x,0,l.y,c.y,0,0,0,1),u=R.copy(h).invert(),p=P.copy(u).transpose().multiply(u).elements,f=function(t,e,n){let i,r,s,a,o;const l=t+n,c=t-n,h=Math.sqrt(c*c+4*e*e);return l>0?(i=.5*(l+h),o=1/i,r=t*o*n-e*o*e):l<0?r=.5*(l-h):(i=.5*h,r=-.5*h),s=c>0?c+h:c-h,Math.abs(s)>2*Math.abs(e)?(o=-2*e/s,a=1/Math.sqrt(1+o*o),s=o*a):0===Math.abs(e)?(s=1,a=0):(o=-.5*s/e,s=1/Math.sqrt(1+o*o),a=o*s),c>0&&(o=s,s=-a,a=o),{rt1:i,rt2:r,cs:s,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);if(t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs),!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const n=R.set(m,0,0,0,g,0,0,0,1),i=P.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),r=n.multiply(i).multiply(h),s=t=>{const{x:e,y:n}=new Sd(Math.cos(t),Math.sin(t),0).applyMatrix3(r);return Math.atan2(n,e)};t.aStartAngle=s(t.aStartAngle),t.aEndAngle=s(t.aEndAngle),d(e)&&(t.aClockwise=!t.aClockwise)}}function r(t){const n=f(e),i=m(e);t.xRadius*=n,t.yRadius*=i;const r=n>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=r,d(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const s=t.subPaths;for(let t=0,a=(null==s?void 0:s.length)||0;t<a;t++){const a=s[t].curves;for(let t=0;t<a.length;t++){const s=a[t];s.isLineCurve?(n(s.v1),n(s.v2)):s.isCubicBezierCurve?(n(s.v0),n(s.v1),n(s.v2),n(s.v3)):s.isQuadraticBezierCurve?(n(s.v0),n(s.v1),n(s.v2)):s.isEllipseCurve&&(N.set(s.aX,s.aY),n(N),s.aX=N.x,s.aY=N.y,p(e)?i(s):r(s))}}}(B,L);"text"!==e.nodeName?E.push(B):"text"===e.nodeName&&w.push(B)}const V=e.childNodes,H="symbol"===e.nodeName?r:k;for(let e=0,i=(null==V?void 0:V.length)||0;e<i;e++){const i=V[e];if(F){const t="function"==typeof i.getAttribute?i.getAttribute("id"):null;"symbol"===i.nodeName&&t&&(O[t]=i)}if(F&&"style"!==i.nodeName&&"defs"!==i.nodeName)continue;let r=t(i,n,H,l);r&&z.push(r)}return U&&(A.pop(),A.length>0?L.copy(A[A.length-1]):L.identity()),B||((null==z?void 0:z.length)?z:void 0)}(H.documentElement,{fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4,fontSize:V});for(let t in U)U[t].len=Mp.sumBy(F,(e=>e.symbolId===t?1:0));return F.forEach((t=>{var e;return t.len=null==(e=U[t.symbolId])?void 0:e.len})),{xml:H.documentElement,viewBox:B,paths:E,labels:w,idsTree:j,assetTypes:X,symbolsMap:U,uses:F,units:q}}}const bf=re,Mf=new Qp;new Ie,new rp;const Sf=new mp,Ef=new Pe;new Sd,new Sd,new Sd,new Sd;class wf extends Sr{constructor(t={}){super(),d(this,"name","EmptyScene3"),d(this,"isDynamic",!0),d(this,"lights"),d(this,"g",new xr),this.lights=new Ep(t),this.lights.bindScene(this),this.init(),this.userData.boundingBox=new Ed(new Sd(-300,-300,0),new Sd(300,300,0))}destroy(){}init(){return p(this,null,(function*(){}))}initFont(t){if(!t)return;const e=new Sp("EMPTY",{font:t,size:20,depth:2});e.computeBoundingBox();const n=-.5*(e.boundingBox.max.x-e.boundingBox.min.x),i=new ra({color:16711680,specular:328965,shininess:50,emissive:0}),r=new ir(e,i);r.position.x=n,this.g.add(r),this.add(this.g)}update(t){Cf+=.003*Tf,Cf>Af?Tf=-1:Cf<-.5&&(Tf=1),this.g.rotation.y=Cf}}let Tf=1,Af=.5,Cf=0;class Rf{constructor(){d(this,"_listeners",new Map)}destroy(){this._listeners.clear()}addEventListener(t,e){let n=this._listeners.get(t);n||(n=[],this._listeners.set(t,n)),n.includes(e)||n.push(e)}addEventListeners(t,e){const n=t.split(","),i=n.length;for(let t=0;t<i;t++)this.addEventListener(n[t].trim(),e)}isListening(t){var e;return this._listeners.has(t)&&!!(null==(e=this._listeners.get(t))?void 0:e.length)}hasEventListener(t,e){var n;return 0!==this._listeners.size&&this._listeners.has(t)&&!!(null==(n=this._listeners.get(t))?void 0:n.includes(e))}removeEventListener(t,e){const n=this._listeners.get(t);if(n){const t=n.indexOf(e);t>-1&&n.splice(t,1)}}dispatchEvent(t){const e=this._listeners.get(t.type);if(e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=void 0}}dispatchEventAsync(t){const e=this._listeners.get(t.type);e&&setTimeout((()=>{for(const n of e)n.call(this,t)}))}}class Pf extends Rf{constructor(){super(),d(this,"xml"),d(this,"paths"),d(this,"symbolsMap"),d(this,"uses"),d(this,"labels"),d(this,"idsTree"),d(this,"idsMap",{}),d(this,"boundingBox",new jp),d(this,"_resourcesMap"),d(this,"scene")}destroy(){super.destroy(),this.xml=void 0,this._resourcesMap=void 0,this.boundingBox.makeEmpty(),this.scene=void 0}init(t={}){return this.params=t,this}initResources(t){this.xml=null==t?void 0:t.xml,this.paths=null==t?void 0:t.paths,this.symbolsMap=null==t?void 0:t.symbolsMap,this.uses=null==t?void 0:t.uses,this.labels=null==t?void 0:t.labels,this.idsTree=null==t?void 0:t.idsTree,this.recomputeIdsMap()}recomputeIdsMap(){var t;if(!(null==(t=this.idsTree)?void 0:t.length))return;const e=[];gf(this.idsTree,(t=>{var n;if(e.push(t.value),!(null==(n=t.children)?void 0:n.length))return;const i=vf(t);this.idsMap[t.value]=Mp.map(i,"value")}))}getAllChildrenById(t,e=[]){if(!t)return e;if(Array.isArray(t)){for(let n=0,i=t.length||0;n<i;n++)this.getAllChildrenById(t[n],e);return e}return this.idsMap.hasOwnProperty(t)&&e.push(...this.idsMap[t]),e.push(t),e}bindScene(t){this.scene=t}unbindScene(){this.scene=void 0}getLayers(t=2){return this.xml?mf(this.xml,t):[]}updateLayersVisibility(t,e=!1){if(!this.scene)throw new Error("please bind a Scene first");this.scene.traverse((n=>{var i,r;(null==(i=n.userData)?void 0:i.id)&&t.includes(n.userData.id)?n.visible=e:(null==(r=n.userData)?void 0:r.id)&&(n.visible=!e)})),this.scene.userData.version=(this.scene.userData.version||0)+1}}const If={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class Nf{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){}dispose(){}}const Df=new Fa(-1,1,1,-1,0,1),Lf=new class extends qi{constructor(){super(),this.setAttribute("position",new Fi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Fi([0,2,0,0,2,0],2))}};class Uf{constructor(t){this._mesh=new ir(Lf,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,Df)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}class Of extends Nf{constructor(t,e="tDiffuse"){super(),this.textureID=e,this.uniforms=null,this.material=null,t instanceof hr?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=cr.clone(t.uniforms),this.material=new hr({name:void 0!==t.name?t.name:"unspecified",defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this._fsQuad=new Uf(this.material)}render(t,e,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),this._fsQuad.render(t)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),this._fsQuad.render(t))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class Ff extends Nf{constructor(t,e){super(),this.scene=t,this.camera=e,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(t,e,n){const i=t.getContext(),r=t.state;let s,a;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(s=0,a=1):(s=1,a=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,s,4294967295),r.buffers.stencil.setClear(a),r.buffers.stencil.setLocked(!0),t.setRenderTarget(n),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class Bf extends Nf{constructor(){super(),this.needsSwap=!1}render(t){t.state.buffers.stencil.setLocked(!1),t.state.buffers.stencil.setTest(!1)}}class zf{constructor(t,e){if(this.renderer=t,this._pixelRatio=t.getPixelRatio(),void 0===e){const n=t.getSize(new Pe);this._width=n.width,this._height=n.height,(e=new Qe(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:ot})).texture.name="EffectComposer.rt1"}else this._width=e.width,this._height=e.height;this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Of(If),this.copyPass.material.blending=0,this.clock=new Ha}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,e){this.passes.splice(e,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const e=this.passes.indexOf(t);-1!==e&&this.passes.splice(e,1)}isLastEnabledPass(t){for(let e=t+1;e<this.passes.length;e++)if(this.passes[e].enabled)return!1;return!0}render(t){void 0===t&&(t=this.clock.getDelta());const e=this.renderer.getRenderTarget();let n=!1;for(let e=0,i=this.passes.length;e<i;e++){const i=this.passes[e];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(e),i.render(this.renderer,this.writeBuffer,this.readBuffer,t,n),i.needsSwap){if(n){const e=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(e.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,t),n.setFunc(e.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==Ff&&(i instanceof Ff?n=!0:i instanceof Bf&&(n=!1))}}this.renderer.setRenderTarget(e)}reset(t){if(void 0===t){const e=this.renderer.getSize(new Pe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=e.width,this._height=e.height,(t=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(t,e){this._width=t,this._height=e;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let t=0;t<this.passes.length;t++)this.passes[t].setSize(n,i)}setPixelRatio(t){this._pixelRatio=t,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class kf extends Nf{constructor(t,e,n=null,i=null,r=null){super(),this.scene=t,this.camera=e,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Ti}render(t,e,n){const i=t.autoClear;let r,s;t.autoClear=!1,null!==this.overrideMaterial&&(s=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(t.getClearColor(this._oldClearColor),t.setClearColor(this.clearColor,t.getClearAlpha())),null!==this.clearAlpha&&(r=t.getClearAlpha(),t.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&t.clearDepth(),t.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera),null!==this.clearColor&&t.setClearColor(this._oldClearColor),null!==this.clearAlpha&&t.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=s),t.autoClear=i}}class Vf extends Ca{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Ia(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){const n=r.parse(JSON.parse(t));e&&e(n)}),n,i)}parse(t){return new Hf(t)}}class Hf{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],i=function(t,e,n){const i=Array.from(t),r=e/n.resolution,s=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,a=[];let o=0,l=0;for(let t=0;t<i.length;t++){const e=i[t];if("\n"===e)o=0,l-=s;else{const t=Gf(e,r,o,l,n);o+=t.offsetX,a.push(t.path)}}return a}(t,e,this.data);for(let t=0,e=i.length;t<e;t++)n.push(...i[t].toShapes());return n}}function Gf(t,e,n,i,r){const s=r.glyphs[t]||r.glyphs["?"];if(!s)return;const a=new po;let o,l,c,h,u,d,p,f;if(s.o){const t=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let r=0,s=t.length;r<s;)switch(t[r++]){case"m":o=t[r++]*e+n,l=t[r++]*e+i,a.moveTo(o,l);break;case"l":o=t[r++]*e+n,l=t[r++]*e+i,a.lineTo(o,l);break;case"q":c=t[r++]*e+n,h=t[r++]*e+i,u=t[r++]*e+n,d=t[r++]*e+i,a.quadraticCurveTo(u,d,c,h);break;case"b":c=t[r++]*e+n,h=t[r++]*e+i,u=t[r++]*e+n,d=t[r++]*e+i,p=t[r++]*e+n,f=t[r++]*e+i,a.bezierCurveTo(u,d,p,f,c,h)}}return{offsetX:s.ha*e,path:a}}class Wf extends xe{constructor(){super(),d(this,"oriScene"),d(this,"desScene"),d(this,"mixer"),d(this,"selectedAction"),d(this,"_selectedClip"),d(this,"_selectedIds",[]);const t=new ma(".dynamicFill",[0,1.2,2],[.95,.38,.38,.5,.95,.68,.68,.5,.95,.38,.38,.5]);this._selectedClip=new Sa("selected",3,[t])}destroy(){}init(t={}){this.params=t}bindScene(t,e){var n;this.oriScene=t,this.desScene=e,this.desScene&&(this.mixer=new to(this.desScene),this.selectedAction=null==(n=this.mixer)?void 0:n.clipAction(this._selectedClip,this.desScene))}clearSelected(t){if(this.desScene&&(!t||!t.length))for(let t=0,e=this._selectedIds.length;t<e;t++);}selectByIds(t,e){this.oriScene&&this.desScene}}class qf extends Sr{constructor(t={}){super(),d(this,"name","AnimateScene"),d(this,"params"),d(this,"isDynamic",!0),d(this,"lights"),d(this,"central"),this.params=t,this.lights=new Ep(t),this.lights.bindScene(this),this.central=function(t={}){const{color:e=15599624,radius:n=10,opacity:i=1}=t,r=new $s(n,0),s=new ra({color:e});s.transparent=!0,s.opacity=i,s.depthTest=!0,s.depthWrite=!1;const a=new ir(r,s);return a.name="CentralMarker",a}({radius:68,color:16711680,opacity:.8}),this.add(this.central),this.central.position.setZ(50)}destroy(){}init(t={}){this.params=t}update(t){const e=3e-4*(t||0);this.central.rotation.z=e}}const jf={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t#include <tonemapping_pars_fragment>\n\t\t#include <colorspace_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( AGX_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};class Xf extends Nf{constructor(){super(),this.uniforms=cr.clone(jf.uniforms),this.material=new na({name:jf.name,uniforms:this.uniforms,vertexShader:jf.vertexShader,fragmentShader:jf.fragmentShader}),this._fsQuad=new Uf(this.material),this._outputColorSpace=null,this._toneMapping=null}render(t,e,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=t.toneMappingExposure,this._outputColorSpace===t.outputColorSpace&&this._toneMapping===t.toneMapping||(this._outputColorSpace=t.outputColorSpace,this._toneMapping=t.toneMapping,this.material.defines={},Ve.getTransfer(this._outputColorSpace)===oe&&(this.material.defines.SRGB_TRANSFER=""),1===this._toneMapping?this.material.defines.LINEAR_TONE_MAPPING="":2===this._toneMapping?this.material.defines.REINHARD_TONE_MAPPING="":3===this._toneMapping?this.material.defines.CINEON_TONE_MAPPING="":4===this._toneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING="":6===this._toneMapping?this.material.defines.AGX_TONE_MAPPING="":7===this._toneMapping?this.material.defines.NEUTRAL_TONE_MAPPING="":5===this._toneMapping&&(this.material.defines.CUSTOM_TONE_MAPPING=""),this.material.needsUpdate=!0),!0===this.renderToScreen?(t.setRenderTarget(null),this._fsQuad.render(t)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),this._fsQuad.render(t))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}const Yf={uniforms:{tDiffuse:{value:null},tDepth:{value:null},currentProjectionMatrix:{value:new Ln},currentViewMatrix:{value:new Ln},previousProjectionMatrix:{value:new Ln},previousViewMatrix:{value:new Ln},cameraNear:{value:.1},cameraFar:{value:1e3}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n ",fragmentShader:"\nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nuniform mat4 currentProjectionMatrix;\nuniform mat4 currentViewMatrix;\nuniform mat4 previousProjectionMatrix;\nuniform mat4 previousViewMatrix;\nuniform float cameraNear;\nuniform float cameraFar;\nvarying vec2 vUv;\n\nfloat linearizeDepth(float depth) {\n float z = depth * 2.0 - 1.0;\n return (2.0 * cameraNear * cameraFar) / (cameraFar + cameraNear - z * (cameraFar - cameraNear));\n}\nvec3 reconstructViewPosition(vec2 uv, float depth) {\n vec3 ndc = vec3(uv.x * 2.0 - 1.0, uv.y * 2.0 - 1.0, depth * 2.0 - 1.0);\n vec4 viewPos = inverse(currentProjectionMatrix) * vec4(ndc, 1.0);\n return viewPos.xyz / viewPos.w;\n}\n\nvoid main() {\n float depth = texture2D(tDepth, vUv).r;\n float linearDepth = linearizeDepth(depth);\n\n vec3 viewPos = reconstructViewPosition(vUv, depth);\n\n vec4 worldPos = inverse(currentViewMatrix) * vec4(viewPos, 1.0);\n\n vec4 prevClipPos = previousProjectionMatrix * previousViewMatrix * worldPos;\n\n vec3 prevNDC = prevClipPos.xyz / prevClipPos.w;\n vec2 pUv = prevNDC.xy * 0.5 + 0.5;\n\n if (pUv.x < 0.0 || pUv.x > 1.0 || pUv.y < 0.0 || pUv.y > 1.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n vec4 color = texture2D(tDiffuse, pUv);\n gl_FragColor = color;\n}\n "};class Zf extends Nf{constructor(t,e,n={}){super(),d(this,"name","DebouncePass3"),d(this,"scene"),d(this,"camera"),d(this,"version",-1),d(this,"debouncedVersion",-2),d(this,"debounceTarget"),d(this,"cacheTarget"),d(this,"finalTarget"),d(this,"uniforms"),d(this,"material"),d(this,"copyUniforms"),d(this,"materialCopy"),d(this,"fsQuad"),d(this,"opacity",1),d(this,"duration",300),d(this,"sliceRendering"),d(this,"renderTimestamp",Date.now()),d(this,"debounceRenderHandler",Mp.debounce(this.debounceRender.bind(this),this.duration)),this.clear=!1,this.needsSwap=!1,this.scene=t,this.camera=e;let{width:i=1,height:r=1,dpr:s=1,sliceRendering:a}=n;this.sliceRendering=a,this.debounceTarget=new Qe(i*s,r*s,{type:ot}),this.debounceTarget.texture.name="DebouncePass.debounceTarget",this.debounceTarget.texture.generateMipmaps=!1,this.cacheTarget=new Qe(i*s,r*s,{type:ot}),this.cacheTarget.texture.name="DebouncePass.cacheTarget",this.cacheTarget.texture.generateMipmaps=!1,this.finalTarget=new Qe(i*s,r*s,{type:ot}),this.finalTarget.texture.name="DebouncePass.finalTarget",this.finalTarget.texture.generateMipmaps=!1;const o=Yf;this.uniforms=cr.clone(o.uniforms),this.material=new hr({uniforms:this.uniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.copyUniforms=cr.clone(If.uniforms),this.materialCopy=new hr({uniforms:this.copyUniforms,vertexShader:If.vertexShader,fragmentShader:If.fragmentShader,blending:0,depthTest:!1,depthWrite:!1}),this.fsQuad=new Uf}destroy(){super.dispose(),this.debounceTarget.dispose(),this.cacheTarget.dispose(),this.finalTarget.dispose(),this.material.dispose(),this.fsQuad.dispose()}get currentVersion(){var t;return(this.scene.userData.version||0)+((null==(t=this.camera)?void 0:t.userData.version)||0)}get isChanged(){return this.version!==this.currentVersion}get isDebounceChanged(){return this.debouncedVersion!==this.currentVersion}isRenderTicComplete(t){return this.renderTimestamp<t.lastTicCompleteTimestamp}render(t,e,n){const i=t.autoClear;t.autoClear=!1,this.isChanged?(this.renderTimestamp=Date.now(),this.debounceRender(t,e,n),this.copyTargetTexture(t,this.debounceTarget,this.cacheTarget,Kf,Jf),this.finalRender(this.cacheTarget,t,e,n),this.debounceRenderHandler(t,e,n)):(t.lastTicCompleted>=this.renderTimestamp&&(this.renderTimestamp=Date.now()),this.copyTargetTexture(t,this.debounceTarget,this.cacheTarget,Kf,Jf),this.finalRender(this.cacheTarget,t,e,n)),t.autoClear=i,this.version=this.currentVersion}copyTargetTexture(t,e,n,i,r){var s;null==(s=this.camera)||s.updateMatrixWorld(),this.material.uniforms.currentProjectionMatrix.value.copy(this.camera.projectionMatrix),this.material.uniforms.currentViewMatrix.value.copy(this.camera.matrixWorldInverse),this.material.uniforms.cameraNear.value=this.camera.near,this.material.uniforms.cameraFar.value=this.camera.far,this.material.uniforms.previousProjectionMatrix.value.copy(i),this.material.uniforms.previousViewMatrix.value.copy(r),this.fsQuad.material=this.material,this.material.uniforms.tDiffuse.value=e.texture,this.material.uniforms.tDepth.value=e.depthTexture,t.setRenderTarget(n),this.fsQuad.render(t)}debounceRender(t,e,n){t.setRenderTarget(this.debounceTarget),t.clear(),t.render(this.scene,this.camera),Kf.copy(this.camera.projectionMatrix),Jf.copy(this.camera.matrixWorldInverse)}finalRender(t,e,n,i){e.setRenderTarget(this.renderToScreen?null:i),this.clear&&e.clear(),e.copyTextureToTexture(t.texture,i.texture)}}const Kf=new Ln,Jf=new Ln;class $f extends Nf{constructor(t,e,n={}){super(),d(this,"name","DynamicPass3"),d(this,"scene"),d(this,"camera"),this.scene=t,this.camera=e,this.clear=!1,this.needsSwap=!1}render(t,e,n){const i=t.autoClear;t.autoClear=!1,t.setRenderTarget(this.renderToScreen?null:n),t.render(this.scene,this.camera),t.autoClear=i}}class Qf extends Sr{constructor(t={}){super(),d(this,"name","ShadowScene3"),d(this,"lights"),d(this,"adapter"),this.params=t,this.lights=new Ep(t),this.lights.bindScene(this),new Qe(512,5112);const e=new Qs(1e3,1e3),n=new ea({opacity:.5}),i=new ir(e,n);i.castShadow=!0,i.receiveShadow=!0,this.add(i);const r=new sr(100,100,100),s=new Pi({color:4013373,opacity:.99,transparent:!0,depthWrite:!1}),a=new ir(r,s);a.castShadow=!0,a.position.set(100,100,50),this.add(a)}destroy(){}init(t){if(!t)return;this.adapter=t;const e=new xr;e.scale.y*=-1,this.add(e)}update(t){}}new Ed;var tm=(t=>(t.INIT="init",t.LOAD="load",t.LOADED="loaded",t.RESIZE="resize",t.SET_SIZE="setSize",t.GET_LAYERS="getLayers",t.GET_ASSET_IDS_BY_TYPE="getAssetIdsByType",t.SET_FILL_BY_IDS="setFillByIds",t.CLEAR_FILL_BY_IDS="clearFillByIds",t.CLEAR_FILL="clearFill",t.SET_STROKE_BY_IDS="setStrokeByIds",t.CLEAR_STROKE="clearStroke",t.TERMINATE="terminate",t.CAMERA_SYNC="cameraSync",t.SLICE_DURATION_CHANGED="sliceDurationChanged",t.ASSET_TYPE_CHANGED="assetTypeChanged",t.FN_ENABLE_CHANGED="fnEnableChanged",t.SVG_LOADING_TYPE_CHANGED="svgLoadingTypeChanged",t.USED_CACHE_CHANGED="usedCacheChanged",t.DEBOUNCE_CACHE_CHANGED="debounceCacheChanged",t.WIREFRAME_CHANGED="wireframeChanged",t.BG_PASS_CHANGED="bgPass",t.SELECT_ENABLE_CHANGED="selectEnableChanged",t.MULTI_SELECT_ENABLE_CHANGED="multiSelectEnableChanged",t.MULTI_SELECT_BY_RANGE="multiSelectByRange",t.ZOOM_TO_SELECT_ENABLE_CHANGED="zoomToSelectEnableChanged",t.SOCIAL_DISTANCE_ENABLE_CHANGED="socialDistanceEnableChanged",t.ENABLE_HOVER_CHANGED="enableHover",t.FONT_ZOOM_IN="fontZoomIn",t.FONT_ZOOM_OUT="fontZoomOut",t.UNPROJECT="unproject",t.STROKE_MORE="strokeMore",t.STROKE_LESS="strokeLess",t.CAMERA_CHANGED="cameraChanged",t.SCENES_CHANGED="scenesChanged",t.UPDATE_LAYERS_VISIBILITY="updateLayersVisibility",t.DYNAMIC_LOADED="dynamicLoaded",t.SYNC_TEXTURE_HELPER_CACHED="syncTextureHelperCached",t.INIT_FONT="initFont",t.INIT_LOADING_FONT="initLoadingFont",t.REFRESH="refresh",t.FULLSCREEN="fullscreen",t.GET_CAMERA_POSITION="getCameraPosition",t.SET_CAMERA_POSITION="setCameraPosition",t.SAVE_CAMERA_POSITION="saveCameraPosition",t.RESTORE_CAMERA_POSITION="restoreCameraPosition",t.FOCUS_AT_IDS="focusAtIds",t.GET_LEGEND="getLegend",t.GET_ASSET_LABELS="getAssetLabels",t.SET_ASSET_LABELS="setAssetLabels",t.CLEAR_ASSET_LABELS="clearAssetLabels",t.CLEAR_DUMMIES="clearDummies",t.SET_DUMMIES="setDummies",t.FOCUS_AT_DUMMY="focusAtDummy",t.HIGHLIGHT_DUMMIES="highlightDummies",t.RESET_HIGHLIGHT_DUMMIES="resetHighlightDummies",t.SET_EDITOR_MODE="setEditorMode",t.BIND_EDITOR_DRAG="bindEditorDrag",t.SET_EDITOR_DRAGGING_OBJECT="setEditorDraggingObject",t.HANDLE_EXTERNAL_EVENT="handleExternalEvent",t.GET_DUMMIES="getDummies",t.ZOOM_IN="zoomIn",t.ZOOM_OUT="zoomOut",t.INITIALIZATION_START="INITIALIZATION_START",t.INITIALIZATION_COMPLETE="INITIALIZATION_COMPLETE",t.POINTER_OVER="pointerover",t.POINTER_OUT="pointerout",t.POINTER_LEAVE="pointerleave",t.SELECTED="selected",t.SELECT_BY_IDS="selectByIds",t.GET_ASSET_BOUNDING_BOX="getAssetBoundingBox",t.SET_ASSET_TYPE="setAssetType",t.LINK_ASSETS_BY_TREE="linkAssetsByTree",t.CLEAR_SELECTED="clearSelected",t.TARGET_BY_IDS="targetByIds",t.SHOW_ASSETS_LABEL="showAssetsLabel",t.HIDE_ASSETS_LABEL="hideAssetsLabel",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.SET_CURSOR="setCursor",t.DRAG_END="dragEnd",t))(tm||{});const em=new th,nm=new class extends xe{constructor(){super(),d(this,"name","App3"),d(this,"adapter"),d(this,"inpEl"),d(this,"_viewVersion",-1/0),d(this,"animateScene"),d(this,"shadowScene"),d(this,"_requestHeader",{}),d(this,"loadingFont"),d(this,"font"),d(this,"director"),d(this,"runningHandler",this.running.bind(this)),this.adapter=new Pf,this.director=new Wf}get isLoadingScene(){var t;return"LoadingScene"===(null==(t=this.scene)?void 0:t.name)}destroy(){var t;null==(t=this.view)||t.destroy(),this.renderer.dispose()}init(t={}){var e,n,i;return this.params=t,this.params.cvs||(this.params.cvs=_p.createCanvas(t)),"undefined"!=typeof window&&(this.params.dpr=window.devicePixelRatio||1),this.view=new sp(this.params),this.view.camera.position.set(0,0,1e3),(null==(e=this.params)?void 0:e.workerRender)?this.inpEl=this.params.inpEl:this.inpEl=this.params.cvs,this.renderer=new Jc({antialias:!0,canvas:t.cvs,alpha:t.alpha}),this.renderer.setPixelRatio(this.params.dpr||1),this.renderer.shadowMap.enabled=null==(i=null==(n=this.params)?void 0:n.light)?void 0:i.castShadow,this.renderer.shadowMap.type=0,this.rendererResize(),new Qe(this.params.width,this.params.height,{stencilBuffer:!0}),this.composer=new zf(this.renderer),this.adapter.init(t),this.director.init(t),this.trans2LoadingScene(),this}initLoadingFont(t){return p(this,null,(function*(){var e,n;t&&(this.loadingFont="string"==typeof t?yield(new Vf).loadAsync(t):t,"function"==typeof(null==(e=this.loadingScene)?void 0:e.initFont)&&(null==(n=this.loadingScene)||n.initFont(this.loadingFont)))}))}initFont(t){return p(this,null,(function*(){var e,n;t&&(this.font="string"==typeof t?yield(new Vf).loadAsync(t):t,"function"==typeof(null==(e=this.mainScene)?void 0:e.initFont)&&(null==(n=this.mainScene)||n.initFont(this.font)))}))}rendererResize(){const t=this.renderer.domElement,e=this.inpEl.clientWidth,n=this.inpEl.clientHeight,i=t.width!==e||t.height!==n;return i&&this.renderer.setSize(e,n,!1),i}resize(){}trans2LoadingScene(){var t;this.loadingScene=new Tp(this.params),this.loadingFont&&this.loadingScene.initFont(this.loadingFont),this.scene=this.loadingScene,this.adapter.unbindScene(),null==(t=this.view)||t.clearScenes().pushScenes(this.scene).bindScene(this.scene),this._viewVersion=-1/0,this.view.fullscreen(!1),this.view.camera.position.setY(200),this.view.camera.lookAt(new rn(0,0,0)),this.view.camera.updateProjectionMatrix();const e=new kf(this.scene,this.view.camera);this.composer.passes=[],this.composer.addPass(e)}trans2MainScene(){return p(this,null,(function*(){var t;this.animateScene||(this.animateScene=new qf(this.params)),this.shadowScene||(this.shadowScene=new Qf(this.params)),this.scene=this.mainScene,this.adapter.bindScene(this.scene),null==(t=this.view)||t.clearScenes().pushScenes(this.animateScene,this.scene).bindScene(this.scene),this._viewVersion=-1/0,this.director.bindScene(this.mainScene,this.animateScene),wd(this.mainScene),this.view.fullscreen();const e=new Zf(this.scene,this.view.camera,this.params),n=new $f(this.animateScene,this.view.camera),i=new $f(this.shadowScene,this.view.camera),r=new Xf;this.composer.passes=[],this.composer.addPass(e),this.composer.addPass(n),this.composer.addPass(i),this.composer.addPass(r)}))}trans2EmptyScene(){return p(this,null,(function*(){var t;this.emptyScene=new wf(this.params),this.loadingFont&&this.emptyScene.initFont(this.loadingFont),this.scene=this.emptyScene,this.adapter.unbindScene(),null==(t=this.view)||t.clearScenes().pushScenes(this.scene).bindScene(this.scene),this._viewVersion=-1/0,wd(this.emptyScene),this.view.fullscreen(!1);const e=new kf(this.scene,this.view.camera);this.composer.passes=[],this.composer.addPass(e)}))}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}setRequestHeader(t){return this._requestHeader=t,this}load(t,e,n=2,i){return p(this,null,(function*(){var n,i;this.isLoadingScene||this.trans2LoadingScene(),yield function(t=2e3){return p(this,null,(function*(){return new Promise((e=>setTimeout(e,(Math.random()+.5)*t)))}))}(this.params.syncDelay);const r=yield(new xf).setRequestHeader(this._requestHeader).setInstancedMesh(null==(n=this.params)?void 0:n.instancedMesh).setPixelRatio(this.params.dpr||1).loadAsync(t).catch((()=>({})));return(null==(i=null==r?void 0:r.paths)?void 0:i.length)?(this.mainScene=new Fp(this.params),this.mainScene.initFont(this.font),this.adapter.initResources(r),this.adapter.bindScene(this.mainScene),this.mainScene.init(this.adapter),this.mainScene.showDefaultLayers(e,!0),yield this.trans2MainScene(),(r||{}).idsTree):(yield this.trans2EmptyScene(),(r||{}).idsTree)}))}sliceDurationChanged(t=0){this.renderer.sliceDuration=t}getLayers(t=2){return p(this,null,(function*(){var e;return null==(e=this.adapter)?void 0:e.getLayers(t)}))}updateLayersVisibility(t,e=!1){this.adapter.updateLayersVisibility(t,e),this.view.needsUpdate=!0}targetByIds(t){this.scene&&(this.director.clearSelected(),this.director.selectByIds(t,!1),this.view.needsUpdate=!0)}setSize(t,e){this.composer.setSize(t,e)}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.view.update(t),(this.params.sliceRendering||this.scene.isDynamic||this._viewVersion!==this.view.version)&&(this.composer.render(t),this._viewVersion=this.view.version),requestAnimationFrame(this.runningHandler))}},im={makeProxy:function(t){em.makeProxy(t)},start:function(t){const e=em.getProxy(t.proxyId);e.ownerDocument=e,self.document={};const n=u(h({},t.conf),{cvs:t.canvas,workerRender:!0,inpEl:e});nm.init(n).start()},event:em.handleEvent,ping:()=>self.postMessage({type:"pang"}),[tm.LOAD]:function(t){return p(this,null,(function*(){const e=yield nm.load(null==t?void 0:t.url,null==t?void 0:t.layers,null==t?void 0:t.lv);self.postMessage({type:"load",data:e})}))},[tm.SLICE_DURATION_CHANGED]:t=>nm.sliceDurationChanged(t.v),getLayers:function(t){return p(this,null,(function*(){const e=yield nm.getLayers(null==t?void 0:t.lv);self.postMessage({type:tm.GET_LAYERS,data:e})}))},[tm.UPDATE_LAYERS_VISIBILITY]:function(t){nm.updateLayersVisibility(null==t?void 0:t.ids,null==t?void 0:t.visible)},[tm.TARGET_BY_IDS]:function(t){nm.targetByIds(null==t?void 0:t.ids)},[tm.INIT_LOADING_FONT]:function(t){nm.initLoadingFont(null==t?void 0:t.font)},[tm.INIT_FONT]:function(t){nm.initFont(null==t?void 0:t.font)},[tm.FULLSCREEN]:function(){nm.fullscreen(),self.postMessage({type:tm.FULLSCREEN})},[tm.GET_CAMERA_POSITION]:function(t){var e;const n=null==(e=nm.view)?void 0:e.getCameraPosition(null==t?void 0:t.id);self.postMessage({type:tm.GET_CAMERA_POSITION,data:n})},[tm.SET_CAMERA_POSITION]:function(t){var e;const n=null==(e=nm.view)?void 0:e.setCameraPosition(null==t?void 0:t.data,!0);self.postMessage({type:tm.SET_CAMERA_POSITION,data:n})}};self.onmessage=function(t){var e,n;const i=im[null==(e=t.data)?void 0:e.type];if("function"!=typeof i)throw new Error(`unsupported command: ${null==(n=t.data)?void 0:n.type}`);i(t.data)}}},function(){return e||(0,t[s(t)[0]])((e={exports:{}}).exports,e),e.exports});export default f();
|
|
22
|
+
//# sourceMappingURL=renderer3.worker.js.map
|